diff options
| author | 2023-10-26 11:09:28 +0900 | |
|---|---|---|
| committer | 2023-10-26 03:58:40 +0000 | |
| commit | 789a230c9f8282a9cb241f8b635ba69c21cb809c (patch) | |
| tree | eb46a3787a5417ef67c4515dae550c18f9bd39c6 | |
| parent | 80697da8e1330e530c815844297b866cdfff536d (diff) | |
Attach background surface to transition root by default
I02cd3a232350a1dc74e755f9445179ccb216507f changed where the
background color surface is attached to from its transition root
to its task display area to avoid the surface from hiding one of
the split tasks unexpectedly.
However, this doesn't work in freeform mode because when an
activity-to-activity transition happens, the background color
should be rendered inside the parent task. Also, there are some
CTS tests that verify that this surface is rendered within the
task when an activity-to-activity transition happens.
This CL limites the original logic only to the split case.
Having this logic for split is okay in freeform mode too.
Bug: 307705229
Test: atest ActivityTransitionTests
Change-Id: I94f0fb792998574fa9fbc36147d9b83af62a7f0a
| -rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java index de03f5826925..9cd318f27355 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/transition/DefaultTransitionHandler.java @@ -25,6 +25,7 @@ import static android.app.ActivityOptions.ANIM_SCENE_TRANSITION; import static android.app.ActivityOptions.ANIM_THUMBNAIL_SCALE_DOWN; import static android.app.ActivityOptions.ANIM_THUMBNAIL_SCALE_UP; import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM; +import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW; import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED; import static android.app.admin.DevicePolicyManager.ACTION_DEVICE_POLICY_RESOURCE_UPDATED; import static android.app.admin.DevicePolicyManager.EXTRA_RESOURCE_TYPE; @@ -515,7 +516,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { } if (backgroundColorForTransition != 0) { - addBackgroundColorOnTDA(info, backgroundColorForTransition, startTransaction, + addBackgroundColor(info, backgroundColorForTransition, startTransaction, finishTransaction); } @@ -546,7 +547,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { return true; } - private void addBackgroundColorOnTDA(@NonNull TransitionInfo info, + private void addBackgroundColor(@NonNull TransitionInfo info, @ColorInt int color, @NonNull SurfaceControl.Transaction startTransaction, @NonNull SurfaceControl.Transaction finishTransaction) { final Color bgColor = Color.valueOf(color); @@ -558,9 +559,19 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler { .setName("animation-background") .setCallsite("DefaultTransitionHandler") .setColorLayer(); - - mRootTDAOrganizer.attachToDisplayArea(displayId, colorLayerBuilder); final SurfaceControl backgroundSurface = colorLayerBuilder.build(); + + // Attaching the background surface to the transition root could unexpectedly make it + // cover one of the split root tasks. To avoid this, put the background surface just + // above the display area when split is on. + final boolean isSplitTaskInvolved = + info.getChanges().stream().anyMatch(c-> c.getTaskInfo() != null + && c.getTaskInfo().getWindowingMode() == WINDOWING_MODE_MULTI_WINDOW); + if (isSplitTaskInvolved) { + mRootTDAOrganizer.attachToDisplayArea(displayId, colorLayerBuilder); + } else { + startTransaction.reparent(backgroundSurface, info.getRootLeash()); + } startTransaction.setColor(backgroundSurface, colorArray) .setLayer(backgroundSurface, -1) .show(backgroundSurface); |