fix(#Magnification): mis-use non resoure id in resource getter when magnification capability setup

In SettingsProvider, when setup magnification capability, we might mis-use the use ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN as the resource id then get unpredicted fail in getContext().getResources().getInteger(). Therefore, we adjust the capability variable declaration and assigning with the correct logic.

Bug: 288038773
Test: build pass
      manually
Change-Id: I189222c2971bb7b72c629780651c10b438271cdd
This commit is contained in:
Roy Chou
2023-06-20 07:04:32 +00:00
parent 00e1235fc8
commit b7547b46c3

View File

@@ -5001,14 +5001,15 @@ public class SettingsProvider extends ContentProvider {
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()) {
final int capability = supportMagnificationArea
? getContext().getResources().getInteger(
R.integer.def_accessibility_magnification_capabilities)
: Secure.ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN;
secureSettings.insertSettingLocked(
Secure.ACCESSIBILITY_MAGNIFICATION_CAPABILITY,
String.valueOf(getContext().getResources().getInteger(capability)),
String.valueOf(capability),
null, true, SettingsState.SYSTEM_PACKAGE_NAME);
if (isMagnificationSettingsOn(secureSettings)) {