Remove the previous animation split tasks container when recreating
Bug: 197919703
Test: Invoke split and swipe up a couple times, ensure the sf dump
doesn't show multiple lingering split containers layers
Change-Id: Iad8b9d9a0d75bdaaa2a7255a33208c2c0c3fc25b
This commit is contained in:
@@ -137,6 +137,9 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
private final Provider<Optional<StageTaskUnfoldController>> mUnfoldControllerProvider;
|
private final Provider<Optional<StageTaskUnfoldController>> mUnfoldControllerProvider;
|
||||||
|
|
||||||
private StageCoordinator mStageCoordinator;
|
private StageCoordinator mStageCoordinator;
|
||||||
|
// Only used for the legacy recents animation from splitscreen to allow the tasks to be animated
|
||||||
|
// outside the bounds of the roots by being reparented into a higher level fullscreen container
|
||||||
|
private SurfaceControl mSplitTasksContainerLayer;
|
||||||
|
|
||||||
public SplitScreenController(ShellTaskOrganizer shellTaskOrganizer,
|
public SplitScreenController(ShellTaskOrganizer shellTaskOrganizer,
|
||||||
SyncTransactionQueue syncQueue, Context context,
|
SyncTransactionQueue syncQueue, Context context,
|
||||||
@@ -378,20 +381,24 @@ public class SplitScreenController implements DragAndDropPolicy.Starter,
|
|||||||
RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) {
|
RemoteAnimationTarget[] onGoingToRecentsLegacy(boolean cancel, RemoteAnimationTarget[] apps) {
|
||||||
if (ENABLE_SHELL_TRANSITIONS || apps.length < 2) return null;
|
if (ENABLE_SHELL_TRANSITIONS || apps.length < 2) return null;
|
||||||
// TODO(b/206487881): Integrate this with shell transition.
|
// TODO(b/206487881): Integrate this with shell transition.
|
||||||
|
SurfaceControl.Transaction transaction = new SurfaceControl.Transaction();
|
||||||
|
if (mSplitTasksContainerLayer != null) {
|
||||||
|
// Remove the previous layer before recreating
|
||||||
|
transaction.remove(mSplitTasksContainerLayer);
|
||||||
|
}
|
||||||
final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
|
final SurfaceControl.Builder builder = new SurfaceControl.Builder(new SurfaceSession())
|
||||||
.setContainerLayer()
|
.setContainerLayer()
|
||||||
.setName("RecentsAnimationSplitTasks")
|
.setName("RecentsAnimationSplitTasks")
|
||||||
.setHidden(false)
|
.setHidden(false)
|
||||||
.setCallsite("SplitScreenController#onGoingtoRecentsLegacy");
|
.setCallsite("SplitScreenController#onGoingtoRecentsLegacy");
|
||||||
mRootTDAOrganizer.attachToDisplayArea(DEFAULT_DISPLAY, builder);
|
mRootTDAOrganizer.attachToDisplayArea(DEFAULT_DISPLAY, builder);
|
||||||
SurfaceControl sc = builder.build();
|
mSplitTasksContainerLayer = builder.build();
|
||||||
SurfaceControl.Transaction transaction = new SurfaceControl.Transaction();
|
|
||||||
|
|
||||||
// Ensure that we order these in the parent in the right z-order as their previous order
|
// Ensure that we order these in the parent in the right z-order as their previous order
|
||||||
Arrays.sort(apps, (a1, a2) -> a1.prefixOrderIndex - a2.prefixOrderIndex);
|
Arrays.sort(apps, (a1, a2) -> a1.prefixOrderIndex - a2.prefixOrderIndex);
|
||||||
int layer = 1;
|
int layer = 1;
|
||||||
for (RemoteAnimationTarget appTarget : apps) {
|
for (RemoteAnimationTarget appTarget : apps) {
|
||||||
transaction.reparent(appTarget.leash, sc);
|
transaction.reparent(appTarget.leash, mSplitTasksContainerLayer);
|
||||||
transaction.setPosition(appTarget.leash, appTarget.screenSpaceBounds.left,
|
transaction.setPosition(appTarget.leash, appTarget.screenSpaceBounds.left,
|
||||||
appTarget.screenSpaceBounds.top);
|
appTarget.screenSpaceBounds.top);
|
||||||
transaction.setLayer(appTarget.leash, layer++);
|
transaction.setLayer(appTarget.leash, layer++);
|
||||||
|
|||||||
Reference in New Issue
Block a user