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

Commit 312da011 authored by wilsonshih's avatar wilsonshih
Browse files

Decompose prepareAnimationIfNeeded into smaller methods.

Use AnimationHandler to create animation leashes, which can
support Activity and Task, also help handle release animation leashes.
Also fix the opening animation leash get higher z-order than closing
animation leash.

Reimplement back-to-home, cross-activity, cross-task animation by the
AnimationHandler, and by decompose prepareAnimationIfNeeded into a
builder class, it should be easier to maintain.

Preparing to adapt for windowless starting surface, which will draw
either splash or snapshot surface on the animation leash.

Bug: 131727607
Bug: 238474994
Test: atest BackNavigationControllerTests
Test: do back gesture on both shell/legacy transiton system, verify
no flicker happen either trigger back. Also verify no surface left
after transition finish.

Change-Id: I27f1df85fab792bbbcdcc430e087a3a38a74f1cc
parent 5975f9dc
Loading
Loading
Loading
Loading
+413 −288

File changed.

Preview size limit exceeded, changes collapsed.

+8 −1
Original line number Diff line number Diff line
@@ -564,6 +564,11 @@ class SurfaceAnimator {
     */
    public static final int ANIMATION_TYPE_STARTING_REVEAL = 1 << 7;

    /**
     * Animation when a back gesture animation is applied to a window container.
     * @hide
     */
    public static final int ANIMATION_TYPE_PREDICT_BACK = 1 << 8;
    /**
     * Bitmask to include all animation types. This is NOT an {@link AnimationType}
     * @hide
@@ -583,7 +588,8 @@ class SurfaceAnimator {
            ANIMATION_TYPE_WINDOW_ANIMATION,
            ANIMATION_TYPE_INSETS_CONTROL,
            ANIMATION_TYPE_TOKEN_TRANSFORM,
            ANIMATION_TYPE_STARTING_REVEAL
            ANIMATION_TYPE_STARTING_REVEAL,
            ANIMATION_TYPE_PREDICT_BACK
    })
    @Retention(RetentionPolicy.SOURCE)
    @interface AnimationType {}
@@ -602,6 +608,7 @@ class SurfaceAnimator {
            case ANIMATION_TYPE_INSETS_CONTROL: return "insets_animation";
            case ANIMATION_TYPE_TOKEN_TRANSFORM: return "token_transform";
            case ANIMATION_TYPE_STARTING_REVEAL: return "starting_reveal";
            case ANIMATION_TYPE_PREDICT_BACK: return "predict_back";
            default: return "unknown type:" + type;
        }
    }
+8 −0
Original line number Diff line number Diff line
@@ -722,6 +722,14 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
        return true;
    }

    boolean isSupportWindowlessStartingSurface() {
        // Enable after ag/20426257
        final ITaskOrganizer lastOrganizer = mTaskOrganizers.peekLast();
        if (lastOrganizer == null) {
            return false;
        }
        return false;
    }
    /**
     * Notify the shell ({@link com.android.wm.shell.ShellTaskOrganizer} that the client has
     * removed the splash screen view.
+2 −7
Original line number Diff line number Diff line
@@ -32,7 +32,6 @@ import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;

import android.annotation.NonNull;
@@ -92,9 +91,7 @@ public class BackNavigationControllerTests extends WindowTestsBase {
                .isEqualTo(typeToString(BackNavigationInfo.TYPE_RETURN_TO_HOME));

        // verify if back animation would start.
        verify(mBackNavigationController).scheduleAnimationLocked(
                eq(BackNavigationInfo.TYPE_RETURN_TO_HOME), any(), eq(mBackAnimationAdapter),
                any());
        assertTrue("Animation scheduled", backNavigationInfo.isPrepareRemoteAnimation());
    }

    @Test
@@ -111,9 +108,7 @@ public class BackNavigationControllerTests extends WindowTestsBase {
                .isEqualTo(typeToString(BackNavigationInfo.TYPE_CROSS_TASK));

        // verify if back animation would start.
        verify(mBackNavigationController).scheduleAnimationLocked(
                eq(BackNavigationInfo.TYPE_CROSS_TASK), any(), eq(mBackAnimationAdapter),
                any());
        assertTrue("Animation scheduled", backNavigationInfo.isPrepareRemoteAnimation());

        // reset drawning status
        topTask.forAllWindows(w -> {