From a88e7e7709b94734a1fb7e94a3958cc141738214 Mon Sep 17 00:00:00 2001 From: Daniel Chapin Date: Mon, 19 Dec 2022 21:41:06 +0000 Subject: [PATCH] Revert "[Bouncer] Do not send message if face auth..." This reverts commit 4dd99003610583b110496321fcf092ddd78f0531. Reason for revert: Droidfood blocking bug: 263067487 Change-Id: I5abc143b8f912c39e1224524d98d5c6621ac0d36 --- .../KeyguardAbsKeyInputViewController.java | 1 - .../keyguard/KeyguardInputViewController.java | 1 - .../ui/binder/KeyguardBouncerViewBinder.kt | 8 ++++++++ .../ui/viewmodel/KeyguardBouncerViewModel.kt | 6 ++++++ .../statusbar/KeyguardIndicationController.java | 3 +-- .../KeyguardAbsKeyInputViewControllerTest.java | 6 ------ .../KeyguardIndicationControllerTest.java | 16 ---------------- 7 files changed, 15 insertions(+), 26 deletions(-) diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java index baaef1983e9cf..7da27b1d68983 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardAbsKeyInputViewController.java @@ -103,7 +103,6 @@ public abstract class KeyguardAbsKeyInputViewController @Override public void reset() { - mMessageAreaController.setMessage("", false); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt index 3d5985c5c7aaf..f772b17a7fb6f 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/binder/KeyguardBouncerViewBinder.kt @@ -104,6 +104,14 @@ object KeyguardBouncerViewBinder { } } + launch { + viewModel.showWithFullExpansion.collect { model -> + hostViewController.resetSecurityContainer() + hostViewController.showPromptReason(model.promptReason) + hostViewController.onResume() + } + } + launch { viewModel.hide.collect { hostViewController.cancelDismissAction() diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt index 737c35d866c28..e5d4e4971baaf 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/ui/viewmodel/KeyguardBouncerViewModel.kt @@ -22,8 +22,10 @@ import com.android.systemui.keyguard.data.BouncerViewDelegate import com.android.systemui.keyguard.domain.interactor.PrimaryBouncerInteractor import com.android.systemui.keyguard.shared.model.BouncerShowMessageModel import com.android.systemui.keyguard.shared.model.KeyguardBouncerModel +import com.android.systemui.statusbar.phone.KeyguardBouncer.EXPANSION_VISIBLE import javax.inject.Inject import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.filter import kotlinx.coroutines.flow.map /** Models UI state for the lock screen bouncer; handles user input. */ @@ -42,6 +44,10 @@ constructor( /** Observe whether bouncer is showing. */ val show: Flow = interactor.show + /** Observe visible expansion when bouncer is showing. */ + val showWithFullExpansion: Flow = + interactor.show.filter { it.expansionAmount == EXPANSION_VISIBLE } + /** Observe whether bouncer is hiding. */ val hide: Flow = interactor.hide diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java index 2738221ed0cb5..0f27420e22b03 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/KeyguardIndicationController.java @@ -930,8 +930,7 @@ public class KeyguardIndicationController { if (mStatusBarKeyguardViewManager.isBouncerShowing()) { if (mStatusBarKeyguardViewManager.isShowingAlternateBouncer()) { return; // udfps affordance is highlighted, no need to show action to unlock - } else if (!mKeyguardUpdateMonitor.getIsFaceAuthenticated() - && mKeyguardUpdateMonitor.isFaceEnrolled()) { + } else if (mKeyguardUpdateMonitor.isFaceEnrolled()) { String message = mContext.getString(R.string.keyguard_retry); mStatusBarKeyguardViewManager.setKeyguardMessage(message, mInitialTextColorState); } diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java index fa9bab28d5d82..10595439200a3 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardAbsKeyInputViewControllerTest.java @@ -150,10 +150,4 @@ public class KeyguardAbsKeyInputViewControllerTest extends SysuiTestCase { getContext().getResources().getString(R.string.kg_prompt_reason_restart_password), false); } - - @Test - public void testReset() { - mKeyguardAbsKeyInputViewController.reset(); - verify(mKeyguardMessageAreaController).setMessage("", false); - } } diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java index 996f61909c45a..c280ec8c4ec81 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/KeyguardIndicationControllerTest.java @@ -660,7 +660,6 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { createController(); String message = mContext.getString(R.string.keyguard_retry); when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); - when(mKeyguardUpdateMonitor.getIsFaceAuthenticated()).thenReturn(false); when(mKeyguardUpdateMonitor.isFaceEnrolled()).thenReturn(true); mController.setVisible(true); @@ -670,21 +669,6 @@ public class KeyguardIndicationControllerTest extends SysuiTestCase { verify(mStatusBarKeyguardViewManager).setKeyguardMessage(eq(message), any()); } - @Test - public void transientIndication_swipeUpToRetry_faceAuthenticated() { - createController(); - String message = mContext.getString(R.string.keyguard_retry); - when(mStatusBarKeyguardViewManager.isBouncerShowing()).thenReturn(true); - when(mKeyguardUpdateMonitor.getIsFaceAuthenticated()).thenReturn(true); - when(mKeyguardUpdateMonitor.isFaceEnrolled()).thenReturn(true); - - mController.setVisible(true); - mController.getKeyguardCallback().onBiometricError(FACE_ERROR_TIMEOUT, - "A message", BiometricSourceType.FACE); - - verify(mStatusBarKeyguardViewManager, never()).setKeyguardMessage(eq(message), any()); - } - @Test public void faceErrorTimeout_whenFingerprintEnrolled_doesNotShowMessage() { createController();