diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java index 1051de358f98e..61394035d731b 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardHostViewController.java @@ -202,11 +202,8 @@ public class KeyguardHostViewController extends ViewController mKeyguardSecurityContainerController.onPause(); } - /** - * Reinflate the view flipper child view. - */ - public void reinflateViewFlipper() { - mKeyguardSecurityContainerController.reinflateViewFlipper(); + public void resetSecurityContainer() { + mKeyguardSecurityContainerController.reset(); } /** @@ -235,19 +232,23 @@ public class KeyguardHostViewController extends ViewController /** * Starts the animation when the Keyguard gets shown. */ - public void appear() { + public void appear(int statusBarHeight) { // 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. - mView.getViewTreeObserver().addOnPreDrawListener( - new ViewTreeObserver.OnPreDrawListener() { - @Override - public boolean onPreDraw() { - mView.getViewTreeObserver().removeOnPreDrawListener(this); - mKeyguardSecurityContainerController.startAppearAnimation(); - return true; - } - }); - mView.requestLayout(); + 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(); + } } /** diff --git a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java index 5476a0c40bdaa..9fcacce311d1b 100644 --- a/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java +++ b/packages/SystemUI/src/com/android/keyguard/KeyguardSecurityContainerController.java @@ -743,20 +743,17 @@ public class KeyguardSecurityContainerController extends ViewController hostViewController.showErrorMessage(errorMessage) } hostViewController.showPrimarySecurityScreen() - hostViewController.appear() + hostViewController.appear( + SystemBarUtils.getStatusBarHeight(view.context) + ) hostViewController.onResume() } } @@ -113,6 +114,7 @@ object KeyguardBouncerViewBinder { viewModel.hide.collect { hostViewController.cancelDismissAction() hostViewController.cleanUp() + hostViewController.resetSecurityContainer() } } @@ -157,6 +159,15 @@ 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 885920bbc2c3c..075ef9df9664d 100644 --- a/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java +++ b/packages/SystemUI/tests/src/com/android/keyguard/KeyguardSecurityContainerControllerTest.java @@ -600,14 +600,6 @@ 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());