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:
Tony Mak
2017-09-20 21:23:48 +01:00
parent 39198faea1
commit 58f2815272

View File

@@ -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;
}