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

Commit fd913216 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Don't assume r.curApp is valid when finalizing broadcasts" into rvc-dev...

Merge "Don't assume r.curApp is valid when finalizing broadcasts" into rvc-dev am: 33e8dc79 am: b3f96855 am: f9151271 am: f719c891

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

Change-Id: Ib3c51d9554f836d8a0b491522887e44b91756d6b
parents 02d2922f f719c891
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -470,22 +470,23 @@ public final class BroadcastQueue {
        // if this receiver was slow, impose deferral policy on the app.  This will kick in
        // when processNextBroadcastLocked() next finds this uid as a receiver identity.
        if (!r.timeoutExempt) {
            if (mConstants.SLOW_TIME > 0 && elapsed > mConstants.SLOW_TIME) {
            // r.curApp can be null if finish has raced with process death - benign
            // edge case, and we just ignore it because we're already cleaning up
            // as expected.
            if (r.curApp != null
                    && mConstants.SLOW_TIME > 0 && elapsed > mConstants.SLOW_TIME) {
                // Core system packages are exempt from deferral policy
                if (!UserHandle.isCore(r.curApp.uid)) {
                    if (DEBUG_BROADCAST_DEFERRAL) {
                        Slog.i(TAG_BROADCAST, "Broadcast receiver " + (r.nextReceiver - 1)
                                + " was slow: " + receiver + " br=" + r);
                    }
                    if (r.curApp != null) {
                    mDispatcher.startDeferring(r.curApp.uid);
                    } else {
                        Slog.d(TAG_BROADCAST, "finish receiver curApp is null? " + r);
                    }
                } else {
                    if (DEBUG_BROADCAST_DEFERRAL) {
                        Slog.i(TAG_BROADCAST, "Core uid " + r.curApp.uid
                                + " receiver was slow but not deferring: " + receiver + " br=" + r);
                                + " receiver was slow but not deferring: "
                                + receiver + " br=" + r);
                    }
                }
            }