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

Commit 8ab1de68 authored by Kevin Chyn's avatar Kevin Chyn
Browse files

Fix several accessibility issues with BiometricPrompt

1) Ensure spaces can be tapped/double-tapped with talkback enabled
2) Do not explicitly set focus
3) Give empty spaces content description for talkback

Fixes: 132376836
Fixes: 132378618

Test: Enabled talkback, the above are fixed
Change-Id: Ic923ba8aed4922e852a8b82b6120644ca627d651
parent bb081124
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -37,7 +37,8 @@
            android:id="@+id/space"
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1" />
            android:layout_weight="1"
            android:contentDescription="@string/biometric_dialog_empty_space_description"/>

        <ScrollView
            android:layout_width="match_parent"
+3 −1
Original line number Diff line number Diff line
@@ -288,8 +288,10 @@

    <!-- Message shown when a biometric is authenticated, asking the user to confirm authentication [CHAR LIMIT=30] -->
    <string name="biometric_dialog_confirm">Confirm</string>
    <!-- Button name on BiometricPrompt shown when a biometric is detected but not authenticated. Tapping the button resumes authentication [CHAR_LIMIT=30] -->
    <!-- Button name on BiometricPrompt shown when a biometric is detected but not authenticated. Tapping the button resumes authentication [CHAR LIMIT=30] -->
    <string name="biometric_dialog_try_again">Try again</string>
    <!-- Content description for empty spaces that are not taken by the biometric dialog. Clicking on these areas will cancel authentication and dismiss the biometric dialog [CHAR LIMIT=NONE] -->
    <string name="biometric_dialog_empty_space_description">Empty region, tap to cancel authentication</string>

    <!-- Message shown when the system-provided fingerprint dialog is shown, asking for authentication -->
    <string name="fingerprint_dialog_touch_sensor">Touch the fingerprint sensor</string>
+1 −7
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ import android.util.DisplayMetrics;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
@@ -228,9 +227,6 @@ public abstract class BiometricDialogView extends LinearLayout {
            showTryAgainButton(false /* show */);
            mCallback.onTryAgainPressed();
        });

        mLayout.setFocusableInTouchMode(true);
        mLayout.requestFocus();
    }

    public void onSaveState(Bundle bundle) {
@@ -278,7 +274,6 @@ public abstract class BiometricDialogView extends LinearLayout {

        mTitleText.setVisibility(View.VISIBLE);
        mTitleText.setText(titleText);
        mTitleText.setSelected(true);

        final CharSequence subtitleText = mBundle.getCharSequence(BiometricPrompt.KEY_SUBTITLE);
        if (TextUtils.isEmpty(subtitleText)) {
@@ -323,11 +318,10 @@ public abstract class BiometricDialogView extends LinearLayout {

    private void setDismissesDialog(View v) {
        v.setClickable(true);
        v.setOnTouchListener((View view, MotionEvent event) -> {
        v.setOnClickListener(v1 -> {
            if (mState != STATE_AUTHENTICATED && shouldGrayAreaDismissDialog()) {
                mCallback.onUserCanceled();
            }
            return true;
        });
    }