diff --git a/staticlibs/framework/com/android/net/module/util/LocationPermissionChecker.java b/staticlibs/framework/com/android/net/module/util/LocationPermissionChecker.java index e4d25cdf07..9e755599e1 100644 --- a/staticlibs/framework/com/android/net/module/util/LocationPermissionChecker.java +++ b/staticlibs/framework/com/android/net/module/util/LocationPermissionChecker.java @@ -221,8 +221,13 @@ public class LocationPermissionChecker { private boolean noteAppOpAllowed(String op, String pkgName, @Nullable String featureId, int uid, @Nullable String message) { - return mAppOpsManager.noteOp(op, uid, pkgName, featureId, message) - == AppOpsManager.MODE_ALLOWED; + try { + return mAppOpsManager.noteOp(op, uid, pkgName, featureId, message) + == AppOpsManager.MODE_ALLOWED; + } catch (SecurityException e) { + // Can happen, for example, if the app is not currently installed. // b/416189588 + return false; + } } private void checkPackage(int uid, String pkgName)