Merge "Send divider change to launcher to animate" into udc-dev

This commit is contained in:
Tony Huang
2023-05-04 13:02:52 +00:00
committed by Android (Google) Code Review
5 changed files with 40 additions and 7 deletions

View File

@@ -431,6 +431,11 @@ public class RecentsTransitionHandler implements Transitions.TransitionHandler {
" adding opening taskId=%d", taskInfo.taskId);
mOpeningTasks.add(new TaskState(change, target.leash));
}
} else if (TransitionUtil.isDividerBar(change)) {
final RemoteAnimationTarget target = TransitionUtil.newTarget(change,
info.getChanges().size() - i, info, t, mLeashMap);
// Add this as a app and we will separate them on launcher side by window type.
apps.add(target);
}
}
t.apply();

View File

@@ -2788,8 +2788,8 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
/** Call this when starting the open-recents animation while split-screen is active. */
public void onRecentsInSplitAnimationStart(@NonNull SurfaceControl.Transaction t) {
setDividerVisibility(false, t);
public void onRecentsInSplitAnimationStart(TransitionInfo info) {
addDividerBarToTransition(info, false /* show */);
}
/** Call this when the recents animation during split-screen finishes. */
@@ -2806,6 +2806,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
|| mSideStage.containsContainer(container))) {
updateSurfaceBounds(mSplitLayout, finishT,
false /* applyResizingOffset */);
finishT.reparent(mSplitLayout.getDividerLeash(), mRootTaskLeash);
setDividerVisibility(true, finishT);
return;
}

View File

@@ -524,7 +524,7 @@ public class DefaultMixedHandler implements Transitions.TransitionHandler,
finishCallback.onTransitionFinished(wct, wctCB);
};
mixed.mInFlightSubAnimations = 1;
mSplitHandler.onRecentsInSplitAnimationStart(startTransaction);
mSplitHandler.onRecentsInSplitAnimationStart(info);
final boolean handled = mixed.mLeftoversHandler.startAnimation(mixed.mTransition, info,
startTransaction, finishTransaction, finishCB);
if (!handled) {

View File

@@ -110,6 +110,11 @@ public class TransitionUtil {
&& !change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY);
}
/** Returns `true` if `change` is the divider. */
public static boolean isDividerBar(TransitionInfo.Change change) {
return isNonApp(change) && change.hasFlags(FLAG_IS_DIVIDER_BAR);
}
/** Returns `true` if `change` is only re-ordering. */
public static boolean isOrderOnly(TransitionInfo.Change change) {
return change.getMode() == TRANSIT_CHANGE
@@ -175,6 +180,14 @@ public class TransitionUtil {
t.setPosition(leash, absBounds.left - info.getRoot(rootIdx).getOffset().x,
absBounds.top - info.getRoot(rootIdx).getOffset().y);
if (isDividerBar(change)) {
if (isOpeningType(mode)) {
t.setAlpha(leash, 0.f);
}
t.setLayer(leash, Integer.MAX_VALUE);
return;
}
// Put all the OPEN/SHOW on top
if (TransitionUtil.isOpeningType(mode)) {
if (isOpening) {
@@ -245,6 +258,10 @@ public class TransitionUtil {
*/
public static RemoteAnimationTarget newTarget(TransitionInfo.Change change, int order,
SurfaceControl leash) {
if (isDividerBar(change)) {
return getDividerTarget(change, leash);
}
int taskId;
boolean isNotInRecents;
ActivityManager.RunningTaskInfo taskInfo;
@@ -284,8 +301,7 @@ public class TransitionUtil {
new Rect(change.getStartAbsBounds()),
taskInfo,
change.getAllowEnterPip(),
(change.getFlags() & FLAG_IS_DIVIDER_BAR) != 0
? TYPE_DOCK_DIVIDER : INVALID_WINDOW_TYPE
INVALID_WINDOW_TYPE
);
target.setWillShowImeOnTarget(
(change.getFlags() & TransitionInfo.FLAG_WILL_IME_SHOWN) != 0);
@@ -293,6 +309,17 @@ public class TransitionUtil {
return target;
}
private static RemoteAnimationTarget getDividerTarget(TransitionInfo.Change change,
SurfaceControl leash) {
return new RemoteAnimationTarget(-1 /* taskId */, -1 /* mode */,
leash, false /* isTranslucent */, null /* clipRect */,
null /* contentInsets */, Integer.MAX_VALUE /* prefixOrderIndex */,
new android.graphics.Point(0, 0) /* position */, change.getStartAbsBounds(),
change.getStartAbsBounds(), new WindowConfiguration(), true, null /* startLeash */,
null /* startBounds */, null /* taskInfo */, false /* allowEnterPip */,
TYPE_DOCK_DIVIDER);
}
/**
* Finds the "correct" root idx for a change. The change's end display is prioritized, then
* the start display. If there is no display, it will fallback on the 0th root in the

View File

@@ -273,7 +273,7 @@ public class SplitTransitionTests extends ShellTestCase {
// simulate the start of recents transition
mMainStage.onTaskVanished(mMainChild);
mSideStage.onTaskVanished(mSideChild);
mStageCoordinator.onRecentsInSplitAnimationStart(mock(SurfaceControl.Transaction.class));
mStageCoordinator.onRecentsInSplitAnimationStart(mock(TransitionInfo.class));
assertTrue(mStageCoordinator.isSplitScreenVisible());
// Make sure it cleans-up if recents doesn't restore
@@ -307,7 +307,7 @@ public class SplitTransitionTests extends ShellTestCase {
// simulate the start of recents transition
mMainStage.onTaskVanished(mMainChild);
mSideStage.onTaskVanished(mSideChild);
mStageCoordinator.onRecentsInSplitAnimationStart(mock(SurfaceControl.Transaction.class));
mStageCoordinator.onRecentsInSplitAnimationStart(mock(TransitionInfo.class));
assertTrue(mStageCoordinator.isSplitScreenVisible());
// Make sure we remain in split after recents restores.