1 /* 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 17 package com.android.internal.widget; 18 19 import android.app.PendingIntent; 20 import android.app.trust.IStrongAuthTracker; 21 import android.os.Bundle; 22 import android.security.keystore.recovery.WrappedApplicationKey; 23 import android.security.keystore.recovery.KeyChainSnapshot; 24 import android.security.keystore.recovery.KeyChainProtectionParams; 25 import android.security.keystore.recovery.RecoveryCertPath; 26 import com.android.internal.widget.ICheckCredentialProgressCallback; 27 import com.android.internal.widget.VerifyCredentialResponse; 28 29 import java.util.Map; 30 31 /** {@hide} */ 32 interface 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); 39 void setLockCredential(in String credential, int type, in String savedCredential, int requestedQuality, int userId); 40 void resetKeyStore(int userId); 41 VerifyCredentialResponse checkCredential(in String credential, int type, int userId, 42 in ICheckCredentialProgressCallback progressCallback); 43 VerifyCredentialResponse verifyCredential(in String credential, int type, long challenge, int userId); 44 VerifyCredentialResponse verifyTiedProfileChallenge(String credential, int type, long challenge, int userId); 45 boolean checkVoldPassword(int userId); 46 boolean havePattern(int userId); 47 boolean havePassword(int userId); 48 byte[] getHashFactor(String currentCredential, int userId); 49 void setSeparateProfileChallengeEnabled(int userId, boolean enabled, String managedUserPassword); 50 boolean getSeparateProfileChallengeEnabled(int userId); 51 void registerStrongAuthTracker(in IStrongAuthTracker tracker); 52 void unregisterStrongAuthTracker(in IStrongAuthTracker tracker); 53 void requireStrongAuth(int strongAuthReason, int userId); 54 void systemReady(); 55 void userPresent(int userId); 56 int getStrongAuthForUser(int userId); 57 58 // Keystore RecoveryController methods. 59 // {@code ServiceSpecificException} may be thrown to signal an error, which caller can 60 // convert to {@code RecoveryManagerException}. 61 void initRecoveryServiceWithSigFile(in String rootCertificateAlias, 62 in byte[] recoveryServiceCertFile, in byte[] recoveryServiceSigFile); 63 KeyChainSnapshot getKeyChainSnapshot(); 64 String generateKey(String alias); 65 String importKey(String alias, in byte[] keyBytes); 66 String getKey(String alias); 67 void removeKey(String alias); 68 void setSnapshotCreatedPendingIntent(in PendingIntent intent); 69 void setServerParams(in byte[] serverParams); 70 void setRecoveryStatus(in String alias, int status); 71 Map getRecoveryStatus(); 72 void setRecoverySecretTypes(in int[] secretTypes); 73 int[] getRecoverySecretTypes(); 74 byte[] startRecoverySessionWithCertPath(in String sessionId, in String rootCertificateAlias, 75 in RecoveryCertPath verifierCertPath, in byte[] vaultParams, in byte[] vaultChallenge, 76 in List<KeyChainProtectionParams> secrets); 77 Map/*<String, String>*/ recoverKeyChainSnapshot( 78 in String sessionId, 79 in byte[] recoveryKeyBlob, 80 in List<WrappedApplicationKey> applicationKeys); 81 void closeSession(in String sessionId); 82 } 83