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

Commit 752bc2a7 authored by Christopher Tate's avatar Christopher Tate
Browse files

Don't attempt to work on empty pending starts list

Also plug a bookkeeping hole where information about pending service
starts was cleared but delayed starts relying on that information were
accidentally left dangling.

Fixes: 124467582
Fixes: 124399808
Test: apct/device_boot_health_check_extra
Change-Id: Ic1fec244c76be0969860fd5abee31be575ce0eca
parent b5fd2e72
Loading
Loading
Loading
Loading
+11 −9
Original line number Diff line number Diff line
@@ -319,10 +319,6 @@ public final class ActiveServices {
                ServiceRecord r = mDelayedStartList.remove(0);
                if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE,
                        "REM FR DELAY LIST (exec next): " + r);
                if (r.pendingStarts.size() <= 0) {
                    Slog.w(TAG, "**** NO PENDING STARTS! " + r + " startReq=" + r.startRequested
                            + " delayedStop=" + r.delayedStop);
                }
                if (DEBUG_DELAYED_SERVICE) {
                    if (mDelayedStartList.size() > 0) {
                        Slog.v(TAG_SERVICE, "Remaining delayed list:");
@@ -332,6 +328,10 @@ public final class ActiveServices {
                    }
                }
                r.delayed = false;
                if (r.pendingStarts.size() <= 0) {
                    Slog.wtf(TAG, "**** NO PENDING STARTS! " + r + " startReq=" + r.startRequested
                            + " delayedStop=" + r.delayedStop);
                } else {
                    try {
                        startServiceInnerLocked(this, r.pendingStarts.get(0).intent, r, false, true,
                                false);
@@ -339,6 +339,7 @@ public final class ActiveServices {
                        // Ignore, nobody upstack cares.
                    }
                }
            }
            if (mStartingBackground.size() > 0) {
                ServiceRecord next = mStartingBackground.get(0);
                long when = next.startingBgTimeout > now ? next.startingBgTimeout : now;
@@ -2978,6 +2979,7 @@ public final class ActiveServices {
        // Clear start entries.
        r.clearDeliveredStartsLocked();
        r.pendingStarts.clear();
        smap.mDelayedStartList.remove(r);

        if (r.app != null) {
            synchronized (r.stats.getBatteryStats()) {