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

Commit 5f5bd84d authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Fix flicker when entering PiP from split-screen / overview

This is a follow-up of ag/16418447 where we hide the Tasks in
split-screen mode on swipe-home-to-pip and here we use the same
mechanism when we are entering PiP from the overview and the pip-able
task is in split-screen mode.

Video: http://recall/-/aaaaaabFQoRHlzixHdtY/bNtg3ZOhuTBKm9nU9CPeNQ
Bug: 228289777
Test: follow the reproduce steps in bug, see video
Change-Id: Icab11d52cedaf94af0ee72023cebca8ec51d8851
parent d34d3b48
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ import android.view.animation.Interpolator;
import android.widget.ListView;
import android.widget.OverScroller;
import android.widget.Toast;
import android.window.PictureInPictureSurfaceTransaction;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
@@ -161,6 +162,7 @@ import com.android.quickstep.TaskThumbnailCache;
import com.android.quickstep.TaskViewUtils;
import com.android.quickstep.ViewUtils;
import com.android.quickstep.util.GroupTask;
import com.android.quickstep.util.LauncherSplitScreenListener;
import com.android.quickstep.util.LayoutUtils;
import com.android.quickstep.util.RecentsOrientedState;
import com.android.quickstep.util.SplitScreenBounds;
@@ -4488,6 +4490,18 @@ public abstract class RecentsView<ACTIVITY_TYPE extends StatefulActivity<STATE_T
            final SystemUiProxy systemUiProxy = SystemUiProxy.INSTANCE.get(getContext());
            systemUiProxy.notifySwipeToHomeFinished();
            systemUiProxy.setShelfHeight(true, mActivity.getDeviceProfile().hotseatBarSizePx);
            // Transaction to hide the task to avoid flicker for entering PiP from split-screen.
            // See also {@link AbsSwipeUpHandler#maybeFinishSwipeToHome}.
            PictureInPictureSurfaceTransaction tx =
                    new PictureInPictureSurfaceTransaction.Builder()
                            .setAlpha(0f)
                            .build();
            int[] taskIds =
                    LauncherSplitScreenListener.INSTANCE.getNoCreate().getRunningSplitTaskIds();
            for (int taskId : taskIds) {
                mRecentsAnimationController.setFinishTaskTransaction(taskId,
                        tx, null /* overlay */);
            }
        }
        mRecentsAnimationController.finish(toRecents, () -> {
            if (onFinishComplete != null) {