blob: 1c5816c1578e43e2da52e5064a4847aa9f9ed03a [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 {
33 void setBoolean(in String key, in boolean value, in int userId);
34 void setLong(in String key, in long value, in int userId);
35 void setString(in String key, in String value, in int userId);
36 boolean getBoolean(in String key, in boolean defaultValue, in int userId);
37 long getLong(in String key, in long defaultValue, in int userId);
38 String getString(in String key, in String defaultValue, in int userId);
Rich Canningsf64ec632019-02-21 12:40:36 -080039 void setLockCredential(in byte[] credential, int type, in byte[] savedCredential, int requestedQuality, int userId);
Ricky Wai4613fe42016-05-24 11:11:42 +010040 void resetKeyStore(int userId);
Rich Canningsf64ec632019-02-21 12:40:36 -080041 VerifyCredentialResponse checkCredential(in byte[] credential, int type, int userId,
Jorim Jaggie8fde5d2016-06-30 23:41:37 -070042 in ICheckCredentialProgressCallback progressCallback);
Rich Canningsf64ec632019-02-21 12:40:36 -080043 VerifyCredentialResponse verifyCredential(in byte[] credential, int type, long challenge, int userId);
44 VerifyCredentialResponse verifyTiedProfileChallenge(in byte[] credential, int type, long challenge, int userId);
Paul Lawrence945490c2014-03-27 16:37:28 +000045 boolean checkVoldPassword(int userId);
Amith Yamasani52c489c2012-03-28 11:42:42 -070046 boolean havePattern(int userId);
47 boolean havePassword(int userId);
Rich Canningsf64ec632019-02-21 12:40:36 -080048 byte[] getHashFactor(in byte[] currentCredential, int userId);
49 void setSeparateProfileChallengeEnabled(int userId, boolean enabled, in byte[] managedUserPassword);
Ricky Waidc283a82016-03-24 19:55:08 +000050 boolean getSeparateProfileChallengeEnabled(int userId);
Adrian Roosb5e47222015-08-14 15:53:06 -070051 void registerStrongAuthTracker(in IStrongAuthTracker tracker);
52 void unregisterStrongAuthTracker(in IStrongAuthTracker tracker);
53 void requireStrongAuth(int strongAuthReason, int userId);
Jim Miller4f93c582016-01-27 19:05:43 -080054 void systemReady();
Adrian Roos4ab7e592016-04-13 15:38:13 -070055 void userPresent(int userId);
Victor Changa0940d32016-05-16 19:36:08 +010056 int getStrongAuthForUser(int userId);
Rubin Xuf095f832017-01-31 15:23:34 +000057
Robert Berry74928a12018-01-18 17:49:07 +000058 // Keystore RecoveryController methods.
Dmitry Dementyev1aa96132017-12-11 11:33:12 -080059 // {@code ServiceSpecificException} may be thrown to signal an error, which caller can
Dmitry Dementyeved89ea02018-01-11 13:53:52 -080060 // convert to {@code RecoveryManagerException}.
Bo Zhu7f414d92018-02-28 09:28:19 -080061 void initRecoveryServiceWithSigFile(in String rootCertificateAlias,
62 in byte[] recoveryServiceCertFile, in byte[] recoveryServiceSigFile);
Dmitry Dementyevb4fb9872018-01-26 11:49:34 -080063 KeyChainSnapshot getKeyChainSnapshot();
Robert Berrya3b99472018-02-23 15:59:02 +000064 String generateKey(String alias);
Bo Zhuc7048342019-01-03 14:04:58 -080065 String generateKeyWithMetadata(String alias, in byte[] metadata);
Bo Zhu2c8e5382018-02-26 15:54:25 -080066 String importKey(String alias, in byte[] keyBytes);
Bo Zhuc7048342019-01-03 14:04:58 -080067 String importKeyWithMetadata(String alias, in byte[] keyBytes, in byte[] metadata);
Dmitry Dementyev29b9de52018-01-31 16:09:32 -080068 String getKey(String alias);
Robert Berry5daccec2018-01-06 19:16:25 +000069 void removeKey(String alias);
Dmitry Dementyev14298312018-01-04 15:19:19 -080070 void setSnapshotCreatedPendingIntent(in PendingIntent intent);
Dmitry Dementyev7d8c78a2018-01-12 19:14:07 -080071 void setServerParams(in byte[] serverParams);
Robert Berrybbe02ae2018-02-20 19:47:43 +000072 void setRecoveryStatus(in String alias, int status);
Robert Berry56f06b42018-02-23 13:31:32 +000073 Map getRecoveryStatus();
Dmitry Dementyev14298312018-01-04 15:19:19 -080074 void setRecoverySecretTypes(in int[] secretTypes);
75 int[] getRecoverySecretTypes();
Bo Zhub31ab672018-03-20 22:44:18 -070076 byte[] startRecoverySessionWithCertPath(in String sessionId, in String rootCertificateAlias,
Bo Zhu7c1972f2018-02-22 21:43:52 -080077 in RecoveryCertPath verifierCertPath, in byte[] vaultParams, in byte[] vaultChallenge,
78 in List<KeyChainProtectionParams> secrets);
Robert Berry4a5c87d2018-03-19 18:00:46 +000079 Map/*<String, String>*/ recoverKeyChainSnapshot(
80 in String sessionId,
81 in byte[] recoveryKeyBlob,
82 in List<WrappedApplicationKey> applicationKeys);
Robert Berry2bcdad92018-01-18 12:53:29 +000083 void closeSession(in String sessionId);
Amith Yamasani52c489c2012-03-28 11:42:42 -070084}