Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4bc81e83 authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

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
parent 6d5bdf29
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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.