Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b7547b46 authored by Roy Chou's avatar Roy Chou
Browse files

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
parent 00e1235f
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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)) {