Fix crash in LocationPermissionChecker when app is not installed.
AppOpsManager#noteOp can throw SecurityException in some cases (for example, if the app is not installed). Don't crash the system when this happens. Test: None Fix: 416189588 Flag: TEST_ONLY Change-Id: Idf017ccf6b033ec80f4c4f3397cf4e417af7ad11
This commit is contained in:
parent
63d1babeeb
commit
e988ae3208
1 changed files with 7 additions and 2 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue