Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bb1f7b38 authored by Issei Suzuki's avatar Issei Suzuki
Browse files

Fixed animation type for animation on the navigation bar.

Bug: 233092166
Test: atest RecentsAnimationControlelrTest
Change-Id: I8779b4b9c3d351f1d2bfdb85e109ec17bdd776c0
parent e2049a89
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -20,7 +20,7 @@ import static android.view.WindowManager.LayoutParams.ROTATION_ANIMATION_SEAMLES
import static android.view.WindowManager.LayoutParams.TYPE_NAVIGATION_BAR;
import static android.view.WindowManager.LayoutParams.TYPE_NOTIFICATION_SHADE;

import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_FIXED_TRANSFORM;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_TOKEN_TRANSFORM;

import android.annotation.IntDef;
import android.os.HandlerExecutor;
@@ -224,7 +224,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
            if (DEBUG) Slog.d(TAG, "finishOp fade-in " + windowToken.getTopChild());
            // The previous animation leash will be dropped when preparing fade-in animation, so
            // simply apply new animation without restoring the transformation.
            fadeWindowToken(true /* show */, windowToken, ANIMATION_TYPE_FIXED_TRANSFORM);
            fadeWindowToken(true /* show */, windowToken, ANIMATION_TYPE_TOKEN_TRANSFORM);
        } else if (op.mAction == Operation.ACTION_SEAMLESS && mRotator != null
                && op.mLeash != null && op.mLeash.isValid()) {
            if (DEBUG) Slog.d(TAG, "finishOp undo seamless " + windowToken.getTopChild());
@@ -298,7 +298,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
            final WindowToken windowToken = mTargetWindowTokens.keyAt(i);
            final Operation op = mTargetWindowTokens.valueAt(i);
            if (op.mAction == Operation.ACTION_FADE) {
                fadeWindowToken(false /* show */, windowToken, ANIMATION_TYPE_FIXED_TRANSFORM);
                fadeWindowToken(false /* show */, windowToken, ANIMATION_TYPE_TOKEN_TRANSFORM);
                op.mLeash = windowToken.getAnimationLeash();
                if (DEBUG) Slog.d(TAG, "Start fade-out " + windowToken.getTopChild());
            } else if (op.mAction == Operation.ACTION_SEAMLESS) {
@@ -332,7 +332,7 @@ class AsyncRotationController extends FadeAnimationController implements Consume
        mHideImmediately = true;
        final Operation op = new Operation(Operation.ACTION_FADE);
        mTargetWindowTokens.put(windowToken, op);
        fadeWindowToken(false /* show */, windowToken, ANIMATION_TYPE_FIXED_TRANSFORM);
        fadeWindowToken(false /* show */, windowToken, ANIMATION_TYPE_TOKEN_TRANSFORM);
        op.mLeash = windowToken.getAnimationLeash();
        mHideImmediately = original;
        if (DEBUG) Slog.d(TAG, "hideImmediately " + windowToken.getTopChild());
+2 −2
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@

package com.android.server.wm;

import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_TOKEN_TRANSFORM;

import android.annotation.NonNull;
import android.view.SurfaceControl;
@@ -83,7 +83,7 @@ public class NavBarFadeAnimationController extends FadeAnimationController{
        final AsyncRotationController controller =
                mDisplayContent.getAsyncRotationController();
        final Runnable fadeAnim = () -> fadeWindowToken(show, mNavigationBar.mToken,
                ANIMATION_TYPE_APP_TRANSITION);
                ANIMATION_TYPE_TOKEN_TRANSFORM);
        if (controller == null) {
            fadeAnim.run();
        } else if (!controller.isTargetToken(mNavigationBar.mToken)) {
+4 −4
Original line number Diff line number Diff line
@@ -553,10 +553,10 @@ class SurfaceAnimator {
    public static final int ANIMATION_TYPE_INSETS_CONTROL = 1 << 5;

    /**
     * Animation when a fixed rotation transform is applied to a window token.
     * Animation applied to a non-app window token, e.g. a fixed rotation transform.
     * @hide
     */
    public static final int ANIMATION_TYPE_FIXED_TRANSFORM = 1 << 6;
    public static final int ANIMATION_TYPE_TOKEN_TRANSFORM = 1 << 6;

    /**
     * Animation when a reveal starting window animation is applied to app window.
@@ -582,7 +582,7 @@ class SurfaceAnimator {
            ANIMATION_TYPE_RECENTS,
            ANIMATION_TYPE_WINDOW_ANIMATION,
            ANIMATION_TYPE_INSETS_CONTROL,
            ANIMATION_TYPE_FIXED_TRANSFORM,
            ANIMATION_TYPE_TOKEN_TRANSFORM,
            ANIMATION_TYPE_STARTING_REVEAL
    })
    @Retention(RetentionPolicy.SOURCE)
@@ -600,7 +600,7 @@ class SurfaceAnimator {
            case ANIMATION_TYPE_RECENTS: return "recents_animation";
            case ANIMATION_TYPE_WINDOW_ANIMATION: return "window_animation";
            case ANIMATION_TYPE_INSETS_CONTROL: return "insets_animation";
            case ANIMATION_TYPE_FIXED_TRANSFORM: return "fixed_rotation";
            case ANIMATION_TYPE_TOKEN_TRANSFORM: return "token_transform";
            case ANIMATION_TYPE_STARTING_REVEAL: return "starting_reveal";
            default: return "unknown type:" + type;
        }
+6 −6
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ import static com.android.dx.mockito.inline.extended.ExtendedMockito.verify;
import static com.android.server.wm.ActivityTaskSupervisor.ON_TOP;
import static com.android.server.wm.DisplayContent.IME_TARGET_LAYERING;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_APP_TRANSITION;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_FIXED_TRANSFORM;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_TOKEN_TRANSFORM;
import static com.android.server.wm.WindowContainer.AnimationFlags.PARENTS;
import static com.android.server.wm.WindowContainer.AnimationFlags.TRANSITION;
import static com.android.server.wm.WindowContainer.POSITION_TOP;
@@ -1439,7 +1439,7 @@ public class DisplayContentTests extends WindowTestsBase {
        displayContent.setRotationAnimation(rotationAnim);
        // The fade rotation animation also starts to hide some non-app windows.
        assertNotNull(displayContent.getAsyncRotationController());
        assertTrue(statusBar.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(statusBar.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_TRANSFORM));

        for (WindowState w : windows) {
            w.setOrientationChanging(true);
@@ -1493,10 +1493,10 @@ public class DisplayContentTests extends WindowTestsBase {
        final AsyncRotationController asyncRotationController =
                mDisplayContent.getAsyncRotationController();
        assertNotNull(asyncRotationController);
        assertTrue(mStatusBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(mNavBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(mStatusBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_TRANSFORM));
        assertTrue(mNavBarWindow.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_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));
        assertFalse(mNotificationShadeWindow.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_TRANSFORM));

        // If the visibility of insets state is changed, the rotated state should be updated too.
        final InsetsState rotatedState = app.getFixedRotationTransformInsetsState();
@@ -1567,7 +1567,7 @@ public class DisplayContentTests extends WindowTestsBase {
                app.token, app.token, mDisplayContent.mDisplayId);
        assertTrue(asyncRotationController.isTargetToken(mImeWindow.mToken));
        assertTrue(mImeWindow.mToken.hasFixedRotationTransform());
        assertTrue(mImeWindow.isAnimating(PARENTS, ANIMATION_TYPE_FIXED_TRANSFORM));
        assertTrue(mImeWindow.isAnimating(PARENTS, ANIMATION_TYPE_TOKEN_TRANSFORM));

        // The fixed rotation transform can only be finished when all animation finished.
        doReturn(false).when(app2).isAnimating(anyInt(), anyInt());
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ import static com.android.server.wm.RecentsAnimationController.REORDER_KEEP_IN_P
import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_ORIGINAL_POSITION;
import static com.android.server.wm.RecentsAnimationController.REORDER_MOVE_TO_TOP;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_RECENTS;
import static com.android.server.wm.SurfaceAnimator.ANIMATION_TYPE_TOKEN_TRANSFORM;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
@@ -595,6 +596,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
                eq(mDefaultDisplay.mDisplayId), eq(true));
        verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
        assertFalse(mController.isNavigationBarAttachedToApp());
        assertTrue(navToken.isAnimating(ANIMATION_TYPE_TOKEN_TRANSFORM));
    }

    @Test
@@ -622,6 +624,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
        verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
        verify(transaction).reparent(navToken.getSurfaceControl(), parent.getSurfaceControl());
        assertFalse(mController.isNavigationBarAttachedToApp());
        assertFalse(navToken.isAnimating(ANIMATION_TYPE_TOKEN_TRANSFORM));
    }

    @Test
@@ -649,6 +652,7 @@ public class RecentsAnimationControllerTest extends WindowTestsBase {
                eq(mDefaultDisplay.mDisplayId), eq(true));
        verify(transaction).setLayer(navToken.getSurfaceControl(), 0);
        assertFalse(mController.isNavigationBarAttachedToApp());
        assertTrue(navToken.isAnimating(ANIMATION_TYPE_TOKEN_TRANSFORM));
    }

    @Test