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

Commit 53b9065a authored by Dianne Hackborn's avatar Dianne Hackborn Committed by Android Git Automerger
Browse files

am 42380b6d: am 9f11f105: am 7f09ec39: Fix issue #10226007: Reset apps...

am 42380b6d: am 9f11f105: am 7f09ec39: Fix issue #10226007: Reset apps restores most of the changed settings...

* commit '42380b6d':
  Fix issue #10226007: Reset apps restores most of the changed settings...
parents 541ba710 42380b6d
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -426,12 +426,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;
@@ -440,9 +442,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) {