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

Commit 6c998f50 authored by Hongwei Wang's avatar Hongwei Wang Committed by Automerger Merge Worker
Browse files

Merge "Ensure onStop before onPictureInPictureModeChanged" into udc-dev am:...

Merge "Ensure onStop before onPictureInPictureModeChanged" into udc-dev am: 00bcb90d am: 374edfcd

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/24058285



Change-Id: I5d5a16885823427522acebd27d5294ec140c928b
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents 43c76eef 374edfcd
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2186,7 +2186,7 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
     * Processes the activities to be stopped or destroyed. This should be called when the resumed
     * activities are idle or drawn.
     */
    private void processStoppingAndFinishingActivities(ActivityRecord launchedActivity,
    void processStoppingAndFinishingActivities(ActivityRecord launchedActivity,
            boolean processPausingActivities, String reason) {
        // Stop any activities that are scheduled to do so but have been waiting for the transition
        // animation to finish.
@@ -2194,7 +2194,10 @@ public class ActivityTaskSupervisor implements RecentTasks.Callbacks {
        ArrayList<ActivityRecord> readyToStopActivities = null;
        for (int i = 0; i < mStoppingActivities.size(); i++) {
            final ActivityRecord s = mStoppingActivities.get(i);
            final boolean animating = s.isInTransition();
            // Activity in a force hidden task should not be counted as animating, i.e., we want to
            // send onStop before any configuration change when removing pip transition is ongoing.
            final boolean animating = s.isInTransition()
                    && s.getTask() != null && !s.getTask().isForceHidden();
            displaySwapping |= s.isDisplaySleepingAndSwapping();
            ProtoLog.v(WM_DEBUG_STATES, "Stopping %s: nowVisible=%b animating=%b "
                    + "finishing=%s", s, s.nowVisible, animating, s.finishing);
+7 −0
Original line number Diff line number Diff line
@@ -559,6 +559,13 @@ class WindowOrganizerController extends IWindowOrganizerController.Stub
                }
                if (forceHiddenForPip) {
                    wc.asTask().setForceHidden(FLAG_FORCE_HIDDEN_FOR_PINNED_TASK, true /* set */);
                    // When removing pip, make sure that onStop is sent to the app ahead of
                    // onPictureInPictureModeChanged.
                    // See also PinnedStackTests#testStopBeforeMultiWindowCallbacksOnDismiss
                    wc.asTask().ensureActivitiesVisible(null, 0, PRESERVE_WINDOWS);
                    wc.asTask().mTaskSupervisor.processStoppingAndFinishingActivities(
                            null /* launchedActivity */, false /* processPausingActivities */,
                            "force-stop-on-removing-pip");
                }

                int containerEffect = applyWindowContainerChange(wc, entry.getValue(),