Remove LockSettingsStorage.CredentialHash
LockSettingsStorage.CredentialHash is no longer used, so remove it. Fix the documentation and parameter naming in some RecoverableKeyStoreManager methods which claimed to be related to CredentialHash but really are not. Test: atest com.android.server.locksettings Change-Id: Ie2c27d37eba685a917df25dbb59ccf12bd3ad05c
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user