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

Commit fc910f23 authored by Eugene Susla's avatar Eugene Susla Committed by Android (Google) Code Review
Browse files

Merge "Synchronize when writing AppOpsService.mUidStates to file"

parents e7ead1ba 463d592d
Loading
Loading
Loading
Loading
+21 −18
Original line number Diff line number Diff line
@@ -198,6 +198,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        }
    };

    @GuardedBy("this")
    @VisibleForTesting
    final SparseArray<UidState> mUidStates = new SparseArray<>();

@@ -1187,7 +1188,7 @@ public class AppOpsService extends IAppOpsService.Stub {
        }
    }

    private void pruneOp(Op op, int uid, String packageName) {
    private void pruneOpLocked(Op op, int uid, String packageName) {
        if (!op.hasAnyTime()) {
            Ops ops = getOpsRawLocked(uid, packageName, false /* isPrivileged */, false /* edit */);
            if (ops != null) {
@@ -1396,7 +1397,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                    if (mode == AppOpsManager.opToDefaultMode(op.op)) {
                        // If going into the default mode, prune this op
                        // if there is nothing else interesting in it.
                        pruneOp(op, uid, packageName);
                        pruneOpLocked(op, uid, packageName);
                    }
                    scheduleFastWriteLocked();
                }
@@ -2979,6 +2980,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                out.startTag(null, "app-ops");
                out.attribute(null, "v", String.valueOf(CURRENT_VERSION));

                synchronized (this) {
                    final int uidStateCount = mUidStates.size();
                    for (int i = 0; i < uidStateCount; i++) {
                        UidState uidState = mUidStates.valueAt(i);
@@ -2998,6 +3000,7 @@ public class AppOpsService extends IAppOpsService.Stub {
                            out.endTag(null, "uid");
                        }
                    }
                }

                if (allOps != null) {
                    String lastPkg = null;