Loading services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -1822,6 +1822,7 @@ class SyntheticPasswordManager { destroyProtectorCommon(protectorId, userId); destroyState(PASSWORD_DATA_NAME, protectorId, userId); destroyState(PASSWORD_METRICS_NAME, protectorId, userId); destroyState(FAILURE_COUNTER_NAME, protectorId, userId); } private void destroyProtectorCommon(long protectorId, int userId) { Loading services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java +17 −0 Original line number Diff line number Diff line Loading @@ -956,6 +956,23 @@ public class SyntheticPasswordTests extends BaseLockSettingsServiceTests { } } @Test public void testFailureCounterDeletedOnLskfChanged() throws Exception { final int userId = PRIMARY_USER_ID; final LockscreenCredential pin = newPin("1234"); initSpAndSetCredential(userId, pin); final long oldProtectorId = mService.getCurrentLskfBasedProtectorId(userId); final LskfIdentifier oldLskfId = new LskfIdentifier(userId, oldProtectorId); mSpManager.writeFailureCounter(oldLskfId, 1); assertEquals(1, mSpManager.readFailureCounter(oldLskfId)); assertTrue(mService.setLockCredential(nonePassword(), pin, userId)); final long newProtectorId = mService.getCurrentLskfBasedProtectorId(userId); assertNotEquals(oldProtectorId, newProtectorId); assertEquals(0, mSpManager.readFailureCounter(oldLskfId)); } // b/62213311 //TODO: add non-migration work profile case, and unify/un-unify transition. //TODO: test token after user resets password Loading Loading
services/core/java/com/android/server/locksettings/SyntheticPasswordManager.java +1 −0 Original line number Diff line number Diff line Loading @@ -1822,6 +1822,7 @@ class SyntheticPasswordManager { destroyProtectorCommon(protectorId, userId); destroyState(PASSWORD_DATA_NAME, protectorId, userId); destroyState(PASSWORD_METRICS_NAME, protectorId, userId); destroyState(FAILURE_COUNTER_NAME, protectorId, userId); } private void destroyProtectorCommon(long protectorId, int userId) { Loading
services/tests/servicestests/src/com/android/server/locksettings/SyntheticPasswordTests.java +17 −0 Original line number Diff line number Diff line Loading @@ -956,6 +956,23 @@ public class SyntheticPasswordTests extends BaseLockSettingsServiceTests { } } @Test public void testFailureCounterDeletedOnLskfChanged() throws Exception { final int userId = PRIMARY_USER_ID; final LockscreenCredential pin = newPin("1234"); initSpAndSetCredential(userId, pin); final long oldProtectorId = mService.getCurrentLskfBasedProtectorId(userId); final LskfIdentifier oldLskfId = new LskfIdentifier(userId, oldProtectorId); mSpManager.writeFailureCounter(oldLskfId, 1); assertEquals(1, mSpManager.readFailureCounter(oldLskfId)); assertTrue(mService.setLockCredential(nonePassword(), pin, userId)); final long newProtectorId = mService.getCurrentLskfBasedProtectorId(userId); assertNotEquals(oldProtectorId, newProtectorId); assertEquals(0, mSpManager.readFailureCounter(oldLskfId)); } // b/62213311 //TODO: add non-migration work profile case, and unify/un-unify transition. //TODO: test token after user resets password Loading