Loading packages/SystemUI/src/com/android/systemui/pip/PipBoundsHandler.java +3 −16 Original line number Diff line number Diff line Loading @@ -61,12 +61,6 @@ public class PipBoundsHandler { private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Rect mTmpInsets = new Rect(); /** * Tracks the destination bounds, used for any following * {@link #onMovementBoundsChanged(Rect, Rect, Rect, DisplayInfo)} calculations. */ private final Rect mLastDestinationBounds = new Rect(); private ComponentName mLastPipComponentName; private float mReentrySnapFraction = INVALID_SNAP_FRACTION; private Size mReentrySize; Loading Loading @@ -198,11 +192,6 @@ public class PipBoundsHandler { mReentrySnapFraction = INVALID_SNAP_FRACTION; mReentrySize = null; mLastPipComponentName = null; mLastDestinationBounds.setEmpty(); } public Rect getLastDestinationBounds() { return mLastDestinationBounds; } public Rect getDisplayBounds() { Loading Loading @@ -262,7 +251,6 @@ public class PipBoundsHandler { false /* useCurrentMinEdgeSize */); } mAspectRatio = aspectRatio; mLastDestinationBounds.set(destinationBounds); return destinationBounds; } Loading @@ -276,8 +264,8 @@ public class PipBoundsHandler { * * @return {@code true} if internal {@link DisplayInfo} is rotated, {@code false} otherwise. */ public boolean onDisplayRotationChanged(Rect outBounds, int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) { public boolean onDisplayRotationChanged(Rect outBounds, Rect oldBounds, int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) { // Bail early if the event is not sent to current {@link #mDisplayInfo} if ((displayId != mDisplayInfo.displayId) || (fromRotation == toRotation)) { return false; Loading @@ -295,7 +283,7 @@ public class PipBoundsHandler { } // Calculate the snap fraction of the current stack along the old movement bounds final Rect postChangeStackBounds = new Rect(mLastDestinationBounds); final Rect postChangeStackBounds = new Rect(oldBounds); final float snapFraction = getSnapFraction(postChangeStackBounds); // Populate the new {@link #mDisplayInfo}. Loading @@ -313,7 +301,6 @@ public class PipBoundsHandler { snapFraction); outBounds.set(postChangeStackBounds); mLastDestinationBounds.set(outBounds); t.setBounds(pinnedStackInfo.stackToken, outBounds); return true; } Loading packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +1 −0 Original line number Diff line number Diff line Loading @@ -600,6 +600,7 @@ public class PipTaskOrganizer extends TaskOrganizer { Log.w(TAG, "Abort animation, invalid leash"); return; } mLastReportedBounds.set(destinationBounds); final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper .crop(tx, mLeash, destinationBounds) Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio private final DisplayChangeController.OnDisplayChangingListener mRotationController = ( int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) -> { final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds, displayId, fromRotation, toRotation, t); mPipTaskOrganizer.getLastReportedBounds(), displayId, fromRotation, toRotation, t); if (changed) { updateMovementBounds(mTmpNormalBounds, true /* fromRotation */, false /* fromImeAdjustment */, false /* fromShelfAdjustment */); Loading Loading @@ -293,7 +293,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio final boolean changed = mPipBoundsHandler.setShelfHeight(visible, height); if (changed) { mTouchHandler.onShelfVisibilityChanged(visible, height); updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(), updateMovementBounds(mPipTaskOrganizer.getLastReportedBounds(), false /* fromRotation */, false /* fromImeAdjustment */, true /* fromShelfAdjustment */); } Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -424,7 +424,7 @@ public class PipTouchHandler { // If this is from an IME or shelf adjustment, then we should move the PiP so that it is not // occluded by the IME or shelf. if (fromImeAdjustment || fromShelfAdjustment || fromDisplayRotationChanged) { if (fromImeAdjustment || fromShelfAdjustment) { if (mTouchState.isUserInteracting()) { // Defer the update of the current movement bounds until after the user finishes // touching the screen Loading Loading
packages/SystemUI/src/com/android/systemui/pip/PipBoundsHandler.java +3 −16 Original line number Diff line number Diff line Loading @@ -61,12 +61,6 @@ public class PipBoundsHandler { private final DisplayInfo mDisplayInfo = new DisplayInfo(); private final Rect mTmpInsets = new Rect(); /** * Tracks the destination bounds, used for any following * {@link #onMovementBoundsChanged(Rect, Rect, Rect, DisplayInfo)} calculations. */ private final Rect mLastDestinationBounds = new Rect(); private ComponentName mLastPipComponentName; private float mReentrySnapFraction = INVALID_SNAP_FRACTION; private Size mReentrySize; Loading Loading @@ -198,11 +192,6 @@ public class PipBoundsHandler { mReentrySnapFraction = INVALID_SNAP_FRACTION; mReentrySize = null; mLastPipComponentName = null; mLastDestinationBounds.setEmpty(); } public Rect getLastDestinationBounds() { return mLastDestinationBounds; } public Rect getDisplayBounds() { Loading Loading @@ -262,7 +251,6 @@ public class PipBoundsHandler { false /* useCurrentMinEdgeSize */); } mAspectRatio = aspectRatio; mLastDestinationBounds.set(destinationBounds); return destinationBounds; } Loading @@ -276,8 +264,8 @@ public class PipBoundsHandler { * * @return {@code true} if internal {@link DisplayInfo} is rotated, {@code false} otherwise. */ public boolean onDisplayRotationChanged(Rect outBounds, int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) { public boolean onDisplayRotationChanged(Rect outBounds, Rect oldBounds, int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) { // Bail early if the event is not sent to current {@link #mDisplayInfo} if ((displayId != mDisplayInfo.displayId) || (fromRotation == toRotation)) { return false; Loading @@ -295,7 +283,7 @@ public class PipBoundsHandler { } // Calculate the snap fraction of the current stack along the old movement bounds final Rect postChangeStackBounds = new Rect(mLastDestinationBounds); final Rect postChangeStackBounds = new Rect(oldBounds); final float snapFraction = getSnapFraction(postChangeStackBounds); // Populate the new {@link #mDisplayInfo}. Loading @@ -313,7 +301,6 @@ public class PipBoundsHandler { snapFraction); outBounds.set(postChangeStackBounds); mLastDestinationBounds.set(outBounds); t.setBounds(pinnedStackInfo.stackToken, outBounds); return true; } Loading
packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +1 −0 Original line number Diff line number Diff line Loading @@ -600,6 +600,7 @@ public class PipTaskOrganizer extends TaskOrganizer { Log.w(TAG, "Abort animation, invalid leash"); return; } mLastReportedBounds.set(destinationBounds); final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper .crop(tx, mLeash, destinationBounds) Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +2 −2 Original line number Diff line number Diff line Loading @@ -95,7 +95,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio private final DisplayChangeController.OnDisplayChangingListener mRotationController = ( int displayId, int fromRotation, int toRotation, WindowContainerTransaction t) -> { final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds, displayId, fromRotation, toRotation, t); mPipTaskOrganizer.getLastReportedBounds(), displayId, fromRotation, toRotation, t); if (changed) { updateMovementBounds(mTmpNormalBounds, true /* fromRotation */, false /* fromImeAdjustment */, false /* fromShelfAdjustment */); Loading Loading @@ -293,7 +293,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio final boolean changed = mPipBoundsHandler.setShelfHeight(visible, height); if (changed) { mTouchHandler.onShelfVisibilityChanged(visible, height); updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(), updateMovementBounds(mPipTaskOrganizer.getLastReportedBounds(), false /* fromRotation */, false /* fromImeAdjustment */, true /* fromShelfAdjustment */); } Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java +1 −1 Original line number Diff line number Diff line Loading @@ -424,7 +424,7 @@ public class PipTouchHandler { // If this is from an IME or shelf adjustment, then we should move the PiP so that it is not // occluded by the IME or shelf. if (fromImeAdjustment || fromShelfAdjustment || fromDisplayRotationChanged) { if (fromImeAdjustment || fromShelfAdjustment) { if (mTouchState.isUserInteracting()) { // Defer the update of the current movement bounds until after the user finishes // touching the screen Loading