From 09ca6e50d099d1b6aa5aa57023a8c41cf792b222 Mon Sep 17 00:00:00 2001 From: Kevin Chyn Date: Fri, 5 Jun 2020 12:35:04 -0700 Subject: Exclude WindowInsets.Type.ime() from credential UI Prevent the credential UI from resizing when the IME appears or disappeares. Fixes the issue where the window behind us is briefly shown behind the IME area, before the IME is fully animated in. Fixes: 157910732 Test: atest com.android.systemui.biometrics Test: 1) Set up work profile, set up separate challenge (password) 2) Open work profile app, close app, lock screen 3) Open work profile app, go to credential UI, toggle IME multiple times. Window behind (launcher) is not seen Change-Id: Id5b9a43fb76a63063abe64c578d7fa3492be4bdd --- .../src/com/android/systemui/biometrics/AuthContainerView.java | 2 ++ .../com/android/systemui/biometrics/AuthContainerViewTest.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java index 1dd6409b8582..dbe5a77965be 100644 --- a/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java +++ b/packages/SystemUI/src/com/android/systemui/biometrics/AuthContainerView.java @@ -34,6 +34,7 @@ import android.view.KeyEvent; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.WindowInsets; import android.view.WindowManager; import android.view.animation.Interpolator; import android.widget.FrameLayout; @@ -632,6 +633,7 @@ public class AuthContainerView extends LinearLayout windowFlags, PixelFormat.TRANSLUCENT); lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS; + lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~WindowInsets.Type.ime()); lp.setTitle("BiometricPrompt"); lp.token = windowToken; return lp; diff --git a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java index 74d0610ee0d6..29d7a524dd8b 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/biometrics/AuthContainerViewTest.java @@ -45,6 +45,7 @@ import android.testing.TestableLooper.RunWithLooper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.view.WindowInsets; import android.view.WindowManager; import android.widget.FrameLayout; import android.widget.ImageView; @@ -210,6 +211,14 @@ public class AuthContainerViewTest extends SysuiTestCase { assertTrue((layoutParams.flags & WindowManager.LayoutParams.FLAG_SECURE) != 0); } + @Test + public void testLayoutParams_excludesImeInsets() { + final IBinder windowToken = mock(IBinder.class); + final WindowManager.LayoutParams layoutParams = + AuthContainerView.getLayoutParams(windowToken); + assertTrue((layoutParams.getFitInsetsTypes() & WindowInsets.Type.ime()) == 0); + } + private void initializeContainer(int authenticators) { AuthContainerView.Config config = new AuthContainerView.Config(); config.mContext = mContext; -- cgit v1.2.3-59-g8ed1b