From 07ad841e2d0133b39e65eb0395431e0be68779e3 Mon Sep 17 00:00:00 2001 From: Joshua Duong Date: Wed, 1 Apr 2020 13:52:17 -0700 Subject: [PATCH] [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 --- res/layout/adb_qrcode_scanner_fragment.xml | 4 +++- .../settings/development/AdbQrcodeScannerFragment.java | 4 ++++ src/com/android/settings/wifi/dpp/AdbQrCode.java | 10 ++++++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/res/layout/adb_qrcode_scanner_fragment.xml b/res/layout/adb_qrcode_scanner_fragment.xml index 975256d18aa..f37c9a6ff4c 100644 --- a/res/layout/adb_qrcode_scanner_fragment.xml +++ b/res/layout/adb_qrcode_scanner_fragment.xml @@ -99,10 +99,12 @@ android:layout_height="wrap_content"/> + android:text="@string/adb_wireless_verifying_qrcode_text" + android:accessibilityLiveRegion="polite"/> diff --git a/src/com/android/settings/development/AdbQrcodeScannerFragment.java b/src/com/android/settings/development/AdbQrcodeScannerFragment.java index 0a02c954289..7a30443bca4 100644 --- a/src/com/android/settings/development/AdbQrcodeScannerFragment.java +++ b/src/com/android/settings/development/AdbQrcodeScannerFragment.java @@ -73,6 +73,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen private QrDecorateView mDecorateView; private View mQrCameraView; private View mVerifyingView; + private TextView mVerifyingTextView; private TextView mErrorMessage; /** QR code data scanned by camera */ @@ -168,6 +169,7 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen mQrCameraView = view.findViewById(R.id.camera_layout); mVerifyingView = view.findViewById(R.id.verifying_layout); + mVerifyingTextView = view.findViewById(R.id.verifying_textview); setHeaderTitle(R.string.wifi_dpp_scan_qr_code); mSummary.setText(R.string.adb_wireless_qrcode_pairing_description); @@ -273,6 +275,8 @@ public class AdbQrcodeScannerFragment extends WifiDppQrCodeBaseFragment implemen mDecorateView.setFocused(true); mQrCameraView.setVisibility(View.GONE); mVerifyingView.setVisibility(View.VISIBLE); + AdbQrCode.triggerVibrationForQrCodeRecognition(getContext()); + mVerifyingTextView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED); try { mAdbManager.enablePairingByQrCode(mAdbConfig.getSsid(), mAdbConfig.getPreSharedKey()); diff --git a/src/com/android/settings/wifi/dpp/AdbQrCode.java b/src/com/android/settings/wifi/dpp/AdbQrCode.java index fb63e0a5384..65577874e20 100644 --- a/src/com/android/settings/wifi/dpp/AdbQrCode.java +++ b/src/com/android/settings/wifi/dpp/AdbQrCode.java @@ -15,6 +15,7 @@ */ package com.android.settings.wifi.dpp; +import android.content.Context; import android.text.TextUtils; /** @@ -53,4 +54,13 @@ public class AdbQrCode extends WifiQrCode { public WifiNetworkConfig getAdbNetworkConfig() { 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); + } }