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

Commit 07c648ed authored by Svet Ganov's avatar Svet Ganov Committed by android-build-merger
Browse files

Merge "Don't warn finishing ops for gone packages" into pi-dev

am: 457bcefb

Change-Id: I40155c6ad7ebb8c6c2fec78800c382523ade19db
parents 1f7fb68e 457bcefb
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -1346,8 +1346,24 @@ public class AppOpsService extends IAppOpsService.Stub {
                return;
            }
            if (!client.mStartedOps.remove(op)) {
                Slog.wtf(TAG, "Operation not started: uid" + op.uid
                        + " pkg=" + op.packageName + " op=" + op.op);
                // 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
                // for a non existing package is fine and we don't log as a wtf.
                final long identity = Binder.clearCallingIdentity();
                try {
                    if (LocalServices.getService(PackageManagerInternal.class).getPackageUid(
                            resolvedPackageName, 0, UserHandle.getUserId(uid)) < 0) {
                        Slog.i(TAG, "Finishing op=" + AppOpsManager.opToName(code)
                                + " for non-existing package=" + resolvedPackageName
                                + " in uid=" + uid);
                        return;
                    }
                } finally {
                    Binder.restoreCallingIdentity(identity);
                }
                Slog.wtf(TAG, "Operation not started: uid=" + op.uid + " pkg="
                        + op.packageName + " op=" + AppOpsManager.opToName(op.op));
                return;
            }
            finishOperationLocked(op, /*finishNested*/ false);