[RRS] Send event to AccessibilityManager when an unselect radio button is selected.
Change the screen resolution will cause re-layout the screen, so the focus will back to the first view. Before we actually set the screen resolution, send an event to the AccessibilityManager and set what it should say when the user selects the unselect option. Therefore TB will say "selected" before the screen refreshes. bug: 229352892 Test: Enable/disable Talkback and check RRS app behaivor. It should read "selected" after user choose one un-selected option. Change-Id: If14ed3685f85962d4e4b1d4961216c6ca5d5f0f8
This commit is contained in:
@@ -2983,6 +2983,8 @@
|
||||
<string name="screen_resolution_summary_highest">1440p QHD+</string>
|
||||
<!-- The footer message for switch screen resolution [CHAR LIMIT=NONE] -->
|
||||
<string name="screen_resolution_footer">Full resolution uses more of your battery. Switching your resolution may cause some apps to restart.</string>
|
||||
<!-- Message announced to a11y users when they selected one resolution [CHAR LIMIT=NONE] -->
|
||||
<string name="screen_resolution_selected_a11y">Selected</string>
|
||||
|
||||
<!-- Display settings screen, Color mode settings title [CHAR LIMIT=30] -->
|
||||
<string name="color_mode_title">Colors</string>
|
||||
|
@@ -29,6 +29,8 @@ import android.hardware.display.DisplayManager;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.view.Display;
|
||||
import android.view.accessibility.AccessibilityEvent;
|
||||
import android.view.accessibility.AccessibilityManager;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.preference.PreferenceScreen;
|
||||
@@ -65,6 +67,7 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
|
||||
|
||||
private IllustrationPreference mImagePreference;
|
||||
private DisplayObserver mDisplayObserver;
|
||||
private AccessibilityManager mAccessibilityManager;
|
||||
|
||||
@Override
|
||||
public void onAttach(Context context) {
|
||||
@@ -72,6 +75,7 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
|
||||
|
||||
mDefaultDisplay =
|
||||
context.getSystemService(DisplayManager.class).getDisplay(Display.DEFAULT_DISPLAY);
|
||||
mAccessibilityManager = context.getSystemService(AccessibilityManager.class);
|
||||
mResources = context.getResources();
|
||||
mScreenResolutionOptions =
|
||||
mResources.getStringArray(R.array.config_screen_resolution_options_strings);
|
||||
@@ -215,6 +219,14 @@ public class ScreenResolutionFragment extends RadioButtonPickerFragment {
|
||||
if (!mDisplayObserver.setPendingResolutionChange(selectedWidth)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAccessibilityManager.isEnabled()) {
|
||||
AccessibilityEvent event = AccessibilityEvent.obtain();
|
||||
event.setEventType(AccessibilityEvent.TYPE_ANNOUNCEMENT);
|
||||
event.getText().add(mResources.getString(R.string.screen_resolution_selected_a11y));
|
||||
mAccessibilityManager.sendAccessibilityEvent(event);
|
||||
}
|
||||
|
||||
super.onRadioButtonClicked(selected);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user