Ensure that bouncer resume propagates a...
state change. When we are showing the sim puk, we want to hide and then show the bouncer so that it goes through the same code path as the regular bouncer. Otherwise, this view does not get properly asynchronously inflated. Additionally, move setvisible to the top of show collector. Before, we would inflate the view before setting visibility to show....this seems to cause a race condition when showing/hiding the bouncer. Bug: 269522372 Test: Open sim puk from sim pin Change-Id: I9e4bc66d61e10a8f1038b3f45268730e26d2ba31
This commit is contained in:
@@ -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<Float> = repository.panelExpansionAmount
|
||||
/** 0f = bouncer fully hidden. 1f = bouncer fully visible. */
|
||||
val bouncerExpansion: Flow<Float> =
|
||||
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
|
||||
|
||||
@@ -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
|
||||
)
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user