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

Commit 8571866c authored by lumark's avatar lumark
Browse files

Fix some cases when enabling hierarchical animation

- Fix split-screen primary stack's thumbnail won't animate:
    - in ActivityRecord#attachThumbnailAnimation, using WC#getAnimatingContainer
      to align the current animating layer.

- Fix animation surface position shifted when launching activity in
  split-screen secondary stack:
    - Using WC#getRelativeDisplayedPosition in WC#getAnimationAdapter
    to get relative position of leash parent.

Also, refined below logics:
- Refine logics in WindowContainer#getAnimationBounds with
  getDisplayBounds for fixing a regression issue that launching activity
  from split screen secondary stack the animation will moving to top stack rather
  then moving to bottom stack.

Bug: 142617871
Bug: 131661052

Test: Refectoring CL, all existing tests passed.
Test: Manual testing for:
      1) Enable hierarchical animation flag by using adb command:
         adb shell setprop persist.wm.hierarchical_animations 1
      2) Entering split-screen mode from recents app.
      3) Make sure task scroll-up thumbnail animation for split-screen primary
         stack can animated.
      4) Launch app to split-screen secondary stack, make sure launching
      animation position will right below divider instead going to top-side
      of screen.

Change-Id: I3ccc39ab1f3f02cecff8631512dc94f2f01c4be3
parent e8bab797
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -5934,7 +5934,11 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            mAnimationBoundsLayer = createAnimationBoundsLayer(t);

            // Crop to stack bounds.
            if (!WindowManagerService.sHierarchicalAnimations) {
                // For Hierarchical animation, we don't need to set window crop since the leash
                // surface size has already same as the animating container.
                t.setWindowCrop(mAnimationBoundsLayer, mTmpRect);
            }
            t.setLayer(mAnimationBoundsLayer, layer);

            // Reparent leash to animation bounds layer.
@@ -5982,9 +5986,10 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
            return;
        }
        clearThumbnail();
        final Transaction transaction = getAnimatingContainer().getPendingTransaction();
        mThumbnail = new WindowContainerThumbnail(mWmService.mSurfaceFactory,
                getPendingTransaction(), this, thumbnailHeader);
        mThumbnail.startAnimation(getPendingTransaction(), loadThumbnailAnimation(thumbnailHeader));
                transaction, getAnimatingContainer(), thumbnailHeader);
        mThumbnail.startAnimation(transaction, loadThumbnailAnimation(thumbnailHeader));
    }

    /**
@@ -6011,13 +6016,13 @@ final class ActivityRecord extends WindowToken implements WindowManagerService.A
        if (thumbnail == null) {
            return;
        }
        final Transaction transaction = getAnimatingContainer().getPendingTransaction();
        mThumbnail = new WindowContainerThumbnail(mWmService.mSurfaceFactory,
                getPendingTransaction(), this, thumbnail);
                transaction, getAnimatingContainer(), thumbnail);
        final Animation animation =
                getDisplayContent().mAppTransition.createCrossProfileAppsThumbnailAnimationLocked(
                        win.getFrameLw());
        mThumbnail.startAnimation(getPendingTransaction(), animation, new Point(frame.left,
                frame.top));
        mThumbnail.startAnimation(transaction, animation, new Point(frame.left, frame.top));
    }

    private Animation loadThumbnailAnimation(GraphicBuffer thumbnailHeader) {
+7 −2
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@ import static com.android.server.wm.WindowManagerDebugConfig.DEBUG_ANIM;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WITH_CLASS_NAME;
import static com.android.server.wm.WindowManagerDebugConfig.TAG_WM;
import static com.android.server.wm.WindowManagerService.logWithStack;
import static com.android.server.wm.WindowManagerService.sHierarchicalAnimations;
import static com.android.server.wm.WindowStateAnimator.STACK_CLIP_AFTER_ANIM;

import android.annotation.CallSuper;
@@ -1855,7 +1856,7 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<
    // TODO: Remove this and use #getBounds() instead once we set an app transition animation
    // on TaskStack.
    Rect getAnimationBounds(int appStackClipMode) {
        return getBounds();
        return getDisplayedBounds();
    }

    /**
@@ -1929,7 +1930,11 @@ class WindowContainer<E extends WindowContainer> extends ConfigurationContainer<

        // Separate position and size for use in animators.
        mTmpRect.set(getAnimationBounds(appStackClipMode));
        if (sHierarchicalAnimations) {
            getRelativeDisplayedPosition(mTmpPoint);
        } else {
            mTmpPoint.set(mTmpRect.left, mTmpRect.top);
        }
        mTmpRect.offsetTo(0, 0);

        final RemoteAnimationController controller =