Directly hide the surface of the invisible activity if display rotates

The surface of an invisible activity was set to top-most z-ordering
while playing display rotation transition animation. It was showing
on top of the entire animation because the surface layer was set on
top.

Bug: 275470440
Test: rotate display while activity embedded
Change-Id: If2467b7865ecef523867059ca15200c38ed7d650
This commit is contained in:
Louis Chang
2023-04-11 02:36:12 +00:00
parent 6218576ef9
commit c2c0c4d879

View File

@@ -327,6 +327,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
@ColorInt int backgroundColorForTransition = 0;
final int wallpaperTransit = getWallpaperTransitType(info);
boolean isDisplayRotationAnimationStarted = false;
for (int i = info.getChanges().size() - 1; i >= 0; --i) {
final TransitionInfo.Change change = info.getChanges().get(i);
if (change.hasAllFlags(FLAG_IN_TASK_WITH_EMBEDDED_ACTIVITY
@@ -350,6 +351,7 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
if (!(isSeamlessDisplayChange || anim == ROTATION_ANIMATION_JUMPCUT)) {
startRotationAnimation(startTransaction, change, info, anim, animations,
onAnimFinish);
isDisplayRotationAnimationStarted = true;
continue;
}
} else {
@@ -405,6 +407,14 @@ public class DefaultTransitionHandler implements Transitions.TransitionHandler {
}
}
// Hide the invisible surface directly without animating it if there is a display
// rotation animation playing.
if (isDisplayRotationAnimationStarted && TransitionUtil.isClosingType(
change.getMode())) {
startTransaction.hide(change.getLeash());
continue;
}
// The back gesture has animated this change before transition happen, so here we don't
// play the animation again.
if (change.hasFlags(FLAG_BACK_GESTURE_ANIMATED)) {