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

Commit 40a5f935 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing animating bounds regression.

- Prior to ag/1954388, we used getAnimatingBounds() to get the final target
  bounds if animating or the current otherwise, but since we needed the
  target bounds to calculate the window scale even after the animation
  completes, the clearing of mBoundsAnimationTarget was removed.

  This inadvertently broke the check in getAnimatingBounds() from ever
  returning the current bounds (as it's never empty)!  This CL fixes the
  issue, and renames the related methods to better reflect what they are
  doing going forward.

  This caused a regression when calculating and notifying SysUI of the
  movement bounds, which was never the current bounds, but the default
  bounds.  Leading the IME change to trigger the PIP to move down.

Bug: 37242422
Test: android.server.cts.ActivityManagerPinnedStackTests
Test: Source hint rect animation still works

Change-Id: I532b0928ebfeaf95e9754a0254306af6fbb35833
parent 19953caa
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -71,7 +71,6 @@ import static android.os.Process.THREAD_GROUP_TOP_APP;
import static android.os.Process.THREAD_PRIORITY_BACKGROUND;
import static android.os.Process.THREAD_PRIORITY_FOREGROUND;
import static android.os.Process.getFreeMemory;
import static android.os.Process.getThreadPriority;
import static android.os.Process.getTotalMemory;
import static android.os.Process.isThreadInProcess;
import static android.os.Process.killProcess;
@@ -7895,7 +7894,7 @@ public class ActivityManagerService extends IActivityManager.Stub
                    // if it is not already expanding to fullscreen. Otherwise, the arguments will
                    // be used the next time the activity enters PiP
                    final PinnedActivityStack stack = r.getStack();
                    if (!stack.isBoundsAnimatingToFullscreen()) {
                    if (!stack.isAnimatingBoundsToFullscreen()) {
                        stack.setPictureInPictureAspectRatio(
                                r.pictureInPictureArgs.getAspectRatio());
                        stack.setPictureInPictureActions(r.pictureInPictureArgs.getActions());
+2 −3
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import android.graphics.Rect;
import com.android.server.am.ActivityStackSupervisor.ActivityContainer;
import com.android.server.wm.PinnedStackWindowController;
import com.android.server.wm.PinnedStackWindowListener;
import com.android.server.wm.StackWindowController;

import java.util.ArrayList;
import java.util.List;
@@ -57,8 +56,8 @@ class PinnedActivityStack extends ActivityStack<PinnedStackWindowController>
        getWindowContainerController().setPictureInPictureActions(actions);
    }

    boolean isBoundsAnimatingToFullscreen() {
        return getWindowContainerController().isBoundsAnimatingToFullscreen();
    boolean isAnimatingBoundsToFullscreen() {
        return getWindowContainerController().isAnimatingBoundsToFullscreen();
    }

    @Override
+1 −1
Original line number Diff line number Diff line
@@ -380,7 +380,7 @@ class PinnedStackController {
                final Rect animatingBounds = mTmpAnimatingBoundsRect;
                final TaskStack pinnedStack = mDisplayContent.getStackById(PINNED_STACK_ID);
                if (pinnedStack != null) {
                    pinnedStack.getAnimatingBounds(animatingBounds);
                    pinnedStack.getAnimationOrCurrentBounds(animatingBounds);
                } else {
                    animatingBounds.set(normalBounds);
                }
+4 −4
Original line number Diff line number Diff line
@@ -63,7 +63,7 @@ public class PinnedStackWindowController extends StackWindowController {

            final Rect originalBounds = new Rect();
            mContainer.getBounds(originalBounds);
            mContainer.setAnimatingBounds(sourceBounds, toBounds);
            mContainer.setAnimationFinalBounds(sourceBounds, toBounds);
            UiThread.getHandler().post(() -> {
                if (mContainer == null) {
                    return;
@@ -87,7 +87,7 @@ public class PinnedStackWindowController extends StackWindowController {
            final Rect toBounds = mService.getPictureInPictureBounds(displayId, aspectRatio,
                    true /* useExistingStackBounds */);
            final Rect targetBounds = new Rect();
            mContainer.getAnimatingBounds(targetBounds);
            mContainer.getAnimationOrCurrentBounds(targetBounds);
            final PinnedStackController pinnedStackController =
                    mContainer.getDisplayContent().getPinnedStackController();

@@ -118,8 +118,8 @@ public class PinnedStackWindowController extends StackWindowController {
    /**
     * @return whether the bounds are currently animating to fullscreen.
     */
    public boolean isBoundsAnimatingToFullscreen() {
        return mContainer.isBoundsAnimatingToFullscreen();
    public boolean isAnimatingBoundsToFullscreen() {
        return mContainer.isAnimatingBoundsToFullscreen();
    }

    public boolean pinnedStackResizeAllowed() {
+1 −2
Original line number Diff line number Diff line
@@ -595,8 +595,7 @@ class Task extends WindowContainer<AppWindowToken> implements DimLayer.DimLayerU
     * we will have a jump at the end.
     */
    boolean isFloating() {
        return StackId.tasksAreFloating(mStack.mStackId)
            && !mStack.isBoundsAnimatingToFullscreen();
        return StackId.tasksAreFloating(mStack.mStackId) && !mStack.isAnimatingBoundsToFullscreen();
    }

    WindowState getTopVisibleAppMainWindow() {
Loading