From d25bcc73a988fa10a5bece1bfdabdd68dadcaf22 Mon Sep 17 00:00:00 2001 From: Chun-Ku Lin Date: Wed, 6 Dec 2023 18:53:37 +0000 Subject: Create a new settings - Settings.Secure.ACCESSIBILITY_QS_TARGETS The new setting is used to store the accessibility features that has tiles in the Quick Setting panel. Bug: 314847175 Test: build succeed Change-Id: I089db6f3034f7d83340e54487ca181442bb9722d --- core/java/android/provider/Settings.java | 11 +++++++++++ core/proto/android/providers/settings/secure.proto | 1 + .../src/android/provider/settings/backup/SecureSettings.java | 3 +++ .../settings/validators/SecureSettingsValidators.java | 3 +++ .../com/android/providers/settings/SettingsProtoDumpUtil.java | 3 +++ 5 files changed, 21 insertions(+) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 9c27f19b349a..e036b7861021 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -8290,6 +8290,17 @@ public final class Settings { @Readable public static final String ACCESSIBILITY_BUTTON_TARGETS = "accessibility_button_targets"; + /** + * Setting specifying the accessibility services, accessibility shortcut targets, + * or features to be toggled via a tile in the quick settings panel. + * + *

This is a colon-separated string list which contains the flattened + * {@link ComponentName} and the class name of a system class implementing a supported + * accessibility feature. + * @hide + */ + public static final String ACCESSIBILITY_QS_TARGETS = "accessibility_qs_targets"; + /** * The system class name of magnification controller which is a target to be toggled via * accessibility shortcut or accessibility button. diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto index 3887dd7a753f..9ca1849dedc2 100644 --- a/core/proto/android/providers/settings/secure.proto +++ b/core/proto/android/providers/settings/secure.proto @@ -99,6 +99,7 @@ message SecureSettingsProto { optional SettingProto accessibility_font_scaling_has_been_changed = 51 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto accessibility_force_invert_color_enabled = 52 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto accessibility_magnification_two_finger_triple_tap_enabled = 53 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto qs_targets = 54 [ (android.privacy).dest = DEST_AUTOMATIC ]; } optional Accessibility accessibility = 2; diff --git a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java index 5c09b1692453..8795fb1672b1 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java @@ -105,6 +105,9 @@ public class SecureSettings { Settings.Secure.CAMERA_DOUBLE_TWIST_TO_FLIP_ENABLED, Settings.Secure.CAMERA_DOUBLE_TAP_POWER_GESTURE_DISABLED, Settings.Secure.SYSTEM_NAVIGATION_KEYS_ENABLED, + // ACCESSIBILITY_QS_TARGETS needs to be restored after ENABLED_ACCESSIBILITY_SERVICES + // but before QS_TILES + Settings.Secure.ACCESSIBILITY_QS_TARGETS, Settings.Secure.QS_TILES, Settings.Secure.QS_AUTO_ADDED_TILES, Settings.Secure.CONTROLS_ENABLED, diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java index b0169a115ec5..067fcc1cf7e5 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java @@ -319,6 +319,9 @@ public class SecureSettingsValidators { VALIDATORS.put( Secure.ACCESSIBILITY_BUTTON_TARGETS, ACCESSIBILITY_SHORTCUT_TARGET_LIST_VALIDATOR); + VALIDATORS.put( + Secure.ACCESSIBILITY_QS_TARGETS, + ACCESSIBILITY_SHORTCUT_TARGET_LIST_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_FORCE_INVERT_COLOR_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ONE_HANDED_MODE_ACTIVATED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ONE_HANDED_MODE_ENABLED, BOOLEAN_VALIDATOR); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java index a97888949446..5afcd5db1b5f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1812,6 +1812,9 @@ class SettingsProtoDumpUtil { dumpSetting(s, p, Settings.Secure.ACCESSIBILITY_BUTTON_TARGETS, SecureSettingsProto.Accessibility.BUTTON_TARGETS); + dumpSetting(s, p, + Settings.Secure.ACCESSIBILITY_QS_TARGETS, + SecureSettingsProto.Accessibility.QS_TARGETS); dumpSetting(s, p, Settings.Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY, SecureSettingsProto.Accessibility.ACCESSIBILITY_MAGNIFICATION_CAPABILITY); -- cgit v1.2.3-59-g8ed1b