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

Commit ef4dc81d authored by Winson Chung's avatar Winson Chung
Browse files

Tightening up rotation behavior for PIP (3/3)

- Fixing up edge case when SysUI resizing conflicts with updating the
  display rotation bounds.  When an interaction causes both a display
  rotation and a resize from SystemUI, we should defer the resize animation
  until the rotation has been propagated to SystemUI, otherwise the bounds
  used will be incorrect.

Bug: 36879891
Test: android.server.cts.ActivityManagerPinnedStackTests
Change-Id: Ife1b7ab0c2f1f11f33cbc9614778ff49a28c79f6
parent 8bca9e47
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -28,4 +28,9 @@ interface IPinnedStackController {
     * Notifies the controller that the PiP is currently minimized.
     */
    oneway void setIsMinimized(boolean isMinimized);

    /**
     * @return what WM considers to be the current device rotation.
     */
    int getDisplayRotation();
}
+5 −1
Original line number Diff line number Diff line
@@ -41,9 +41,13 @@ oneway interface IPinnedStackListener {
     * current state with the aspect ratio applied.  The {@param animatingBounds} are provided
     * to indicate the current target bounds of the pinned stack (the final bounds if animating,
     * the current bounds if not), which may be helpful in calculating dependent animation bounds.
     *
     * The {@param displayRotation} is provided so that the client can verify when making certain
     * calls that it will not provide stale information based on an old display rotation (ie. if
     * the WM has changed in the mean time but the client has not received onMovementBoundsChanged).
     */
    void onMovementBoundsChanged(in Rect insetBounds, in Rect normalBounds, in Rect animatingBounds,
            boolean fromImeAdjustement);
            boolean fromImeAdjustement, int displayRotation);

    /**
     * Called when window manager decides to adjust the pinned stack bounds because of the IME, or
+2 −2
Original line number Diff line number Diff line
@@ -143,10 +143,10 @@ public class PipManager implements BasePipManager {

        @Override
        public void onMovementBoundsChanged(Rect insetBounds, Rect normalBounds,
                Rect animatingBounds, boolean fromImeAdjustement) {
                Rect animatingBounds, boolean fromImeAdjustement, int displayRotation) {
            mHandler.post(() -> {
                mTouchHandler.onMovementBoundsChanged(insetBounds, normalBounds, animatingBounds,
                        fromImeAdjustement);
                        fromImeAdjustement, displayRotation);
            });
        }

+7 −0
Original line number Diff line number Diff line
@@ -220,6 +220,13 @@ public class PipMenuActivity extends Activity {
        finish();
    }

    @Override
    protected void onStop() {
        super.onStop();

        cancelDelayedFinish();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
+7 −2
Original line number Diff line number Diff line
@@ -311,7 +311,8 @@ public class PipMotionHelper {
     * Animates the PiP from the expanded state to the normal state after the menu is hidden.
     */
    void animateToUnexpandedState(Rect normalBounds, float savedSnapFraction,
            Rect normalMovementBounds, Rect currentMovementBounds, boolean minimized) {
            Rect normalMovementBounds, Rect currentMovementBounds, boolean minimized,
            boolean immediate) {
        if (savedSnapFraction < 0f) {
            // If there are no saved snap fractions, then just use the current bounds
            savedSnapFraction = mSnapAlgorithm.getSnapFraction(new Rect(mBounds),
@@ -321,8 +322,12 @@ public class PipMotionHelper {
        if (minimized) {
            normalBounds = getClosestMinimizedBounds(normalBounds, normalMovementBounds);
        }
        if (immediate) {
            movePip(normalBounds);
        } else {
            resizeAndAnimatePipUnchecked(normalBounds, SHRINK_STACK_FROM_MENU_DURATION);
        }
    }

    /**
     * Animates the PiP to offset it from the IME.
Loading