diff options
| author | 2018-06-25 11:35:19 -0700 | |
|---|---|---|
| committer | 2018-06-25 11:35:19 -0700 | |
| commit | 4bc81e836c360a212c30c696c51588fa05193b6d (patch) | |
| tree | 00d0b9b758e4b66f919c95f3d3fb1de69a769698 | |
| parent | 6d5bdf293d399d9986179ae0987e4e058a27e324 (diff) | |
Use correct validator for SELECTED_SPELL_CHECKER_SUBTYPE
This CL fixes a bug that COMPONENT_NAME_VALIDATOR is mistakenly used
for SELECTED_SPELL_CHECKER_SUBTYPE secure settings due to a comment
bug. ANY_INTEGER_VALIDATOR should be used instead because it stores
the hashcode of SpellCheckerSubtype.
This CL also addresses the comment bug, which caused this issue.
Fix: 110363012
Test: atest FrameworksCoreTests:android.provider.SettingsBackupTest
Test: atest FrameworksCoreTests:android.provider.SettingsValidatorsTest
Test: manually verified as follows
1. In a source device, complete the setup wizard (without restoring
the previous settings) then run 'adb shell bmgr backupnow --all'
2. In a destination device, restore settings by choosing the option
from a cloud backup.
3. Check logcat. Make sure that the following message is not shown.
SettingsBackupAgent: Attempted restore of selected_spell_checker_subtype setting, but its value didn't pass validation, value: 0
Test: manually verified as follows
1. In a source device
1.1. complete the setup wizard without restoring the previous
settings
1.2. Open Settings -> System -> Languages & input -> Advanced
-> Spell checker -> Languages
1.3. Select 'French'
1.4. adb shell settings get secure selected_spell_checker_subtype
-> Make sure it shows '102517'
1.5. adb shell bmgr backupnow --all
2. In a destination device
2.1. Restore settings by choosing the option from a cloud backup.
2.2. adb shell settings get secure selected_spell_checker_subtype
-> Make sure it shows '102517'
Change-Id: I560395a2ccd5bcf1bf7446123b892b23ab14f9f5
| -rw-r--r-- | core/java/android/provider/Settings.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/core/java/android/provider/Settings.java b/core/java/android/provider/Settings.java index 6edcec18fdba..a10c30dfd48a 100644 --- a/core/java/android/provider/Settings.java +++ b/core/java/android/provider/Settings.java @@ -6985,8 +6985,9 @@ public final class Settings { private static final Validator SELECTED_SPELL_CHECKER_VALIDATOR = COMPONENT_NAME_VALIDATOR; /** - * The {@link ComponentName} string of the selected subtype of the selected spell checker - * service which is one of the services managed by the text service manager. + * {@link android.view.textservice.SpellCheckerSubtype#hashCode()} of the selected subtype + * of the selected spell checker service which is one of the services managed by the text + * service manager. * * @hide */ @@ -6994,7 +6995,7 @@ public final class Settings { "selected_spell_checker_subtype"; private static final Validator SELECTED_SPELL_CHECKER_SUBTYPE_VALIDATOR = - COMPONENT_NAME_VALIDATOR; + ANY_INTEGER_VALIDATOR; /** * Whether spell checker is enabled or not. |