Loading packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -322,13 +322,19 @@ public class PipTaskOrganizer extends TaskOrganizer { * @param destinationBoundsOut the current destination bounds will be populated to this param * @param destinationBoundsOut the current destination bounds will be populated to this param */ */ @SuppressWarnings("unchecked") @SuppressWarnings("unchecked") public void onMovementBoundsChanged(Rect destinationBoundsOut, public void onMovementBoundsChanged(Rect destinationBoundsOut, boolean fromRotation, boolean fromImeAdjustment, boolean fromShelfAdjustment) { boolean fromImeAdjustment, boolean fromShelfAdjustment) { final PipAnimationController.PipTransitionAnimator animator = final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); mPipAnimationController.getCurrentAnimator(); destinationBoundsOut.set(mLastReportedBounds); if (animator == null || !animator.isRunning() if (animator == null || !animator.isRunning() || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { if (mInPip && fromRotation) { // this could happen if rotation finishes before the animation mLastReportedBounds.set(destinationBoundsOut); scheduleFinishResizePip(mLastReportedBounds); } else if (!mLastReportedBounds.isEmpty()) { destinationBoundsOut.set(mLastReportedBounds); } return; return; } } Loading packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -97,8 +97,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds, final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds, displayId, fromRotation, toRotation, t); displayId, fromRotation, toRotation, t); if (changed) { if (changed) { updateMovementBounds(mTmpNormalBounds, false /* fromImeAdjustment */, updateMovementBounds(mTmpNormalBounds, true /* fromRotation */, false /* fromShelfAdjustment */); false /* fromImeAdjustment */, false /* fromShelfAdjustment */); } } }; }; Loading Loading @@ -163,7 +163,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio @Override @Override public void onMovementBoundsChanged(boolean fromImeAdjustment) { public void onMovementBoundsChanged(boolean fromImeAdjustment) { mHandler.post(() -> updateMovementBounds(null /* toBounds */, mHandler.post(() -> updateMovementBounds(null /* toBounds */, fromImeAdjustment, false /* fromShelfAdjustment */)); false /* fromRotation */, fromImeAdjustment, false /* fromShelfAdjustment */)); } } @Override @Override Loading Loading @@ -294,7 +294,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio if (changed) { if (changed) { mTouchHandler.onShelfVisibilityChanged(visible, height); mTouchHandler.onShelfVisibilityChanged(visible, height); updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(), updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(), false /* fromImeAdjustment */, true /* fromShelfAdjustment */); false /* fromRotation */, false /* fromImeAdjustment */, true /* fromShelfAdjustment */); } } }); }); } } Loading Loading @@ -353,7 +354,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mMenuController.onPinnedStackAnimationEnded(); mMenuController.onPinnedStackAnimationEnded(); } } private void updateMovementBounds(@Nullable Rect toBounds, private void updateMovementBounds(@Nullable Rect toBounds, boolean fromRotation, boolean fromImeAdjustment, boolean fromShelfAdjustment) { boolean fromImeAdjustment, boolean fromShelfAdjustment) { // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before // passing to mTouchHandler/mPipTaskOrganizer // passing to mTouchHandler/mPipTaskOrganizer Loading @@ -361,7 +362,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mPipBoundsHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, mPipBoundsHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, outBounds, mTmpDisplayInfo); outBounds, mTmpDisplayInfo); // mTouchHandler would rely on the bounds populated from mPipTaskOrganizer // mTouchHandler would rely on the bounds populated from mPipTaskOrganizer mPipTaskOrganizer.onMovementBoundsChanged(outBounds, mPipTaskOrganizer.onMovementBoundsChanged(outBounds, fromRotation, fromImeAdjustment, fromShelfAdjustment); fromImeAdjustment, fromShelfAdjustment); mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, outBounds, fromImeAdjustment, fromShelfAdjustment, outBounds, fromImeAdjustment, fromShelfAdjustment, Loading Loading
packages/SystemUI/src/com/android/systemui/pip/PipTaskOrganizer.java +8 −2 Original line number Original line Diff line number Diff line Loading @@ -322,13 +322,19 @@ public class PipTaskOrganizer extends TaskOrganizer { * @param destinationBoundsOut the current destination bounds will be populated to this param * @param destinationBoundsOut the current destination bounds will be populated to this param */ */ @SuppressWarnings("unchecked") @SuppressWarnings("unchecked") public void onMovementBoundsChanged(Rect destinationBoundsOut, public void onMovementBoundsChanged(Rect destinationBoundsOut, boolean fromRotation, boolean fromImeAdjustment, boolean fromShelfAdjustment) { boolean fromImeAdjustment, boolean fromShelfAdjustment) { final PipAnimationController.PipTransitionAnimator animator = final PipAnimationController.PipTransitionAnimator animator = mPipAnimationController.getCurrentAnimator(); mPipAnimationController.getCurrentAnimator(); destinationBoundsOut.set(mLastReportedBounds); if (animator == null || !animator.isRunning() if (animator == null || !animator.isRunning() || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { || animator.getTransitionDirection() != TRANSITION_DIRECTION_TO_PIP) { if (mInPip && fromRotation) { // this could happen if rotation finishes before the animation mLastReportedBounds.set(destinationBoundsOut); scheduleFinishResizePip(mLastReportedBounds); } else if (!mLastReportedBounds.isEmpty()) { destinationBoundsOut.set(mLastReportedBounds); } return; return; } } Loading
packages/SystemUI/src/com/android/systemui/pip/phone/PipManager.java +7 −6 Original line number Original line Diff line number Diff line Loading @@ -97,8 +97,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds, final boolean changed = mPipBoundsHandler.onDisplayRotationChanged(mTmpNormalBounds, displayId, fromRotation, toRotation, t); displayId, fromRotation, toRotation, t); if (changed) { if (changed) { updateMovementBounds(mTmpNormalBounds, false /* fromImeAdjustment */, updateMovementBounds(mTmpNormalBounds, true /* fromRotation */, false /* fromShelfAdjustment */); false /* fromImeAdjustment */, false /* fromShelfAdjustment */); } } }; }; Loading Loading @@ -163,7 +163,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio @Override @Override public void onMovementBoundsChanged(boolean fromImeAdjustment) { public void onMovementBoundsChanged(boolean fromImeAdjustment) { mHandler.post(() -> updateMovementBounds(null /* toBounds */, mHandler.post(() -> updateMovementBounds(null /* toBounds */, fromImeAdjustment, false /* fromShelfAdjustment */)); false /* fromRotation */, fromImeAdjustment, false /* fromShelfAdjustment */)); } } @Override @Override Loading Loading @@ -294,7 +294,8 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio if (changed) { if (changed) { mTouchHandler.onShelfVisibilityChanged(visible, height); mTouchHandler.onShelfVisibilityChanged(visible, height); updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(), updateMovementBounds(mPipBoundsHandler.getLastDestinationBounds(), false /* fromImeAdjustment */, true /* fromShelfAdjustment */); false /* fromRotation */, false /* fromImeAdjustment */, true /* fromShelfAdjustment */); } } }); }); } } Loading Loading @@ -353,7 +354,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mMenuController.onPinnedStackAnimationEnded(); mMenuController.onPinnedStackAnimationEnded(); } } private void updateMovementBounds(@Nullable Rect toBounds, private void updateMovementBounds(@Nullable Rect toBounds, boolean fromRotation, boolean fromImeAdjustment, boolean fromShelfAdjustment) { boolean fromImeAdjustment, boolean fromShelfAdjustment) { // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before // Populate inset / normal bounds and DisplayInfo from mPipBoundsHandler before // passing to mTouchHandler/mPipTaskOrganizer // passing to mTouchHandler/mPipTaskOrganizer Loading @@ -361,7 +362,7 @@ public class PipManager implements BasePipManager, PipTaskOrganizer.PipTransitio mPipBoundsHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, mPipBoundsHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, outBounds, mTmpDisplayInfo); outBounds, mTmpDisplayInfo); // mTouchHandler would rely on the bounds populated from mPipTaskOrganizer // mTouchHandler would rely on the bounds populated from mPipTaskOrganizer mPipTaskOrganizer.onMovementBoundsChanged(outBounds, mPipTaskOrganizer.onMovementBoundsChanged(outBounds, fromRotation, fromImeAdjustment, fromShelfAdjustment); fromImeAdjustment, fromShelfAdjustment); mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, mTouchHandler.onMovementBoundsChanged(mTmpInsetBounds, mTmpNormalBounds, outBounds, fromImeAdjustment, fromShelfAdjustment, outBounds, fromImeAdjustment, fromShelfAdjustment, Loading