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

Commit 1984bba8 authored by Svetoslav Ganov's avatar Svetoslav Ganov
Browse files

UID appop state should always override package appop

bug:27831867

Change-Id: I32829137f84a2f1d70363b6d1481ccbb87c15d1c
parent 07a0e79a
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1046,7 +1046,9 @@ public class AppOpsService extends IAppOpsService.Stub {
            op.duration = 0;
            final int switchCode = AppOpsManager.opToSwitch(code);
            UidState uidState = ops.uidState;
            if (uidState.opModes != null) {
            // If there is a non-default per UID policy (we set UID op mode only if
            // non-default) it takes over, otherwise use the per package policy.
            if (uidState.opModes != null && uidState.opModes.indexOfKey(switchCode) >= 0) {
                final int uidMode = uidState.opModes.get(switchCode);
                if (uidMode != AppOpsManager.MODE_ALLOWED) {
                    if (DEBUG) Log.d(TAG, "noteOperation: reject #" + op.mode + " for code "
@@ -1055,14 +1057,16 @@ public class AppOpsService extends IAppOpsService.Stub {
                    op.rejectTime = System.currentTimeMillis();
                    return uidMode;
                }
            }
            } else {
                final Op switchOp = switchCode != code ? getOpLocked(ops, switchCode, true) : op;
                if (switchOp.mode != AppOpsManager.MODE_ALLOWED) {
                    if (DEBUG) Log.d(TAG, "noteOperation: reject #" + op.mode + " for code "
                        + switchCode + " (" + code + ") uid " + uid + " package " + packageName);
                            + switchCode + " (" + code + ") uid " + uid + " package "
                            + packageName);
                    op.rejectTime = System.currentTimeMillis();
                    return switchOp.mode;
                }
            }
            if (DEBUG) Log.d(TAG, "noteOperation: allowing code " + code + " uid " + uid
                    + " package " + packageName);
            op.time = System.currentTimeMillis();