Merge "Fix resetAllModes call to act only on the calling user" into lmp-dev

This commit is contained in:
Alexandra Gherghina
2014-08-06 13:43:22 +00:00
committed by Android (Google) Code Review

View File

@@ -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<Callback, ArrayList<Pair<String, Integer>>> callbacks = null;
synchronized (this) {
boolean changed = false;
for (int i=mUidOps.size()-1; i>=0; i--) {
HashMap<String, Ops> packages = mUidOps.valueAt(i);
if (UserHandle.getUserId(callingUid) != UserHandle.getUserId(mUidOps.keyAt(i))) {
// Skip any ops for a different user
continue;
}
Iterator<Map.Entry<String, Ops>> it = packages.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Ops> ent = it.next();