chore(#AlwaysOnMagnifier): Replace string constant with Settings Pref Key

In AccessibilityManagerService, previously we use string constant as the
name in Settings getter method. After the Settings key is defined, we replace
the string constants with the defined key.

Bug: 146504200
Test: atest AccessibilityManagerServiceTest
Change-Id: Ia31a068f9e882b2f5e5a1a3112b682006ee54fe1
This commit is contained in:
Roy Chou
2023-02-08 03:17:56 +00:00
parent c2ffacf2f2
commit 4c8331b30a
2 changed files with 4 additions and 8 deletions

View File

@@ -4379,9 +4379,8 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
private final Uri mMagnificationFollowTypingUri = Settings.Secure.getUriFor(
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_FOLLOW_TYPING_ENABLED);
// TODO: replace name with Settings Secure Key
private final Uri mAlwaysOnMagnificationUri = Settings.Secure.getUriFor(
"accessibility_magnification_always_on_enabled");
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED);
private final Uri mUiContrastUri = Settings.Secure.getUriFor(
CONTRAST_LEVEL);
@@ -4615,10 +4614,9 @@ public class AccessibilityManagerService extends IAccessibilityManager.Stub
}
boolean readAlwaysOnMagnificationLocked(AccessibilityUserState userState) {
// TODO: replace name const with Settings Secure Key
final boolean isSettingsAlwaysOnEnabled = Settings.Secure.getIntForUser(
mContext.getContentResolver(),
"accessibility_magnification_always_on_enabled",
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED,
0, userState.mUserId) == 1;
final boolean isAlwaysOnFeatureFlagEnabled = mMagnificationController
.isAlwaysOnMagnificationFeatureFlagEnabled();

View File

@@ -448,8 +448,7 @@ public class AccessibilityManagerServiceTest {
mA11yms.getCurrentUserIdLocked());
Settings.Secure.putIntForUser(
mTestableContext.getContentResolver(),
// TODO: replace name with Settings Secure Key
"accessibility_magnification_always_on_enabled",
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED,
1, mA11yms.getCurrentUserIdLocked());
mA11yms.readAlwaysOnMagnificationLocked(userState);
@@ -466,8 +465,7 @@ public class AccessibilityManagerServiceTest {
mA11yms.getCurrentUserIdLocked());
Settings.Secure.putIntForUser(
mTestableContext.getContentResolver(),
// TODO: replace name with Settings Secure Key
"accessibility_magnification_always_on_enabled",
Settings.Secure.ACCESSIBILITY_MAGNIFICATION_ALWAYS_ON_ENABLED,
1, mA11yms.getCurrentUserIdLocked());
mA11yms.readAlwaysOnMagnificationLocked(userState);