Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -769,7 +769,6 @@ public class PipAnimationController { getSurfaceTransactionHelper().crop(tx, leash, destBounds); getSurfaceTransactionHelper().crop(tx, leash, destBounds); } } if (mContentOverlay != null) { if (mContentOverlay != null) { mContentOverlay.onAnimationEnd(tx, destBounds); clearContentOverlay(); clearContentOverlay(); } } } } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipContentOverlay.java +0 −24 Original line number Original line Diff line number Diff line Loading @@ -67,15 +67,6 @@ public abstract class PipContentOverlay { public abstract void onAnimationUpdate(SurfaceControl.Transaction atomicTx, public abstract void onAnimationUpdate(SurfaceControl.Transaction atomicTx, Rect currentBounds, float fraction); Rect currentBounds, float fraction); /** * Callback when reaches the end of animation on the internal {@link #mLeash}. * @param atomicTx {@link SurfaceControl.Transaction} to operate, you should not explicitly * call apply on this transaction, it should be applied on the caller side. * @param destinationBounds {@link Rect} of the final bounds. */ public abstract void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds); /** A {@link PipContentOverlay} uses solid color. */ /** A {@link PipContentOverlay} uses solid color. */ public static final class PipColorOverlay extends PipContentOverlay { public static final class PipColorOverlay extends PipContentOverlay { private static final String TAG = PipColorOverlay.class.getSimpleName(); private static final String TAG = PipColorOverlay.class.getSimpleName(); Loading Loading @@ -107,11 +98,6 @@ public abstract class PipContentOverlay { atomicTx.setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); atomicTx.setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); } } @Override public void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds) { // Do nothing. Color overlay should be fully opaque by now, ready for fade out. } private float[] getContentOverlayColor(Context context) { private float[] getContentOverlayColor(Context context) { final TypedArray ta = context.obtainStyledAttributes(new int[] { final TypedArray ta = context.obtainStyledAttributes(new int[] { android.R.attr.colorBackground }); android.R.attr.colorBackground }); Loading Loading @@ -164,11 +150,6 @@ public abstract class PipContentOverlay { Rect currentBounds, float fraction) { Rect currentBounds, float fraction) { // Do nothing. Keep the snapshot till animation ends. // Do nothing. Keep the snapshot till animation ends. } } @Override public void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds) { // Do nothing. Snapshot overlay should be fully opaque by now, ready for fade out. } } } /** A {@link PipContentOverlay} shows app icon on solid color background. */ /** A {@link PipContentOverlay} shows app icon on solid color background. */ Loading Loading @@ -254,11 +235,6 @@ public abstract class PipContentOverlay { .setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); .setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); } } @Override public void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds) { // Do nothing. Icon overlay should be fully opaque by now, ready for fade out. } @Override @Override public void detach(SurfaceControl.Transaction tx) { public void detach(SurfaceControl.Transaction tx) { super.detach(tx); super.detach(tx); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +7 −15 Original line number Original line Diff line number Diff line Loading @@ -329,15 +329,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, private @Surface.Rotation int mCurrentRotation; private @Surface.Rotation int mCurrentRotation; /** /** * An optional overlay used to mask content changing between an app in/out of PiP, only set if * An optional overlay used to mask content changing between an app in/out of PiP. * {@link PipTransitionState#getInSwipePipToHomeTransition()} is true, only in gesture nav. */ @Nullable SurfaceControl mSwipePipToHomeOverlay; /** * An optional overlay used to mask content changing between an app in/out of PiP, only set if * {@link PipTransitionState#getInSwipePipToHomeTransition()} is false. */ */ @Nullable @Nullable SurfaceControl mPipOverlay; SurfaceControl mPipOverlay; Loading Loading @@ -480,7 +472,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, return; return; } } mPipBoundsState.setBounds(destinationBounds); mPipBoundsState.setBounds(destinationBounds); mSwipePipToHomeOverlay = overlay; mPipOverlay = overlay; if (ENABLE_SHELL_TRANSITIONS && overlay != null) { if (ENABLE_SHELL_TRANSITIONS && overlay != null) { // With Shell transition, the overlay was attached to the remote transition leash, which // 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 // will be removed when the current transition is finished, so we need to reparent it Loading Loading @@ -892,7 +884,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } final Rect destinationBounds = mPipBoundsState.getBounds(); final Rect destinationBounds = mPipBoundsState.getBounds(); final SurfaceControl swipeToHomeOverlay = mSwipePipToHomeOverlay; final SurfaceControl swipeToHomeOverlay = mPipOverlay; final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper mSurfaceTransactionHelper .resetScale(tx, mLeash, destinationBounds) .resetScale(tx, mLeash, destinationBounds) Loading @@ -911,7 +903,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } }, tx); }, tx); mPipTransitionState.setInSwipePipToHomeTransition(false); mPipTransitionState.setInSwipePipToHomeTransition(false); mSwipePipToHomeOverlay = null; mPipOverlay = null; } } private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable, private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable, Loading Loading @@ -1126,9 +1118,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } clearWaitForFixedRotation(); clearWaitForFixedRotation(); if (mSwipePipToHomeOverlay != null) { if (mPipOverlay != null) { removeContentOverlay(mSwipePipToHomeOverlay, null /* callback */); removeContentOverlay(mPipOverlay, null /* callback */); mSwipePipToHomeOverlay = null; mPipOverlay = null; } } resetShadowRadius(); resetShadowRadius(); mPipTransitionState.setInSwipePipToHomeTransition(false); mPipTransitionState.setInSwipePipToHomeTransition(false); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +9 −9 Original line number Original line Diff line number Diff line Loading @@ -465,7 +465,7 @@ public class PipTransition extends PipTransitionController { mSurfaceTransactionHelper.crop(tx, leash, destinationBounds) mSurfaceTransactionHelper.crop(tx, leash, destinationBounds) .resetScale(tx, leash, destinationBounds) .resetScale(tx, leash, destinationBounds) .round(tx, leash, true /* applyCornerRadius */); .round(tx, leash, true /* applyCornerRadius */); if (mPipOrganizer.mSwipePipToHomeOverlay != null && !mInitBounds.isEmpty()) { if (mPipOrganizer.mPipOverlay != null && !mInitBounds.isEmpty()) { // Resetting the scale for pinned task while re-adjusting its crop, // Resetting the scale for pinned task while re-adjusting its crop, // also scales the overlay. So we need to update the overlay leash too. // also scales the overlay. So we need to update the overlay leash too. Rect overlayBounds = new Rect(destinationBounds); Rect overlayBounds = new Rect(destinationBounds); Loading @@ -476,7 +476,7 @@ public class PipTransition extends PipTransitionController { (destinationBounds.width() - overlaySize) / 2, (destinationBounds.width() - overlaySize) / 2, (destinationBounds.height() - overlaySize) / 2); (destinationBounds.height() - overlaySize) / 2); mSurfaceTransactionHelper.resetScale(tx, mSurfaceTransactionHelper.resetScale(tx, mPipOrganizer.mSwipePipToHomeOverlay, overlayBounds); mPipOrganizer.mPipOverlay, overlayBounds); } } } } mInitBounds.setEmpty(); mInitBounds.setEmpty(); Loading Loading @@ -615,9 +615,9 @@ public class PipTransition extends PipTransitionController { } } } } // if overlay is present remove it immediately, as exit transition came before it faded out // if overlay is present remove it immediately, as exit transition came before it faded out if (mPipOrganizer.mSwipePipToHomeOverlay != null) { if (mPipOrganizer.mPipOverlay != null) { startTransaction.remove(mPipOrganizer.mSwipePipToHomeOverlay); startTransaction.remove(mPipOrganizer.mPipOverlay); clearSwipePipToHomeOverlay(); clearPipOverlay(); } } if (pipChange == null) { if (pipChange == null) { ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, Loading Loading @@ -1077,7 +1077,7 @@ public class PipTransition extends PipTransitionController { if (mFixedRotationState == FIXED_ROTATION_CALLBACK && appBounds != null) { if (mFixedRotationState == FIXED_ROTATION_CALLBACK && appBounds != null) { mInitBounds.set(appBounds); mInitBounds.set(appBounds); } } final SurfaceControl swipePipToHomeOverlay = mPipOrganizer.mSwipePipToHomeOverlay; final SurfaceControl swipePipToHomeOverlay = mPipOrganizer.mPipOverlay; if (swipePipToHomeOverlay != null) { if (swipePipToHomeOverlay != null) { // Launcher fade in the overlay on top of the fullscreen Task. It is possible we // Launcher fade in the overlay on top of the fullscreen Task. It is possible we // reparent the PIP activity to a new PIP task (in case there are other activities // reparent the PIP activity to a new PIP task (in case there are other activities Loading Loading @@ -1106,7 +1106,7 @@ public class PipTransition extends PipTransitionController { sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); if (swipePipToHomeOverlay != null) { if (swipePipToHomeOverlay != null) { mPipOrganizer.fadeOutAndRemoveOverlay(swipePipToHomeOverlay, mPipOrganizer.fadeOutAndRemoveOverlay(swipePipToHomeOverlay, this::clearSwipePipToHomeOverlay /* callback */, false /* withStartDelay */); this::clearPipOverlay /* callback */, false /* withStartDelay */); } } mPipTransitionState.setInSwipePipToHomeTransition(false); mPipTransitionState.setInSwipePipToHomeTransition(false); } } Loading Loading @@ -1250,8 +1250,8 @@ public class PipTransition extends PipTransitionController { mPipMenuController.updateMenuBounds(destinationBounds); mPipMenuController.updateMenuBounds(destinationBounds); } } private void clearSwipePipToHomeOverlay() { private void clearPipOverlay() { mPipOrganizer.mSwipePipToHomeOverlay = null; mPipOrganizer.mPipOverlay = null; } } @Override @Override Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipAnimationController.java +0 −1 Original line number Original line Diff line number Diff line Loading @@ -769,7 +769,6 @@ public class PipAnimationController { getSurfaceTransactionHelper().crop(tx, leash, destBounds); getSurfaceTransactionHelper().crop(tx, leash, destBounds); } } if (mContentOverlay != null) { if (mContentOverlay != null) { mContentOverlay.onAnimationEnd(tx, destBounds); clearContentOverlay(); clearContentOverlay(); } } } } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipContentOverlay.java +0 −24 Original line number Original line Diff line number Diff line Loading @@ -67,15 +67,6 @@ public abstract class PipContentOverlay { public abstract void onAnimationUpdate(SurfaceControl.Transaction atomicTx, public abstract void onAnimationUpdate(SurfaceControl.Transaction atomicTx, Rect currentBounds, float fraction); Rect currentBounds, float fraction); /** * Callback when reaches the end of animation on the internal {@link #mLeash}. * @param atomicTx {@link SurfaceControl.Transaction} to operate, you should not explicitly * call apply on this transaction, it should be applied on the caller side. * @param destinationBounds {@link Rect} of the final bounds. */ public abstract void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds); /** A {@link PipContentOverlay} uses solid color. */ /** A {@link PipContentOverlay} uses solid color. */ public static final class PipColorOverlay extends PipContentOverlay { public static final class PipColorOverlay extends PipContentOverlay { private static final String TAG = PipColorOverlay.class.getSimpleName(); private static final String TAG = PipColorOverlay.class.getSimpleName(); Loading Loading @@ -107,11 +98,6 @@ public abstract class PipContentOverlay { atomicTx.setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); atomicTx.setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); } } @Override public void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds) { // Do nothing. Color overlay should be fully opaque by now, ready for fade out. } private float[] getContentOverlayColor(Context context) { private float[] getContentOverlayColor(Context context) { final TypedArray ta = context.obtainStyledAttributes(new int[] { final TypedArray ta = context.obtainStyledAttributes(new int[] { android.R.attr.colorBackground }); android.R.attr.colorBackground }); Loading Loading @@ -164,11 +150,6 @@ public abstract class PipContentOverlay { Rect currentBounds, float fraction) { Rect currentBounds, float fraction) { // Do nothing. Keep the snapshot till animation ends. // Do nothing. Keep the snapshot till animation ends. } } @Override public void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds) { // Do nothing. Snapshot overlay should be fully opaque by now, ready for fade out. } } } /** A {@link PipContentOverlay} shows app icon on solid color background. */ /** A {@link PipContentOverlay} shows app icon on solid color background. */ Loading Loading @@ -254,11 +235,6 @@ public abstract class PipContentOverlay { .setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); .setAlpha(mLeash, fraction < 0.5f ? 0 : (fraction - 0.5f) * 2); } } @Override public void onAnimationEnd(SurfaceControl.Transaction atomicTx, Rect destinationBounds) { // Do nothing. Icon overlay should be fully opaque by now, ready for fade out. } @Override @Override public void detach(SurfaceControl.Transaction tx) { public void detach(SurfaceControl.Transaction tx) { super.detach(tx); super.detach(tx); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +7 −15 Original line number Original line Diff line number Diff line Loading @@ -329,15 +329,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, private @Surface.Rotation int mCurrentRotation; private @Surface.Rotation int mCurrentRotation; /** /** * An optional overlay used to mask content changing between an app in/out of PiP, only set if * An optional overlay used to mask content changing between an app in/out of PiP. * {@link PipTransitionState#getInSwipePipToHomeTransition()} is true, only in gesture nav. */ @Nullable SurfaceControl mSwipePipToHomeOverlay; /** * An optional overlay used to mask content changing between an app in/out of PiP, only set if * {@link PipTransitionState#getInSwipePipToHomeTransition()} is false. */ */ @Nullable @Nullable SurfaceControl mPipOverlay; SurfaceControl mPipOverlay; Loading Loading @@ -480,7 +472,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, return; return; } } mPipBoundsState.setBounds(destinationBounds); mPipBoundsState.setBounds(destinationBounds); mSwipePipToHomeOverlay = overlay; mPipOverlay = overlay; if (ENABLE_SHELL_TRANSITIONS && overlay != null) { if (ENABLE_SHELL_TRANSITIONS && overlay != null) { // With Shell transition, the overlay was attached to the remote transition leash, which // 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 // will be removed when the current transition is finished, so we need to reparent it Loading Loading @@ -892,7 +884,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } final Rect destinationBounds = mPipBoundsState.getBounds(); final Rect destinationBounds = mPipBoundsState.getBounds(); final SurfaceControl swipeToHomeOverlay = mSwipePipToHomeOverlay; final SurfaceControl swipeToHomeOverlay = mPipOverlay; final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); final SurfaceControl.Transaction tx = mSurfaceControlTransactionFactory.getTransaction(); mSurfaceTransactionHelper mSurfaceTransactionHelper .resetScale(tx, mLeash, destinationBounds) .resetScale(tx, mLeash, destinationBounds) Loading @@ -911,7 +903,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } }, tx); }, tx); mPipTransitionState.setInSwipePipToHomeTransition(false); mPipTransitionState.setInSwipePipToHomeTransition(false); mSwipePipToHomeOverlay = null; mPipOverlay = null; } } private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable, private void applyEnterPipSyncTransaction(Rect destinationBounds, Runnable runnable, Loading Loading @@ -1126,9 +1118,9 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } } clearWaitForFixedRotation(); clearWaitForFixedRotation(); if (mSwipePipToHomeOverlay != null) { if (mPipOverlay != null) { removeContentOverlay(mSwipePipToHomeOverlay, null /* callback */); removeContentOverlay(mPipOverlay, null /* callback */); mSwipePipToHomeOverlay = null; mPipOverlay = null; } } resetShadowRadius(); resetShadowRadius(); mPipTransitionState.setInSwipePipToHomeTransition(false); mPipTransitionState.setInSwipePipToHomeTransition(false); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTransition.java +9 −9 Original line number Original line Diff line number Diff line Loading @@ -465,7 +465,7 @@ public class PipTransition extends PipTransitionController { mSurfaceTransactionHelper.crop(tx, leash, destinationBounds) mSurfaceTransactionHelper.crop(tx, leash, destinationBounds) .resetScale(tx, leash, destinationBounds) .resetScale(tx, leash, destinationBounds) .round(tx, leash, true /* applyCornerRadius */); .round(tx, leash, true /* applyCornerRadius */); if (mPipOrganizer.mSwipePipToHomeOverlay != null && !mInitBounds.isEmpty()) { if (mPipOrganizer.mPipOverlay != null && !mInitBounds.isEmpty()) { // Resetting the scale for pinned task while re-adjusting its crop, // Resetting the scale for pinned task while re-adjusting its crop, // also scales the overlay. So we need to update the overlay leash too. // also scales the overlay. So we need to update the overlay leash too. Rect overlayBounds = new Rect(destinationBounds); Rect overlayBounds = new Rect(destinationBounds); Loading @@ -476,7 +476,7 @@ public class PipTransition extends PipTransitionController { (destinationBounds.width() - overlaySize) / 2, (destinationBounds.width() - overlaySize) / 2, (destinationBounds.height() - overlaySize) / 2); (destinationBounds.height() - overlaySize) / 2); mSurfaceTransactionHelper.resetScale(tx, mSurfaceTransactionHelper.resetScale(tx, mPipOrganizer.mSwipePipToHomeOverlay, overlayBounds); mPipOrganizer.mPipOverlay, overlayBounds); } } } } mInitBounds.setEmpty(); mInitBounds.setEmpty(); Loading Loading @@ -615,9 +615,9 @@ public class PipTransition extends PipTransitionController { } } } } // if overlay is present remove it immediately, as exit transition came before it faded out // if overlay is present remove it immediately, as exit transition came before it faded out if (mPipOrganizer.mSwipePipToHomeOverlay != null) { if (mPipOrganizer.mPipOverlay != null) { startTransaction.remove(mPipOrganizer.mSwipePipToHomeOverlay); startTransaction.remove(mPipOrganizer.mPipOverlay); clearSwipePipToHomeOverlay(); clearPipOverlay(); } } if (pipChange == null) { if (pipChange == null) { ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, ProtoLog.w(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE, Loading Loading @@ -1077,7 +1077,7 @@ public class PipTransition extends PipTransitionController { if (mFixedRotationState == FIXED_ROTATION_CALLBACK && appBounds != null) { if (mFixedRotationState == FIXED_ROTATION_CALLBACK && appBounds != null) { mInitBounds.set(appBounds); mInitBounds.set(appBounds); } } final SurfaceControl swipePipToHomeOverlay = mPipOrganizer.mSwipePipToHomeOverlay; final SurfaceControl swipePipToHomeOverlay = mPipOrganizer.mPipOverlay; if (swipePipToHomeOverlay != null) { if (swipePipToHomeOverlay != null) { // Launcher fade in the overlay on top of the fullscreen Task. It is possible we // Launcher fade in the overlay on top of the fullscreen Task. It is possible we // reparent the PIP activity to a new PIP task (in case there are other activities // reparent the PIP activity to a new PIP task (in case there are other activities Loading Loading @@ -1106,7 +1106,7 @@ public class PipTransition extends PipTransitionController { sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); sendOnPipTransitionFinished(TRANSITION_DIRECTION_TO_PIP); if (swipePipToHomeOverlay != null) { if (swipePipToHomeOverlay != null) { mPipOrganizer.fadeOutAndRemoveOverlay(swipePipToHomeOverlay, mPipOrganizer.fadeOutAndRemoveOverlay(swipePipToHomeOverlay, this::clearSwipePipToHomeOverlay /* callback */, false /* withStartDelay */); this::clearPipOverlay /* callback */, false /* withStartDelay */); } } mPipTransitionState.setInSwipePipToHomeTransition(false); mPipTransitionState.setInSwipePipToHomeTransition(false); } } Loading Loading @@ -1250,8 +1250,8 @@ public class PipTransition extends PipTransitionController { mPipMenuController.updateMenuBounds(destinationBounds); mPipMenuController.updateMenuBounds(destinationBounds); } } private void clearSwipePipToHomeOverlay() { private void clearPipOverlay() { mPipOrganizer.mSwipePipToHomeOverlay = null; mPipOrganizer.mPipOverlay = null; } } @Override @Override Loading