Merge "[RRS] Send event to AccessibilityManager when an unselect radio button is selected." into tm-d1-dev am: c799cb11f5
am: d434100421
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/19893206 Change-Id: I589ef3fb4fc332af6e5f6b655b97a63ba18d8c67 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -3128,6 +3128,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