Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09ca6e50 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

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
parent a614cef7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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;
+9 −0
Original line number Diff line number Diff line
@@ -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;