diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java index 61394035d731b..77f6318738a79 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java @@ -206,6 +206,13 @@ public class KeyguardHostViewController extends ViewController mKeyguardSecurityContainerController.reset(); } + /** + * Reinflate the view flipper child view. + */ + public void reinflateViewFlipper() { + mKeyguardSecurityContainerController.reinflateViewFlipper(); + } + /** * Dismisses the keyguard by going to the next screen or making it gone. * @param targetUserId a user that needs to be the foreground user at the dismissal completion. @@ -232,23 +239,19 @@ public class KeyguardHostViewController extends ViewController /** * Starts the animation when the Keyguard gets shown. */ - public void appear(int statusBarHeight) { + public void appear() { // We might still be collapsed and the view didn't have time to layout yet or still // be small, let's wait on the predraw to do the animation in that case. - if (mView.getHeight() != 0 && mView.getHeight() != statusBarHeight) { - mKeyguardSecurityContainerController.startAppearAnimation(); - } else { - mView.getViewTreeObserver().addOnPreDrawListener( - new ViewTreeObserver.OnPreDrawListener() { - @Override - public boolean onPreDraw() { - mView.getViewTreeObserver().removeOnPreDrawListener(this); - mKeyguardSecurityContainerController.startAppearAnimation(); - return true; - } - }); - mView.requestLayout(); - } + mView.getViewTreeObserver().addOnPreDrawListener( + new ViewTreeObserver.OnPreDrawListener() { + @Override + public boolean onPreDraw() { + mView.getViewTreeObserver().removeOnPreDrawListener(this); + mKeyguardSecurityContainerController.startAppearAnimation(); + return true; + } + }); + mView.requestLayout(); } /** diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 9fcacce311d1b..5476a0c40bdaa 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -743,17 +743,20 @@ public class KeyguardSecurityContainerController extends ViewController hostViewController.showErrorMessage(errorMessage) } hostViewController.showPrimarySecurityScreen() - hostViewController.appear( - SystemBarUtils.getStatusBarHeight(view.context) - ) + hostViewController.appear() hostViewController.onResume() } } @@ -159,15 +158,6 @@ object KeyguardBouncerViewBinder { } } - launch { - viewModel.isBouncerVisible - .filter { !it } - .collect { - // Remove existing input for security reasons. - hostViewController.resetSecurityContainer() - } - } - launch { viewModel.keyguardPosition.collect { position -> hostViewController.updateKeyguardPosition(position) diff --git a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java index 075ef9df9664d..885920bbc2c3c 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java @@ -600,6 +600,14 @@ public class KeyguardSecurityContainerControllerTest extends SysuiTestCase { any(KeyguardSecurityCallback.class)); } + @Test + public void testReinflateViewFlipper() { + mKeyguardSecurityContainerController.reinflateViewFlipper(); + verify(mKeyguardSecurityViewFlipperController).clearViews(); + verify(mKeyguardSecurityViewFlipperController).getSecurityView(any(SecurityMode.class), + any(KeyguardSecurityCallback.class)); + } + private KeyguardSecurityContainer.SwipeListener getRegisteredSwipeListener() { mKeyguardSecurityContainerController.onViewAttached(); verify(mView).setSwipeListener(mSwipeListenerArgumentCaptor.capture());