Loading core/java/android/provider/Settings.java +13 −0 Original line number Diff line number Diff line Loading @@ -11113,6 +11113,19 @@ public final class Settings { public static final String NAVIGATION_MODE = "navigation_mode"; /** * The value is from another(source) device's {@link #NAVIGATION_MODE} during restore. * It's supposed to be written only by * {@link com.android.providers.settings.SettingsHelper}. * This setting should not be added into backup array. * <p>Value: -1 = Can't get value from restore(default), * 0 = 3 button, * 1 = 2 button, * 2 = fully gestural. * @hide */ public static final String NAVIGATION_MODE_RESTORE = "navigation_mode_restore"; /** * Scale factor for the back gesture inset size on the left side of the screen. * @hide Loading packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +2 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,8 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.NAV_BAR_KIDS_MODE, BOOLEAN_VALIDATOR); VALIDATORS.put( Secure.NAVIGATION_MODE, new DiscreteValueValidator(new String[] {"0", "1", "2"})); VALIDATORS.put(Secure.NAVIGATION_MODE_RESTORE, new DiscreteValueValidator(new String[] {"-1", "0", "1", "2"})); VALIDATORS.put(Secure.BACK_GESTURE_INSET_SCALE_LEFT, new InclusiveFloatRangeValidator(0.0f, Float.MAX_VALUE)); VALIDATORS.put(Secure.BACK_GESTURE_INSET_SCALE_RIGHT, Loading packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +22 −1 Original line number Diff line number Diff line Loading @@ -813,7 +813,11 @@ public class SettingsBackupAgent extends BackupAgentHelper { continue; } if (settingsToPreserve.contains(getQualifiedKeyForSetting(key, contentUri))) { // Filter out Settings.Secure.NAVIGATION_MODE from modified preserve settings. // Let it take part in restore process. See also b/244532342. boolean isSettingPreserved = settingsToPreserve.contains( getQualifiedKeyForSetting(key, contentUri)); if (isSettingPreserved && !Settings.Secure.NAVIGATION_MODE.equals(key)) { Log.i(TAG, "Skipping restore for setting " + key + " as it is marked as " + "preserved"); continue; Loading Loading @@ -874,6 +878,23 @@ public class SettingsBackupAgent extends BackupAgentHelper { } else { destination = contentUri; } // Value is written to NAVIGATION_MODE_RESTORE to mark navigation mode // has been set before on source device. // See also: b/244532342. if (Settings.Secure.NAVIGATION_MODE.equals(key)) { contentValues.clear(); contentValues.put(Settings.NameValueTable.NAME, Settings.Secure.NAVIGATION_MODE_RESTORE); contentValues.put(Settings.NameValueTable.VALUE, value); cr.insert(destination, contentValues); // Avoid restore original setting if it has been preserved. if (isSettingPreserved) { Log.i(TAG, "Skipping restore for setting navigation_mode " + "as it is marked as preserved"); continue; } } settingsHelper.restoreValue(this, cr, contentValues, destination, key, value, mRestoredFromSdkInt); Loading packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -848,7 +848,8 @@ public class SettingsBackupTest { Settings.Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT, Settings.Secure.UI_TRANSLATION_ENABLED, Settings.Secure.CREDENTIAL_SERVICE, Settings.Secure.CREDENTIAL_SERVICE_PRIMARY); Settings.Secure.CREDENTIAL_SERVICE_PRIMARY, Settings.Secure.NAVIGATION_MODE_RESTORE); @Test public void systemSettingsBackedUpOrDenied() { Loading Loading
core/java/android/provider/Settings.java +13 −0 Original line number Diff line number Diff line Loading @@ -11113,6 +11113,19 @@ public final class Settings { public static final String NAVIGATION_MODE = "navigation_mode"; /** * The value is from another(source) device's {@link #NAVIGATION_MODE} during restore. * It's supposed to be written only by * {@link com.android.providers.settings.SettingsHelper}. * This setting should not be added into backup array. * <p>Value: -1 = Can't get value from restore(default), * 0 = 3 button, * 1 = 2 button, * 2 = fully gestural. * @hide */ public static final String NAVIGATION_MODE_RESTORE = "navigation_mode_restore"; /** * Scale factor for the back gesture inset size on the left side of the screen. * @hide Loading
packages/SettingsProvider/src/android/provider/settings/validators/SecureSettingsValidators.java +2 −0 Original line number Diff line number Diff line Loading @@ -259,6 +259,8 @@ public class SecureSettingsValidators { VALIDATORS.put(Secure.NAV_BAR_KIDS_MODE, BOOLEAN_VALIDATOR); VALIDATORS.put( Secure.NAVIGATION_MODE, new DiscreteValueValidator(new String[] {"0", "1", "2"})); VALIDATORS.put(Secure.NAVIGATION_MODE_RESTORE, new DiscreteValueValidator(new String[] {"-1", "0", "1", "2"})); VALIDATORS.put(Secure.BACK_GESTURE_INSET_SCALE_LEFT, new InclusiveFloatRangeValidator(0.0f, Float.MAX_VALUE)); VALIDATORS.put(Secure.BACK_GESTURE_INSET_SCALE_RIGHT, Loading
packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +22 −1 Original line number Diff line number Diff line Loading @@ -813,7 +813,11 @@ public class SettingsBackupAgent extends BackupAgentHelper { continue; } if (settingsToPreserve.contains(getQualifiedKeyForSetting(key, contentUri))) { // Filter out Settings.Secure.NAVIGATION_MODE from modified preserve settings. // Let it take part in restore process. See also b/244532342. boolean isSettingPreserved = settingsToPreserve.contains( getQualifiedKeyForSetting(key, contentUri)); if (isSettingPreserved && !Settings.Secure.NAVIGATION_MODE.equals(key)) { Log.i(TAG, "Skipping restore for setting " + key + " as it is marked as " + "preserved"); continue; Loading Loading @@ -874,6 +878,23 @@ public class SettingsBackupAgent extends BackupAgentHelper { } else { destination = contentUri; } // Value is written to NAVIGATION_MODE_RESTORE to mark navigation mode // has been set before on source device. // See also: b/244532342. if (Settings.Secure.NAVIGATION_MODE.equals(key)) { contentValues.clear(); contentValues.put(Settings.NameValueTable.NAME, Settings.Secure.NAVIGATION_MODE_RESTORE); contentValues.put(Settings.NameValueTable.VALUE, value); cr.insert(destination, contentValues); // Avoid restore original setting if it has been preserved. if (isSettingPreserved) { Log.i(TAG, "Skipping restore for setting navigation_mode " + "as it is marked as preserved"); continue; } } settingsHelper.restoreValue(this, cr, contentValues, destination, key, value, mRestoredFromSdkInt); Loading
packages/SettingsProvider/test/src/android/provider/SettingsBackupTest.java +2 −1 Original line number Diff line number Diff line Loading @@ -848,7 +848,8 @@ public class SettingsBackupTest { Settings.Secure.ACCESSIBILITY_FLOATING_MENU_MIGRATION_TOOLTIP_PROMPT, Settings.Secure.UI_TRANSLATION_ENABLED, Settings.Secure.CREDENTIAL_SERVICE, Settings.Secure.CREDENTIAL_SERVICE_PRIMARY); Settings.Secure.CREDENTIAL_SERVICE_PRIMARY, Settings.Secure.NAVIGATION_MODE_RESTORE); @Test public void systemSettingsBackedUpOrDenied() { Loading