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

Commit af75df0b authored by Sterling Huber's avatar Sterling Huber Committed by Automerger Merge Worker
Browse files

Merge "Ensure caller identity is restored in CP quick-path." into rvc-dev am: 978c1ffc

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13081826

Change-Id: I25bec816043d02d8a0279fffaa796c9096d2dfd6
parents c59c54bb 978c1ffc
Loading
Loading
Loading
Loading
+59 −58
Original line number Original line Diff line number Diff line
@@ -7158,13 +7158,12 @@ public class ActivityManagerService extends IActivityManager.Stub
                        "getContentProviderImpl: after checkContentProviderPermission");
                        "getContentProviderImpl: after checkContentProviderPermission");
                final long origId = Binder.clearCallingIdentity();
                final long origId = Binder.clearCallingIdentity();
                try {
                    checkTime(startTime, "getContentProviderImpl: incProviderCountLocked");
                    checkTime(startTime, "getContentProviderImpl: incProviderCountLocked");
                // In this case the provider instance already exists, so we can
                    // Return the provider instance right away since it already exists.
                // return it right away.
                    conn = incProviderCountLocked(r, cpr, token, callingUid, callingPackage,
                conn = incProviderCountLocked(r, cpr, token, callingUid, callingPackage, callingTag,
                            callingTag, stable);
                        stable);
                    if (conn != null && (conn.stableCount+conn.unstableCount) == 1) {
                    if (conn != null && (conn.stableCount+conn.unstableCount) == 1) {
                        if (cpr.proc != null
                        if (cpr.proc != null
                                && r != null && r.setAdj <= ProcessList.PERCEPTIBLE_LOW_APP_ADJ) {
                                && r != null && r.setAdj <= ProcessList.PERCEPTIBLE_LOW_APP_ADJ) {
@@ -7187,7 +7186,8 @@ public class ActivityManagerService extends IActivityManager.Stub
                    // it, we will check whether the process still exists.  Note that this doesn't
                    // it, we will check whether the process still exists.  Note that this doesn't
                    // completely get rid of races with LMK killing the process, but should make
                    // completely get rid of races with LMK killing the process, but should make
                    // them much smaller.
                    // them much smaller.
                if (success && verifiedAdj != cpr.proc.setAdj && !isProcessAliveLocked(cpr.proc)) {
                    if (success && verifiedAdj != cpr.proc.setAdj
                            && !isProcessAliveLocked(cpr.proc)) {
                        success = false;
                        success = false;
                    }
                    }
                    maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name);
                    maybeUpdateProviderUsageStatsLocked(r, cpr.info.packageName, name);
@@ -7217,9 +7217,10 @@ public class ActivityManagerService extends IActivityManager.Stub
                    } else {
                    } else {
                        cpr.proc.verifiedAdj = cpr.proc.setAdj;
                        cpr.proc.verifiedAdj = cpr.proc.setAdj;
                    }
                    }
                } finally {
                    Binder.restoreCallingIdentity(origId);
                    Binder.restoreCallingIdentity(origId);
                }
                }
            }
            if (!providerRunning) {
            if (!providerRunning) {
                try {
                try {