diff --git a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java index d62f83c005fb7..dad50bd8a9d14 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/BaseLockSettingsServiceTests.java @@ -221,7 +221,6 @@ public abstract class BaseLockSettingsServiceTests { Object[] args = invocation.getArguments(); mStorageManager.addUserKeyAuth((int) args[0] /* userId */, (int) args[1] /* serialNumber */, - (byte[]) args[2] /* token */, (byte[]) args[3] /* secret */); return null; } @@ -233,7 +232,6 @@ public abstract class BaseLockSettingsServiceTests { Object[] args = invocation.getArguments(); mStorageManager.clearUserKeyAuth((int) args[0] /* userId */, (int) args[1] /* serialNumber */, - (byte[]) args[2] /* token */, (byte[]) args[3] /* secret */); return null; } diff --git a/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java b/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java index 102bac111adac..619ef7078c246 100644 --- a/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java +++ b/services/tests/servicestests/src/com/android/server/locksettings/FakeStorageManager.java @@ -19,7 +19,6 @@ package com.android.server.locksettings; import android.os.IProgressListener; import android.os.RemoteException; import android.util.ArrayMap; -import android.util.Pair; import junit.framework.AssertionFailedError; @@ -29,56 +28,56 @@ import java.util.Arrays; public class FakeStorageManager { - private ArrayMap>> mAuth = new ArrayMap<>(); + private ArrayMap> mAuth = new ArrayMap<>(); private boolean mIgnoreBadUnlock; - public void addUserKeyAuth(int userId, int serialNumber, byte[] token, byte[] secret) { - getUserAuth(userId).add(new Pair<>(token, secret)); + public void addUserKeyAuth(int userId, int serialNumber, byte[] secret) { + getUserAuth(userId).add(secret); } - public void clearUserKeyAuth(int userId, int serialNumber, byte[] token, byte[] secret) { - ArrayList> auths = getUserAuth(userId); - if (token == null && secret == null) { + public void clearUserKeyAuth(int userId, int serialNumber, byte[] secret) { + ArrayList auths = getUserAuth(userId); + if (secret == null) { return; } - auths.remove(new Pair<>(token, secret)); - auths.add(new Pair<>(null, null)); + auths.remove(secret); + auths.add(null); } public void fixateNewestUserKeyAuth(int userId) { - ArrayList> auths = mAuth.get(userId); - Pair latest = auths.get(auths.size() - 1); + ArrayList auths = mAuth.get(userId); + byte[] latest = auths.get(auths.size() - 1); auths.clear(); auths.add(latest); } - private ArrayList> getUserAuth(int userId) { + private ArrayList getUserAuth(int userId) { if (!mAuth.containsKey(userId)) { - ArrayList> auths = new ArrayList>(); - auths.add(new Pair(null, null)); - mAuth.put(userId, auths); + ArrayList auths = new ArrayList<>(); + auths.add(null); + mAuth.put(userId, auths); } return mAuth.get(userId); } public byte[] getUserUnlockToken(int userId) { - ArrayList> auths = getUserAuth(userId); + ArrayList auths = getUserAuth(userId); if (auths.size() != 1) { throw new AssertionFailedError("More than one secret exists"); } - return auths.get(0).second; + return auths.get(0); } public void unlockUser(int userId, byte[] secret, IProgressListener listener) throws RemoteException { listener.onStarted(userId, null); listener.onFinished(userId, null); - ArrayList> auths = getUserAuth(userId); + ArrayList auths = getUserAuth(userId); if (auths.size() > 1) { throw new AssertionFailedError("More than one secret exists"); } - Pair auth = auths.get(0); - if (!Arrays.equals(secret, auth.second)) { + byte[] auth = auths.get(0); + if (!Arrays.equals(secret, auth)) { if (!mIgnoreBadUnlock) { throw new AssertionFailedError("Invalid secret to unlock user " + userId); }