Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +1 −6 Original line number Diff line number Diff line Loading @@ -397,12 +397,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio * Update the bounds used to save the re-entry size and snap fraction when exiting PIP. */ public void updateReentryBounds(Rect bounds) { // On phones, the expansion animation that happens on pip tap before restoring // to fullscreen makes it so that the last reported bounds are the expanded // bounds. We want to restore to the unexpanded bounds when re-entering pip, // so we use the bounds before expansion (normal) instead of the reported // bounds. Rect reentryBounds = mTouchHandler.getNormalBounds(); final Rect reentryBounds = mTouchHandler.getUserResizeBounds(); float snapFraction = mPipBoundsHandler.getSnapFraction(bounds); mPipBoundsHandler.applySnapFraction(reentryBounds, snapFraction); mReentryBounds.set(reentryBounds); Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java +11 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class PipResizeGestureHandler { private final Point mMaxSize = new Point(); private final Point mMinSize = new Point(); private final Rect mLastResizeBounds = new Rect(); private final Rect mUserResizeBounds = new Rect(); private final Rect mLastDownBounds = new Rect(); private final Rect mDragCornerSize = new Rect(); private final Rect mTmpTopLeftCorner = new Rect(); Loading Loading @@ -185,6 +186,7 @@ public class PipResizeGestureHandler { void onActivityUnpinned() { mIsAttached = false; mUserResizeBounds.setEmpty(); updateIsEnabled(); } Loading Loading @@ -333,6 +335,7 @@ public class PipResizeGestureHandler { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: if (!mLastResizeBounds.isEmpty()) { mUserResizeBounds.set(mLastResizeBounds); mPipTaskOrganizer.scheduleFinishResizePip(mLastResizeBounds, (Rect bounds) -> { new Handler(Looper.getMainLooper()).post(() -> { Loading @@ -357,6 +360,14 @@ public class PipResizeGestureHandler { mThresholdCrossed = false; } void setUserResizeBounds(Rect bounds) { mUserResizeBounds.set(bounds); } Rect getUserResizeBounds() { return mUserResizeBounds; } void updateMaxSize(int maxX, int maxY) { mMaxSize.set(maxX, maxY); } Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +7 −10 Original line number Diff line number Diff line Loading @@ -133,9 +133,6 @@ public class PipTouchHandler { // The current movement bounds private Rect mMovementBounds = new Rect(); // The current resized bounds, changed by user resize. // This is used during expand/un-expand to save/restore the user's resized size. @VisibleForTesting Rect mResizedBounds = new Rect(); // The reference inset bounds, used to determine the dismiss fraction private Rect mInsetBounds = new Rect(); Loading Loading @@ -380,7 +377,6 @@ public class PipTouchHandler { mFloatingContentCoordinator.onContentRemoved(mMotionHelper); } mResizedBounds.setEmpty(); mPipResizeGestureHandler.onActivityUnpinned(); } Loading @@ -390,9 +386,8 @@ public class PipTouchHandler { mMotionHelper.synchronizePinnedStackBounds(); updateMovementBounds(); if (direction == TRANSITION_DIRECTION_TO_PIP) { // updates mResizedBounds only if it's an entering PiP animation // mResized should be otherwise updated in setMenuState. mResizedBounds.set(mMotionHelper.getBounds()); // Set the initial bounds as the user resize bounds. mPipResizeGestureHandler.setUserResizeBounds(mMotionHelper.getBounds()); } if (mShowPipMenuOnAnimationEnd) { Loading Loading @@ -805,9 +800,7 @@ public class PipTouchHandler { // Save the current snap fraction and if we do not drag or move the PiP, then // we store back to this snap fraction. Otherwise, we'll reset the snap // fraction and snap to the closest edge. // Also save the current resized bounds so when the menu disappears, we can restore it. if (resize) { mResizedBounds.set(mMotionHelper.getBounds()); Rect expandedBounds = new Rect(mExpandedBounds); mSavedSnapFraction = mMotionHelper.animateToExpandedState(expandedBounds, mMovementBounds, mExpandedMovementBounds, callback); Loading Loading @@ -836,7 +829,7 @@ public class PipTouchHandler { } if (mDeferResizeToNormalBoundsUntilRotation == -1) { Rect restoreBounds = new Rect(mResizedBounds); Rect restoreBounds = new Rect(getUserResizeBounds()); Rect restoredMovementBounds = new Rect(); mSnapAlgorithm.getMovementBounds(restoreBounds, mInsetBounds, restoredMovementBounds, mIsImeShowing ? mImeHeight : 0); Loading Loading @@ -889,6 +882,10 @@ public class PipTouchHandler { return mNormalBounds; } Rect getUserResizeBounds() { return mPipResizeGestureHandler.getUserResizeBounds(); } /** * Gesture controlling normal movement of the PIP. */ Loading Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +1 −6 Original line number Diff line number Diff line Loading @@ -397,12 +397,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio * Update the bounds used to save the re-entry size and snap fraction when exiting PIP. */ public void updateReentryBounds(Rect bounds) { // On phones, the expansion animation that happens on pip tap before restoring // to fullscreen makes it so that the last reported bounds are the expanded // bounds. We want to restore to the unexpanded bounds when re-entering pip, // so we use the bounds before expansion (normal) instead of the reported // bounds. Rect reentryBounds = mTouchHandler.getNormalBounds(); final Rect reentryBounds = mTouchHandler.getUserResizeBounds(); float snapFraction = mPipBoundsHandler.getSnapFraction(bounds); mPipBoundsHandler.applySnapFraction(reentryBounds, snapFraction); mReentryBounds.set(reentryBounds); Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipResizeGestureHandler.java +11 −0 Original line number Diff line number Diff line Loading @@ -89,6 +89,7 @@ public class PipResizeGestureHandler { private final Point mMaxSize = new Point(); private final Point mMinSize = new Point(); private final Rect mLastResizeBounds = new Rect(); private final Rect mUserResizeBounds = new Rect(); private final Rect mLastDownBounds = new Rect(); private final Rect mDragCornerSize = new Rect(); private final Rect mTmpTopLeftCorner = new Rect(); Loading Loading @@ -185,6 +186,7 @@ public class PipResizeGestureHandler { void onActivityUnpinned() { mIsAttached = false; mUserResizeBounds.setEmpty(); updateIsEnabled(); } Loading Loading @@ -333,6 +335,7 @@ public class PipResizeGestureHandler { case MotionEvent.ACTION_UP: case MotionEvent.ACTION_CANCEL: if (!mLastResizeBounds.isEmpty()) { mUserResizeBounds.set(mLastResizeBounds); mPipTaskOrganizer.scheduleFinishResizePip(mLastResizeBounds, (Rect bounds) -> { new Handler(Looper.getMainLooper()).post(() -> { Loading @@ -357,6 +360,14 @@ public class PipResizeGestureHandler { mThresholdCrossed = false; } void setUserResizeBounds(Rect bounds) { mUserResizeBounds.set(bounds); } Rect getUserResizeBounds() { return mUserResizeBounds; } void updateMaxSize(int maxX, int maxY) { mMaxSize.set(maxX, maxY); } Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +7 −10 Original line number Diff line number Diff line Loading @@ -133,9 +133,6 @@ public class PipTouchHandler { // The current movement bounds private Rect mMovementBounds = new Rect(); // The current resized bounds, changed by user resize. // This is used during expand/un-expand to save/restore the user's resized size. @VisibleForTesting Rect mResizedBounds = new Rect(); // The reference inset bounds, used to determine the dismiss fraction private Rect mInsetBounds = new Rect(); Loading Loading @@ -380,7 +377,6 @@ public class PipTouchHandler { mFloatingContentCoordinator.onContentRemoved(mMotionHelper); } mResizedBounds.setEmpty(); mPipResizeGestureHandler.onActivityUnpinned(); } Loading @@ -390,9 +386,8 @@ public class PipTouchHandler { mMotionHelper.synchronizePinnedStackBounds(); updateMovementBounds(); if (direction == TRANSITION_DIRECTION_TO_PIP) { // updates mResizedBounds only if it's an entering PiP animation // mResized should be otherwise updated in setMenuState. mResizedBounds.set(mMotionHelper.getBounds()); // Set the initial bounds as the user resize bounds. mPipResizeGestureHandler.setUserResizeBounds(mMotionHelper.getBounds()); } if (mShowPipMenuOnAnimationEnd) { Loading Loading @@ -805,9 +800,7 @@ public class PipTouchHandler { // Save the current snap fraction and if we do not drag or move the PiP, then // we store back to this snap fraction. Otherwise, we'll reset the snap // fraction and snap to the closest edge. // Also save the current resized bounds so when the menu disappears, we can restore it. if (resize) { mResizedBounds.set(mMotionHelper.getBounds()); Rect expandedBounds = new Rect(mExpandedBounds); mSavedSnapFraction = mMotionHelper.animateToExpandedState(expandedBounds, mMovementBounds, mExpandedMovementBounds, callback); Loading Loading @@ -836,7 +829,7 @@ public class PipTouchHandler { } if (mDeferResizeToNormalBoundsUntilRotation == -1) { Rect restoreBounds = new Rect(mResizedBounds); Rect restoreBounds = new Rect(getUserResizeBounds()); Rect restoredMovementBounds = new Rect(); mSnapAlgorithm.getMovementBounds(restoreBounds, mInsetBounds, restoredMovementBounds, mIsImeShowing ? mImeHeight : 0); Loading Loading @@ -889,6 +882,10 @@ public class PipTouchHandler { return mNormalBounds; } Rect getUserResizeBounds() { return mPipResizeGestureHandler.getUserResizeBounds(); } /** * Gesture controlling normal movement of the PIP. */ Loading