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

Commit 457bcefb authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

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

parents f43923f0 f5d5af13
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);