diff options
3 files changed, 11 insertions, 46 deletions
diff --git a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java index 8161503652ff..b0fc71909bf2 100644 --- a/services/core/java/com/android/server/locksettings/LockSettingsStorage.java +++ b/services/core/java/com/android/server/locksettings/LockSettingsStorage.java @@ -44,7 +44,6 @@ import com.android.internal.util.ArrayUtils; import com.android.internal.util.IndentingPrintWriter; import com.android.internal.util.Preconditions; import com.android.internal.widget.LockPatternUtils; -import com.android.internal.widget.LockPatternUtils.CredentialType; import com.android.server.LocalServices; import com.android.server.PersistentDataBlockManagerInternal; import com.android.server.utils.WatchableImpl; @@ -108,39 +107,6 @@ class LockSettingsStorage extends WatchableImpl { private PersistentDataBlockManagerInternal mPersistentDataBlockManagerInternal; - @VisibleForTesting - public static class CredentialHash { - - private CredentialHash(byte[] hash, @CredentialType int type) { - if (type != LockPatternUtils.CREDENTIAL_TYPE_NONE) { - if (hash == null) { - throw new IllegalArgumentException("Empty hash for CredentialHash"); - } - } else /* type == LockPatternUtils.CREDENTIAL_TYPE_NONE */ { - if (hash != null) { - throw new IllegalArgumentException( - "None type CredentialHash should not have hash"); - } - } - this.hash = hash; - this.type = type; - } - - static CredentialHash create(byte[] hash, int type) { - if (type == LockPatternUtils.CREDENTIAL_TYPE_NONE) { - throw new IllegalArgumentException("Bad type for CredentialHash"); - } - return new CredentialHash(hash, type); - } - - static CredentialHash createEmptyHash() { - return new CredentialHash(null, LockPatternUtils.CREDENTIAL_TYPE_NONE); - } - - byte[] hash; - @CredentialType int type; - } - public LockSettingsStorage(Context context) { mContext = context; mOpenHelper = new DatabaseHelper(context); diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java index 2cb89b314b33..ec0d9856486d 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/KeySyncTask.java @@ -122,7 +122,7 @@ public class KeySyncTask implements Runnable { * @param recoverableKeyStoreDb Database where the keys are stored. * @param userId The uid of the user whose profile has been unlocked. * @param credentialType The type of credential as defined in {@code LockPatternUtils} - * @param credential The credential, encoded as a {@link String}. + * @param credential The credential, encoded as a byte array * @param credentialUpdated signals weather credentials were updated. * @param platformKeyManager platform key manager * @param testOnlyInsecureCertificateHelper utility class used for end-to-end tests diff --git a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java index b49bced4e567..e620c80b8e28 100644 --- a/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java +++ b/services/core/java/com/android/server/locksettings/recoverablekeystore/RecoverableKeyStoreManager.java @@ -900,14 +900,13 @@ public class RecoverableKeyStoreManager { /** * This function can only be used inside LockSettingsService. * - * @param storedHashType from {@code CredentialHash} - * @param credential - unencrypted byte array. Password length should be at most 16 symbols - * {@code mPasswordMaxLength} - * @param userId for user who just unlocked the device. + * @param credentialType the type of credential, as defined in {@code LockPatternUtils} + * @param credential the credential, encoded as a byte array + * @param userId the ID of the user to whom the credential belongs * @hide */ public void lockScreenSecretAvailable( - int storedHashType, @NonNull byte[] credential, int userId) { + int credentialType, @NonNull byte[] credential, int userId) { // So as not to block the critical path unlocking the phone, defer to another thread. try { mExecutorService.schedule(KeySyncTask.newInstance( @@ -916,7 +915,7 @@ public class RecoverableKeyStoreManager { mSnapshotStorage, mListenersStorage, userId, - storedHashType, + credentialType, credential, /*credentialUpdated=*/ false), SYNC_DELAY_MILLIS, @@ -934,13 +933,13 @@ public class RecoverableKeyStoreManager { /** * This function can only be used inside LockSettingsService. * - * @param storedHashType from {@code CredentialHash} - * @param credential - unencrypted byte array - * @param userId for the user whose lock screen credentials were changed. + * @param credentialType the type of the new credential, as defined in {@code LockPatternUtils} + * @param credential the new credential, encoded as a byte array + * @param userId the ID of the user whose credential was changed * @hide */ public void lockScreenSecretChanged( - int storedHashType, + int credentialType, @Nullable byte[] credential, int userId) { // So as not to block the critical path unlocking the phone, defer to another thread. @@ -951,7 +950,7 @@ public class RecoverableKeyStoreManager { mSnapshotStorage, mListenersStorage, userId, - storedHashType, + credentialType, credential, /*credentialUpdated=*/ true), SYNC_DELAY_MILLIS, |