From a1616135cc58e198a56ca924338d516ffdaa5d48 Mon Sep 17 00:00:00 2001 From: Beverly Date: Thu, 17 Dec 2020 10:26:13 -0500 Subject: [PATCH] Only show lock icon on devices using faceauth Don't show on devices with faceauth + udfps enrolled Test: manual, atest SystemUITests Bug: 172050991 Change-Id: I2b0acfd5d07286c57e6da0637747ceacdcd73cc6 --- .../com/android/keyguard/KeyguardUpdateMonitor.java | 9 +++++++++ .../phone/KeyguardClockPositionAlgorithm.java | 6 +++--- .../statusbar/phone/LockscreenLockIconController.java | 10 ++++------ .../phone/NotificationPanelViewController.java | 3 ++- .../statusbar/phone/LockscreenIconControllerTest.java | 9 ++++----- 5 files changed, 22 insertions(+), 15 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 2071cfaf2bd90..b43496cb55dc1 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1900,6 +1900,15 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab mIsUdfpsEnrolled = mAuthController.isUdfpsEnrolled(userId); } + /** + * Whether to show the lock icon on lock screen and bouncer. This depends on the enrolled + * biometrics to the device. + */ + public boolean shouldShowLockIcon() { + return isFaceAuthEnabledForUser(KeyguardUpdateMonitor.getCurrentUser()) + && !isUdfpsEnrolled(); + } + /** * @return true if there's at least one udfps enrolled */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java index b9e8d74d9b851..6da5d1b90cd96 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardClockPositionAlgorithm.java @@ -164,10 +164,10 @@ public class KeyguardClockPositionAlgorithm { public void setup(int statusBarMinHeight, int maxShadeBottom, int notificationStackHeight, float panelExpansion, int parentHeight, int keyguardStatusHeight, int clockPreferredY, boolean hasCustomClock, boolean hasVisibleNotifs, float dark, float emptyDragAmount, - boolean bypassEnabled, int unlockedStackScrollerPadding, boolean udfpsEnrolled, + boolean bypassEnabled, int unlockedStackScrollerPadding, boolean showLockIcon, float qsExpansion) { - mMinTopMargin = statusBarMinHeight + (udfpsEnrolled ? mContainerTopPaddingWithoutLockIcon : - mContainerTopPaddingWithLockIcon); + mMinTopMargin = statusBarMinHeight + (showLockIcon + ? mContainerTopPaddingWithLockIcon : mContainerTopPaddingWithoutLockIcon); mMaxShadeBottom = maxShadeBottom; mNotificationStackHeight = notificationStackHeight; mPanelExpansion = panelExpansion; diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java index 6bdc303b47862..ab0366e07b9cb 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java @@ -501,7 +501,7 @@ public class LockscreenLockIconController { if (mBlockUpdates && canBlockUpdates()) { shouldUpdate = false; } - if (shouldUpdate && mLockIcon != null) { + if (shouldUpdate && mLockIcon != null && mLockIcon.getVisibility() != GONE) { mLockIcon.update(state, mStatusBarStateController.isDozing(), mKeyguardJustShown); } @@ -549,16 +549,14 @@ public class LockscreenLockIconController { return false; } - if (mKeyguardUpdateMonitor.isUdfpsEnrolled()) { - boolean changed = mLockIcon.getVisibility() == GONE; + if (!mKeyguardUpdateMonitor.shouldShowLockIcon()) { + boolean changed = mLockIcon.getVisibility() != GONE; mLockIcon.setVisibility(GONE); return changed; } boolean onAodOrDocked = mStatusBarStateController.isDozing() || mDocked; - boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance - || (mKeyguardSecurityModel.getSecurityMode(KeyguardUpdateMonitor.getCurrentUser()) - == KeyguardSecurityModel.SecurityMode.None); + boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; boolean fingerprintOrBypass = mFingerprintUnlock || mKeyguardBypassController.getBypassEnabled(); if (fingerprintOrBypass && !mBouncerShowingScrimmed) { diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java index 8d3b12868dd75..ba08e76e6f66a 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelViewController.java @@ -912,7 +912,8 @@ public class NotificationPanelViewController extends PanelViewController { clockPreferredY, hasCustomClock(), hasVisibleNotifications, mInterpolatedDarkAmount, mEmptyDragAmount, bypassEnabled, getUnlockedStackScrollerPadding(), - mUpdateMonitor.isUdfpsEnrolled(), getQsExpansionFraction()); + mUpdateMonitor.shouldShowLockIcon(), + getQsExpansionFraction()); mClockPositionAlgorithm.run(mClockPositionResult); mKeyguardStatusViewController.updatePosition( mClockPositionResult.clockX, mClockPositionResult.clockY, diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LockscreenIconControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LockscreenIconControllerTest.java index 1ac793730f023..95a35050c09ea 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LockscreenIconControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LockscreenIconControllerTest.java @@ -91,6 +91,7 @@ public class LockscreenIconControllerTest extends SysuiTestCase { public void setUp() { MockitoAnnotations.initMocks(this); + when(mKeyguardUpdateMonitor.shouldShowLockIcon()).thenReturn(true); when(mLockIcon.getContext()).thenReturn(mContext); mLockIconController = new LockscreenLockIconController( mLockscreenGestureLogger, mKeyguardUpdateMonitor, mLockPatternUtils, @@ -145,12 +146,10 @@ public class LockscreenIconControllerTest extends SysuiTestCase { } @Test - public void testVisibility_noBouncer() { - // no security (ie: no lock screen OR swipe to unlock) - when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn( - KeyguardSecurityModel.SecurityMode.None); + public void testVisibility_doNotShowLockIcon() { + when(mKeyguardUpdateMonitor.shouldShowLockIcon()).thenReturn(false); mOnAttachStateChangeListener.onViewAttachedToWindow(mLockIcon); - verify(mLockIcon).updateIconVisibility(false); + verify(mLockIcon).setVisibility(View.GONE); } }