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

Commit 692ea60d authored by Svetoslav Ganov's avatar Svetoslav Ganov Committed by android-build-merger
Browse files

Merge "UID appop state should always override package appop" into nyc-dev

am: 6c773c5d

* commit '6c773c5d':
  UID appop state should always override package appop

Change-Id: Iab38726048f51ae02ac13af42f9906826e0721d4
parents 7ad43dd3 6c773c5d
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();