Loading libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/IPip.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -53,9 +53,11 @@ interface IPip { * @param destinationBounds the destination bounds the PiP window lands into * @param overlay an optional overlay to fade out after entering PiP * @param appBounds the bounds used to set the buffer size of the optional content overlay * @param sourceRectHint the bounds to show in the transition to PiP */ oneway void stopSwipePipToHome(int taskId, in ComponentName componentName, in Rect destinationBounds, in SurfaceControl overlay, in Rect appBounds) = 2; in Rect destinationBounds, in SurfaceControl overlay, in Rect appBounds, in Rect sourceRectHint) = 2; /** * Notifies the swiping Activity to PiP onto home transition is aborted Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +20 −1 Original line number Diff line number Diff line Loading @@ -373,6 +373,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, @NonNull final Rect mAppBounds = new Rect(); /** The source rect hint from stopSwipePipToHome(). */ @Nullable private Rect mSwipeSourceRectHint; public PipTaskOrganizer(Context context, @NonNull SyncTransactionQueue syncTransactionQueue, @NonNull PipTransitionState pipTransitionState, Loading Loading @@ -504,7 +508,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, * Expect {@link #onTaskAppeared(ActivityManager.RunningTaskInfo, SurfaceControl)} afterwards. */ public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "stopSwipePipToHome: %s, stat=%s", componentName, mPipTransitionState); // do nothing if there is no startSwipePipToHome being called before Loading @@ -513,6 +517,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } mPipBoundsState.setBounds(destinationBounds); setContentOverlay(overlay, appBounds); mSwipeSourceRectHint = sourceRectHint; if (ENABLE_SHELL_TRANSITIONS && overlay != null) { // With Shell transition, the overlay was attached to the remote transition leash, which // will be removed when the current transition is finished, so we need to reparent it Loading @@ -529,6 +534,20 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } /** * Returns non-null Rect if the pip is entering from swipe-to-home with a specified source hint. * This also consumes the rect hint. */ @Nullable Rect takeSwipeSourceRectHint() { final Rect sourceRectHint = mSwipeSourceRectHint; if (sourceRectHint == null || sourceRectHint.isEmpty()) { return null; } mSwipeSourceRectHint = null; return mPipTransitionState.getInSwipePipToHomeTransition() ? sourceRectHint : null; } private void mayRemoveContentOverlay(SurfaceControl overlay) { final WeakReference<SurfaceControl> overlayRef = new WeakReference<>(overlay); final long timeoutDuration = (mEnterAnimationDuration Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +5 −2 Original line number Diff line number Diff line Loading @@ -1004,8 +1004,11 @@ public class PipTransition extends PipTransitionController { final Rect currentBounds = pipChange.getStartAbsBounds(); int rotationDelta = deltaRotation(startRotation, endRotation); Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( Rect sourceHintRect = mPipOrganizer.takeSwipeSourceRectHint(); if (sourceHintRect == null) { sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( taskInfo.pictureInPictureParams, currentBounds, destinationBounds); } if (rotationDelta != Surface.ROTATION_0 && endRotation != mPipDisplayLayoutState.getRotation()) { // Computes the destination bounds in new rotation. Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +6 −4 Original line number Diff line number Diff line Loading @@ -1001,9 +1001,9 @@ public class PipController implements PipTransitionController.PipTransitionCallb } private void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { mPipTaskOrganizer.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay, appBounds); appBounds, sourceRectHint); } private void abortSwipePipToHome(int taskId, ComponentName componentName) { Loading Loading @@ -1291,13 +1291,15 @@ public class PipController implements PipTransitionController.PipTransitionCallb @Override public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { Rect destinationBounds, SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { if (overlay != null) { overlay.setUnreleasedWarningCallSite("PipController.stopSwipePipToHome"); } executeRemoteCallWithTaskPermission(mController, "stopSwipePipToHome", (controller) -> controller.stopSwipePipToHome( taskId, componentName, destinationBounds, overlay, appBounds)); taskId, componentName, destinationBounds, overlay, appBounds, sourceRectHint)); } @Override Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipController.java +6 −3 Original line number Diff line number Diff line Loading @@ -285,7 +285,8 @@ public class PipController implements ConfigurationChangeListener, } private void onSwipePipToHomeAnimationStart(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { Rect destinationBounds, SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "onSwipePipToHomeAnimationStart: %s", componentName); Bundle extra = new Bundle(); Loading Loading @@ -409,13 +410,15 @@ public class PipController implements ConfigurationChangeListener, @Override public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { Rect destinationBounds, SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { if (overlay != null) { overlay.setUnreleasedWarningCallSite("PipController.stopSwipePipToHome"); } executeRemoteCallWithTaskPermission(mController, "stopSwipePipToHome", (controller) -> controller.onSwipePipToHomeAnimationStart( taskId, componentName, destinationBounds, overlay, appBounds)); taskId, componentName, destinationBounds, overlay, appBounds, sourceRectHint)); } @Override Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/common/pip/IPip.aidl +3 −1 Original line number Diff line number Diff line Loading @@ -53,9 +53,11 @@ interface IPip { * @param destinationBounds the destination bounds the PiP window lands into * @param overlay an optional overlay to fade out after entering PiP * @param appBounds the bounds used to set the buffer size of the optional content overlay * @param sourceRectHint the bounds to show in the transition to PiP */ oneway void stopSwipePipToHome(int taskId, in ComponentName componentName, in Rect destinationBounds, in SurfaceControl overlay, in Rect appBounds) = 2; in Rect destinationBounds, in SurfaceControl overlay, in Rect appBounds, in Rect sourceRectHint) = 2; /** * Notifies the swiping Activity to PiP onto home transition is aborted Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +20 −1 Original line number Diff line number Diff line Loading @@ -373,6 +373,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, @NonNull final Rect mAppBounds = new Rect(); /** The source rect hint from stopSwipePipToHome(). */ @Nullable private Rect mSwipeSourceRectHint; public PipTaskOrganizer(Context context, @NonNull SyncTransactionQueue syncTransactionQueue, @NonNull PipTransitionState pipTransitionState, Loading Loading @@ -504,7 +508,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, * Expect {@link #onTaskAppeared(ActivityManager.RunningTaskInfo, SurfaceControl)} afterwards. */ public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "stopSwipePipToHome: %s, stat=%s", componentName, mPipTransitionState); // do nothing if there is no startSwipePipToHome being called before Loading @@ -513,6 +517,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } mPipBoundsState.setBounds(destinationBounds); setContentOverlay(overlay, appBounds); mSwipeSourceRectHint = sourceRectHint; if (ENABLE_SHELL_TRANSITIONS && overlay != null) { // With Shell transition, the overlay was attached to the remote transition leash, which // will be removed when the current transition is finished, so we need to reparent it Loading @@ -529,6 +534,20 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } /** * Returns non-null Rect if the pip is entering from swipe-to-home with a specified source hint. * This also consumes the rect hint. */ @Nullable Rect takeSwipeSourceRectHint() { final Rect sourceRectHint = mSwipeSourceRectHint; if (sourceRectHint == null || sourceRectHint.isEmpty()) { return null; } mSwipeSourceRectHint = null; return mPipTransitionState.getInSwipePipToHomeTransition() ? sourceRectHint : null; } private void mayRemoveContentOverlay(SurfaceControl overlay) { final WeakReference<SurfaceControl> overlayRef = new WeakReference<>(overlay); final long timeoutDuration = (mEnterAnimationDuration Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +5 −2 Original line number Diff line number Diff line Loading @@ -1004,8 +1004,11 @@ public class PipTransition extends PipTransitionController { final Rect currentBounds = pipChange.getStartAbsBounds(); int rotationDelta = deltaRotation(startRotation, endRotation); Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( Rect sourceHintRect = mPipOrganizer.takeSwipeSourceRectHint(); if (sourceHintRect == null) { sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( taskInfo.pictureInPictureParams, currentBounds, destinationBounds); } if (rotationDelta != Surface.ROTATION_0 && endRotation != mPipDisplayLayoutState.getRotation()) { // Computes the destination bounds in new rotation. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +6 −4 Original line number Diff line number Diff line Loading @@ -1001,9 +1001,9 @@ public class PipController implements PipTransitionController.PipTransitionCallb } private void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { mPipTaskOrganizer.stopSwipePipToHome(taskId, componentName, destinationBounds, overlay, appBounds); appBounds, sourceRectHint); } private void abortSwipePipToHome(int taskId, ComponentName componentName) { Loading Loading @@ -1291,13 +1291,15 @@ public class PipController implements PipTransitionController.PipTransitionCallb @Override public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { Rect destinationBounds, SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { if (overlay != null) { overlay.setUnreleasedWarningCallSite("PipController.stopSwipePipToHome"); } executeRemoteCallWithTaskPermission(mController, "stopSwipePipToHome", (controller) -> controller.stopSwipePipToHome( taskId, componentName, destinationBounds, overlay, appBounds)); taskId, componentName, destinationBounds, overlay, appBounds, sourceRectHint)); } @Override Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/phone/PipController.java +6 −3 Original line number Diff line number Diff line Loading @@ -285,7 +285,8 @@ public class PipController implements ConfigurationChangeListener, } private void onSwipePipToHomeAnimationStart(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { Rect destinationBounds, SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, "onSwipePipToHomeAnimationStart: %s", componentName); Bundle extra = new Bundle(); Loading Loading @@ -409,13 +410,15 @@ public class PipController implements ConfigurationChangeListener, @Override public void stopSwipePipToHome(int taskId, ComponentName componentName, Rect destinationBounds, SurfaceControl overlay, Rect appBounds) { Rect destinationBounds, SurfaceControl overlay, Rect appBounds, Rect sourceRectHint) { if (overlay != null) { overlay.setUnreleasedWarningCallSite("PipController.stopSwipePipToHome"); } executeRemoteCallWithTaskPermission(mController, "stopSwipePipToHome", (controller) -> controller.onSwipePipToHomeAnimationStart( taskId, componentName, destinationBounds, overlay, appBounds)); taskId, componentName, destinationBounds, overlay, appBounds, sourceRectHint)); } @Override Loading