diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java index 7a994a894a86b..8de361105104f 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsHelper.java @@ -251,6 +251,7 @@ public class SettingsHelper { case Settings.Secure.TOUCH_EXPLORATION_ENABLED: case Settings.Secure.ACCESSIBILITY_DISPLAY_DALTONIZER_ENABLED: case Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED: + case Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED: case Settings.Secure.UI_NIGHT_MODE: return Settings.Secure.getInt(mContext.getContentResolver(), name, 0) != 0; case Settings.Secure.TOUCH_EXPLORATION_GRANTED_ACCESSIBILITY_SERVICES: diff --git a/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsHelperRestoreTest.java b/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsHelperRestoreTest.java index b5324e5509ab2..10749571b6235 100644 --- a/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsHelperRestoreTest.java +++ b/packages/SettingsProvider/test/src/com/android/providers/settings/SettingsHelperRestoreTest.java @@ -118,4 +118,48 @@ public class SettingsHelperRestoreTest { defaultSettingValue); return defaultSettingValue; } + + /** Tests for {@link Settings.Secure#ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED}. */ + @Test + public void + testRestoreAccessibilityDisplayMagnificationNavbarEnabled_alreadyConfigured_doesNotRestoreValue() + throws Exception { + String settingName = Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED; + // Simulate already configuring setting via SUW. + int configuredSettingValue = 1; + Settings.Secure.putInt(mContentResolver, settingName, configuredSettingValue); + + mSettingsHelper.restoreValue( + mContext, + mContentResolver, + new ContentValues(2), + Settings.Secure.getUriFor(settingName), + settingName, + String.valueOf(0), + Build.VERSION.SDK_INT); + + assertEquals(configuredSettingValue, Settings.Secure.getInt(mContentResolver, settingName)); + } + + @Test + public void + testRestoreAccessibilityDisplayMagnificationNavbarEnabled_notAlreadyConfigured_restoresValue() + throws Exception { + String settingName = Settings.Secure.ACCESSIBILITY_DISPLAY_MAGNIFICATION_NAVBAR_ENABLED; + int defaultSettingValue = 0; + // Simulate system default at boot. + Settings.Secure.putInt(mContentResolver, settingName, defaultSettingValue); + + int restoreSettingValue = 1; + mSettingsHelper.restoreValue( + mContext, + mContentResolver, + new ContentValues(2), + Settings.Secure.getUriFor(settingName), + settingName, + String.valueOf(restoreSettingValue), + Build.VERSION.SDK_INT); + + assertEquals(restoreSettingValue, Settings.Secure.getInt(mContentResolver, settingName)); + } }