diff options
7 files changed, 33 insertions, 45 deletions
diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java index 2878df2fe03f..38a8cd39a078 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityCallback.java @@ -96,7 +96,7 @@ public interface KeyguardSecurityCallback { /** * Dismisses keyguard and go to unlocked state. */ - default void finish(boolean strongAuth, int targetUserId) { + default void finish(int targetUserId) { } /** diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 9f3908a4ab92..d90785dd266d 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -290,13 +290,11 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard * Authentication has happened and it's time to dismiss keyguard. This function * should clean up and inform KeyguardViewMediator. * - * @param fromPrimaryAuth whether the user has authenticated with primary auth like - * pattern, password or PIN but not by trust agents or fingerprint * @param targetUserId a user that needs to be the foreground user at the dismissal * completion. */ @Override - public void finish(boolean fromPrimaryAuth, int targetUserId) { + public void finish(int targetUserId) { // If there's a pending runnable because the user interacted with a widget // and we're leaving keyguard, then run it. boolean deferKeyguardDone = false; @@ -309,9 +307,9 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard } if (mViewMediatorCallback != null) { if (deferKeyguardDone) { - mViewMediatorCallback.keyguardDonePending(fromPrimaryAuth, targetUserId); + mViewMediatorCallback.keyguardDonePending(targetUserId); } else { - mViewMediatorCallback.keyguardDone(fromPrimaryAuth, targetUserId); + mViewMediatorCallback.keyguardDone(targetUserId); } } @@ -690,8 +688,8 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard /** * Dismiss keyguard due to a user unlock event. */ - public void finish(boolean primaryAuth, int currentUser) { - mKeyguardSecurityCallback.finish(primaryAuth, currentUser); + public void finish(int currentUser) { + mKeyguardSecurityCallback.finish(currentUser); } /** @@ -902,7 +900,7 @@ public class KeyguardSecurityContainerController extends ViewController<Keyguard mUiEventLogger.log(uiEvent, getSessionId()); } if (finish) { - mKeyguardSecurityCallback.finish(primaryAuth, targetUserId); + mKeyguardSecurityCallback.finish(targetUserId); } return finish; } diff --git a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java index 14ec27ae6739..8d49f08d2690 100644 --- a/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java +++ b/packages/SystemUI/src/com/android/keyguard/ViewMediatorCallback.java @@ -29,11 +29,9 @@ public interface ViewMediatorCallback { /** * Report that the keyguard is done. * - * @param primaryAuth whether the user has authenticated with primary authentication like - * pattern, password or PIN but not by trust agents or fingerprint * @param targetUserId a user that needs to be the foreground user at the completion. */ - void keyguardDone(boolean primaryAuth, int targetUserId); + void keyguardDone(int targetUserId); /** * Report that the keyguard is done drawing. @@ -47,13 +45,11 @@ public interface ViewMediatorCallback { void setNeedsInput(boolean needsInput); /** - * Report that the keyguard is dismissable, pending the next keyguardDone call. + * Report that the keyguard is dismissible, pending the next keyguardDone call. * - * @param primaryAuth whether the user has authenticated with primary authentication like - * pattern, password or PIN but not by trust agents or fingerprint * @param targetUserId a user that needs to be the foreground user at the completion. */ - void keyguardDonePending(boolean primaryAuth, int targetUserId); + void keyguardDonePending(int targetUserId); /** * Report when keyguard is actually gone diff --git a/packages/SystemUI/src/com/android/systemui/bouncer/ui/binder/KeyguardBouncerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/bouncer/ui/binder/KeyguardBouncerViewBinder.kt index 56f1cf661cda..e29d6bdf14ef 100644 --- a/packages/SystemUI/src/com/android/systemui/bouncer/ui/binder/KeyguardBouncerViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/bouncer/ui/binder/KeyguardBouncerViewBinder.kt @@ -221,7 +221,6 @@ object KeyguardBouncerViewBinder { launch { viewModel.keyguardAuthenticated.collect { securityContainerController.finish( - it, KeyguardUpdateMonitor.getCurrentUser() ) viewModel.notifyKeyguardAuthenticated() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index fd15853a5a50..07c65a96977e 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -181,6 +181,7 @@ import java.util.concurrent.Executor; import java.util.function.Consumer; import dagger.Lazy; + import kotlinx.coroutines.CoroutineDispatcher; /** @@ -775,7 +776,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } @Override - public void keyguardDone(boolean primaryAuth, int targetUserId) { + public void keyguardDone(int targetUserId) { if (targetUserId != KeyguardUpdateMonitor.getCurrentUser()) { return; } @@ -796,7 +797,7 @@ public class KeyguardViewMediator implements CoreStartable, Dumpable, } @Override - public void keyguardDonePending(boolean primaryAuth, int targetUserId) { + public void keyguardDonePending(int targetUserId) { Trace.beginSection("KeyguardViewMediator.mViewMediatorCallback#keyguardDonePending"); if (DEBUG) Log.d(TAG, "keyguardDonePending"); if (targetUserId != KeyguardUpdateMonitor.getCurrentUser()) { diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt index dff058c49188..80172a10062a 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.kt @@ -83,7 +83,6 @@ import org.junit.Test import org.junit.runner.RunWith import org.mockito.ArgumentCaptor import org.mockito.ArgumentMatcher -import org.mockito.ArgumentMatchers.anyBoolean import org.mockito.ArgumentMatchers.anyInt import org.mockito.ArgumentMatchers.eq import org.mockito.Captor @@ -442,8 +441,8 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { ) // THEN the next security method of PIN is set, and the keyguard is not marked as done - verify(viewMediatorCallback, never()).keyguardDonePending(anyBoolean(), anyInt()) - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDonePending(anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) Truth.assertThat(underTest.currentSecurityMode).isEqualTo(SecurityMode.PIN) } @@ -467,7 +466,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { ) // THEN the next security method of None will dismiss keyguard. - verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback).keyguardDone(anyInt()) } @Test @@ -510,7 +509,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { ) // THEN the next security method of None will dismiss keyguard. - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) } @Test fun showNextSecurityScreenOrFinish_SimPin_Swipe_userNotSetup() { @@ -534,7 +533,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { ) // THEN the next security method of None will dismiss keyguard. - verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback).keyguardDone(anyInt()) } @Test @@ -679,7 +678,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { val action: OnDismissAction = mock() whenever(action.willRunAnimationOnKeyguard()).thenReturn(true) underTest.setOnDismissAction(action, null /* cancelAction */) - underTest.finish(false /* strongAuth */, 0 /* currentUser */) + underTest.finish(0 /* currentUser */) Truth.assertThat(underTest.willRunDismissFromKeyguard()).isTrue() } @@ -688,14 +687,14 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { val action: OnDismissAction = mock() whenever(action.willRunAnimationOnKeyguard()).thenReturn(false) underTest.setOnDismissAction(action, null /* cancelAction */) - underTest.finish(false /* strongAuth */, 0 /* currentUser */) + underTest.finish(0 /* currentUser */) Truth.assertThat(underTest.willRunDismissFromKeyguard()).isFalse() } @Test fun willRunDismissFromKeyguardIsFalseWhenNoDismissActionSet() { underTest.setOnDismissAction(null /* action */, null /* cancelAction */) - underTest.finish(false /* strongAuth */, 0 /* currentUser */) + underTest.finish(0 /* currentUser */) Truth.assertThat(underTest.willRunDismissFromKeyguard()).isFalse() } @@ -806,7 +805,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { // Upon init, we have never dismisses the keyguard. underTest.onInit() runCurrent() - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) // Once the view is attached, we start listening but simply going to the bouncer scene // is @@ -823,7 +822,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { sceneInteractor.onSceneChanged(SceneModel(SceneKey.Bouncer, null), "reason") sceneTransitionStateFlow.value = ObservableTransitionState.Idle(SceneKey.Bouncer) runCurrent() - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) // While listening, going from the bouncer scene to the gone scene, does dismiss the // keyguard. @@ -834,7 +833,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { sceneInteractor.onSceneChanged(SceneModel(SceneKey.Gone, null), "reason") sceneTransitionStateFlow.value = ObservableTransitionState.Idle(SceneKey.Gone) runCurrent() - verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback).keyguardDone(anyInt()) // While listening, moving back to the bouncer scene does not dismiss the keyguard // again. @@ -846,7 +845,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { sceneInteractor.onSceneChanged(SceneModel(SceneKey.Bouncer, null), "reason") sceneTransitionStateFlow.value = ObservableTransitionState.Idle(SceneKey.Bouncer) runCurrent() - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) // Detaching the view stops listening, so moving from the bouncer scene to the gone // scene @@ -859,7 +858,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { sceneInteractor.onSceneChanged(SceneModel(SceneKey.Gone, null), "reason") sceneTransitionStateFlow.value = ObservableTransitionState.Idle(SceneKey.Gone) runCurrent() - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) // While not listening, moving to the lockscreen does not dismiss the keyguard. sceneInteractor.changeScene(SceneModel(SceneKey.Lockscreen, null), "reason") @@ -873,7 +872,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { sceneInteractor.onSceneChanged(SceneModel(SceneKey.Lockscreen, null), "reason") sceneTransitionStateFlow.value = ObservableTransitionState.Idle(SceneKey.Lockscreen) runCurrent() - verify(viewMediatorCallback, never()).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback, never()).keyguardDone(anyInt()) // Reattaching the view starts listening again so moving from the bouncer scene to the // gone scene now does dismiss the keyguard again, this time from lockscreen. @@ -889,7 +888,7 @@ class KeyguardSecurityContainerControllerTest : SysuiTestCase() { sceneInteractor.onSceneChanged(SceneModel(SceneKey.Gone, null), "reason") sceneTransitionStateFlow.value = ObservableTransitionState.Idle(SceneKey.Gone) runCurrent() - verify(viewMediatorCallback).keyguardDone(anyBoolean(), anyInt()) + verify(viewMediatorCallback).keyguardDone(anyInt()) } @Test diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java index 377c5c7d1b20..f0d55ca41589 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/KeyguardViewMediatorTest.java @@ -403,8 +403,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { mViewMediator.setKeyguardEnabled(false); TestableLooper.get(this).processAllMessages(); - mViewMediator.mViewMediatorCallback.keyguardDonePending(true, - mUpdateMonitor.getCurrentUser()); + mViewMediator.mViewMediatorCallback.keyguardDonePending(mUpdateMonitor.getCurrentUser()); mViewMediator.mViewMediatorCallback.readyForKeyguardDone(); final ArgumentCaptor<Runnable> animationRunnableCaptor = ArgumentCaptor.forClass(Runnable.class); @@ -694,8 +693,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { startMockKeyguardExitAnimation(); assertTrue(mViewMediator.isAnimatingBetweenKeyguardAndSurfaceBehind()); - mViewMediator.mViewMediatorCallback.keyguardDonePending(true, - mUpdateMonitor.getCurrentUser()); + mViewMediator.mViewMediatorCallback.keyguardDonePending(mUpdateMonitor.getCurrentUser()); mViewMediator.mViewMediatorCallback.readyForKeyguardDone(); TestableLooper.get(this).processAllMessages(); verify(mKeyguardUnlockAnimationController).notifyFinishedKeyguardExitAnimation(false); @@ -756,8 +754,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { // Verify keyguard told of authentication verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(anyBoolean()); - mViewMediator.mViewMediatorCallback.keyguardDonePending(true, - mUpdateMonitor.getCurrentUser()); + mViewMediator.mViewMediatorCallback.keyguardDonePending(mUpdateMonitor.getCurrentUser()); mViewMediator.mViewMediatorCallback.readyForKeyguardDone(); final ArgumentCaptor<Runnable> animationRunnableCaptor = ArgumentCaptor.forClass(Runnable.class); @@ -786,8 +783,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { // Verify keyguard told of authentication verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(anyBoolean()); clearInvocations(mStatusBarKeyguardViewManager); - mViewMediator.mViewMediatorCallback.keyguardDonePending(true, - mUpdateMonitor.getCurrentUser()); + mViewMediator.mViewMediatorCallback.keyguardDonePending(mUpdateMonitor.getCurrentUser()); mViewMediator.mViewMediatorCallback.readyForKeyguardDone(); final ArgumentCaptor<Runnable> animationRunnableCaptor = ArgumentCaptor.forClass(Runnable.class); @@ -817,8 +813,7 @@ public class KeyguardViewMediatorTest extends SysuiTestCase { // Verify keyguard told of authentication verify(mStatusBarKeyguardViewManager).notifyKeyguardAuthenticated(anyBoolean()); - mViewMediator.mViewMediatorCallback.keyguardDonePending(true, - mUpdateMonitor.getCurrentUser()); + mViewMediator.mViewMediatorCallback.keyguardDonePending(mUpdateMonitor.getCurrentUser()); mViewMediator.mViewMediatorCallback.readyForKeyguardDone(); final ArgumentCaptor<Runnable> animationRunnableCaptor = ArgumentCaptor.forClass(Runnable.class); |