diff --git a/packages/SystemUI/res-keyguard/drawable/super_lock_icon.xml b/packages/SystemUI/res-keyguard/drawable/super_lock_icon.xml index b3987f1aeeda0..951d6fed0a17c 100644 --- a/packages/SystemUI/res-keyguard/drawable/super_lock_icon.xml +++ b/packages/SystemUI/res-keyguard/drawable/super_lock_icon.xml @@ -99,4 +99,9 @@ android:fromId="@id/unlocked" android:toId="@id/locked_aod" android:drawable="@drawable/unlocked_to_aod_lock" /> + + diff --git a/packages/SystemUI/res-keyguard/drawable/unlocked_to_locked.xml b/packages/SystemUI/res-keyguard/drawable/unlocked_to_locked.xml new file mode 100644 index 0000000000000..b55abd1fdddc4 --- /dev/null +++ b/packages/SystemUI/res-keyguard/drawable/unlocked_to_locked.xml @@ -0,0 +1,145 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java index dd6a1bd457b8d..1322f16a5a59e 100644 --- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java @@ -500,6 +500,17 @@ public class LockIconViewController extends ViewController impleme updateVisibility(); } + @Override + public void onBiometricsCleared() { + final boolean wasUserUnlockedWithBiometric = mUserUnlockedWithBiometric; + mUserUnlockedWithBiometric = + mKeyguardUpdateMonitor.getUserUnlockedWithBiometric( + KeyguardUpdateMonitor.getCurrentUser()); + if (wasUserUnlockedWithBiometric != mUserUnlockedWithBiometric) { + updateVisibility(); + } + } + @Override public void onBiometricRunningStateChanged(boolean running, BiometricSourceType biometricSourceType) { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerBaseTest.java b/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerBaseTest.java index ae8f419d4e648..e4c41a7ed804d 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerBaseTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerBaseTest.java @@ -68,6 +68,7 @@ import org.mockito.quality.Strictness; public class LockIconViewControllerBaseTest extends SysuiTestCase { protected static final String UNLOCKED_LABEL = "unlocked"; + protected static final String LOCKED_LABEL = "locked"; protected static final int PADDING = 10; protected MockitoSession mStaticMockSession; @@ -130,6 +131,7 @@ public class LockIconViewControllerBaseTest extends SysuiTestCase { Rect windowBounds = new Rect(0, 0, 800, 1200); when(mWindowManager.getCurrentWindowMetrics().getBounds()).thenReturn(windowBounds); when(mResources.getString(R.string.accessibility_unlock_button)).thenReturn(UNLOCKED_LABEL); + when(mResources.getString(R.string.accessibility_lock_icon)).thenReturn(LOCKED_LABEL); when(mResources.getDrawable(anyInt(), any())).thenReturn(mIconDrawable); when(mResources.getDimensionPixelSize(R.dimen.lock_icon_padding)).thenReturn(PADDING); when(mAuthController.getScaleFactor()).thenReturn(1f); diff --git a/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java index da40595a4f122..b69491ed10964 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java @@ -262,6 +262,26 @@ public class LockIconViewControllerTest extends LockIconViewControllerBaseTest { // THEN the view is updated to NO translation (no burn-in offsets anymore) verify(mLockIconView).setTranslationY(0); verify(mLockIconView).setTranslationX(0); + } + @Test + public void lockIconShows_afterBiometricsCleared() { + // GIVEN lock icon controller is initialized and view is attached + init(/* useMigrationFlag= */false); + 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 biometrics are cleared + when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(false); + mKeyguardUpdateMonitorCallback.onBiometricsCleared(); + + // THEN the lock icon is shown + verify(mLockIconView).setContentDescription(LOCKED_LABEL); } }