diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt index 77541e931e08a..58f6f1e57c94d 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt +++ b/packages/SystemUI/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractor.kt @@ -21,8 +21,6 @@ import android.content.res.ColorStateList import android.hardware.biometrics.BiometricSourceType import android.os.Handler import android.os.Trace -import android.os.UserHandle -import android.os.UserManager import android.util.Log import android.view.View import com.android.keyguard.KeyguardConstants @@ -106,10 +104,9 @@ constructor( val panelExpansionAmount: Flow = repository.panelExpansionAmount /** 0f = bouncer fully hidden. 1f = bouncer fully visible. */ val bouncerExpansion: Flow = - combine( - repository.panelExpansionAmount, - repository.primaryBouncerShow - ) { panelExpansion, primaryBouncerIsShowing -> + combine(repository.panelExpansionAmount, repository.primaryBouncerShow) { + panelExpansion, + primaryBouncerIsShowing -> if (primaryBouncerIsShowing) { 1f - panelExpansion } else { @@ -152,22 +149,18 @@ constructor( (isBouncerShowing() || repository.primaryBouncerShowingSoon.value) && needsFullscreenBouncer() - if (!resumeBouncer && isBouncerShowing()) { - // If bouncer is visible, the bouncer is already showing. - return - } - Trace.beginSection("KeyguardBouncer#show") repository.setPrimaryScrimmed(isScrimmed) if (isScrimmed) { setPanelExpansion(KeyguardBouncerConstants.EXPANSION_VISIBLE) } + // In this special case, we want to hide the bouncer and show it again. We want to emit + // show(true) again so that we can reinflate the new view. if (resumeBouncer) { - primaryBouncerView.delegate?.resume() - // Bouncer is showing the next security screen and we just need to prompt a resume. - return + repository.setPrimaryShow(false) } + if (primaryBouncerView.delegate?.showNextSecurityScreenOrFinish() == true) { // Keyguard is done. return 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 468a6b52c5e5e..0b2f02a3c73ac 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 @@ -112,9 +112,9 @@ object KeyguardBouncerViewBinder { viewModel.isShowing.collect { isShowing -> if (isShowing) { // Reset Security Container entirely. + view.visibility = View.VISIBLE securityContainerController.reinflateViewFlipper { // Reset Security Container entirely. - view.visibility = View.VISIBLE securityContainerController.onBouncerVisibilityChanged( /* isVisible= */ true ) diff --git a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt index bdc33f45c7175..3ac4c978ba3a1 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt +++ b/packages/SystemUI/tests/src/com/android/systemui/keyguard/domain/interactor/PrimaryBouncerInteractorTest.kt @@ -48,6 +48,7 @@ import org.junit.runner.RunWith import org.mockito.Answers import org.mockito.ArgumentCaptor import org.mockito.Mock +import org.mockito.Mockito.anyInt import org.mockito.Mockito.mock import org.mockito.Mockito.never import org.mockito.Mockito.verify @@ -123,6 +124,17 @@ class PrimaryBouncerInteractorTest : SysuiTestCase() { verify(mPrimaryBouncerCallbackInteractor, never()).dispatchStartingToShow() } + @Test + fun testShow_isResumed() { + whenever(repository.primaryBouncerShow.value).thenReturn(true) + whenever(keyguardSecurityModel.getSecurityMode(anyInt())) + .thenReturn(KeyguardSecurityModel.SecurityMode.SimPuk) + + underTest.show(true) + verify(repository).setPrimaryShow(false) + verify(repository).setPrimaryShow(true) + } + @Test fun testHide() { underTest.hide()