Merge "Set force translucent by split visibility" into tm-qpr-dev am: 4b4bd64563 am: d32bff63eb

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/21899700

Change-Id: I3aca1f1d48ccde699531160503e4a0ab22672fe3
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Tony Huang
2023-03-09 07:29:31 +00:00
committed by Automerger Merge Worker

View File

@@ -207,6 +207,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
private boolean mIsDividerRemoteAnimating; private boolean mIsDividerRemoteAnimating;
private boolean mIsDropEntering; private boolean mIsDropEntering;
private boolean mIsExiting; private boolean mIsExiting;
private boolean mIsRootTranslucent;
private DefaultMixedHandler mMixedHandler; private DefaultMixedHandler mMixedHandler;
private final Toast mSplitUnsupportedToast; private final Toast mSplitUnsupportedToast;
@@ -422,6 +423,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
} }
} }
if (!isSplitActive()) {
// prevent the fling divider to center transitioni if split screen didn't active.
mIsDropEntering = true;
}
setSideStagePosition(sideStagePosition, wct); setSideStagePosition(sideStagePosition, wct);
final WindowContainerTransaction evictWct = new WindowContainerTransaction(); final WindowContainerTransaction evictWct = new WindowContainerTransaction();
targetStage.evictAllChildren(evictWct); targetStage.evictAllChildren(evictWct);
@@ -436,28 +442,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// reparent the task to an invisible split root will make the activity invisible. Reorder // reparent the task to an invisible split root will make the activity invisible. Reorder
// the root task to front to make the entering transition from pip to split smooth. // the root task to front to make the entering transition from pip to split smooth.
wct.reorder(mRootTaskInfo.token, true); wct.reorder(mRootTaskInfo.token, true);
wct.setForceTranslucent(mRootTaskInfo.token, true);
wct.reorder(targetStage.mRootTaskInfo.token, true); wct.reorder(targetStage.mRootTaskInfo.token, true);
wct.setForceTranslucent(targetStage.mRootTaskInfo.token, true);
// prevent the fling divider to center transition
mIsDropEntering = true;
targetStage.addTask(task, wct); targetStage.addTask(task, wct);
if (ENABLE_SHELL_TRANSITIONS) { if (!evictWct.isEmpty()) {
prepareEnterSplitScreen(wct); wct.merge(evictWct, true /* transfer */);
mSplitTransitions.startEnterTransition(TRANSIT_SPLIT_SCREEN_OPEN_TO_SIDE, wct,
null, this, null /* consumedCallback */, (finishWct, finishT) -> {
if (!evictWct.isEmpty()) {
finishWct.merge(evictWct, true);
}
} /* finishedCallback */);
} else {
if (!evictWct.isEmpty()) {
wct.merge(evictWct, true /* transfer */);
}
mTaskOrganizer.applyTransaction(wct);
} }
mTaskOrganizer.applyTransaction(wct);
return true; return true;
} }
@@ -716,7 +707,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mSplitLayout.setDivideRatio(splitRatio); mSplitLayout.setDivideRatio(splitRatio);
updateWindowBounds(mSplitLayout, wct); updateWindowBounds(mSplitLayout, wct);
wct.reorder(mRootTaskInfo.token, true); wct.reorder(mRootTaskInfo.token, true);
wct.setForceTranslucent(mRootTaskInfo.token, false); setRootForceTranslucent(false, wct);
// Make sure the launch options will put tasks in the corresponding split roots // Make sure the launch options will put tasks in the corresponding split roots
mainOptions = mainOptions != null ? mainOptions : new Bundle(); mainOptions = mainOptions != null ? mainOptions : new Bundle();
@@ -923,7 +914,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
updateWindowBounds(mSplitLayout, wct); updateWindowBounds(mSplitLayout, wct);
wct.reorder(mRootTaskInfo.token, true); wct.reorder(mRootTaskInfo.token, true);
wct.setForceTranslucent(mRootTaskInfo.token, false); setRootForceTranslucent(false, wct);
// TODO(b/268008375): Merge APIs to start a split pair into one. // TODO(b/268008375): Merge APIs to start a split pair into one.
if (mainTaskId != INVALID_TASK_ID) { if (mainTaskId != INVALID_TASK_ID) {
@@ -1351,7 +1342,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
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 */);
wct.setForceTranslucent(mRootTaskInfo.token, true); setRootForceTranslucent(true, wct);
wct.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1); wct.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
onTransitionAnimationComplete(); onTransitionAnimationComplete();
} else { } else {
@@ -1383,7 +1374,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mMainStage.deactivate(finishedWCT, childrenToTop == mMainStage /* toTop */); mMainStage.deactivate(finishedWCT, childrenToTop == mMainStage /* toTop */);
mSideStage.removeAllTasks(finishedWCT, childrenToTop == mSideStage /* toTop */); mSideStage.removeAllTasks(finishedWCT, childrenToTop == mSideStage /* toTop */);
finishedWCT.reorder(mRootTaskInfo.token, false /* toTop */); finishedWCT.reorder(mRootTaskInfo.token, false /* toTop */);
finishedWCT.setForceTranslucent(mRootTaskInfo.token, true); setRootForceTranslucent(true, wct);
finishedWCT.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1); finishedWCT.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
mSyncQueue.queue(finishedWCT); mSyncQueue.queue(finishedWCT);
mSyncQueue.runInSync(at -> { mSyncQueue.runInSync(at -> {
@@ -1505,7 +1496,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mMainStage.activate(wct, true /* includingTopTask */); mMainStage.activate(wct, true /* includingTopTask */);
updateWindowBounds(mSplitLayout, wct); updateWindowBounds(mSplitLayout, wct);
wct.reorder(mRootTaskInfo.token, true); wct.reorder(mRootTaskInfo.token, true);
wct.setForceTranslucent(mRootTaskInfo.token, false); setRootForceTranslucent(false, wct);
} }
void finishEnterSplitScreen(SurfaceControl.Transaction t) { void finishEnterSplitScreen(SurfaceControl.Transaction t) {
@@ -1709,6 +1700,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mRootTaskInfo = null; mRootTaskInfo = null;
mRootTaskLeash = null; mRootTaskLeash = null;
mIsRootTranslucent = false;
} }
@@ -1727,7 +1719,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Make the stages adjacent to each other so they occlude what's behind them. // Make the stages adjacent to each other so they occlude what's behind them.
wct.setAdjacentRoots(mMainStage.mRootTaskInfo.token, mSideStage.mRootTaskInfo.token); wct.setAdjacentRoots(mMainStage.mRootTaskInfo.token, mSideStage.mRootTaskInfo.token);
wct.setLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token); wct.setLaunchAdjacentFlagRoot(mSideStage.mRootTaskInfo.token);
wct.setForceTranslucent(mRootTaskInfo.token, true); setRootForceTranslucent(true, wct);
mSplitLayout.getInvisibleBounds(mTempRect1); mSplitLayout.getInvisibleBounds(mTempRect1);
wct.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1); wct.setBounds(mSideStage.mRootTaskInfo.token, mTempRect1);
mSyncQueue.queue(wct); mSyncQueue.queue(wct);
@@ -1751,7 +1743,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mSideStage.evictOtherChildren(wct, taskId); mSideStage.evictOtherChildren(wct, taskId);
updateWindowBounds(mSplitLayout, wct); updateWindowBounds(mSplitLayout, wct);
wct.reorder(mRootTaskInfo.token, true); wct.reorder(mRootTaskInfo.token, true);
wct.setForceTranslucent(mRootTaskInfo.token, false); setRootForceTranslucent(false, wct);
mSyncQueue.queue(wct); mSyncQueue.queue(wct);
mSyncQueue.runInSync(t -> { mSyncQueue.runInSync(t -> {
@@ -1775,6 +1767,13 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mDisplayInsetsController.removeInsetsChangedListener(mDisplayId, mSplitLayout); mDisplayInsetsController.removeInsetsChangedListener(mDisplayId, mSplitLayout);
} }
private void setRootForceTranslucent(boolean translucent, WindowContainerTransaction wct) {
if (mIsRootTranslucent == translucent) return;
mIsRootTranslucent = translucent;
wct.setForceTranslucent(mRootTaskInfo.token, translucent);
}
private void onStageVisibilityChanged(StageListenerImpl stageListener) { private void onStageVisibilityChanged(StageListenerImpl stageListener) {
// If split didn't active, just ignore this callback because we should already did these // If split didn't active, just ignore this callback because we should already did these
// on #applyExitSplitScreen. // on #applyExitSplitScreen.
@@ -1801,12 +1800,11 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
// Split entering background. // Split entering background.
wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
true /* setReparentLeafTaskIfRelaunch */); true /* setReparentLeafTaskIfRelaunch */);
if (!mMainStage.mRootTaskInfo.isSleeping && !mSideStage.mRootTaskInfo.isSleeping) { setRootForceTranslucent(true, wct);
wct.setForceTranslucent(mRootTaskInfo.token, true);
}
} else { } else {
wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token, wct.setReparentLeafTaskIfRelaunch(mRootTaskInfo.token,
false /* setReparentLeafTaskIfRelaunch */); false /* setReparentLeafTaskIfRelaunch */);
setRootForceTranslucent(false, wct);
} }
mSyncQueue.queue(wct); mSyncQueue.queue(wct);
@@ -1938,7 +1936,7 @@ public class StageCoordinator implements SplitLayout.SplitLayoutHandler,
mMainStage.activate(wct, true /* includingTopTask */); mMainStage.activate(wct, true /* includingTopTask */);
updateWindowBounds(mSplitLayout, wct); updateWindowBounds(mSplitLayout, wct);
wct.reorder(mRootTaskInfo.token, true); wct.reorder(mRootTaskInfo.token, true);
wct.setForceTranslucent(mRootTaskInfo.token, false); setRootForceTranslucent(false, wct);
} }
mSyncQueue.queue(wct); mSyncQueue.queue(wct);