Loading packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java +13 −7 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import androidx.annotation.Nullable; import com.android.internal.logging.nano.MetricsProto; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.settingslib.Utils; Loading Loading @@ -78,6 +79,7 @@ public class LockscreenLockIconController { private final KeyguardStateController mKeyguardStateController; private final Resources mResources; private final HeadsUpManagerPhone mHeadsUpManagerPhone; private final KeyguardSecurityModel mKeyguardSecurityModel; private boolean mKeyguardShowing; private boolean mKeyguardJustShown; private boolean mBlockUpdates; Loading Loading @@ -326,7 +328,8 @@ public class LockscreenLockIconController { @Nullable DockManager dockManager, KeyguardStateController keyguardStateController, @Main Resources resources, HeadsUpManagerPhone headsUpManagerPhone) { HeadsUpManagerPhone headsUpManagerPhone, KeyguardSecurityModel keyguardSecurityModel) { mLockscreenGestureLogger = lockscreenGestureLogger; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLockPatternUtils = lockPatternUtils; Loading @@ -341,6 +344,7 @@ public class LockscreenLockIconController { mKeyguardStateController = keyguardStateController; mResources = resources; mHeadsUpManagerPhone = headsUpManagerPhone; mKeyguardSecurityModel = keyguardSecurityModel; mKeyguardIndicationController.setLockIconController(this); } Loading Loading @@ -541,13 +545,20 @@ public class LockscreenLockIconController { * @return true if the visibility changed */ private boolean updateIconVisibility() { if (mLockIcon == null) { return false; } if (mKeyguardUpdateMonitor.isUdfpsEnrolled()) { boolean changed = mLockIcon.getVisibility() == GONE; mLockIcon.setVisibility(GONE); return changed; } boolean onAodOrDocked = mStatusBarStateController.isDozing() || mDocked; boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance || (mKeyguardSecurityModel.getSecurityMode(KeyguardUpdateMonitor.getCurrentUser()) == KeyguardSecurityModel.SecurityMode.None); boolean fingerprintOrBypass = mFingerprintUnlock || mKeyguardBypassController.getBypassEnabled(); if (fingerprintOrBypass && !mBouncerShowingScrimmed) { Loading @@ -559,11 +570,6 @@ public class LockscreenLockIconController { invisible = true; } } if (mLockIcon == null) { return false; } return mLockIcon.updateIconVisibility(!invisible); } Loading packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LockscreenIconControllerTest.java +13 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.dock.DockManager; Loading Loading @@ -80,6 +81,8 @@ public class LockscreenIconControllerTest extends SysuiTestCase { private Resources mResources; @Mock private HeadsUpManagerPhone mHeadsUpManagerPhone; @Mock private KeyguardSecurityModel mKeyguardSecurityModel; private LockscreenLockIconController mLockIconController; private OnAttachStateChangeListener mOnAttachStateChangeListener; Loading @@ -94,7 +97,7 @@ public class LockscreenIconControllerTest extends SysuiTestCase { mShadeController, mAccessibilityController, mKeyguardIndicationController, mStatusBarStateController, mConfigurationController, mNotificationWakeUpCoordinator, mKeyguardBypassController, mDockManager, mKeyguardStateController, mResources, mHeadsUpManagerPhone); mHeadsUpManagerPhone, mKeyguardSecurityModel); ArgumentCaptor<OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor = ArgumentCaptor.forClass(OnAttachStateChangeListener.class); Loading Loading @@ -139,6 +142,15 @@ public class LockscreenIconControllerTest extends SysuiTestCase { sBStateListenerCaptor.getValue().onDozingChanged(true); verify(mLockIcon).updateIconVisibility(false); } @Test public void testVisibility_noBouncer() { // no security (ie: no lock screen OR swipe to unlock) when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn( KeyguardSecurityModel.SecurityMode.None); mOnAttachStateChangeListener.onViewAttachedToWindow(mLockIcon); verify(mLockIcon).updateIconVisibility(false); } } Loading
packages/SystemUI/src/com/android/systemui/statusbar/phone/LockscreenLockIconController.java +13 −7 Original line number Diff line number Diff line Loading @@ -37,6 +37,7 @@ import androidx.annotation.Nullable; import com.android.internal.logging.nano.MetricsProto; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.keyguard.KeyguardUpdateMonitorCallback; import com.android.settingslib.Utils; Loading Loading @@ -78,6 +79,7 @@ public class LockscreenLockIconController { private final KeyguardStateController mKeyguardStateController; private final Resources mResources; private final HeadsUpManagerPhone mHeadsUpManagerPhone; private final KeyguardSecurityModel mKeyguardSecurityModel; private boolean mKeyguardShowing; private boolean mKeyguardJustShown; private boolean mBlockUpdates; Loading Loading @@ -326,7 +328,8 @@ public class LockscreenLockIconController { @Nullable DockManager dockManager, KeyguardStateController keyguardStateController, @Main Resources resources, HeadsUpManagerPhone headsUpManagerPhone) { HeadsUpManagerPhone headsUpManagerPhone, KeyguardSecurityModel keyguardSecurityModel) { mLockscreenGestureLogger = lockscreenGestureLogger; mKeyguardUpdateMonitor = keyguardUpdateMonitor; mLockPatternUtils = lockPatternUtils; Loading @@ -341,6 +344,7 @@ public class LockscreenLockIconController { mKeyguardStateController = keyguardStateController; mResources = resources; mHeadsUpManagerPhone = headsUpManagerPhone; mKeyguardSecurityModel = keyguardSecurityModel; mKeyguardIndicationController.setLockIconController(this); } Loading Loading @@ -541,13 +545,20 @@ public class LockscreenLockIconController { * @return true if the visibility changed */ private boolean updateIconVisibility() { if (mLockIcon == null) { return false; } if (mKeyguardUpdateMonitor.isUdfpsEnrolled()) { boolean changed = mLockIcon.getVisibility() == GONE; mLockIcon.setVisibility(GONE); return changed; } boolean onAodOrDocked = mStatusBarStateController.isDozing() || mDocked; boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance; boolean invisible = onAodOrDocked || mWakeAndUnlockRunning || mShowingLaunchAffordance || (mKeyguardSecurityModel.getSecurityMode(KeyguardUpdateMonitor.getCurrentUser()) == KeyguardSecurityModel.SecurityMode.None); boolean fingerprintOrBypass = mFingerprintUnlock || mKeyguardBypassController.getBypassEnabled(); if (fingerprintOrBypass && !mBouncerShowingScrimmed) { Loading @@ -559,11 +570,6 @@ public class LockscreenLockIconController { invisible = true; } } if (mLockIcon == null) { return false; } return mLockIcon.updateIconVisibility(!invisible); } Loading
packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/LockscreenIconControllerTest.java +13 −1 Original line number Diff line number Diff line Loading @@ -30,6 +30,7 @@ import androidx.test.filters.SmallTest; import androidx.test.runner.AndroidJUnit4; import com.android.internal.widget.LockPatternUtils; import com.android.keyguard.KeyguardSecurityModel; import com.android.keyguard.KeyguardUpdateMonitor; import com.android.systemui.SysuiTestCase; import com.android.systemui.dock.DockManager; Loading Loading @@ -80,6 +81,8 @@ public class LockscreenIconControllerTest extends SysuiTestCase { private Resources mResources; @Mock private HeadsUpManagerPhone mHeadsUpManagerPhone; @Mock private KeyguardSecurityModel mKeyguardSecurityModel; private LockscreenLockIconController mLockIconController; private OnAttachStateChangeListener mOnAttachStateChangeListener; Loading @@ -94,7 +97,7 @@ public class LockscreenIconControllerTest extends SysuiTestCase { mShadeController, mAccessibilityController, mKeyguardIndicationController, mStatusBarStateController, mConfigurationController, mNotificationWakeUpCoordinator, mKeyguardBypassController, mDockManager, mKeyguardStateController, mResources, mHeadsUpManagerPhone); mHeadsUpManagerPhone, mKeyguardSecurityModel); ArgumentCaptor<OnAttachStateChangeListener> onAttachStateChangeListenerArgumentCaptor = ArgumentCaptor.forClass(OnAttachStateChangeListener.class); Loading Loading @@ -139,6 +142,15 @@ public class LockscreenIconControllerTest extends SysuiTestCase { sBStateListenerCaptor.getValue().onDozingChanged(true); verify(mLockIcon).updateIconVisibility(false); } @Test public void testVisibility_noBouncer() { // no security (ie: no lock screen OR swipe to unlock) when(mKeyguardSecurityModel.getSecurityMode(anyInt())).thenReturn( KeyguardSecurityModel.SecurityMode.None); mOnAttachStateChangeListener.onViewAttachedToWindow(mLockIcon); verify(mLockIcon).updateIconVisibility(false); } }