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

Commit 40ae2b00 authored by Riddle Hsu's avatar Riddle Hsu Committed by Android (Google) Code Review
Browse files

Merge "Use surface position for starting reveal animation" into main

parents a307da6c 73b61057
Loading
Loading
Loading
Loading
+8 −13
Original line number Diff line number Diff line
@@ -573,7 +573,7 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {

    // Capture the animation surface control for activity's main window
    static class StartingWindowAnimationAdaptor implements AnimationAdapter {
        SurfaceControl mAnimationLeash;

        @Override
        public boolean getShowWallpaper() {
            return false;
@@ -582,14 +582,10 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
        @Override
        public void startAnimation(SurfaceControl animationLeash, SurfaceControl.Transaction t,
                int type, @NonNull SurfaceAnimator.OnAnimationFinishedCallback finishCallback) {
            mAnimationLeash = animationLeash;
        }

        @Override
        public void onAnimationCancelled(SurfaceControl animationLeash) {
            if (mAnimationLeash == animationLeash) {
                mAnimationLeash = null;
            }
        }

        @Override
@@ -604,9 +600,6 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {

        @Override
        public void dump(PrintWriter pw, String prefix) {
            pw.print(prefix + "StartingWindowAnimationAdaptor mCapturedLeash=");
            pw.print(mAnimationLeash);
            pw.println();
        }

        @Override
@@ -616,16 +609,16 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {

    static SurfaceControl applyStartingWindowAnimation(WindowState window) {
        final SurfaceControl.Transaction t = window.getPendingTransaction();
        final Rect mainFrame = window.getRelativeFrame();
        final StartingWindowAnimationAdaptor adaptor = new StartingWindowAnimationAdaptor();
        window.startAnimation(t, adaptor, false, ANIMATION_TYPE_STARTING_REVEAL);
        if (adaptor.mAnimationLeash == null) {
        final SurfaceControl leash = window.getAnimationLeash();
        if (leash == null) {
            Slog.e(TAG, "Cannot start starting window animation, the window " + window
                    + " was removed");
            return null;
        }
        t.setPosition(adaptor.mAnimationLeash, mainFrame.left, mainFrame.top);
        return adaptor.mAnimationLeash;
        t.setPosition(leash, window.mSurfacePosition.x, window.mSurfacePosition.y);
        return leash;
    }

    boolean addStartingWindow(Task task, ActivityRecord activity, int launchTheme,
@@ -696,7 +689,9 @@ class TaskOrganizerController extends ITaskOrganizerController.Stub {
                removalInfo.roundedCornerRadius =
                        topActivity.mLetterboxUiController.getRoundedCornersRadius(mainWindow);
                removalInfo.windowAnimationLeash = applyStartingWindowAnimation(mainWindow);
                removalInfo.mainFrame = mainWindow.getRelativeFrame();
                removalInfo.mainFrame = new Rect(mainWindow.getFrame());
                removalInfo.mainFrame.offsetTo(mainWindow.mSurfacePosition.x,
                        mainWindow.mSurfacePosition.y);
            }
        }
        try {
+2 −1
Original line number Diff line number Diff line
@@ -695,7 +695,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
     */
    private boolean mDrawnStateEvaluated;

    private final Point mSurfacePosition = new Point();
    /** The surface position relative to the parent container. */
    final Point mSurfacePosition = new Point();

    /**
     * A region inside of this window to be excluded from touch.