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
This commit is contained in:
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user