Adjusts the default magnification settings for config_magnification_area
Cnfig flag, config_magnification_area, determines if the device
supports magnification area or not.
If OEM doesn't support magnification area, we should adjust the
magnification capability setting and window magnification prompt
setting.
Bug: 177371954
Test: atest SettingsBackupTest
Change-Id: I67947285eb6a73b8e0e21d1db866c426a0ea49d7
(cherry picked from commit f9d7150a5c)
Merged-In: I67947285eb6a73b8e0e21d1db866c426a0ea49d7
This commit is contained in:
@@ -4726,17 +4726,23 @@ public class SettingsProvider extends ContentProvider {
|
||||
}
|
||||
|
||||
if (currentVersion == 192) {
|
||||
// Version 192: set the default value for magnification capabilities. If
|
||||
// magnification is enabled by the user, set it to full-screen, and set a value
|
||||
// to show a prompt when using the magnification first time after upgrading.
|
||||
// Version 192: set the default value for magnification capabilities.
|
||||
// If the device supports magnification area and magnification is enabled
|
||||
// by the user, set it to full-screen, and set a value to show a prompt
|
||||
// when using the magnification first time after upgrading.
|
||||
final SettingsState secureSettings = getSecureSettingsLocked(userId);
|
||||
final Setting magnificationCapabilities = secureSettings.getSettingLocked(
|
||||
Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY);
|
||||
final boolean supportMagnificationArea = getContext().getResources().getBoolean(
|
||||
com.android.internal.R.bool.config_magnification_area);
|
||||
final int capability = supportMagnificationArea
|
||||
? R.integer.def_accessibility_magnification_capabilities
|
||||
: Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
|
||||
final String supportShowPrompt = supportMagnificationArea ? "1" : "0";
|
||||
if (magnificationCapabilities.isNull()) {
|
||||
secureSettings.insertSettingLocked(
|
||||
Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
|
||||
String.valueOf(getContext().getResources().getInteger(
|
||||
R.integer.def_accessibility_magnification_capabilities)),
|
||||
String.valueOf(getContext().getResources().getInteger(capability)),
|
||||
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
|
||||
if (isMagnificationSettingsOn(secureSettings)) {
|
||||
@@ -4746,7 +4752,8 @@ public class SettingsProvider extends ContentProvider {
|
||||
null, false /* makeDefault */,
|
||||
SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
secureSettings.insertSettingLocked(
|
||||
Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT, "1",
|
||||
Secure.ACCESSIBILITY_SHOW_WINDOW_MAGNIFICATION_PROMPT,
|
||||
supportShowPrompt,
|
||||
null, false /* makeDefault */,
|
||||
SettingsState.SYSTEM_PACKAGE_NAME);
|
||||
}
|
||||
|
||||
@@ -118,6 +118,9 @@ class AccessibilityUserState {
|
||||
private int mNonInteractiveUiTimeout = 0;
|
||||
private int mInteractiveUiTimeout = 0;
|
||||
private int mLastSentClientState = -1;
|
||||
|
||||
/** {@code true} if the device config supports magnification area. */
|
||||
private final boolean mSupportMagnificationArea;
|
||||
// The magnification mode of default display.
|
||||
private int mMagnificationMode = ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
|
||||
// The magnification capabilities used to know magnification mode could be switched.
|
||||
@@ -138,6 +141,10 @@ class AccessibilityUserState {
|
||||
private int mSoftKeyboardShowMode = SHOW_MODE_AUTO;
|
||||
|
||||
boolean isValidMagnificationModeLocked() {
|
||||
if (!mSupportMagnificationArea
|
||||
&& mMagnificationMode == Settings.Secure.ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW) {
|
||||
return false;
|
||||
}
|
||||
return (mMagnificationCapabilities & mMagnificationMode) != 0;
|
||||
}
|
||||
|
||||
@@ -156,6 +163,8 @@ class AccessibilityUserState {
|
||||
R.color.accessibility_focus_highlight_color);
|
||||
mFocusStrokeWidth = mFocusStrokeWidthDefaultValue;
|
||||
mFocusColor = mFocusColorDefaultValue;
|
||||
mSupportMagnificationArea = mContext.getResources().getBoolean(
|
||||
R.bool.config_magnification_area);
|
||||
}
|
||||
|
||||
boolean isHandlingAccessibilityEventsLocked() {
|
||||
|
||||
Reference in New Issue
Block a user