diff options
| author | Dianne Hackborn <hackbod@google.com> | 2013-08-07 16:09:14 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2013-08-07 16:09:14 -0700 |
| commit | 9f11f105cd2983021a73b9aa921674fbff3457f3 (patch) | |
| tree | fb688e77812af363a5cbf9a6b926f19650b62068 | |
| parent | 72289702e5e134eb189a208aa6e2fb3edb041f7a (diff) | |
| parent | 7f09ec39b6fd7f24751f814649f12ea686cb28d4 (diff) | |
| download | frameworks_base-9f11f105cd2983021a73b9aa921674fbff3457f3.zip frameworks_base-9f11f105cd2983021a73b9aa921674fbff3457f3.tar.gz frameworks_base-9f11f105cd2983021a73b9aa921674fbff3457f3.tar.bz2 | |
am 7f09ec39: Fix issue #10226007: Reset apps restores most of the changed settings...
* commit '7f09ec39b6fd7f24751f814649f12ea686cb28d4':
Fix issue #10226007: Reset apps restores most of the changed settings...
| -rw-r--r-- | services/java/com/android/server/AppOpsService.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/services/java/com/android/server/AppOpsService.java b/services/java/com/android/server/AppOpsService.java index 20ad636..a55fddc 100644 --- a/services/java/com/android/server/AppOpsService.java +++ b/services/java/com/android/server/AppOpsService.java @@ -380,12 +380,14 @@ public class AppOpsService extends IAppOpsService.Stub { HashMap<Callback, ArrayList<Pair<String, Integer>>> callbacks = null; synchronized (this) { boolean changed = false; - for (int i=0; i<mUidOps.size(); i++) { + for (int i=mUidOps.size()-1; i>=0; i--) { HashMap<String, Ops> packages = mUidOps.valueAt(i); - for (Map.Entry<String, Ops> ent : packages.entrySet()) { + Iterator<Map.Entry<String, Ops>> it = packages.entrySet().iterator(); + while (it.hasNext()) { + Map.Entry<String, Ops> ent = it.next(); String packageName = ent.getKey(); Ops pkgOps = ent.getValue(); - for (int j=0; j<pkgOps.size(); j++) { + for (int j=pkgOps.size()-1; j>=0; j--) { Op curOp = pkgOps.valueAt(j); if (curOp.mode != AppOpsManager.MODE_ALLOWED) { curOp.mode = AppOpsManager.MODE_ALLOWED; @@ -394,9 +396,17 @@ public class AppOpsService extends IAppOpsService.Stub { mOpModeWatchers.get(curOp.op)); callbacks = addCallbacks(callbacks, packageName, curOp.op, mPackageModeWatchers.get(packageName)); - pruneOp(curOp, mUidOps.keyAt(i), packageName); + if (curOp.time == 0 && curOp.rejectTime == 0) { + pkgOps.removeAt(j); + } } } + if (pkgOps.size() == 0) { + it.remove(); + } + } + if (packages.size() == 0) { + mUidOps.removeAt(i); } } if (changed) { |
