Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java +29 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,35 @@ public class PipBoundsAlgorithm { return null; } /** * Returns the source hint rect if it is valid (if provided and is contained by the current * task bounds, while not smaller than the destination bounds). */ @Nullable public static Rect getValidSourceHintRect(PictureInPictureParams params, Rect sourceBounds, Rect destinationBounds) { Rect sourceRectHint = getValidSourceHintRect(params, sourceBounds); if (!isSourceRectHintValidForEnterPip(sourceRectHint, destinationBounds)) { sourceRectHint = null; } return sourceRectHint; } /** * This is a situation in which the source rect hint on at least one axis is smaller * than the destination bounds, which represents a problem because we would have to scale * up that axis to fit the bounds. So instead, just fallback to the non-source hint * animation in this case. * * @return {@code false} if the given source is too small to use for the entering animation. */ static boolean isSourceRectHintValidForEnterPip(Rect sourceRectHint, Rect destinationBounds) { return sourceRectHint != null && sourceRectHint.width() > destinationBounds.width() && sourceRectHint.height() > destinationBounds.height(); } public float getDefaultAspectRatio() { return mDefaultAspectRatio; } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +2 −16 Original line number Diff line number Diff line Loading @@ -1657,8 +1657,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, "%s: Abort animation, invalid leash", TAG); return null; } if (isInPipDirection(direction) && !isSourceRectHintValidForEnterPip(sourceHintRect, destinationBounds)) { if (isInPipDirection(direction) && !PipBoundsAlgorithm .isSourceRectHintValidForEnterPip(sourceHintRect, destinationBounds)) { // The given source rect hint is too small for enter PiP animation, reset it to null. sourceHintRect = null; } Loading Loading @@ -1756,20 +1756,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, return sourceHintRect; } /** * This is a situation in which the source rect hint on at least one axis is smaller * than the destination bounds, which represents a problem because we would have to scale * up that axis to fit the bounds. So instead, just fallback to the non-source hint * animation in this case. * * @return {@code false} if the given source is too small to use for the entering animation. */ private boolean isSourceRectHintValidForEnterPip(Rect sourceRectHint, Rect destinationBounds) { return sourceRectHint != null && sourceRectHint.width() > destinationBounds.width() && sourceRectHint.height() > destinationBounds.height(); } /** * Sync with {@link SplitScreenController} on destination bounds if PiP is going to * split screen. Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +1 −1 Original line number Diff line number Diff line Loading @@ -764,7 +764,7 @@ public class PipTransition extends PipTransitionController { final Rect currentBounds = taskInfo.configuration.windowConfiguration.getBounds(); int rotationDelta = deltaRotation(startRotation, endRotation); Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( taskInfo.pictureInPictureParams, currentBounds); taskInfo.pictureInPictureParams, currentBounds, destinationBounds); if (rotationDelta != Surface.ROTATION_0 && mInFixedRotation) { // Need to get the bounds of new rotation in old rotation for fixed rotation, computeEnterPipRotatedBounds(rotationDelta, startRotation, endRotation, taskInfo, Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsAlgorithm.java +29 −0 Original line number Diff line number Diff line Loading @@ -180,6 +180,35 @@ public class PipBoundsAlgorithm { return null; } /** * Returns the source hint rect if it is valid (if provided and is contained by the current * task bounds, while not smaller than the destination bounds). */ @Nullable public static Rect getValidSourceHintRect(PictureInPictureParams params, Rect sourceBounds, Rect destinationBounds) { Rect sourceRectHint = getValidSourceHintRect(params, sourceBounds); if (!isSourceRectHintValidForEnterPip(sourceRectHint, destinationBounds)) { sourceRectHint = null; } return sourceRectHint; } /** * This is a situation in which the source rect hint on at least one axis is smaller * than the destination bounds, which represents a problem because we would have to scale * up that axis to fit the bounds. So instead, just fallback to the non-source hint * animation in this case. * * @return {@code false} if the given source is too small to use for the entering animation. */ static boolean isSourceRectHintValidForEnterPip(Rect sourceRectHint, Rect destinationBounds) { return sourceRectHint != null && sourceRectHint.width() > destinationBounds.width() && sourceRectHint.height() > destinationBounds.height(); } public float getDefaultAspectRatio() { return mDefaultAspectRatio; } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +2 −16 Original line number Diff line number Diff line Loading @@ -1657,8 +1657,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, "%s: Abort animation, invalid leash", TAG); return null; } if (isInPipDirection(direction) && !isSourceRectHintValidForEnterPip(sourceHintRect, destinationBounds)) { if (isInPipDirection(direction) && !PipBoundsAlgorithm .isSourceRectHintValidForEnterPip(sourceHintRect, destinationBounds)) { // The given source rect hint is too small for enter PiP animation, reset it to null. sourceHintRect = null; } Loading Loading @@ -1756,20 +1756,6 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, return sourceHintRect; } /** * This is a situation in which the source rect hint on at least one axis is smaller * than the destination bounds, which represents a problem because we would have to scale * up that axis to fit the bounds. So instead, just fallback to the non-source hint * animation in this case. * * @return {@code false} if the given source is too small to use for the entering animation. */ private boolean isSourceRectHintValidForEnterPip(Rect sourceRectHint, Rect destinationBounds) { return sourceRectHint != null && sourceRectHint.width() > destinationBounds.width() && sourceRectHint.height() > destinationBounds.height(); } /** * Sync with {@link SplitScreenController} on destination bounds if PiP is going to * split screen. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +1 −1 Original line number Diff line number Diff line Loading @@ -764,7 +764,7 @@ public class PipTransition extends PipTransitionController { final Rect currentBounds = taskInfo.configuration.windowConfiguration.getBounds(); int rotationDelta = deltaRotation(startRotation, endRotation); Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( taskInfo.pictureInPictureParams, currentBounds); taskInfo.pictureInPictureParams, currentBounds, destinationBounds); if (rotationDelta != Surface.ROTATION_0 && mInFixedRotation) { // Need to get the bounds of new rotation in old rotation for fixed rotation, computeEnterPipRotatedBounds(rotationDelta, startRotation, endRotation, taskInfo, Loading