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

Commit eca419fe authored by Joe Bolinger's avatar Joe Bolinger
Browse files

Prevent talkback from annoucing the "System UI" container when BiometricPrompt is activated.

Fix: 187344988
Test: manual (talkback with integration test app annouces title)

Change-Id: I6ca61a61a5db0137115872cad57e374f0b31a1c5
parent a0ecdaaf
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -596,10 +596,6 @@ public abstract class AuthBiometricView extends LinearLayout {
        Utils.notifyAccessibilityContentChanged(mAccessibilityManager, this);
    }

    private void setText(TextView view, CharSequence charSequence) {
        view.setText(charSequence);
    }

    // Remove all pending icon and text animations
    private void removePendingAnimations() {
        mHandler.removeCallbacks(mResetHelpRunnable);
@@ -688,7 +684,7 @@ public abstract class AuthBiometricView extends LinearLayout {
     */
    @VisibleForTesting
    void onAttachedToWindowInternal() {
        setText(mTitleView, mPromptInfo.getTitle());
        mTitleView.setText(mPromptInfo.getTitle());

        if (isDeviceCredentialAllowed()) {
            final CharSequence credentialButtonText;
@@ -718,7 +714,7 @@ public abstract class AuthBiometricView extends LinearLayout {
            mUseCredentialButton.setText(credentialButtonText);
            mUseCredentialButton.setVisibility(View.VISIBLE);
        } else {
            setText(mNegativeButton, mPromptInfo.getNegativeButtonText());
            mNegativeButton.setText(mPromptInfo.getNegativeButtonText());
        }

        setTextOrHide(mSubtitleView, mPromptInfo.getSubtitle());
+5 −6
Original line number Diff line number Diff line
@@ -575,7 +575,7 @@ public class AuthContainerView extends LinearLayout
        if (mBiometricView != null) {
            mBiometricView.restoreState(savedState);
        }
        wm.addView(this, getLayoutParams(mWindowToken));
        wm.addView(this, getLayoutParams(mWindowToken, mConfig.mPromptInfo.getTitle()));
    }

    @Override
@@ -728,11 +728,9 @@ public class AuthContainerView extends LinearLayout
        }
    }

    /**
     * @param windowToken token for the window
     * @return
     */
    public static WindowManager.LayoutParams getLayoutParams(IBinder windowToken) {
    @VisibleForTesting
    static WindowManager.LayoutParams getLayoutParams(IBinder windowToken,
            CharSequence title) {
        final int windowFlags = WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED
                | WindowManager.LayoutParams.FLAG_SECURE;
        final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
@@ -744,6 +742,7 @@ public class AuthContainerView extends LinearLayout
        lp.privateFlags |= WindowManager.LayoutParams.SYSTEM_FLAG_SHOW_FOR_ALL_USERS;
        lp.setFitInsetsTypes(lp.getFitInsetsTypes() & ~WindowInsets.Type.ime());
        lp.setTitle("BiometricPrompt");
        lp.accessibilityTitle = title;
        lp.token = windowToken;
        return lp;
    }
+2 −2
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ public class AuthContainerViewTest extends SysuiTestCase {
    public void testLayoutParams_hasSecureWindowFlag() {
        final IBinder windowToken = mock(IBinder.class);
        final WindowManager.LayoutParams layoutParams =
                AuthContainerView.getLayoutParams(windowToken);
                AuthContainerView.getLayoutParams(windowToken, "");
        assertTrue((layoutParams.flags & WindowManager.LayoutParams.FLAG_SECURE) != 0);
    }

@@ -232,7 +232,7 @@ public class AuthContainerViewTest extends SysuiTestCase {
    public void testLayoutParams_excludesImeInsets() {
        final IBinder windowToken = mock(IBinder.class);
        final WindowManager.LayoutParams layoutParams =
                AuthContainerView.getLayoutParams(windowToken);
                AuthContainerView.getLayoutParams(windowToken, "");
        assertTrue((layoutParams.getFitInsetsTypes() & WindowInsets.Type.ime()) == 0);
    }