summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vinit Nayak <peanutbutter@google.com> 2025-02-26 07:11:25 -0800
committer Android (Google) Code Review <android-gerrit@google.com> 2025-02-26 07:11:25 -0800
commitbf609ca32c330a2855629b7257314d8773d8914a (patch)
tree5d2113c68418fbbf4e644e2d4a2f705cb00ef63e
parent543b0879c2d011c697d2e9a3ab6a6a712bf3fdac (diff)
parent5ccfe4e30c7e294209d21e6d447abcc2d42f1ac2 (diff)
Merge "Handle launch adjacent resize" into main
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java11
-rw-r--r--libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java3
2 files changed, 14 insertions, 0 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java
index 0438d16796cf..93023471fdfb 100644
--- a/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java
+++ b/libs/WindowManager/Shell/src/com/android/wm/shell/splitscreen/StageCoordinator.java
@@ -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;
@@ -2890,6 +2891,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
diff --git a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java
index 414c0147660c..ffef0d18bcc1 100644
--- a/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java
+++ b/libs/WindowManager/Shell/tests/unittest/src/com/android/wm/shell/splitscreen/SplitTestUtils.java
@@ -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;
}