Merge changes from topic "a11y_rbc"
* changes: Add Reduce Bright Colors page to settings_enum.proto Use inclusive language Add infrastructure for supporting Reduce Bright Colors as an A11y shortcut
This commit is contained in:
@@ -80,6 +80,8 @@ public class AccessibilityShortcutController {
|
||||
"com.android.server.accessibility.MagnificationController";
|
||||
public static final ComponentName MAGNIFICATION_COMPONENT_NAME =
|
||||
new ComponentName("com.android.server.accessibility", "Magnification");
|
||||
public static final ComponentName REDUCE_BRIGHT_COLORS_COMPONENT_NAME =
|
||||
new ComponentName("com.android.server.accessibility", "ReduceBrightColors");
|
||||
|
||||
private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
|
||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
||||
@@ -126,6 +128,11 @@ public class AccessibilityShortcutController {
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED,
|
||||
"1" /* Value to enable */, "0" /* Value to disable */,
|
||||
R.string.color_correction_feature_name));
|
||||
featuresMap.put(REDUCE_BRIGHT_COLORS_COMPONENT_NAME,
|
||||
new ToggleableFrameworkFeatureInfo(
|
||||
Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED,
|
||||
"1" /* Value to enable */, "0" /* Value to disable */,
|
||||
R.string.reduce_bright_colors_feature_name));
|
||||
sFrameworkShortcutFeaturesMap = Collections.unmodifiableMap(featuresMap);
|
||||
}
|
||||
return sFrameworkShortcutFeaturesMap;
|
||||
|
||||
@@ -21,6 +21,7 @@ import static android.view.accessibility.AccessibilityManager.ACCESSIBILITY_BUTT
|
||||
import static com.android.internal.accessibility.AccessibilityShortcutController.COLOR_INVERSION_COMPONENT_NAME;
|
||||
import static com.android.internal.accessibility.AccessibilityShortcutController.DALTONIZER_COMPONENT_NAME;
|
||||
import static com.android.internal.accessibility.AccessibilityShortcutController.MAGNIFICATION_CONTROLLER_NAME;
|
||||
import static com.android.internal.accessibility.AccessibilityShortcutController.REDUCE_BRIGHT_COLORS_COMPONENT_NAME;
|
||||
import static com.android.internal.accessibility.util.AccessibilityUtils.getAccessibilityServiceFragmentType;
|
||||
import static com.android.internal.accessibility.util.ShortcutUtils.isShortcutContained;
|
||||
|
||||
@@ -112,7 +113,7 @@ public final class AccessibilityTargetHelper {
|
||||
@ShortcutType int shortcutType) {
|
||||
final List<AccessibilityTarget> targets = new ArrayList<>();
|
||||
targets.addAll(getAccessibilityFilteredTargets(context, shortcutType));
|
||||
targets.addAll(getWhiteListingFeatureTargets(context, shortcutType));
|
||||
targets.addAll(getAllowListingFeatureTargets(context, shortcutType));
|
||||
|
||||
return targets;
|
||||
}
|
||||
@@ -196,12 +197,12 @@ public final class AccessibilityTargetHelper {
|
||||
return targets;
|
||||
}
|
||||
|
||||
private static List<AccessibilityTarget> getWhiteListingFeatureTargets(Context context,
|
||||
private static List<AccessibilityTarget> getAllowListingFeatureTargets(Context context,
|
||||
@ShortcutType int shortcutType) {
|
||||
final List<AccessibilityTarget> targets = new ArrayList<>();
|
||||
|
||||
final InvisibleToggleWhiteListingFeatureTarget magnification =
|
||||
new InvisibleToggleWhiteListingFeatureTarget(context,
|
||||
final InvisibleToggleAllowListingFeatureTarget magnification =
|
||||
new InvisibleToggleAllowListingFeatureTarget(context,
|
||||
shortcutType,
|
||||
isShortcutContained(context, shortcutType, MAGNIFICATION_CONTROLLER_NAME),
|
||||
MAGNIFICATION_CONTROLLER_NAME,
|
||||
@@ -209,8 +210,8 @@ public final class AccessibilityTargetHelper {
|
||||
context.getDrawable(R.drawable.ic_accessibility_magnification),
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED);
|
||||
|
||||
final ToggleWhiteListingFeatureTarget daltonizer =
|
||||
new ToggleWhiteListingFeatureTarget(context,
|
||||
final ToggleAllowListingFeatureTarget daltonizer =
|
||||
new ToggleAllowListingFeatureTarget(context,
|
||||
shortcutType,
|
||||
isShortcutContained(context, shortcutType,
|
||||
DALTONIZER_COMPONENT_NAME.flattenToString()),
|
||||
@@ -219,8 +220,8 @@ public final class AccessibilityTargetHelper {
|
||||
context.getDrawable(R.drawable.ic_accessibility_color_correction),
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED);
|
||||
|
||||
final ToggleWhiteListingFeatureTarget colorInversion =
|
||||
new ToggleWhiteListingFeatureTarget(context,
|
||||
final ToggleAllowListingFeatureTarget colorInversion =
|
||||
new ToggleAllowListingFeatureTarget(context,
|
||||
shortcutType,
|
||||
isShortcutContained(context, shortcutType,
|
||||
COLOR_INVERSION_COMPONENT_NAME.flattenToString()),
|
||||
@@ -229,9 +230,21 @@ public final class AccessibilityTargetHelper {
|
||||
context.getDrawable(R.drawable.ic_accessibility_color_inversion),
|
||||
Settings.Secure.ACCESSIBILITY_DISPLAY_INVERSION_ENABLED);
|
||||
|
||||
// TODO: Update with shortcut icon
|
||||
final ToggleAllowListingFeatureTarget reduceBrightColors =
|
||||
new ToggleAllowListingFeatureTarget(context,
|
||||
shortcutType,
|
||||
isShortcutContained(context, shortcutType,
|
||||
REDUCE_BRIGHT_COLORS_COMPONENT_NAME.flattenToString()),
|
||||
REDUCE_BRIGHT_COLORS_COMPONENT_NAME.flattenToString(),
|
||||
context.getString(R.string.reduce_bright_colors_feature_name),
|
||||
null,
|
||||
Settings.Secure.REDUCE_BRIGHT_COLORS_ACTIVATED);
|
||||
|
||||
targets.add(magnification);
|
||||
targets.add(daltonizer);
|
||||
targets.add(colorInversion);
|
||||
targets.add(reduceBrightColors);
|
||||
|
||||
return targets;
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ import com.android.internal.accessibility.common.ShortcutConstants.Accessibility
|
||||
* Extension for {@link AccessibilityTarget} with {@link AccessibilityFragmentType#INVISIBLE_TOGGLE}
|
||||
* type.
|
||||
*/
|
||||
class InvisibleToggleWhiteListingFeatureTarget extends AccessibilityTarget {
|
||||
class InvisibleToggleAllowListingFeatureTarget extends AccessibilityTarget {
|
||||
|
||||
InvisibleToggleWhiteListingFeatureTarget(Context context, @ShortcutType int shortcutType,
|
||||
InvisibleToggleAllowListingFeatureTarget(Context context, @ShortcutType int shortcutType,
|
||||
boolean isShortcutSwitched, String id, CharSequence label, Drawable icon, String key) {
|
||||
super(context, shortcutType, AccessibilityFragmentType.INVISIBLE_TOGGLE,
|
||||
isShortcutSwitched, id, label, icon, key);
|
||||
@@ -32,9 +32,9 @@ import com.android.internal.accessibility.dialog.TargetAdapter.ViewHolder;
|
||||
* Extension for {@link AccessibilityTarget} with {@link AccessibilityFragmentType#TOGGLE}
|
||||
* type.
|
||||
*/
|
||||
class ToggleWhiteListingFeatureTarget extends AccessibilityTarget {
|
||||
class ToggleAllowListingFeatureTarget extends AccessibilityTarget {
|
||||
|
||||
ToggleWhiteListingFeatureTarget(Context context, @ShortcutType int shortcutType,
|
||||
ToggleAllowListingFeatureTarget(Context context, @ShortcutType int shortcutType,
|
||||
boolean isShortcutSwitched, String id, CharSequence label, Drawable icon, String key) {
|
||||
super(context, shortcutType, AccessibilityFragmentType.TOGGLE,
|
||||
isShortcutSwitched, id, label, icon, key);
|
||||
@@ -2756,4 +2756,9 @@ enum PageId {
|
||||
// CATEGORY: SETTINGS
|
||||
// OS: S
|
||||
SCREEN_TIMEOUT = 1852;
|
||||
|
||||
// OPEN: Settings > Accessibility > Reduce Bright Colors
|
||||
// CATEGORY: SETTINGS
|
||||
// OS: S
|
||||
REDUCE_BRIGHT_COLORS_SETTINGS = 1853;
|
||||
}
|
||||
|
||||
@@ -4494,6 +4494,9 @@
|
||||
shown in the warning dialog about the accessibility shortcut. -->
|
||||
<string name="color_correction_feature_name">Color Correction</string>
|
||||
|
||||
<!-- Title of Reduce Bright Colors feature, shown in the warning dialog about the accessibility shortcut. [CHAR LIMIT=none] -->
|
||||
<string name="reduce_bright_colors_feature_name">Reduce Bright Colors</string>
|
||||
|
||||
<!-- Text in toast to alert the user that the accessibility shortcut turned on an accessibility service. [CHAR LIMIT=none] -->
|
||||
<string name="accessibility_shortcut_enabling_service">Held volume keys. <xliff:g id="service_name" example="TalkBack">%1$s</xliff:g> turned on.</string>
|
||||
|
||||
|
||||
@@ -3249,6 +3249,7 @@
|
||||
<java-symbol type="string" name="accessibility_shortcut_disabling_service" />
|
||||
<java-symbol type="string" name="color_inversion_feature_name" />
|
||||
<java-symbol type="string" name="color_correction_feature_name" />
|
||||
<java-symbol type="string" name="reduce_bright_colors_feature_name" />
|
||||
<java-symbol type="string" name="config_defaultAccessibilityService" />
|
||||
<java-symbol type="string" name="accessibility_shortcut_spoken_feedback" />
|
||||
|
||||
|
||||
Reference in New Issue
Block a user