Crop embedded split TaskFragment as Task

Before, we only crop Task surface when rotate display which may result
janky animation. Now, we also crop other embedded split TaskFragments.

Bug: 207070762
Test: manually verify with rotate embedded split app
Change-Id: If955b7889b7951c7a06f046905d825f0f784e17b
This commit is contained in:
Chris Li
2022-09-27 11:43:30 +08:00
parent d316c7d45c
commit a5dfc1b3ef

View File

@@ -47,6 +47,8 @@ import static android.view.WindowManager.transitTypeToString;
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_OWNER_THUMBNAIL;
import static android.window.TransitionInfo.FLAG_CROSS_PROFILE_WORK_THUMBNAIL;
import static android.window.TransitionInfo.FLAG_DISPLAY_HAS_ALERT_WINDOWS;
import static android.window.TransitionInfo.FLAG_FILLS_TASK;
import static android.window.TransitionInfo.FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY;
import static android.window.TransitionInfo.FLAG_IS_DISPLAY;
import static android.window.TransitionInfo.FLAG_IS_VOICE_INTERACTION;
import static android.window.TransitionInfo.FLAG_IS_WALLPAPER;
@@ -384,8 +386,10 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
change.getEndAbsBounds().top - info.getRootOffset().y);
// Seamless display transition doesn't need to animate.
if (isSeamlessDisplayChange) continue;
if (isTask) {
// Skip non-tasks since those usually have null bounds.
if (isTask || (change.hasFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY)
&& !change.hasFlags(FLAG_FILLS_TASK))) {
// Update Task and embedded split window crop bounds, otherwise we may see crop
// on previous bounds during the rotation animation.
startTransaction.setWindowCrop(change.getLeash(),
change.getEndAbsBounds().width(), change.getEndAbsBounds().height());
}