From a6a3ebcdc9570bb7125070db9c25a2924a3dea12 Mon Sep 17 00:00:00 2001 From: Selim Cinek Date: Wed, 19 Jun 2019 18:33:17 -0700 Subject: [PATCH] Made sure to unlock the pending unlock if the user is being switched Whenever the user switches and we still have a pending unlock, we should not bypass anymore. Bug: 134094877 Test: atest SystemUITests Change-Id: I46e179748ecc7dc5e283fd7f0ef6c2968c5ae294 --- .../systemui/statusbar/phone/KeyguardBypassController.kt | 5 ++++- .../systemui/statusbar/phone/NotificationPanelViewTest.java | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt index 45ca0d18b4d88..58d1462f7bccc 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/KeyguardBypassController.kt @@ -22,6 +22,7 @@ import android.hardware.face.FaceManager import android.provider.Settings import com.android.keyguard.KeyguardUpdateMonitor import com.android.systemui.plugins.statusbar.StatusBarStateController +import com.android.systemui.statusbar.NotificationLockscreenUserManager import com.android.systemui.statusbar.StatusBarState import com.android.systemui.tuner.TunerService import javax.inject.Inject @@ -61,7 +62,8 @@ class KeyguardBypassController { @Inject constructor(context: Context, tunerService: TunerService, - statusBarStateController: StatusBarStateController) { + statusBarStateController: StatusBarStateController, + lockscreenUserManager: NotificationLockscreenUserManager) { unlockMethodCache = UnlockMethodCache.getInstance(context) this.statusBarStateController = statusBarStateController statusBarStateController.addCallback(object : StatusBarStateController.StateListener { @@ -88,6 +90,7 @@ class KeyguardBypassController { KeyguardUpdateMonitor.getCurrentUser()) != 0 } }, Settings.Secure.FACE_UNLOCK_DISMISSES_KEYGUARD) + lockscreenUserManager.addUserChangedListener { pendingUnlockType = null } } /** diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java index 7742023a23b85..4b5e1dd612908 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/NotificationPanelViewTest.java @@ -112,7 +112,8 @@ public class NotificationPanelViewTest extends SysuiTestCase { mDependency.injectMockDependency(ConfigurationController.class); mDependency.injectMockDependency(ZenModeController.class); KeyguardBypassController bypassController = new KeyguardBypassController(mContext, - mock(TunerService.class), mStatusBarStateController); + mock(TunerService.class), mStatusBarStateController, + mock(NotificationLockscreenUserManager.class)); NotificationWakeUpCoordinator coordinator = new NotificationWakeUpCoordinator(mContext, mock(HeadsUpManagerPhone.class),