Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java +9 −1 Original line number Diff line number Diff line Loading @@ -367,7 +367,15 @@ public class PipBoundsAlgorithm { * the default stack bounds when first entering PiP. */ public float getSnapFraction(Rect stackBounds) { return mSnapAlgorithm.getSnapFraction(stackBounds, getMovementBounds(stackBounds)); return getSnapFraction(stackBounds, getMovementBounds(stackBounds)); } /** * @return the default snap fraction to apply instead of the default gravity when calculating * the default stack bounds when first entering PiP. */ public float getSnapFraction(Rect stackBounds, Rect movementBounds) { return mSnapAlgorithm.getSnapFraction(stackBounds, movementBounds); } /** Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java +12 −1 Original line number Diff line number Diff line Loading @@ -517,7 +517,18 @@ public class PipResizeGestureHandler { || mLastResizeBounds.height() >= PINCH_RESIZE_AUTO_MAX_RATIO * mMaxSize.y) { resizeRectAboutCenter(mLastResizeBounds, mMaxSize.x, mMaxSize.y); } final float snapFraction = mPipBoundsAlgorithm.getSnapFraction(mLastResizeBounds); final int leftEdge = mLastResizeBounds.left; final Rect movementBounds = mPipBoundsAlgorithm.getMovementBounds(mLastResizeBounds); final int fromLeft = Math.abs(leftEdge - movementBounds.left); final int fromRight = Math.abs(movementBounds.right - leftEdge); // The PIP will be snapped to either the right or left edge, so calculate which one // is closest to the current position. final int newLeft = fromLeft < fromRight ? movementBounds.left : movementBounds.right; mLastResizeBounds.offsetTo(newLeft, mLastResizeBounds.top); final float snapFraction = mPipBoundsAlgorithm.getSnapFraction( mLastResizeBounds, movementBounds); mPipBoundsAlgorithm.applySnapFraction(mLastResizeBounds, snapFraction); mPipTaskOrganizer.scheduleAnimateResizePip(startBounds, mLastResizeBounds, PINCH_RESIZE_SNAP_DURATION, mAngle, callback); Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java +9 −1 Original line number Diff line number Diff line Loading @@ -367,7 +367,15 @@ public class PipBoundsAlgorithm { * the default stack bounds when first entering PiP. */ public float getSnapFraction(Rect stackBounds) { return mSnapAlgorithm.getSnapFraction(stackBounds, getMovementBounds(stackBounds)); return getSnapFraction(stackBounds, getMovementBounds(stackBounds)); } /** * @return the default snap fraction to apply instead of the default gravity when calculating * the default stack bounds when first entering PiP. */ public float getSnapFraction(Rect stackBounds, Rect movementBounds) { return mSnapAlgorithm.getSnapFraction(stackBounds, movementBounds); } /** Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipResizeGestureHandler.java +12 −1 Original line number Diff line number Diff line Loading @@ -517,7 +517,18 @@ public class PipResizeGestureHandler { || mLastResizeBounds.height() >= PINCH_RESIZE_AUTO_MAX_RATIO * mMaxSize.y) { resizeRectAboutCenter(mLastResizeBounds, mMaxSize.x, mMaxSize.y); } final float snapFraction = mPipBoundsAlgorithm.getSnapFraction(mLastResizeBounds); final int leftEdge = mLastResizeBounds.left; final Rect movementBounds = mPipBoundsAlgorithm.getMovementBounds(mLastResizeBounds); final int fromLeft = Math.abs(leftEdge - movementBounds.left); final int fromRight = Math.abs(movementBounds.right - leftEdge); // The PIP will be snapped to either the right or left edge, so calculate which one // is closest to the current position. final int newLeft = fromLeft < fromRight ? movementBounds.left : movementBounds.right; mLastResizeBounds.offsetTo(newLeft, mLastResizeBounds.top); final float snapFraction = mPipBoundsAlgorithm.getSnapFraction( mLastResizeBounds, movementBounds); mPipBoundsAlgorithm.applySnapFraction(mLastResizeBounds, snapFraction); mPipTaskOrganizer.scheduleAnimateResizePip(startBounds, mLastResizeBounds, PINCH_RESIZE_SNAP_DURATION, mAngle, callback); Loading