From 36e81f298fd36cb49537586c21a463f6211d0be4 Mon Sep 17 00:00:00 2001 From: Lauren Winston Date: Thu, 18 Aug 2022 21:07:07 +0000 Subject: [PATCH] Add Settings.Secure values for Software Cursor settings for hiding trigger hints and for shifting the trigger region when the keyboard is opened. More context for these settings: https://docs.google.com/document/d/1hh2eY1a6wsOmOajxOUm8Xt8DT29oUvH9x0mCH83pnvk/edit#heading=h.e572ymeclvtl Bug: 242218807 Test: SettingsBackupTest Change-Id: I67e6d1ed0261a592aba0cb75a8e900c07683f667 --- core/java/android/provider/Settings.java | 17 +++++++++++++++++ .../android/providers/settings/secure.proto | 8 ++++++++ .../settings/backup/SecureSettings.java | 4 +++- .../validators/SecureSettingsValidators.java | 4 ++++ .../settings/SettingsProtoDumpUtil.java | 6 ++++++ 5 files changed, 38 insertions(+), 1 deletion(-) diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index a7c72730a89fd..4ac0d73b8c000 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -10830,6 +10830,23 @@ public final class Settings { public static final String ACCESSIBILITY_SOFTWARE_CURSOR_ENABLED = "accessibility_software_cursor_enabled"; + /** + * Software Cursor settings that specifies whether trigger hints are enabled. + * + * @hide + */ + public static final String ACCESSIBILITY_SOFTWARE_CURSOR_TRIGGER_HINTS_ENABLED = + "accessibility_software_cursor_trigger_hints_enabled"; + + /** + * Software Cursor settings that specifies whether triggers are shifted when the keyboard + * is shown. + * + * @hide + */ + public static final String ACCESSIBILITY_SOFTWARE_CURSOR_KEYBOARD_SHIFT_ENABLED = + "accessibility_software_cursor_keyboard_shift_enabled"; + /** * Whether the Adaptive connectivity option is enabled. * diff --git a/core/proto/android/providers/settings/secure.proto b/core/proto/android/providers/settings/secure.proto index 322354b5ad60d..789ceffefbe91 100644 --- a/core/proto/android/providers/settings/secure.proto +++ b/core/proto/android/providers/settings/secure.proto @@ -89,6 +89,14 @@ message SecureSettingsProto { // Setting for accessibility magnification for following typing. optional SettingProto accessibility_magnification_follow_typing_enabled = 43 [ (android.privacy).dest = DEST_AUTOMATIC ]; optional SettingProto accessibility_software_cursor_enabled = 44 [ (android.privacy).dest = DEST_AUTOMATIC ]; + + message SoftwareCursorSettings { + optional SettingProto trigger_hints_enabled = 1 [ (android.privacy).dest = DEST_AUTOMATIC ]; + optional SettingProto keyboard_shift_enabled = 2 [ (android.privacy).dest = DEST_AUTOMATIC ]; + } + + optional SoftwareCursorSettings accessibility_software_cursor_settings = 45 [ (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 42b992fb44d32..bc9490fc8f9d2 100644 --- a/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java +++ b/packages/SettingsProvider/src/android/provider/settings/backup/SecureSettings.java @@ -212,6 +212,8 @@ public class SecureSettings { Settings.Secure.STATUS_BAR_SHOW_VIBRATE_ICON, Settings.Secure.WEAR_TALKBACK_ENABLED, Settings.Secure.HBM_SETTING_KEY, - Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_ENABLED + Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_ENABLED, + Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_TRIGGER_HINTS_ENABLED, + Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_KEYBOARD_SHIFT_ENABLED, }; } diff --git a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java index 14b58550d1623..2c99d713d2363 100644 --- a/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +++ b/packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java @@ -346,5 +346,9 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.WEAR_TALKBACK_ENABLED, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.HBM_SETTING_KEY, BOOLEAN_VALIDATOR); VALIDATORS.put(Secure.ACCESSIBILITY_SOFTWARE_CURSOR_ENABLED, BOOLEAN_VALIDATOR); + VALIDATORS.put( + Secure.ACCESSIBILITY_SOFTWARE_CURSOR_TRIGGER_HINTS_ENABLED, BOOLEAN_VALIDATOR); + VALIDATORS.put( + Secure.ACCESSIBILITY_SOFTWARE_CURSOR_KEYBOARD_SHIFT_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 c3b645e7bc0df..a2ffcf3858806 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProtoDumpUtil.java @@ -1828,6 +1828,12 @@ class SettingsProtoDumpUtil { dumpSetting(s, p, Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_ENABLED, SecureSettingsProto.Accessibility.ACCESSIBILITY_SOFTWARE_CURSOR_ENABLED); + dumpSetting(s, p, + Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_TRIGGER_HINTS_ENABLED, + SecureSettingsProto.Accessibility.SoftwareCursorSettings.TRIGGER_HINTS_ENABLED); + dumpSetting(s, p, + Settings.Secure.ACCESSIBILITY_SOFTWARE_CURSOR_KEYBOARD_SHIFT_ENABLED, + SecureSettingsProto.Accessibility.SoftwareCursorSettings.KEYBOARD_SHIFT_ENABLED); p.end(accessibilityToken); final long adaptiveSleepToken = p.start(SecureSettingsProto.ADAPTIVE_SLEEP);