Loading core/java/android/view/IRecentsAnimationController.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -43,8 +43,11 @@ interface IRecentsAnimationController { * accordingly. This should be called before `finish` * @param taskId for which the leash should be updated * @param destinationBounds bounds of the final PiP window * @param windowCrop bounds to crop as part of final transform. * @param float9 An array of 9 floats to be used as matrix transform. */ void setFinishTaskBounds(int taskId, in Rect destinationBounds); void setFinishTaskBounds(int taskId, in Rect destinationBounds, in Rect windowCrop, in float[] float9); /** * Notifies to the system that the animation into Recents should end, and all leashes associated Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +12 −3 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.PictureInPictureParams; Loading Loading @@ -423,12 +424,16 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, if (mInSwipePipToHomeTransition) { final Rect destinationBounds = mPipBoundsState.getBounds(); final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper.resetScale(tx, mLeash, destinationBounds); mSurfaceTransactionHelper.crop(tx, mLeash, destinationBounds); // animation is finished in the Launcher and here we directly apply the final touch. applyEnterPipSyncTransaction(destinationBounds, () -> { // ensure menu's settled in its final bounds first finishResizeForMenu(destinationBounds); sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); }); }, tx); mInSwipePipToHomeTransition = false; return; } Loading Loading @@ -490,16 +495,20 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, // mState is set right after the animation is kicked off to block any resize // requests such as offsetPip that may have been called prior to the transition. mState = State.ENTERING_PIP; }); }, null /* boundsChangeTransaction */); } private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable) { private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable, @Nullable SurfaceControl.Transaction boundsChangeTransaction) { // PiP menu is attached late in the process here to avoid any artifacts on the leash // caused by addShellRoot when in gesture navigation mode. mPipMenuController.attach(mLeash); final WindowContainerTransaction wct = new WindowContainerTransaction(); wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED); wct.setBounds(mToken, destinationBounds); if (boundsChangeTransaction != null) { wct.setBoundsChangeTransaction(mToken, boundsChangeTransaction); } wct.scheduleFinishEnterPip(mToken, destinationBounds); mSyncTransactionQueue.queue(wct); if (runnable != null) { Loading packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java +0 −19 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.RectF; import android.view.Choreographer; import android.view.Surface; import android.view.SurfaceControl; /** Loading Loading @@ -91,24 +90,6 @@ public class PipSurfaceTransactionHelper { .setPosition(leash, positionX, positionY); } public void reset(SurfaceControl.Transaction tx, SurfaceControl leash, Rect destinationBounds, @Surface.Rotation int rotation) { resetScale(tx, leash, destinationBounds); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { final int degree = (rotation == Surface.ROTATION_90) ? -90 : 90; mTmpTransform.setRotate(degree, 0, 0); tx.setMatrix(leash, mTmpTransform, mTmpFloat9); } resetCornerRadius(tx, leash); crop(tx, leash, destinationBounds); } public void resetScale(SurfaceControl.Transaction tx, SurfaceControl leash, Rect destinationBounds) { tx.setMatrix(leash, Matrix.IDENTITY_MATRIX, mTmpFloat9) .setPosition(leash, destinationBounds.left, destinationBounds.top); } public void resetCornerRadius(SurfaceControl.Transaction tx, SurfaceControl leash) { tx.setCornerRadius(leash, 0); } Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java +6 −2 Original line number Diff line number Diff line Loading @@ -76,10 +76,14 @@ public class RecentsAnimationControllerCompat { * accordingly. This should be called before `finish` * @param taskId Task id of the Activity in PiP mode. * @param destinationBounds Bounds of the PiP window on home. * @param windowCrop bounds to crop as part of final transform. * @param float9 An array of 9 floats to be used as matrix transform. */ public void setFinishTaskBounds(int taskId, Rect destinationBounds) { public void setFinishTaskBounds(int taskId, Rect destinationBounds, Rect windowCrop, float[] float9) { try { mAnimationController.setFinishTaskBounds(taskId, destinationBounds); mAnimationController.setFinishTaskBounds(taskId, destinationBounds, windowCrop, float9); } catch (RemoteException e) { Log.d(TAG, "Failed to set finish task bounds", e); } Loading packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +5 −2 Original line number Diff line number Diff line Loading @@ -137,8 +137,11 @@ public class RemoteTransitionCompat implements Parcelable { mWrapped.hideCurrentInputMethod(); } @Override public void setFinishTaskBounds(int taskId, Rect destinationBounds) { if (mWrapped != null) mWrapped.setFinishTaskBounds(taskId, destinationBounds); @Override public void setFinishTaskBounds(int taskId, Rect destinationBounds, Rect windowCrop, float[] float9) { if (mWrapped != null) { mWrapped.setFinishTaskBounds(taskId, destinationBounds, windowCrop, float9); } } @Override public void finish(boolean toHome, boolean sendUserLeaveHint) { Loading Loading
core/java/android/view/IRecentsAnimationController.aidl +4 −1 Original line number Diff line number Diff line Loading @@ -43,8 +43,11 @@ interface IRecentsAnimationController { * accordingly. This should be called before `finish` * @param taskId for which the leash should be updated * @param destinationBounds bounds of the final PiP window * @param windowCrop bounds to crop as part of final transform. * @param float9 An array of 9 floats to be used as matrix transform. */ void setFinishTaskBounds(int taskId, in Rect destinationBounds); void setFinishTaskBounds(int taskId, in Rect destinationBounds, in Rect windowCrop, in float[] float9); /** * Notifies to the system that the animation into Recents should end, and all leashes associated Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +12 −3 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import android.animation.Animator; import android.animation.AnimatorListenerAdapter; import android.animation.ValueAnimator; import android.annotation.NonNull; import android.annotation.Nullable; import android.app.ActivityManager; import android.app.ActivityTaskManager; import android.app.PictureInPictureParams; Loading Loading @@ -423,12 +424,16 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, if (mInSwipePipToHomeTransition) { final Rect destinationBounds = mPipBoundsState.getBounds(); final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper.resetScale(tx, mLeash, destinationBounds); mSurfaceTransactionHelper.crop(tx, mLeash, destinationBounds); // animation is finished in the Launcher and here we directly apply the final touch. applyEnterPipSyncTransaction(destinationBounds, () -> { // ensure menu's settled in its final bounds first finishResizeForMenu(destinationBounds); sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); }); }, tx); mInSwipePipToHomeTransition = false; return; } Loading Loading @@ -490,16 +495,20 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, // mState is set right after the animation is kicked off to block any resize // requests such as offsetPip that may have been called prior to the transition. mState = State.ENTERING_PIP; }); }, null /* boundsChangeTransaction */); } private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable) { private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable, @Nullable SurfaceControl.Transaction boundsChangeTransaction) { // PiP menu is attached late in the process here to avoid any artifacts on the leash // caused by addShellRoot when in gesture navigation mode. mPipMenuController.attach(mLeash); final WindowContainerTransaction wct = new WindowContainerTransaction(); wct.setActivityWindowingMode(mToken, WINDOWING_MODE_UNDEFINED); wct.setBounds(mToken, destinationBounds); if (boundsChangeTransaction != null) { wct.setBoundsChangeTransaction(mToken, boundsChangeTransaction); } wct.scheduleFinishEnterPip(mToken, destinationBounds); mSyncTransactionQueue.queue(wct); if (runnable != null) { Loading
packages/SystemUI/shared/src/com/android/systemui/shared/pip/PipSurfaceTransactionHelper.java +0 −19 Original line number Diff line number Diff line Loading @@ -20,7 +20,6 @@ import android.graphics.Matrix; import android.graphics.Rect; import android.graphics.RectF; import android.view.Choreographer; import android.view.Surface; import android.view.SurfaceControl; /** Loading Loading @@ -91,24 +90,6 @@ public class PipSurfaceTransactionHelper { .setPosition(leash, positionX, positionY); } public void reset(SurfaceControl.Transaction tx, SurfaceControl leash, Rect destinationBounds, @Surface.Rotation int rotation) { resetScale(tx, leash, destinationBounds); if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { final int degree = (rotation == Surface.ROTATION_90) ? -90 : 90; mTmpTransform.setRotate(degree, 0, 0); tx.setMatrix(leash, mTmpTransform, mTmpFloat9); } resetCornerRadius(tx, leash); crop(tx, leash, destinationBounds); } public void resetScale(SurfaceControl.Transaction tx, SurfaceControl leash, Rect destinationBounds) { tx.setMatrix(leash, Matrix.IDENTITY_MATRIX, mTmpFloat9) .setPosition(leash, destinationBounds.left, destinationBounds.top); } public void resetCornerRadius(SurfaceControl.Transaction tx, SurfaceControl leash) { tx.setCornerRadius(leash, 0); } Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/RecentsAnimationControllerCompat.java +6 −2 Original line number Diff line number Diff line Loading @@ -76,10 +76,14 @@ public class RecentsAnimationControllerCompat { * accordingly. This should be called before `finish` * @param taskId Task id of the Activity in PiP mode. * @param destinationBounds Bounds of the PiP window on home. * @param windowCrop bounds to crop as part of final transform. * @param float9 An array of 9 floats to be used as matrix transform. */ public void setFinishTaskBounds(int taskId, Rect destinationBounds) { public void setFinishTaskBounds(int taskId, Rect destinationBounds, Rect windowCrop, float[] float9) { try { mAnimationController.setFinishTaskBounds(taskId, destinationBounds); mAnimationController.setFinishTaskBounds(taskId, destinationBounds, windowCrop, float9); } catch (RemoteException e) { Log.d(TAG, "Failed to set finish task bounds", e); } Loading
packages/SystemUI/shared/src/com/android/systemui/shared/system/RemoteTransitionCompat.java +5 −2 Original line number Diff line number Diff line Loading @@ -137,8 +137,11 @@ public class RemoteTransitionCompat implements Parcelable { mWrapped.hideCurrentInputMethod(); } @Override public void setFinishTaskBounds(int taskId, Rect destinationBounds) { if (mWrapped != null) mWrapped.setFinishTaskBounds(taskId, destinationBounds); @Override public void setFinishTaskBounds(int taskId, Rect destinationBounds, Rect windowCrop, float[] float9) { if (mWrapped != null) { mWrapped.setFinishTaskBounds(taskId, destinationBounds, windowCrop, float9); } } @Override public void finish(boolean toHome, boolean sendUserLeaveHint) { Loading