Remove unneeded code that supported old UI
Fixes: 276348149
Test: atest LockIconViewControllerTest
Test: manually check that udfps and lock icon
shows appropriately for transitions between
AOD <-> lock screen and home screen <-> AoD
and home screen <-> lock screen
Change-Id: I4e385e87d06ad04ddccdaf2de49ab42773752385
diff --git a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
index 1ae380e..fa68287 100644
--- a/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
+++ b/packages/SystemUI/src/com/android/keyguard/LockIconViewController.java
@@ -127,8 +127,6 @@
private boolean mCanDismissLockScreen;
private int mStatusBarState;
private boolean mIsKeyguardShowing;
- private boolean mUserUnlockedWithBiometric;
- private Runnable mCancelDelayedUpdateVisibilityRunnable;
private Runnable mOnGestureDetectedRunnable;
private Runnable mLongPressCancelRunnable;
@@ -229,7 +227,6 @@
updateIsUdfpsEnrolled();
updateConfiguration();
updateKeyguardShowing();
- mUserUnlockedWithBiometric = false;
mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
mIsDozing = mStatusBarStateController.isDozing();
@@ -270,11 +267,6 @@
mStatusBarStateController.removeCallback(mStatusBarStateListener);
mKeyguardStateController.removeCallback(mKeyguardStateCallback);
- if (mCancelDelayedUpdateVisibilityRunnable != null) {
- mCancelDelayedUpdateVisibilityRunnable.run();
- mCancelDelayedUpdateVisibilityRunnable = null;
- }
-
mAccessibilityManager.removeAccessibilityStateChangeListener(
mAccessibilityStateChangeListener);
}
@@ -288,11 +280,6 @@
}
private void updateVisibility() {
- if (mCancelDelayedUpdateVisibilityRunnable != null) {
- mCancelDelayedUpdateVisibilityRunnable.run();
- mCancelDelayedUpdateVisibilityRunnable = null;
- }
-
if (!mIsKeyguardShowing && !mIsDozing) {
mView.setVisibility(View.INVISIBLE);
return;
@@ -300,9 +287,9 @@
boolean wasShowingFpIcon = mUdfpsEnrolled && !mShowUnlockIcon && !mShowLockIcon
&& !mShowAodUnlockedIcon && !mShowAodLockIcon;
- mShowLockIcon = !mCanDismissLockScreen && !mUserUnlockedWithBiometric && isLockScreen()
+ mShowLockIcon = !mCanDismissLockScreen && isLockScreen()
&& (!mUdfpsEnrolled || !mRunningFPS);
- mShowUnlockIcon = (mCanDismissLockScreen || mUserUnlockedWithBiometric) && isLockScreen();
+ mShowUnlockIcon = mCanDismissLockScreen && isLockScreen();
mShowAodUnlockedIcon = mIsDozing && mUdfpsEnrolled && !mRunningFPS && mCanDismissLockScreen;
mShowAodLockIcon = mIsDozing && mUdfpsEnrolled && !mRunningFPS && !mCanDismissLockScreen;
@@ -426,7 +413,6 @@
pw.println(" isFlagEnabled(DOZING_MIGRATION_1): "
+ mFeatureFlags.isEnabled(DOZING_MIGRATION_1));
pw.println(" mIsBouncerShowing: " + mIsBouncerShowing);
- pw.println(" mUserUnlockedWithBiometric: " + mUserUnlockedWithBiometric);
pw.println(" mRunningFPS: " + mRunningFPS);
pw.println(" mCanDismissLockScreen: " + mCanDismissLockScreen);
pw.println(" mStatusBarState: " + StatusBarState.toString(mStatusBarState));
@@ -469,17 +455,6 @@
}
}
- /**
- * @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
@@ -516,36 +491,15 @@
}
@Override
- public void onBiometricsCleared() {
- if (updateUserUnlockedWithBiometric()) {
- updateVisibility();
- }
- }
-
- @Override
public void onBiometricRunningStateChanged(boolean running,
BiometricSourceType biometricSourceType) {
final boolean wasRunningFps = mRunningFPS;
- final boolean userUnlockedWithBiometricChanged =
- updateUserUnlockedWithBiometric();
if (biometricSourceType == FINGERPRINT) {
mRunningFPS = running;
- if (wasRunningFps && !mRunningFPS) {
- if (mCancelDelayedUpdateVisibilityRunnable != null) {
- mCancelDelayedUpdateVisibilityRunnable.run();
- }
-
- // For some devices, auth is cancelled immediately on screen off but
- // before dozing state is set. We want to avoid briefly showing the
- // button in this case, so we delay updating the visibility by 50ms.
- mCancelDelayedUpdateVisibilityRunnable =
- mExecutor.executeDelayed(() -> updateVisibility(), 50);
- return;
- }
}
- if (userUnlockedWithBiometricChanged || wasRunningFps != mRunningFPS) {
+ if (wasRunningFps != mRunningFPS) {
updateVisibility();
}
}
@@ -556,7 +510,6 @@
@Override
public void onUnlockedChanged() {
mCanDismissLockScreen = mKeyguardStateController.canDismissLockScreen();
- updateUserUnlockedWithBiometric();
updateKeyguardShowing();
updateVisibility();
}
@@ -573,9 +526,6 @@
mIsBouncerShowing = mKeyguardViewController.isBouncerShowing();
updateKeyguardShowing();
- if (mIsKeyguardShowing) {
- updateUserUnlockedWithBiometric();
- }
updateVisibility();
}
diff --git a/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java
index 33f0ae5..b6287598 100644
--- a/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java
+++ b/packages/SystemUI/tests/src/com/android/keyguard/LockIconViewControllerTest.java
@@ -141,27 +141,6 @@
}
@Test
- public void testUnlockIconShows_biometricUnlockedTrue() {
- // GIVEN UDFPS sensor location is available
- setupUdfps();
-
- // 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)
- when(mKeyguardUpdateMonitor.getUserUnlockedWithBiometric(anyInt())).thenReturn(true);
- reset(mLockIconView);
-
- // WHEN face auth's biometric running state changes
- mKeyguardUpdateMonitorCallback.onBiometricRunningStateChanged(false,
- BiometricSourceType.FACE);
-
- // THEN the unlock icon is shown
- verify(mLockIconView).setContentDescription(UNLOCKED_LABEL);
- }
-
- @Test
public void testLockIconStartState() {
// GIVEN lock icon state
setupShowLockIcon();
@@ -268,27 +247,6 @@
}
@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);
- }
-
- @Test
public void lockIconShows_afterUnlockStateChanges() {
// GIVEN lock icon controller is initialized and view is attached
init(/* useMigrationFlag= */false);