Use noteOpNoThrow instead in AMS
We just want a boolean result to tell whether a package has certain permissions, we do not expect the check to throw SecurityException, so let's use noteOpNoThrow instead. Fixes: 65912167 Test: Disable Gmail, install a test app and run setPassword. No crash. Change-Id: Ifc6e7fbbae1121bda329f0a291522af9698959db
This commit is contained in:
@@ -5285,7 +5285,7 @@ public class AccountManagerService
|
||||
== PackageManager.PERMISSION_GRANTED) {
|
||||
// Checks runtime permission revocation.
|
||||
final int opCode = AppOpsManager.permissionToOpCode(perm);
|
||||
if (opCode == AppOpsManager.OP_NONE || mAppOpsManager.noteOp(
|
||||
if (opCode == AppOpsManager.OP_NONE || mAppOpsManager.noteOpNoThrow(
|
||||
opCode, uid, packageName) == AppOpsManager.MODE_ALLOWED) {
|
||||
return true;
|
||||
}
|
||||
@@ -5306,7 +5306,7 @@ public class AccountManagerService
|
||||
Log.v(TAG, " caller uid " + callingUid + " has " + perm);
|
||||
}
|
||||
final int opCode = AppOpsManager.permissionToOpCode(perm);
|
||||
if (opCode == AppOpsManager.OP_NONE || mAppOpsManager.noteOp(
|
||||
if (opCode == AppOpsManager.OP_NONE || mAppOpsManager.noteOpNoThrow(
|
||||
opCode, callingUid, opPackageName) == AppOpsManager.MODE_ALLOWED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user