From b7547b46c3184aa83a5c283c624f026201df3c36 Mon Sep 17 00:00:00 2001 From: Roy Chou Date: Tue, 20 Jun 2023 07:04:32 +0000 Subject: 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 --- .../src/com/android/providers/settings/SettingsProvider.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java index 84a559391343..9d5696306206 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsProvider.java @@ -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)) { -- cgit v1.2.3-59-g8ed1b