Fix swipe-to-home not enter pip from split properly
Unlick 3-button home-key to enter pip from split flow, if using gesture
navigation, the flow is like:
swipe to home -> handle as a TYPE_RECENTS_DURING_SPLIT ->
finishTransition checks and triggers auto-pip -> create TRANSIT_PIP ->
reparent task to TDA -> collect to new transition -> file TRANSIT_PIP
Since the task was collected after reparent, shell-side unable to
identify if it was in split when receiving TRANSIT_PIP.
This checks if a TRANSIT_PIP implies empty one side of the split, so we
can handle enter-pip-from-split properly.
Fix: 287002454
Test: 1. Return to home from a split pair, the activity on the
split can enter PiP and clear the split pair in overview.
2. Put a split pair in background, launch another
fullscreen activity and request entering PiP, the log
should not show:
"Got a PiP-enter request while Split-Screen is active".
Change-Id: Ifc129e85a69e7c05363204e72fe4cc6ba61b9b47
This commit is contained in:
@@ -364,6 +364,27 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|
||||
return mMainStage.isActive();
|
||||
}
|
||||
|
||||
/** @return whether the transition-request implies entering pip from split. */
|
||||
public boolean requestImpliesSplitToPip(TransitionRequestInfo request) {
|
||||
if (!isSplitActive() || !mMixedHandler.requestHasPipEnter(request)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (request.getTriggerTask() != null && getSplitPosition(
|
||||
request.getTriggerTask().taskId) != SPLIT_POSITION_UNDEFINED) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// If one of the splitting tasks support auto-pip, wm-core might reparent the task to TDA
|
||||
// and file a TRANSIT_PIP transition when finishing transitions.
|
||||
// @see com.android.server.wm.RootWindowContainer#moveActivityToPinnedRootTask
|
||||
if (mMainStage.getChildCount() == 0 || mSideStage.getChildCount() == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Checks if `transition` is a pending enter-split transition. */
|
||||
public boolean isPendingEnter(IBinder transition) {
|
||||
return mSplitTransitions.isPendingEnter(transition);
|
||||
|
||||
@@ -24,7 +24,6 @@ import static android.view.WindowManager.TRANSIT_TO_BACK;
|
||||
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
|
||||
|
||||
import static com.android.wm.shell.common.split.SplitScreenConstants.FLAG_IS_DIVIDER_BAR;
|
||||
import static com.android.wm.shell.common.split.SplitScreenConstants.SPLIT_POSITION_UNDEFINED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreen.STAGE_TYPE_UNDEFINED;
|
||||
import static com.android.wm.shell.splitscreen.SplitScreenController.EXIT_REASON_CHILD_TASK_ENTER_PIP;
|
||||
import static com.android.wm.shell.util.TransitionUtil.isOpeningType;
|
||||
@@ -33,7 +32,6 @@ import android.annotation.NonNull;
|
||||
import android.annotation.Nullable;
|
||||
import android.app.PendingIntent;
|
||||
import android.os.IBinder;
|
||||
import android.util.Log;
|
||||
import android.util.Pair;
|
||||
import android.view.SurfaceControl;
|
||||
import android.view.WindowManager;
|
||||
@@ -161,9 +159,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
|
||||
@Override
|
||||
public WindowContainerTransaction handleRequest(@NonNull IBinder transition,
|
||||
@NonNull TransitionRequestInfo request) {
|
||||
if (mPipHandler.requestHasPipEnter(request) && mSplitHandler.isSplitActive()
|
||||
&& request.getTriggerTask() != null && mSplitHandler.getSplitItemPosition(
|
||||
request.getTriggerTask().token) != SPLIT_POSITION_UNDEFINED) {
|
||||
if (mSplitHandler.requestImpliesSplitToPip(request)) {
|
||||
ProtoLog.v(ShellProtoLogGroup.WM_SHELL_TRANSITIONS, " Got a PiP-enter request while "
|
||||
+ "Split-Screen is active, so treat it as Mixed.");
|
||||
if (request.getRemoteTransition() != null) {
|
||||
@@ -606,6 +602,11 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @return whether the transition-request represents a pip-entry. */
|
||||
public boolean requestHasPipEnter(TransitionRequestInfo request) {
|
||||
return mPipHandler.requestHasPipEnter(request);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mergeAnimation(@NonNull IBinder transition, @NonNull TransitionInfo info,
|
||||
@NonNull SurfaceControl.Transaction t, @NonNull IBinder mergeTarget,
|
||||
|
||||
Reference in New Issue
Block a user