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

Commit 068d7a21 authored by Gopal Krishna Shukla's avatar Gopal Krishna Shukla Committed by Gopal Shukla
Browse files

Avoid IOB while bringDownDisabledPackageServicesLocked()

bringDownServiceLocked may lead to runtime exception which
can again invoke bringDownDisabledPackageServicesLocked on
the package and since  mTmpCollectionResults is global it
might be cleaned in subsequent call.

Test: Monkey or directed (see bug)
Bug: 146547048
Change-Id: Ic77bbf7fc1c424b4479c10f6b8887be04ab1de3f
parent 4bef5586
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -272,6 +272,7 @@ public final class ActiveServices {

        static final int MSG_BG_START_TIMEOUT = 1;
        static final int MSG_UPDATE_FOREGROUND_APPS = 2;
        static final int MSG_ENSURE_NOT_START_BG = 3;

        ServiceMap(Looper looper, int userId) {
            super(looper);
@@ -289,6 +290,11 @@ public final class ActiveServices {
                case MSG_UPDATE_FOREGROUND_APPS: {
                    updateForegroundApps(this);
                } break;
                case MSG_ENSURE_NOT_START_BG: {
                    synchronized (mAm) {
                        rescheduleDelayedStartsLocked();
                    }
                } break;
            }
        }

@@ -296,7 +302,9 @@ public final class ActiveServices {
            if (mStartingBackground.remove(r)) {
                if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE,
                        "No longer background starting: " + r);
                rescheduleDelayedStartsLocked();
                removeMessages(MSG_ENSURE_NOT_START_BG);
                Message msg = obtainMessage(MSG_ENSURE_NOT_START_BG);
                sendMessage(msg);
            }
            if (mDelayedStartList.remove(r)) {
                if (DEBUG_DELAYED_STARTS) Slog.v(TAG_SERVICE, "No longer delaying start: " + r);