Merge "Consolidate leaving split screen to pip mode behavior" into tm-qpr-dev

This commit is contained in:
Jerry Chang
2022-12-02 01:58:06 +00:00
committed by Android (Google) Code Review
3 changed files with 18 additions and 26 deletions

View File

@@ -122,6 +122,7 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
private int mDensity;
private final boolean mDimNonImeSide;
private ValueAnimator mDividerFlingAnimator;
public SplitLayout(String windowName, Context context, Configuration configuration,
SplitLayoutHandler splitLayoutHandler,
@@ -395,6 +396,10 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
mSplitWindowManager.release(t);
mDisplayImeController.removePositionProcessor(mImePositionProcessor);
mImePositionProcessor.reset();
if (mDividerFlingAnimator != null) {
mDividerFlingAnimator.cancel();
}
resetDividerPosition();
}
public void release() {
@@ -577,13 +582,18 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
CUJ_SPLIT_SCREEN_RESIZE);
return;
}
ValueAnimator animator = ValueAnimator
if (mDividerFlingAnimator != null) {
mDividerFlingAnimator.cancel();
}
mDividerFlingAnimator = ValueAnimator
.ofInt(from, to)
.setDuration(duration);
animator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
animator.addUpdateListener(
mDividerFlingAnimator.setInterpolator(Interpolators.FAST_OUT_SLOW_IN);
mDividerFlingAnimator.addUpdateListener(
animation -> updateDivideBounds((int) animation.getAnimatedValue()));
animator.addListener(new AnimatorListenerAdapter() {
mDividerFlingAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (flingFinishedCallback != null) {
@@ -591,14 +601,15 @@ public final class SplitLayout implements DisplayInsetsController.OnInsetsChange
}
InteractionJankMonitorUtils.endTracing(
CUJ_SPLIT_SCREEN_RESIZE);
mDividerFlingAnimator = null;
}
@Override
public void onAnimationCancel(Animator animation) {
setDividePosition(to, true /* applyLayoutChange */);
mDividerFlingAnimator = null;
}
});
animator.start();
mDividerFlingAnimator.start();
}
/** Switch both surface position with animation. */

View File

@@ -1040,7 +1040,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mIsDividerRemoteAnimating = false;
mSplitLayout.getInvisibleBounds(mTempRect1);
if (childrenToTop == null) {
if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) {
mSideStage.removeAllTasks(wct, false /* toTop */);
mMainStage.deactivate(wct, false /* toTop */);
wct.reorder(mRootTaskInfo.token, false /* onTop */);
@@ -1299,13 +1299,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
}
}
private void onStageChildTaskEnterPip() {
// When the exit split-screen is caused by one of the task enters auto pip,
// we want both tasks to be put to bottom instead of top, otherwise it will end up
// a fullscreen plus a pinned task instead of pinned only at the end of the transition.
exitSplitScreen(null, EXIT_REASON_CHILD_TASK_ENTER_PIP);
}
private void updateRecentTasksSplitPair() {
if (!mShouldUpdateRecents) {
return;
@@ -2068,7 +2061,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Update divider state after animation so that it is still around and positioned
// properly for the animation itself.
mSplitLayout.release();
mSplitLayout.resetDividerPosition();
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
}
}
@@ -2344,11 +2336,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible);
}
@Override
public void onChildTaskEnterPip() {
StageCoordinator.this.onStageChildTaskEnterPip();
}
@Override
public void onRootTaskVanished() {
reset();

View File

@@ -18,7 +18,6 @@ package com.android.wm.shell.splitscreen;
import static android.app.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.RemoteAnimationTarget.MODE_OPENING;
@@ -74,8 +73,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
void onChildTaskStatusChanged(int taskId, boolean present, boolean visible);
void onChildTaskEnterPip();
void onRootTaskVanished();
void onNoLongerSupportMultiWindow();
@@ -257,9 +254,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
// Status is managed/synchronized by the transition lifecycle.
return;
}
if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) {
mCallbacks.onChildTaskEnterPip();
}
sendStatusChanged();
} else {
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo