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

Commit 24b50fb5 authored by Wale Ogunwale's avatar Wale Ogunwale Committed by The Android Automerger
Browse files

Correct activity lifecycle when forcedResize activity is finished

- Regerssion introduced ag/1039265. We still need to resume the
starting activity in a task with an overlay activity is the starting
activity is the overlay activity. Otherwise the activity below it
might not be moved to the paused state.
- Also, we don't want to clear starting window for activities that
aren't behind fullscreen activities as we need to display their
starting window until they are done initializing.

Bug: 28808506
Bug: 28751186
Change-Id: I9a1a5feecea2ed3592a4064fca80e240a3bce387
parent 9982ade3
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -2017,6 +2017,9 @@ final class ActivityStack {
    void cancelInitializingActivities() {
        final ActivityRecord topActivity = topRunningActivityLocked();
        boolean aboveTop = true;
        // We don't want to clear starting window for activities that aren't behind fullscreen
        // activities as we need to display their starting window until they are done initializing.
        boolean behindFullscreenActivity = false;
        for (int taskNdx = mTaskHistory.size() - 1; taskNdx >= 0; --taskNdx) {
            final ArrayList<ActivityRecord> activities = mTaskHistory.get(taskNdx).mActivities;
            for (int activityNdx = activities.size() - 1; activityNdx >= 0; --activityNdx) {
@@ -2025,16 +2028,20 @@ final class ActivityStack {
                    if (r == topActivity) {
                        aboveTop = false;
                    }
                    behindFullscreenActivity |= r.fullscreen;
                    continue;
                }

                if (r.state == ActivityState.INITIALIZING
                        && r.mStartingWindowState == STARTING_WINDOW_SHOWN) {
                        && r.mStartingWindowState == STARTING_WINDOW_SHOWN
                        && behindFullscreenActivity) {
                    if (DEBUG_VISIBILITY) Slog.w(TAG_VISIBILITY,
                            "Found orphaned starting window " + r);
                    r.mStartingWindowState = STARTING_WINDOW_REMOVED;
                    mWindowManager.removeAppStartingWindow(r.appToken);
                }

                behindFullscreenActivity |= r.fullscreen;
            }
        }
    }
+2 −1
Original line number Diff line number Diff line
@@ -1122,7 +1122,8 @@ class ActivityStarter {
            }
            final ActivityRecord topTaskActivity = mStartActivity.task.topRunningActivityLocked();
            if (!mTargetStack.isFocusable()
                    || (topTaskActivity != null && topTaskActivity.mTaskOverlay)) {
                    || (topTaskActivity != null && topTaskActivity.mTaskOverlay
                    && mStartActivity != topTaskActivity)) {
                // If the activity is not focusable, we can't resume it, but still would like to
                // make sure it becomes visible as it starts (this will also trigger entry
                // animation). An example of this are PIP activities.