Loading core/java/com/android/internal/policy/PipSnapAlgorithm.java +6 −3 Original line number Diff line number Diff line Loading @@ -128,11 +128,14 @@ public class PipSnapAlgorithm { /** * Applies the offset to the {@param stackBounds} to adjust it to a minimized state. */ public void applyMinimizedOffset(Rect stackBounds, Rect movementBounds, Point displaySize) { public void applyMinimizedOffset(Rect stackBounds, Rect movementBounds, Point displaySize, Rect stableInsets) { if (stackBounds.left <= movementBounds.centerX()) { stackBounds.offsetTo(-stackBounds.width() + mMinimizedVisibleSize, stackBounds.top); stackBounds.offsetTo(stableInsets.left + mMinimizedVisibleSize - stackBounds.width(), stackBounds.top); } else { stackBounds.offsetTo(displaySize.x - mMinimizedVisibleSize, stackBounds.top); stackBounds.offsetTo(displaySize.x - stableInsets.right - mMinimizedVisibleSize, stackBounds.top); } } Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +4 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ public class PipTouchHandler implements TunerService.Tunable { // Allow the PIP to be "docked" slightly offscreen private boolean mEnableMinimizing = true; private final Rect mStableInsets = new Rect(); private final Rect mPinnedStackBounds = new Rect(); private final Rect mBoundedPinnedStackBounds = new Rect(); private ValueAnimator mPinnedStackBoundsAnimator = null; Loading Loading @@ -421,7 +422,8 @@ public class PipTouchHandler implements TunerService.Tunable { mContext.getDisplay().getRealSize(displaySize); Rect toBounds = mSnapAlgorithm.findClosestSnapBounds(mBoundedPinnedStackBounds, mPinnedStackBounds); mSnapAlgorithm.applyMinimizedOffset(toBounds, mBoundedPinnedStackBounds, displaySize); mSnapAlgorithm.applyMinimizedOffset(toBounds, mBoundedPinnedStackBounds, displaySize, mStableInsets); mPinnedStackBoundsAnimator = mMotionHelper.createAnimationToBounds(mPinnedStackBounds, toBounds, MINIMIZE_STACK_MAX_DURATION, LINEAR_OUT_SLOW_IN, mUpdatePinnedStackBoundsListener); Loading Loading @@ -528,6 +530,7 @@ public class PipTouchHandler implements TunerService.Tunable { if (updatePinnedStackBounds) { mPinnedStackBounds.set(info.bounds); } mWindowManager.getStableInsets(info.displayId, mStableInsets); mBoundedPinnedStackBounds.set(mWindowManager.getPictureInPictureMovementBounds( info.displayId)); } Loading services/core/java/com/android/server/wm/PinnedStackController.java +7 −3 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ class PinnedStackController { // Used to calculate stack bounds across rotations private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Rect mStableInsets = new Rect(); // The size and position information that describes where the pinned stack will go by default. private int mDefaultStackGravity; Loading Loading @@ -250,10 +251,12 @@ class PinnedStackController { } /** * @return the repositioned PIP bounds given it's pre-change bounds, and the new display info. * @return the repositioned PIP bounds given it's pre-change bounds, and the new display * content. */ Rect onDisplayChanged(Rect preChangeStackBounds, DisplayInfo displayInfo) { Rect onDisplayChanged(Rect preChangeStackBounds, DisplayContent displayContent) { final Rect postChangeStackBounds = new Rect(preChangeStackBounds); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); if (!mDisplayInfo.equals(displayInfo)) { // Calculate the snap fraction of the current stack along the old movement bounds, and // then update the stack bounds to the same fraction along the rotated movement bounds. Loading @@ -269,8 +272,9 @@ class PinnedStackController { if (mIsMinimized) { final Point displaySize = new Point(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight); mService.getStableInsetsLocked(displayContent.getDisplayId(), mStableInsets); mSnapAlgorithm.applyMinimizedOffset(postChangeStackBounds, postChangeMovementBounds, displaySize); displaySize, mStableInsets); } } return postChangeStackBounds; Loading services/core/java/com/android/server/wm/TaskStack.java +2 −2 Original line number Diff line number Diff line Loading @@ -413,7 +413,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye switch (mStackId) { case PINNED_STACK_ID: mTmpRect2 = mDisplayContent.getPinnedStackController().onDisplayChanged(mBounds, getDisplayInfo()); mDisplayContent); break; case DOCKED_STACK_ID: repositionDockedStackAfterRotation(mTmpRect2); Loading Loading @@ -684,7 +684,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye // Update the pinned stack controller after the display info is updated if (mStackId == PINNED_STACK_ID) { mDisplayContent.getPinnedStackController().onDisplayChanged(oldBounds, getDisplayInfo()); mDisplayContent); } super.onDisplayChanged(dc); Loading Loading
core/java/com/android/internal/policy/PipSnapAlgorithm.java +6 −3 Original line number Diff line number Diff line Loading @@ -128,11 +128,14 @@ public class PipSnapAlgorithm { /** * Applies the offset to the {@param stackBounds} to adjust it to a minimized state. */ public void applyMinimizedOffset(Rect stackBounds, Rect movementBounds, Point displaySize) { public void applyMinimizedOffset(Rect stackBounds, Rect movementBounds, Point displaySize, Rect stableInsets) { if (stackBounds.left <= movementBounds.centerX()) { stackBounds.offsetTo(-stackBounds.width() + mMinimizedVisibleSize, stackBounds.top); stackBounds.offsetTo(stableInsets.left + mMinimizedVisibleSize - stackBounds.width(), stackBounds.top); } else { stackBounds.offsetTo(displaySize.x - mMinimizedVisibleSize, stackBounds.top); stackBounds.offsetTo(displaySize.x - stableInsets.right - mMinimizedVisibleSize, stackBounds.top); } } Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +4 −1 Original line number Diff line number Diff line Loading @@ -87,6 +87,7 @@ public class PipTouchHandler implements TunerService.Tunable { // Allow the PIP to be "docked" slightly offscreen private boolean mEnableMinimizing = true; private final Rect mStableInsets = new Rect(); private final Rect mPinnedStackBounds = new Rect(); private final Rect mBoundedPinnedStackBounds = new Rect(); private ValueAnimator mPinnedStackBoundsAnimator = null; Loading Loading @@ -421,7 +422,8 @@ public class PipTouchHandler implements TunerService.Tunable { mContext.getDisplay().getRealSize(displaySize); Rect toBounds = mSnapAlgorithm.findClosestSnapBounds(mBoundedPinnedStackBounds, mPinnedStackBounds); mSnapAlgorithm.applyMinimizedOffset(toBounds, mBoundedPinnedStackBounds, displaySize); mSnapAlgorithm.applyMinimizedOffset(toBounds, mBoundedPinnedStackBounds, displaySize, mStableInsets); mPinnedStackBoundsAnimator = mMotionHelper.createAnimationToBounds(mPinnedStackBounds, toBounds, MINIMIZE_STACK_MAX_DURATION, LINEAR_OUT_SLOW_IN, mUpdatePinnedStackBoundsListener); Loading Loading @@ -528,6 +530,7 @@ public class PipTouchHandler implements TunerService.Tunable { if (updatePinnedStackBounds) { mPinnedStackBounds.set(info.bounds); } mWindowManager.getStableInsets(info.displayId, mStableInsets); mBoundedPinnedStackBounds.set(mWindowManager.getPictureInPictureMovementBounds( info.displayId)); } Loading
services/core/java/com/android/server/wm/PinnedStackController.java +7 −3 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ class PinnedStackController { // Used to calculate stack bounds across rotations private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Rect mStableInsets = new Rect(); // The size and position information that describes where the pinned stack will go by default. private int mDefaultStackGravity; Loading Loading @@ -250,10 +251,12 @@ class PinnedStackController { } /** * @return the repositioned PIP bounds given it's pre-change bounds, and the new display info. * @return the repositioned PIP bounds given it's pre-change bounds, and the new display * content. */ Rect onDisplayChanged(Rect preChangeStackBounds, DisplayInfo displayInfo) { Rect onDisplayChanged(Rect preChangeStackBounds, DisplayContent displayContent) { final Rect postChangeStackBounds = new Rect(preChangeStackBounds); final DisplayInfo displayInfo = displayContent.getDisplayInfo(); if (!mDisplayInfo.equals(displayInfo)) { // Calculate the snap fraction of the current stack along the old movement bounds, and // then update the stack bounds to the same fraction along the rotated movement bounds. Loading @@ -269,8 +272,9 @@ class PinnedStackController { if (mIsMinimized) { final Point displaySize = new Point(mDisplayInfo.logicalWidth, mDisplayInfo.logicalHeight); mService.getStableInsetsLocked(displayContent.getDisplayId(), mStableInsets); mSnapAlgorithm.applyMinimizedOffset(postChangeStackBounds, postChangeMovementBounds, displaySize); displaySize, mStableInsets); } } return postChangeStackBounds; Loading
services/core/java/com/android/server/wm/TaskStack.java +2 −2 Original line number Diff line number Diff line Loading @@ -413,7 +413,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye switch (mStackId) { case PINNED_STACK_ID: mTmpRect2 = mDisplayContent.getPinnedStackController().onDisplayChanged(mBounds, getDisplayInfo()); mDisplayContent); break; case DOCKED_STACK_ID: repositionDockedStackAfterRotation(mTmpRect2); Loading Loading @@ -684,7 +684,7 @@ public class TaskStack extends WindowContainer<Task> implements DimLayer.DimLaye // Update the pinned stack controller after the display info is updated if (mStackId == PINNED_STACK_ID) { mDisplayContent.getPinnedStackController().onDisplayChanged(oldBounds, getDisplayInfo()); mDisplayContent); } super.onDisplayChanged(dc); Loading