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

Commit 5ccfe4e3 authored by Vinit Nayak's avatar Vinit Nayak
Browse files

Handle launch adjacent resize

* Re-use path for enter transition that dragging an app to replace
an app already in split uses for resizing.
* Ideally we can resize after start animation or add the changes we
want in the WCT we return in handleRequest(). Currently that work
is done in SplitLayout#flingDividerToCenter() which starts its own
transition for resizing after animating to center. In our case I think
we want to set the final state and then animate so it plays well with
handleRequest() and then startAnimation()?
* Technically just calling flingDividerToCenter() here works but
there is too much flickering in the UI during resizing, not sure if the
resize surface updates are interfereing w/ the app that is starting?

Test: Doesn't resize when the task being replaced is pippable since
we need to let MixedHandler handle that. But resizes for other cases.
Bug: 383624769
Flag: EXEMPT bug fix

Change-Id: Iccd3398900089177928cd51fab999a421610ab45
parent 03bb0fb6
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ import android.app.ActivityManager;
import android.app.ActivityOptions;
import android.app.IActivityTaskManager;
import android.app.PendingIntent;
import android.app.PictureInPictureParams;
import android.app.TaskInfo;
import android.content.ActivityNotFoundException;
import android.content.Context;
@@ -2880,6 +2881,16 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
                    prepareEnterSplitScreen(out);
                    mSplitTransitions.setEnterTransition(transition, request.getRemoteTransition(),
                            TRANSIT_SPLIT_SCREEN_PAIR_OPEN, !mIsDropEntering);
                } else if (isSplitScreenVisible() && isOpening) {
                    // launching into an existing split stage; possibly launchAdjacent
                    // If we're replacing a pip-able app, we need to let mixed handler take care of
                    // it. Otherwise we'll just treat it as an enter+resize
                    if (mSplitLayout.calculateCurrentSnapPosition() != SNAP_TO_2_50_50) {
                        // updated layout will get applied in startAnimation pendingResize
                        mSplitTransitions.setEnterTransition(transition,
                                request.getRemoteTransition(),
                                TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, true /*resizeAnim*/);
                    }
                } else if (inFullscreen && isSplitScreenVisible()) {
                    // If the trigger task is in fullscreen and in split, exit split and place
                    // task on top
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package com.android.wm.shell.splitscreen;

import static com.android.wm.shell.shared.split.SplitScreenConstants.SNAP_TO_2_50_50;

import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.mock;

@@ -58,6 +60,7 @@ public class SplitTestUtils {
        doReturn(leash).when(out).getDividerLeash();
        doReturn(bounds1).when(out).getTopLeftBounds();
        doReturn(bounds2).when(out).getBottomRightBounds();
        doReturn(SNAP_TO_2_50_50).when(out).calculateCurrentSnapPosition();
        return out;
    }