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

Commit 2a859249 authored by Joshua Duong's avatar Joshua Duong
Browse files

[a11y] Set focus on "Pairing device" text once QR code is scanned.

Bug: 152462657

Test: Manual. Enable TalkBack in Settings > Accessibility. Navigate to
Developer options > Wireless debugging > Pairing device with QR code.
Scan a valid QR code, which should change to "Pairing device..." and
screen reader should say "Pairing device".

Change-Id: If467b56f787bda765fce1e5d46f8ab3c6210dc76
(cherry picked from commit 07ad841e)
Exempt-From-Owner-Approval: cherry-pick
parent 7c4557be
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -99,10 +99,12 @@
                android:layout_height="wrap_content"/>
                android:layout_height="wrap_content"/>


            <TextView
            <TextView
                android:id="@+id/verifying_textview"
                android:layout_width="wrap_content"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_height="wrap_content"
                style="@style/adb_wireless_item_progress_text"
                style="@style/adb_wireless_item_progress_text"
                android:text="@string/adb_wireless_verifying_qrcode_text"/>
                android:text="@string/adb_wireless_verifying_qrcode_text"
                android:accessibilityLiveRegion="polite"/>


        </LinearLayout>
        </LinearLayout>


+4 −0
Original line number Original line Diff line number Diff line
@@ -73,6 +73,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
    private QrDecorateView mDecorateView;
    private QrDecorateView mDecorateView;
    private View mQrCameraView;
    private View mQrCameraView;
    private View mVerifyingView;
    private View mVerifyingView;
    private TextView mVerifyingTextView;
    private TextView mErrorMessage;
    private TextView mErrorMessage;


    /** QR code data scanned by camera */
    /** QR code data scanned by camera */
@@ -168,6 +169,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen


        mQrCameraView = view.findViewById(R.id.camera_layout);
        mQrCameraView = view.findViewById(R.id.camera_layout);
        mVerifyingView = view.findViewById(R.id.verifying_layout);
        mVerifyingView = view.findViewById(R.id.verifying_layout);
        mVerifyingTextView = view.findViewById(R.id.verifying_textview);


        setHeaderTitle(R.string.wifi_dpp_scan_qr_code);
        setHeaderTitle(R.string.wifi_dpp_scan_qr_code);
        mSummary.setText(R.string.adb_wireless_qrcode_pairing_description);
        mSummary.setText(R.string.adb_wireless_qrcode_pairing_description);
@@ -264,6 +266,8 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen
        mDecorateView.setFocused(true);
        mDecorateView.setFocused(true);
        mQrCameraView.setVisibility(View.GONE);
        mQrCameraView.setVisibility(View.GONE);
        mVerifyingView.setVisibility(View.VISIBLE);
        mVerifyingView.setVisibility(View.VISIBLE);
        AdbQrCode.triggerVibrationForQrCodeRecognition(getContext());
        mVerifyingTextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
        try {
        try {
            mAdbManager.enablePairingByQrCode(mAdbConfig.getSsid(),
            mAdbManager.enablePairingByQrCode(mAdbConfig.getSsid(),
                    mAdbConfig.getPreSharedKey());
                    mAdbConfig.getPreSharedKey());
+10 −0
Original line number Original line Diff line number Diff line
@@ -15,6 +15,7 @@
 */
 */
package com.android.settings.wifi.dpp;
package com.android.settings.wifi.dpp;


import android.content.Context;
import android.text.TextUtils;
import android.text.TextUtils;


/**
/**
@@ -53,4 +54,13 @@ public class AdbQrCode extends WifiQrCode {
    public WifiNetworkConfig getAdbNetworkConfig() {
    public WifiNetworkConfig getAdbNetworkConfig() {
        return mAdbConfig;
        return mAdbConfig;
    }
    }

    /**
     * Triggers a vibration to notify of a valid QR code.
     *
     * @param context The context to use
     */
    public static void triggerVibrationForQrCodeRecognition(Context context) {
        WifiDppUtils.triggerVibrationForQrCodeRecognition(context);
    }
}
}