Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 58f28152 authored by Tony Mak's avatar Tony Mak
Browse files

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
parent 39198fae
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
                }