diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java index 13e1b3761b84d..ef6e07c129336 100644 --- a/services/core/java/com/android/server/AppOpsService.java +++ b/services/core/java/com/android/server/AppOpsService.java @@ -437,13 +437,18 @@ public class AppOpsService extends IAppOpsService.Stub { @Override public void resetAllModes() { + int callingUid = Binder.getCallingUid(); mContext.enforcePermission(android.Manifest.permission.UPDATE_APP_OPS_STATS, - Binder.getCallingPid(), Binder.getCallingUid(), null); + Binder.getCallingPid(), callingUid, null); HashMap>> callbacks = null; synchronized (this) { boolean changed = false; for (int i=mUidOps.size()-1; i>=0; i--) { HashMap packages = mUidOps.valueAt(i); + if (UserHandle.getUserId(callingUid) != UserHandle.getUserId(mUidOps.keyAt(i))) { + // Skip any ops for a different user + continue; + } Iterator> it = packages.entrySet().iterator(); while (it.hasNext()) { Map.Entry ent = it.next();