Merge "Add navbar magnification to critical accessibility check"

This commit is contained in:
Annie Meng
2018-05-03 18:47:39 +00:00
committed by Android (Google) Code Review
2 changed files with 45 additions and 0 deletions

View File

@@ -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:

View File

@@ -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));
}
}