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

Commit b2d80612 authored by Winson Chung's avatar Winson Chung Committed by Automerger Merge Worker
Browse files

Fix a couple minor but visible issues am: 0764d9e8

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/12006512

Change-Id: I48856a8fe0f10148d4b5855210467fe7e2d31b79
parents 9c480bce 0764d9e8
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -480,6 +480,8 @@ public class PipTouchHandler {
                mSnapAlgorithm.getMovementBounds(curBounds, insetBounds,
                        toMovementBounds, mIsImeShowing ? mImeHeight : 0);
                final int prevBottom = mMovementBounds.bottom - mMovementBoundsExtraOffsets;
                // This is to handle landscape fullscreen IMEs, don't apply the extra offset in this
                // case
                final int toBottom = toMovementBounds.bottom < toMovementBounds.top
                        ? toMovementBounds.bottom
                        : toMovementBounds.bottom - extraOffset;
@@ -490,13 +492,19 @@ public class PipTouchHandler {
                            mSavedSnapFraction);
                }

                if ((Math.min(prevBottom, toBottom) - mBottomOffsetBufferPx) <= curBounds.top
                        && curBounds.top <= (Math.max(prevBottom, toBottom)
                                + mBottomOffsetBufferPx)) {
                if (prevBottom < toBottom) {
                    // The movement bounds are expanding
                    if (curBounds.top > prevBottom - mBottomOffsetBufferPx) {
                        mMotionHelper.animateToOffset(curBounds, toBottom - curBounds.top);
                    }
                } else if (prevBottom > toBottom) {
                    // The movement bounds are shrinking
                    if (curBounds.top > toBottom - mBottomOffsetBufferPx) {
                        mMotionHelper.animateToOffset(curBounds, toBottom - curBounds.top);
                    }
                }
            }
        }

        // Update the movement bounds after doing the calculations based on the old movement bounds
        // above
@@ -971,6 +979,8 @@ public class PipTouchHandler {
                }
                mShouldHideMenuAfterFling = mMenuState == MENU_STATE_NONE;

                // Reset the touch state on up before the fling settles
                mTouchState.reset();
                mMotionHelper.flingToSnapTarget(vel.x, vel.y,
                        PipTouchHandler.this::updateDismissFraction /* updateAction */,
                        this::flingEndAction /* endAction */);
@@ -997,7 +1007,6 @@ public class PipTouchHandler {
        }

        private void flingEndAction() {
            mTouchState.setAllowTouches(true);
            if (mShouldHideMenuAfterFling) {
                // If the menu is not visible, then we can still be showing the activity for the
                // dismiss overlay, so just finish it after the animation completes