Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsHandler.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -118,6 +118,13 @@ public class PipBoundsHandler { mDisplayLayout.set(newDisplayLayout); mDisplayLayout.set(newDisplayLayout); } } /** * Get the current saved display info. */ public DisplayInfo getDisplayInfo() { return mDisplayInfo; } /** /** * Update the Min edge size for {@link PipSnapAlgorithm} to calculate corresponding bounds * Update the Min edge size for {@link PipSnapAlgorithm} to calculate corresponding bounds * @param minEdgeSize * @param minEdgeSize Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +16 −0 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,7 @@ import java.util.Map; import java.util.Objects; import java.util.Objects; import java.util.Optional; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Consumer; import java.util.function.IntConsumer; /** /** * Manages PiP tasks such as resize and offset. * Manages PiP tasks such as resize and offset. Loading Loading @@ -248,6 +249,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory mSurfaceControlTransactionFactory; mSurfaceControlTransactionFactory; private PictureInPictureParams mPictureInPictureParams; private PictureInPictureParams mPictureInPictureParams; private IntConsumer mOnDisplayIdChangeCallback; /** /** * If set to {@code true}, the entering animation will be skipped and we will wait for * If set to {@code true}, the entering animation will be skipped and we will wait for Loading Loading @@ -314,6 +316,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mPipTransitionCallbacks.add(callback); mPipTransitionCallbacks.add(callback); } } /** * Registers a callback when a display change has been detected when we enter PiP. */ public void registerOnDisplayIdChangeCallback(IntConsumer onDisplayIdChangeCallback) { mOnDisplayIdChangeCallback = onDisplayIdChangeCallback; } /** /** * Sets the preferred animation type for one time. * Sets the preferred animation type for one time. * This is typically used to set the animation type to * This is typically used to set the animation type to Loading Loading @@ -477,6 +486,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mPipUiEventLoggerLogger.setTaskInfo(mTaskInfo); mPipUiEventLoggerLogger.setTaskInfo(mTaskInfo); mPipUiEventLoggerLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_ENTER); mPipUiEventLoggerLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_ENTER); // If the displayId of the task is different than what PipBoundsHandler has, then update // it. This is possible if we entered PiP on an external display. if (info.displayId != mPipBoundsHandler.getDisplayInfo().displayId && mOnDisplayIdChangeCallback != null) { mOnDisplayIdChangeCallback.accept(info.displayId); } if (mShouldIgnoreEnteringPipTransition) { if (mShouldIgnoreEnteringPipTransition) { // Animation has been finished together with Recents, directly apply the sync // Animation has been finished together with Recents, directly apply the sync // transaction to PiP here. // transaction to PiP here. Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -228,6 +228,14 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac mPipBoundsState = pipBoundsState; mPipBoundsState = pipBoundsState; mPipTaskOrganizer = pipTaskOrganizer; mPipTaskOrganizer = pipTaskOrganizer; mPipTaskOrganizer.registerPipTransitionCallback(this); mPipTaskOrganizer.registerPipTransitionCallback(this); mPipTaskOrganizer.registerOnDisplayIdChangeCallback((int displayId) -> { final DisplayInfo newDisplayInfo = new DisplayInfo(); displayController.getDisplay(displayId).getDisplayInfo(newDisplayInfo); mPipBoundsHandler.onDisplayInfoChanged(newDisplayInfo); updateMovementBounds(null /* toBounds */, false /* fromRotation */, false /* fromImeAdjustment */, false /* fromShelfAdustment */, null /* wct */); }); mMediaController = pipMediaController; mMediaController = pipMediaController; mMenuController = pipMenuActivityController; mMenuController = pipMenuActivityController; mTouchHandler = pipTouchHandler; mTouchHandler = pipTouchHandler; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipBoundsHandler.java +7 −0 Original line number Original line Diff line number Diff line Loading @@ -118,6 +118,13 @@ public class PipBoundsHandler { mDisplayLayout.set(newDisplayLayout); mDisplayLayout.set(newDisplayLayout); } } /** * Get the current saved display info. */ public DisplayInfo getDisplayInfo() { return mDisplayInfo; } /** /** * Update the Min edge size for {@link PipSnapAlgorithm} to calculate corresponding bounds * Update the Min edge size for {@link PipSnapAlgorithm} to calculate corresponding bounds * @param minEdgeSize * @param minEdgeSize Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +16 −0 Original line number Original line Diff line number Diff line Loading @@ -79,6 +79,7 @@ import java.util.Map; import java.util.Objects; import java.util.Objects; import java.util.Optional; import java.util.Optional; import java.util.function.Consumer; import java.util.function.Consumer; import java.util.function.IntConsumer; /** /** * Manages PiP tasks such as resize and offset. * Manages PiP tasks such as resize and offset. Loading Loading @@ -248,6 +249,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory mSurfaceControlTransactionFactory; mSurfaceControlTransactionFactory; private PictureInPictureParams mPictureInPictureParams; private PictureInPictureParams mPictureInPictureParams; private IntConsumer mOnDisplayIdChangeCallback; /** /** * If set to {@code true}, the entering animation will be skipped and we will wait for * If set to {@code true}, the entering animation will be skipped and we will wait for Loading Loading @@ -314,6 +316,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mPipTransitionCallbacks.add(callback); mPipTransitionCallbacks.add(callback); } } /** * Registers a callback when a display change has been detected when we enter PiP. */ public void registerOnDisplayIdChangeCallback(IntConsumer onDisplayIdChangeCallback) { mOnDisplayIdChangeCallback = onDisplayIdChangeCallback; } /** /** * Sets the preferred animation type for one time. * Sets the preferred animation type for one time. * This is typically used to set the animation type to * This is typically used to set the animation type to Loading Loading @@ -477,6 +486,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mPipUiEventLoggerLogger.setTaskInfo(mTaskInfo); mPipUiEventLoggerLogger.setTaskInfo(mTaskInfo); mPipUiEventLoggerLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_ENTER); mPipUiEventLoggerLogger.log(PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_ENTER); // If the displayId of the task is different than what PipBoundsHandler has, then update // it. This is possible if we entered PiP on an external display. if (info.displayId != mPipBoundsHandler.getDisplayInfo().displayId && mOnDisplayIdChangeCallback != null) { mOnDisplayIdChangeCallback.accept(info.displayId); } if (mShouldIgnoreEnteringPipTransition) { if (mShouldIgnoreEnteringPipTransition) { // Animation has been finished together with Recents, directly apply the sync // Animation has been finished together with Recents, directly apply the sync // transaction to PiP here. // transaction to PiP here. Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipController.java +8 −0 Original line number Original line Diff line number Diff line Loading @@ -228,6 +228,14 @@ public class PipController implements Pip, PipTaskOrganizer.PipTransitionCallbac mPipBoundsState = pipBoundsState; mPipBoundsState = pipBoundsState; mPipTaskOrganizer = pipTaskOrganizer; mPipTaskOrganizer = pipTaskOrganizer; mPipTaskOrganizer.registerPipTransitionCallback(this); mPipTaskOrganizer.registerPipTransitionCallback(this); mPipTaskOrganizer.registerOnDisplayIdChangeCallback((int displayId) -> { final DisplayInfo newDisplayInfo = new DisplayInfo(); displayController.getDisplay(displayId).getDisplayInfo(newDisplayInfo); mPipBoundsHandler.onDisplayInfoChanged(newDisplayInfo); updateMovementBounds(null /* toBounds */, false /* fromRotation */, false /* fromImeAdjustment */, false /* fromShelfAdustment */, null /* wct */); }); mMediaController = pipMediaController; mMediaController = pipMediaController; mMenuController = pipMenuActivityController; mMenuController = pipMenuActivityController; mTouchHandler = pipTouchHandler; mTouchHandler = pipTouchHandler; Loading