From 10fb7116bdfa70528ba2fb1bebd45de3858bf949 Mon Sep 17 00:00:00 2001 From: Beverly Date: Fri, 17 Mar 2023 15:13:28 +0000 Subject: [PATCH] ActiveUnlock dismisses keyguard on trigger from assistant The Assistant visibility doesn't change until the assistant is attempting to address a query that requires auth. In this case, without ActiveUnlock, the bouncer would show for the user to proceed, and if the user enters their pin/patttern/password or biometric success, then the user is brought to the secure assistant activity over the home screen (keyguard is dismissed). To align with this CUJ, also make ActiveUnlock dismiss the keyguard on successfull auth from a AU request coming from the assistant visible signal. Test: without biometrics enrolled, launch the assistant with a query that requires auth to trigger active unlock. When active unlock is triggered, the device will proceed to enter the device (dismiss keyguard). Test: atest KeyguardUpdateMonitorTest Fixes: 269207635 Change-Id: Ic4f41b0705fb680691f7a3472853e76778cb9dfa --- .../keyguard/KeyguardUpdateMonitor.java | 2 +- .../keyguard/KeyguardUpdateMonitorTest.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java index 1ccde322628af..0f709fc4f81de 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardUpdateMonitor.java @@ -1601,7 +1601,7 @@ public class KeyguardUpdateMonitor implements TrustManager.TrustListener, Dumpab requestActiveUnlock( ActiveUnlockConfig.ActiveUnlockRequestOrigin.ASSISTANT, "assistant", - false); + /* dismissKeyguard */ true); } } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java index 4c92eddd66fb0..a2628cc1060c1 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardUpdateMonitorTest.java @@ -2244,6 +2244,26 @@ public class KeyguardUpdateMonitorTest extends SysuiTestCase { assertThat(mKeyguardUpdateMonitor.shouldListenForFace()).isFalse(); } + @Test + public void assistantVisible_requestActiveUnlock() { + // GIVEN active unlock requests from the assistant are allowed + when(mActiveUnlockConfig.shouldAllowActiveUnlockFromOrigin( + ActiveUnlockConfig.ActiveUnlockRequestOrigin.ASSISTANT)).thenReturn(true); + + // GIVEN should trigger active unlock + keyguardIsVisible(); + keyguardNotGoingAway(); + statusBarShadeIsNotLocked(); + when(mLockPatternUtils.isSecure(KeyguardUpdateMonitor.getCurrentUser())).thenReturn(true); + + // WHEN the assistant is visible + mKeyguardUpdateMonitor.setAssistantVisible(true); + + // THEN request unlock with keyguard dismissal + verify(mTrustManager).reportUserRequestedUnlock(eq(KeyguardUpdateMonitor.getCurrentUser()), + eq(true)); + } + @Test public void fingerprintFailure_requestActiveUnlock_dismissKeyguard() throws RemoteException {