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

View File

@@ -1040,7 +1040,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mIsDividerRemoteAnimating = false; mIsDividerRemoteAnimating = false;
mSplitLayout.getInvisibleBounds(mTempRect1); mSplitLayout.getInvisibleBounds(mTempRect1);
if (childrenToTop == null) { if (childrenToTop == null || childrenToTop.getTopVisibleChildTaskId() == INVALID_TASK_ID) {
mSideStage.removeAllTasks(wct, false /* toTop */); mSideStage.removeAllTasks(wct, false /* toTop */);
mMainStage.deactivate(wct, false /* toTop */); mMainStage.deactivate(wct, false /* toTop */);
wct.reorder(mRootTaskInfo.token, false /* onTop */); 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() { private void updateRecentTasksSplitPair() {
if (!mShouldUpdateRecents) { if (!mShouldUpdateRecents) {
return; return;
@@ -2068,7 +2061,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Update divider state after animation so that it is still around and positioned // Update divider state after animation so that it is still around and positioned
// properly for the animation itself. // properly for the animation itself.
mSplitLayout.release(); mSplitLayout.release();
mSplitLayout.resetDividerPosition();
mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED; mTopStageAfterFoldDismiss = STAGE_TYPE_UNDEFINED;
} }
} }
@@ -2344,11 +2336,6 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible); StageCoordinator.this.onStageChildTaskStatusChanged(this, taskId, present, visible);
} }
@Override
public void onChildTaskEnterPip() {
StageCoordinator.this.onStageChildTaskEnterPip();
}
@Override @Override
public void onRootTaskVanished() { public void onRootTaskVanished() {
reset(); 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.ActivityTaskManager.INVALID_TASK_ID;
import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; 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.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
import static android.view.RemoteAnimationTarget.MODE_OPENING; 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 onChildTaskStatusChanged(int taskId, boolean present, boolean visible);
void onChildTaskEnterPip();
void onRootTaskVanished(); void onRootTaskVanished();
void onNoLongerSupportMultiWindow(); void onNoLongerSupportMultiWindow();
@@ -257,9 +254,6 @@ class StageTaskListener implements ShellTaskOrganizer.TaskListener {
// Status is managed/synchronized by the transition lifecycle. // Status is managed/synchronized by the transition lifecycle.
return; return;
} }
if (taskInfo.getWindowingMode() == WINDOWING_MODE_PINNED) {
mCallbacks.onChildTaskEnterPip();
}
sendStatusChanged(); sendStatusChanged();
} else { } else {
throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo throw new IllegalArgumentException(this + "\n Unknown task: " + taskInfo