Check animating accurately when assigning mAnimatingExit from relayout
Otherwise if the window is animating with type which won't report to WindowState#onExitAnimationDone (e.g. ANIMATION_TYPE_FIXED_TRANSFORM), the window will keep mAnimatingExit=true and visible logically. The condition from relayout now is aligned with WS#removeIfPossible. Also polish a case when launching app from notification with orientation change. The notification shade may animate collapsing panel so it should not be faded out. Fixes: 185554529 Test: DisplayContentTests#testApplyTopFixedRotationTransform Change-Id: I02943e37869bb2757ad38440fe281cf19b4ceec9
This commit is contained in:
@@ -66,9 +66,14 @@ public class FadeRotationAnimationController extends FadeAnimationController {
|
||||
} else {
|
||||
mNavBarToken = null;
|
||||
}
|
||||
// Do not fade notification shade when running fixed rotation (not frozen) because it may
|
||||
// need to animate with the launching app.
|
||||
final WindowState notificationShade = mFrozenTimeoutRunnable == null
|
||||
? displayPolicy.getNotificationShade() : null;
|
||||
displayContent.forAllWindows(w -> {
|
||||
if (w.mActivityRecord == null && w.mHasSurface && !w.mForceSeamlesslyRotate
|
||||
&& !w.mIsWallpaper && !w.mIsImWindow && w != navigationBar) {
|
||||
&& !w.mIsWallpaper && !w.mIsImWindow && w != navigationBar
|
||||
&& w != notificationShade) {
|
||||
mTargetWindowTokens.add(w.mToken);
|
||||
}
|
||||
}, true /* traverseTopToBottom */);
|
||||
|
||||
@@ -2510,7 +2510,8 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
} else if (win.isWinVisibleLw() && winAnimator.applyAnimationLocked(transit, false)) {
|
||||
focusMayChange = true;
|
||||
win.mAnimatingExit = true;
|
||||
} else if (win.mDisplayContent.okToAnimate() && win.isAnimating(TRANSITION | PARENTS)) {
|
||||
} else if (win.mDisplayContent.okToAnimate() && win.isAnimating(TRANSITION | PARENTS,
|
||||
WindowState.EXIT_ANIMATING_TYPES)) {
|
||||
// Currently in a hide animation... turn this into
|
||||
// an exit.
|
||||
win.mAnimatingExit = true;
|
||||
|
||||
@@ -132,6 +132,7 @@ import static com.android.server.wm.MoveAnimationSpecProto.FROM;
|
||||
import static com.android.server.wm.MoveAnimationSpecProto.TO;
|
||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_ALL;
|
||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
|
||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
|
||||
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_WINDOW_ANIMATION;
|
||||
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
|
||||
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
|
||||
@@ -517,6 +518,13 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
*/
|
||||
boolean mSurfacePlacementNeeded;
|
||||
|
||||
/**
|
||||
* The animation types that will call {@link #onExitAnimationDone} so {@link #mAnimatingExit}
|
||||
* is guaranteed to be cleared.
|
||||
*/
|
||||
static final int EXIT_ANIMATING_TYPES = ANIMATION_TYPE_APP_TRANSITION
|
||||
| ANIMATION_TYPE_WINDOW_ANIMATION | ANIMATION_TYPE_RECENTS;
|
||||
|
||||
/** Currently running an exit animation? */
|
||||
boolean mAnimatingExit;
|
||||
|
||||
@@ -2456,8 +2464,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
mWmService.mAccessibilityController.onWindowTransition(this, transit);
|
||||
}
|
||||
}
|
||||
final boolean isAnimating = mAnimatingExit || isAnimating(TRANSITION | PARENTS,
|
||||
ANIMATION_TYPE_APP_TRANSITION | ANIMATION_TYPE_WINDOW_ANIMATION)
|
||||
final boolean isAnimating = mAnimatingExit
|
||||
|| isAnimating(TRANSITION | PARENTS, EXIT_ANIMATING_TYPES)
|
||||
&& (mActivityRecord == null || !mActivityRecord.isWaitingForTransitionStart());
|
||||
final boolean lastWindowIsStartingWindow = startingWindow && mActivityRecord != null
|
||||
&& mActivityRecord.isLastWindow(this);
|
||||
|
||||
@@ -1292,7 +1292,8 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
assertNull(displayContent.getFadeRotationAnimationController());
|
||||
}
|
||||
|
||||
@UseTestDisplay(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR })
|
||||
@UseTestDisplay(addWindows = { W_ACTIVITY, W_WALLPAPER, W_STATUS_BAR, W_NAVIGATION_BAR,
|
||||
W_NOTIFICATION_SHADE })
|
||||
@Test
|
||||
public void testApplyTopFixedRotationTransform() {
|
||||
final DisplayPolicy displayPolicy = mDisplayContent.getDisplayPolicy();
|
||||
@@ -1300,6 +1301,7 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
doReturn(false).when(displayPolicy).navigationBarCanMove();
|
||||
displayPolicy.addWindowLw(mStatusBarWindow, mStatusBarWindow.mAttrs);
|
||||
displayPolicy.addWindowLw(mNavBarWindow, mNavBarWindow.mAttrs);
|
||||
displayPolicy.addWindowLw(mNotificationShadeWindow, mNotificationShadeWindow.mAttrs);
|
||||
makeWindowVisible(mStatusBarWindow, mNavBarWindow);
|
||||
final Configuration config90 = new Configuration();
|
||||
mDisplayContent.computeScreenConfiguration(config90, ROTATION_90);
|
||||
@@ -1324,10 +1326,10 @@ public class DisplayContentTests extends WindowTestsBase {
|
||||
false /* forceUpdate */));
|
||||
|
||||
assertNotNull(mDisplayContent.getFadeRotationAnimationController());
|
||||
assertTrue(mStatusBarWindow.getParent().isAnimating(WindowContainer.AnimationFlags.PARENTS,
|
||||
ANIMATION_TYPE_FIXED_TRANSFORM));
|
||||
assertTrue(mNavBarWindow.getParent().isAnimating(WindowContainer.AnimationFlags.PARENTS,
|
||||
ANIMATION_TYPE_FIXED_TRANSFORM));
|
||||
assertTrue(mStatusBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
|
||||
assertTrue(mNavBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
|
||||
// Notification shade may have its own view animation in real case so do not fade out it.
|
||||
assertFalse(mNotificationShadeWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
|
||||
|
||||
// If the visibility of insets state is changed, the rotated state should be updated too.
|
||||
final InsetsState rotatedState = app.getFixedRotationTransformInsetsState();
|
||||
|
||||
Reference in New Issue
Block a user