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

Commit 8c50f820 authored by Philip P. Moltmann's avatar Philip P. Moltmann
Browse files

Don't call into pm with appops lock held

We want to untagle pm from appopmanager and rather keep the locks
independant.

Test: atest --test-mapping=services/core/java/com/android/server/appop/
Bug: 124731615
Change-Id: I7dad2fa8cacf5ee1e9ea068947019fcbde1335ec
parent dcd5379d
Loading
Loading
Loading
Loading
+23 −21
Original line number Diff line number Diff line
@@ -2230,7 +2230,16 @@ public class AppOpsService extends IAppOpsService.Stub {
            if (op == null) {
                return;
            }
            if (!client.mStartedOps.remove(op)) {
            if (client.mStartedOps.remove(op)) {
                finishOperationLocked(op, /*finishNested*/ false);
                if (op.startNesting <= 0) {
                    scheduleOpActiveChangedIfNeededLocked(code, uid, packageName, false);
                }

                return;
            }
        }

        // We finish ops when packages get removed to guarantee no dangling
        // started ops. However, some part of the system may asynchronously
        // finish ops for an already gone package. Hence, finishing an op
@@ -2247,15 +2256,8 @@ public class AppOpsService extends IAppOpsService.Stub {
        } finally {
            Binder.restoreCallingIdentity(identity);
        }
                Slog.wtf(TAG, "Operation not started: uid=" + op.uidState.uid + " pkg="
                        + op.packageName + " op=" + AppOpsManager.opToName(op.op));
                return;
            }
            finishOperationLocked(op, /*finishNested*/ false);
            if (op.startNesting <= 0) {
                scheduleOpActiveChangedIfNeededLocked(code, uid, packageName, false);
            }
        }
        Slog.wtf(TAG, "Operation not started: uid=" + uid + " pkg="
                + packageName + " op=" + AppOpsManager.opToName(code));
    }

    private void scheduleOpActiveChangedIfNeededLocked(int code, int uid, String packageName,