blob: 3be7c3e35895425c730bfc776cad79101499abf6 [file] [log] [blame]
Amith Yamasani52c489c2012-03-28 11:42:42 -07001/*
2 * Copyright (C) 2012 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package com.android.internal.widget;
18
Dmitry Dementyevb8b030b2017-12-19 11:02:54 -080019import android.app.PendingIntent;
Adrian Roosb5e47222015-08-14 15:53:06 -070020import android.app.trust.IStrongAuthTracker;
Dmitry Dementyev1aa96132017-12-11 11:33:12 -080021import android.os.Bundle;
Robert Berry81ee34b2018-01-23 11:59:59 +000022import android.security.keystore.recovery.WrappedApplicationKey;
Dmitry Dementyev0916e7c2018-01-23 13:02:08 -080023import android.security.keystore.recovery.KeyChainSnapshot;
24import android.security.keystore.recovery.KeyChainProtectionParams;
Bo Zhu7c1972f2018-02-22 21:43:52 -080025import android.security.keystore.recovery.RecoveryCertPath;
Jorim Jaggie8fde5d2016-06-30 23:41:37 -070026import com.android.internal.widget.ICheckCredentialProgressCallback;
Andres Morales23974272015-05-14 22:42:26 -070027import com.android.internal.widget.VerifyCredentialResponse;
28
Dmitry Dementyevb8b030b2017-12-19 11:02:54 -080029import java.util.Map;
30
Amith Yamasani52c489c2012-03-28 11:42:42 -070031/** {@hide} */
32interface ILockSettings {
Andrei Oneafa152f92019-02-27 15:58:05 +000033 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070034 void setBoolean(in String key, in boolean value, in int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000035 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070036 void setLong(in String key, in long value, in int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000037 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070038 void setString(in String key, in String value, in int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000039 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070040 boolean getBoolean(in String key, in boolean defaultValue, in int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000041 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070042 long getLong(in String key, in long defaultValue, in int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000043 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070044 String getString(in String key, in String defaultValue, in int userId);
Rich Canningsf64ec632019-02-21 12:40:36 -080045 void setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId);
Ricky Wai4613fe42016-05-24 11:11:42 +010046 void resetKeyStore(int userId);
Rich Canningsf64ec632019-02-21 12:40:36 -080047 VerifyCredentialResponse checkCredential(in byte[] credential, int type, int userId,
Jorim Jaggie8fde5d2016-06-30 23:41:37 -070048 in ICheckCredentialProgressCallback progressCallback);
Rich Canningsf64ec632019-02-21 12:40:36 -080049 VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId);
50 VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId);
Paul Lawrence945490c2014-03-27 16:37:28 +000051 boolean checkVoldPassword(int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000052 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070053 boolean havePattern(int userId);
Andrei Oneafa152f92019-02-27 15:58:05 +000054 @UnsupportedAppUsage
Amith Yamasani52c489c2012-03-28 11:42:42 -070055 boolean havePassword(int userId);
Rich Canningsf64ec632019-02-21 12:40:36 -080056 byte[] getHashFactor(in byte[] currentCredential, int userId);
57 void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword);
Ricky Waidc283a82016-03-24 19:55:08 +000058 boolean getSeparateProfileChallengeEnabled(int userId);
Adrian Roosb5e47222015-08-14 15:53:06 -070059 void registerStrongAuthTracker(in IStrongAuthTracker tracker);
60 void unregisterStrongAuthTracker(in IStrongAuthTracker tracker);
61 void requireStrongAuth(int strongAuthReason, int userId);
Jim Miller4f93c582016-01-27 19:05:43 -080062 void systemReady();
Adrian Roos4ab7e592016-04-13 15:38:13 -070063 void userPresent(int userId);
Victor Changa0940d32016-05-16 19:36:08 +010064 int getStrongAuthForUser(int userId);
Rubin Xuf095f832017-01-31 15:23:34 +000065
Robert Berry74928a12018-01-18 17:49:07 +000066 // Keystore RecoveryController methods.
Dmitry Dementyev1aa96132017-12-11 11:33:12 -080067 // {@code ServiceSpecificException} may be thrown to signal an error, which caller can
Dmitry Dementyeved89ea02018-01-11 13:53:52 -080068 // convert to {@code RecoveryManagerException}.
Bo Zhu7f414d92018-02-28 09:28:19 -080069 void initRecoveryServiceWithSigFile(in String rootCertificateAlias,
70 in byte[] recoveryServiceCertFile, in byte[] recoveryServiceSigFile);
Dmitry Dementyevb4fb9872018-01-26 11:49:34 -080071 KeyChainSnapshot getKeyChainSnapshot();
Robert Berrya3b99472018-02-23 15:59:02 +000072 String generateKey(String alias);
Bo Zhuc7048342019-01-03 14:04:58 -080073 String generateKeyWithMetadata(String alias, in byte[] metadata);
Bo Zhu2c8e5382018-02-26 15:54:25 -080074 String importKey(String alias, in byte[] keyBytes);
Bo Zhuc7048342019-01-03 14:04:58 -080075 String importKeyWithMetadata(String alias, in byte[] keyBytes, in byte[] metadata);
Dmitry Dementyev29b9de52018-01-31 16:09:32 -080076 String getKey(String alias);
Robert Berry5daccec2018-01-06 19:16:25 +000077 void removeKey(String alias);
Dmitry Dementyev14298312018-01-04 15:19:19 -080078 void setSnapshotCreatedPendingIntent(in PendingIntent intent);
Dmitry Dementyev7d8c78a2018-01-12 19:14:07 -080079 void setServerParams(in byte[] serverParams);
Robert Berrybbe02ae2018-02-20 19:47:43 +000080 void setRecoveryStatus(in String alias, int status);
Robert Berry56f06b42018-02-23 13:31:32 +000081 Map getRecoveryStatus();
Dmitry Dementyev14298312018-01-04 15:19:19 -080082 void setRecoverySecretTypes(in int[] secretTypes);
83 int[] getRecoverySecretTypes();
Bo Zhub31ab672018-03-20 22:44:18 -070084 byte[] startRecoverySessionWithCertPath(in String sessionId, in String rootCertificateAlias,
Bo Zhu7c1972f2018-02-22 21:43:52 -080085 in RecoveryCertPath verifierCertPath, in byte[] vaultParams, in byte[] vaultChallenge,
86 in List<KeyChainProtectionParams> secrets);
Robert Berry4a5c87d2018-03-19 18:00:46 +000087 Map/*<String, String>*/ recoverKeyChainSnapshot(
88 in String sessionId,
89 in byte[] recoveryKeyBlob,
90 in List<WrappedApplicationKey> applicationKeys);
Robert Berry2bcdad92018-01-18 12:53:29 +000091 void closeSession(in String sessionId);
Amith Yamasani52c489c2012-03-28 11:42:42 -070092}