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

Commit 7b4d6804 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Fix force-stop may restart stopped process"

parents 2ea424ea 1f3889a4
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -1177,12 +1177,19 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
    boolean handleAppDied() {
        mAtm.mStackSupervisor.removeHistoryRecords(this);

        final boolean isRemoved = isRemoved();
        boolean hasVisibleActivities = false;
        if (mInactiveActivities != null && !mInactiveActivities.isEmpty()) {
            // Make sure that all activities in this process are handled.
            mActivities.addAll(mInactiveActivities);
        }
        if (isRemoved()) {
            // The package of the died process should be force-stopped, so make its activities as
            // finishing to prevent the process from being started again if the next top (or being
            // visible) activity also resides in the same process. This must be done before removal.
            for (int i = mActivities.size() - 1; i >= 0; i--) {
                mActivities.get(i).makeFinishingLocked();
            }
        }
        for (int i = mActivities.size() - 1; i >= 0; i--) {
            final ActivityRecord r = mActivities.get(i);
            if (r.mVisibleRequested || r.isVisible()) {
@@ -1191,12 +1198,6 @@ public class WindowProcessController extends ConfigurationContainer<Configuratio
                // is not yet committed, so isVisible()=true.
                hasVisibleActivities = true;
            }
            if (isRemoved) {
                // The package of the died process should be force-stopped, so make its activities
                // as finishing to prevent the process from being started again if the next top (or
                // being visible) activity also resides in the same process.
                r.makeFinishingLocked();
            }

            final Task rootTask = r.getRootTask();
            if (rootTask != null) {