Loading packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +17 −14 Original line number Diff line number Diff line Loading @@ -466,6 +466,17 @@ public class LockIconViewController extends ViewController<LockIconView> impleme } } /** * @return whether the userUnlockedWithBiometric state changed */ private boolean updateUserUnlockedWithBiometric() { final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); return wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric; } private StatusBarStateController.StateListener mStatusBarStateListener = new StatusBarStateController.StateListener() { @Override Loading Loading @@ -503,11 +514,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onBiometricsCleared() { final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); if (wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric) { if (updateUserUnlockedWithBiometric()) { updateVisibility(); } } Loading @@ -516,10 +523,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { final boolean wasRunningFps = mRunningFPS; final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); final boolean userUnlockedWithBiometricChanged = updateUserUnlockedWithBiometric(); if (biometricSourceType == FINGERPRINT) { mRunningFPS = running; Loading @@ -537,8 +542,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme } } if (wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric || wasRunningFps != mRunningFPS) { if (userUnlockedWithBiometricChanged || wasRunningFps != mRunningFPS) { updateVisibility(); } } Loading @@ -549,6 +553,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onUnlockedChanged() { mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen(); updateUserUnlockedWithBiometric(); updateKeyguardShowing(); updateVisibility(); } Loading @@ -566,9 +571,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme updateKeyguardShowing(); if (mIsKeyguardShowing) { mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); updateUserUnlockedWithBiometric(); } updateVisibility(); } Loading packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -284,4 +284,26 @@ public class LockIconViewControllerTest extends LockIconViewControllerBaseTest { // THEN the lock icon is shown verify(mLockIconView).setContentDescription(LOCKED_LABEL); } @Test public void lockIconShows_afterUnlockStateChanges() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setContentDescription(LOCKED_LABEL); } } Loading
packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +17 −14 Original line number Diff line number Diff line Loading @@ -466,6 +466,17 @@ public class LockIconViewController extends ViewController<LockIconView> impleme } } /** * @return whether the userUnlockedWithBiometric state changed */ private boolean updateUserUnlockedWithBiometric() { final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); return wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric; } private StatusBarStateController.StateListener mStatusBarStateListener = new StatusBarStateController.StateListener() { @Override Loading Loading @@ -503,11 +514,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onBiometricsCleared() { final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); if (wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric) { if (updateUserUnlockedWithBiometric()) { updateVisibility(); } } Loading @@ -516,10 +523,8 @@ public class LockIconViewController extends ViewController<LockIconView> impleme public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { final boolean wasRunningFps = mRunningFPS; final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); final boolean userUnlockedWithBiometricChanged = updateUserUnlockedWithBiometric(); if (biometricSourceType == FINGERPRINT) { mRunningFPS = running; Loading @@ -537,8 +542,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme } } if (wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric || wasRunningFps != mRunningFPS) { if (userUnlockedWithBiometricChanged || wasRunningFps != mRunningFPS) { updateVisibility(); } } Loading @@ -549,6 +553,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme @Override public void onUnlockedChanged() { mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen(); updateUserUnlockedWithBiometric(); updateKeyguardShowing(); updateVisibility(); } Loading @@ -566,9 +571,7 @@ public class LockIconViewController extends ViewController<LockIconView> impleme updateKeyguardShowing(); if (mIsKeyguardShowing) { mUserUnlockedWithBiometric = mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( KeyguardUpdateMonitor.getCurrentUser()); updateUserUnlockedWithBiometric(); } updateVisibility(); } Loading
packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java +22 −0 Original line number Diff line number Diff line Loading @@ -284,4 +284,26 @@ public class LockIconViewControllerTest extends LockIconViewControllerBaseTest { // THEN the lock icon is shown verify(mLockIconView).setContentDescription(LOCKED_LABEL); } @Test public void lockIconShows_afterUnlockStateChanges() { // GIVEN lock icon controller is initialized and view is attached init(/* useMigrationFlag= */false); captureKeyguardStateCallback(); captureKeyguardUpdateMonitorCallback(); // GIVEN user has unlocked with a biometric auth (ie: face auth) // and biometric running state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true); mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false, BiometricSourceType.FACE); reset(mLockIconView); // WHEN the unlocked state changes when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); mKeyguardStateCallback.onUnlockedChanged(); // THEN the lock icon is shown verify(mLockIconView).setContentDescription(LOCKED_LABEL); } }