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

Commit 4968d79e authored by ot903277's avatar ot903277 Committed by Rajeev Kumar
Browse files

Add PM checker for AppOpsManager

Added null == pm to deal with the possible null pointer problem when
LowRamDevice gets AppOps

Bug:230592908
Fixes:237613199
Test: run gts -m GtsPreserveLegacyStorageHostTest -t android.scopedstorage.cts.host.PreserveLegacyStorageHostTest#testPreserveLegacy

Change-Id: I80f1662a694886ef2acde58ae3eec50254e08aa2
parent 70439981
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -10291,6 +10291,9 @@ public class AppOpsManager {

        // system alert window is disable on low ram phones starting from Q
        final PackageManager pm = context.getPackageManager();
        if (null == pm) {
            return AppOpsManager.MODE_DEFAULT;
        }
        // TVs are constantly plugged in and has less concern for memory/power
        if (ActivityManager.isLowRamDeviceStatic()
                && !pm.hasSystemFeature(PackageManager.FEATURE_LEANBACK, 0)) {