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

Commit 82ec168c authored by Philip P. Moltmann's avatar Philip P. Moltmann Committed by Android (Google) Code Review
Browse files

Merge "Don't throw exception in AppOpsManager.checkOp"

parents b47250f0 c5f504a7
Loading
Loading
Loading
Loading
+12 −5
Original line number Original line Diff line number Diff line
@@ -1749,7 +1749,14 @@ public class AppOpsService extends IAppOpsService.Stub {
     */
     */
    private @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName,
    private @Mode int checkOperationUnchecked(int code, int uid, @NonNull String packageName,
                boolean raw) {
                boolean raw) {
        boolean isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
        boolean isPrivileged;

        try {
            isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
        } catch (SecurityException e) {
            Slog.e(TAG, "checkOperation", e);
            return AppOpsManager.opToDefaultMode(code);
        }


        synchronized (this) {
        synchronized (this) {
            if (isOpRestrictedLocked(uid, code, packageName, isPrivileged)) {
            if (isOpRestrictedLocked(uid, code, packageName, isPrivileged)) {
@@ -1939,8 +1946,8 @@ public class AppOpsService extends IAppOpsService.Stub {
        try {
        try {
            isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
            isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
        } catch (SecurityException e) {
        } catch (SecurityException e) {
            Slog.e(TAG, "Cannot startOperation", e);
            Slog.e(TAG, "noteOperation", e);
            return AppOpsManager.MODE_IGNORED;
            return AppOpsManager.MODE_ERRORED;
        }
        }


        synchronized (this) {
        synchronized (this) {
@@ -2117,8 +2124,8 @@ public class AppOpsService extends IAppOpsService.Stub {
        try {
        try {
            isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
            isPrivileged = verifyAndGetIsPrivileged(uid, packageName);
        } catch (SecurityException e) {
        } catch (SecurityException e) {
            Slog.e(TAG, "Cannot startOperation", e);
            Slog.e(TAG, "startOperation", e);
            return AppOpsManager.MODE_IGNORED;
            return AppOpsManager.MODE_ERRORED;
        }
        }


        synchronized (this) {
        synchronized (this) {