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

Commit d8026641 authored by Wale Ogunwale's avatar Wale Ogunwale
Browse files

Don't stop paused activities that are visible.

Paused activities can be visible, but stopped activities are not
visible.

Change-Id: I305f77542d198ca897b33ad07ac3fc2a14a04397
parent 4fdeed95
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -1127,7 +1127,8 @@ final class ActivityStack {
                if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Executing finish of activity: " + prev);
                prev = finishCurrentActivityLocked(prev, FINISH_AFTER_VISIBLE, false);
            } else if (prev.app != null) {
                if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueueing pending stop: " + prev);
                if (DEBUG_PAUSE) Slog.v(TAG_PAUSE, "Enqueue pending stop if needed: " + prev
                        + " wasStopping=" + wasStopping + " visible=" + prev.visible);
                if (mStackSupervisor.mWaitingVisibleActivities.remove(prev)) {
                    if (DEBUG_SWITCH || DEBUG_PAUSE) Slog.v(TAG_PAUSE,
                            "Complete pause, no longer waiting: " + prev);
@@ -1142,7 +1143,8 @@ final class ActivityStack {
                    // We can't clobber it, because the stop confirmation will not be handled.
                    // We don't need to schedule another stop, we only need to let it happen.
                    prev.state = ActivityState.STOPPING;
                } else if (!hasVisibleBehindActivity() || mService.isSleepingOrShuttingDown()) {
                } else if ((!prev.visible && !hasVisibleBehindActivity())
                        || mService.isSleepingOrShuttingDown()) {
                    // If we were visible then resumeTopActivities will release resources before
                    // stopping.
                    addToStopping(prev);