Loading libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java +9 −3 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public abstract class Pip2Module { @WMSingleton @Provides static PipTransition providePipTransition(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, @NonNull ShellInit shellInit, @NonNull ShellTaskOrganizer shellTaskOrganizer, @NonNull Transitions transitions, Loading @@ -99,7 +100,8 @@ public abstract class Pip2Module { PipDesktopState pipDesktopState, Optional<DesktopPipTransitionController> desktopPipTransitionController, PipInteractionHandler pipInteractionHandler) { return new PipTransition(context, shellInit, shellTaskOrganizer, transitions, return new PipTransition(context, pipSurfaceTransactionHelper, shellInit, shellTaskOrganizer, transitions, pipBoundsState, null, pipBoundsAlgorithm, pipTaskListener, pipScheduler, pipStackListenerController, pipDisplayLayoutState, pipUiStateChangeController, displayController, splitScreenControllerOptional, Loading Loading @@ -154,6 +156,7 @@ public abstract class Pip2Module { @WMSingleton @Provides static PipScheduler providePipScheduler(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, PipBoundsState pipBoundsState, @ShellMainThread ShellExecutor mainExecutor, PipTransitionState pipTransitionState, Loading @@ -161,7 +164,8 @@ public abstract class Pip2Module { Optional<DesktopPipTransitionController> desktopPipTransitionController, PipDesktopState pipDesktopState, DisplayController displayController) { return new PipScheduler(context, pipBoundsState, mainExecutor, pipTransitionState, return new PipScheduler(context, pipSurfaceTransactionHelper, pipBoundsState, mainExecutor, pipTransitionState, splitScreenControllerOptional, desktopPipTransitionController, pipDesktopState, displayController); } Loading @@ -186,6 +190,7 @@ public abstract class Pip2Module { @WMSingleton @Provides static PipTouchHandler providePipTouchHandler(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, ShellInit shellInit, ShellCommandHandler shellCommandHandler, PhonePipMenuController menuPhoneController, Loading @@ -203,7 +208,8 @@ public abstract class Pip2Module { @ShellMainThread ShellExecutor mainExecutor, Optional<PipPerfHintController> pipPerfHintControllerOptional, PipDisplayTransferHandler pipDisplayTransferHandler) { return new PipTouchHandler(context, shellInit, shellCommandHandler, menuPhoneController, return new PipTouchHandler(context, pipSurfaceTransactionHelper, shellInit, shellCommandHandler, menuPhoneController, pipBoundsAlgorithm, pipBoundsState, pipTransitionState, pipScheduler, sizeSpecSource, pipDisplayLayoutState, pipDesktopState, displayController, pipMotionHelper, floatingContentCoordinator, pipUiEventLogger, mainExecutor, Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/PipSurfaceTransactionHelper.java +8 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,14 @@ public class PipSurfaceTransactionHelper { mShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_shadow_radius); } /** * Gets corner radius which is loaded from resources. * @return the corner radius. */ public int getCornerRadius() { return mCornerRadius; } /** * Operates the scale (setMatrix) on a given transaction and leash * @return same {@link PipSurfaceTransactionHelper} instance for method chaining Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipAlphaAnimator.java +6 −8 Original line number Diff line number Diff line Loading @@ -53,9 +53,6 @@ public class PipAlphaAnimator extends ValueAnimator { private final SurfaceControl.Transaction mFinishTransaction; private final int mDirection; private final int mCornerRadius; private final int mShadowRadius; private final Animator.AnimatorListener mAnimatorListener = new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { Loading Loading @@ -99,8 +96,10 @@ public class PipAlphaAnimator extends ValueAnimator { @NonNull private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory mSurfaceControlTransactionFactory; @NonNull private final PipSurfaceTransactionHelper mSurfaceTransactionHelper; public PipAlphaAnimator(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, SurfaceControl leash, SurfaceControl.Transaction startTransaction, SurfaceControl.Transaction finishTransaction, Loading @@ -108,6 +107,7 @@ public class PipAlphaAnimator extends ValueAnimator { mLeash = leash; mStartTransaction = startTransaction; mFinishTransaction = finishTransaction; mSurfaceTransactionHelper = pipSurfaceTransactionHelper; mDirection = direction; setFloatValues(getStartAlphaValue(), getEndAlphaValue()); Loading @@ -115,8 +115,6 @@ public class PipAlphaAnimator extends ValueAnimator { new PipSurfaceTransactionHelper.VsyncSurfaceControlTransactionFactory(); final int enterAnimationDuration = context.getResources() .getInteger(R.integer.config_pipEnterAnimationDuration); mCornerRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_corner_radius); mShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_shadow_radius); setDuration(enterAnimationDuration); addListener(mAnimatorListener); addUpdateListener(mAnimatorUpdateListener); Loading @@ -132,9 +130,9 @@ public class PipAlphaAnimator extends ValueAnimator { private void onAlphaAnimationUpdate(float alpha, SurfaceControl.Transaction tx) { // only set shadow radius on fade in tx.setAlpha(mLeash, alpha) .setCornerRadius(mLeash, mCornerRadius) .setShadowRadius(mLeash, mDirection == FADE_IN ? mShadowRadius : 0f); tx.setAlpha(mLeash, alpha); mSurfaceTransactionHelper.round(tx, mLeash, true /* applyCornerRadius */); mSurfaceTransactionHelper.shadow(tx, mLeash, mDirection == FADE_IN /* applyCornerRadius */); tx.apply(); } Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipEnterAnimator.java +6 −6 Original line number Diff line number Diff line Loading @@ -52,9 +52,6 @@ public class PipEnterAnimator extends ValueAnimator { private final SurfaceControl.Transaction mStartTransaction; private final SurfaceControl.Transaction mFinishTransaction; private final int mCornerRadius; private final int mShadowRadius; // Bounds updated by the evaluator as animator is running. private final Rect mAnimatedRect = new Rect(); Loading Loading @@ -113,7 +110,10 @@ public class PipEnterAnimator extends ValueAnimator { } }; private final @NonNull PipSurfaceTransactionHelper mSurfaceTransactionHelper; public PipEnterAnimator(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, @NonNull SurfaceControl leash, SurfaceControl.Transaction startTransaction, SurfaceControl.Transaction finishTransaction, Loading @@ -128,11 +128,10 @@ public class PipEnterAnimator extends ValueAnimator { mSurfaceControlTransactionFactory = new PipSurfaceTransactionHelper.VsyncSurfaceControlTransactionFactory(); mPipAppIconOverlaySupplier = this::getAppIconOverlay; mSurfaceTransactionHelper = pipSurfaceTransactionHelper; final int enterAnimationDuration = context.getResources() .getInteger(R.integer.config_pipEnterAnimationDuration); mCornerRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_corner_radius); mShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_shadow_radius); setDuration(enterAnimationDuration); setFloatValues(0f, 1f); setInterpolator(Interpolators.FAST_OUT_SLOW_IN); Loading Loading @@ -182,7 +181,8 @@ public class PipEnterAnimator extends ValueAnimator { mTransformTensor.postRotate(degrees); tx.setMatrix(mLeash, mTransformTensor, mMatrixTmp); tx.setCornerRadius(mLeash, mCornerRadius).setShadowRadius(mLeash, mShadowRadius); mSurfaceTransactionHelper.round(tx, mLeash, true /* applyCornerRadius */); mSurfaceTransactionHelper.shadow(tx, mLeash, true /* applyShadow */); if (mContentOverlay != null) { mContentOverlay.onAnimationUpdate(tx, 1f / scaleX, fraction, mEndBounds); Loading libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipExpandAnimator.java +3 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class PipExpandAnimator extends ValueAnimator { mSurfaceControlTransactionFactory; private final RectEvaluator mRectEvaluator; private final RectEvaluator mInsetEvaluator; private final PipSurfaceTransactionHelper mPipSurfaceTransactionHelper; private @NonNull final PipSurfaceTransactionHelper mPipSurfaceTransactionHelper; private final Animator.AnimatorListener mAnimatorListener = new AnimatorListenerAdapter() { @Override Loading Loading @@ -106,6 +106,7 @@ public class PipExpandAnimator extends ValueAnimator { }; public PipExpandAnimator(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, @NonNull SurfaceControl leash, SurfaceControl.Transaction startTransaction, SurfaceControl.Transaction finishTransaction, Loading @@ -124,7 +125,7 @@ public class PipExpandAnimator extends ValueAnimator { mEndBounds.set(endBounds); mRectEvaluator = new RectEvaluator(mAnimatedRect); mInsetEvaluator = new RectEvaluator(new Rect()); mPipSurfaceTransactionHelper = new PipSurfaceTransactionHelper(context); mPipSurfaceTransactionHelper = pipSurfaceTransactionHelper; mRotation = rotation; mIsPipInDesktopMode = isPipInDesktopMode; Loading Loading
libs/WindowManager/Shell/src/com/android/wm/shell/dagger/pip/Pip2Module.java +9 −3 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ public abstract class Pip2Module { @WMSingleton @Provides static PipTransition providePipTransition(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, @NonNull ShellInit shellInit, @NonNull ShellTaskOrganizer shellTaskOrganizer, @NonNull Transitions transitions, Loading @@ -99,7 +100,8 @@ public abstract class Pip2Module { PipDesktopState pipDesktopState, Optional<DesktopPipTransitionController> desktopPipTransitionController, PipInteractionHandler pipInteractionHandler) { return new PipTransition(context, shellInit, shellTaskOrganizer, transitions, return new PipTransition(context, pipSurfaceTransactionHelper, shellInit, shellTaskOrganizer, transitions, pipBoundsState, null, pipBoundsAlgorithm, pipTaskListener, pipScheduler, pipStackListenerController, pipDisplayLayoutState, pipUiStateChangeController, displayController, splitScreenControllerOptional, Loading Loading @@ -154,6 +156,7 @@ public abstract class Pip2Module { @WMSingleton @Provides static PipScheduler providePipScheduler(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, PipBoundsState pipBoundsState, @ShellMainThread ShellExecutor mainExecutor, PipTransitionState pipTransitionState, Loading @@ -161,7 +164,8 @@ public abstract class Pip2Module { Optional<DesktopPipTransitionController> desktopPipTransitionController, PipDesktopState pipDesktopState, DisplayController displayController) { return new PipScheduler(context, pipBoundsState, mainExecutor, pipTransitionState, return new PipScheduler(context, pipSurfaceTransactionHelper, pipBoundsState, mainExecutor, pipTransitionState, splitScreenControllerOptional, desktopPipTransitionController, pipDesktopState, displayController); } Loading @@ -186,6 +190,7 @@ public abstract class Pip2Module { @WMSingleton @Provides static PipTouchHandler providePipTouchHandler(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, ShellInit shellInit, ShellCommandHandler shellCommandHandler, PhonePipMenuController menuPhoneController, Loading @@ -203,7 +208,8 @@ public abstract class Pip2Module { @ShellMainThread ShellExecutor mainExecutor, Optional<PipPerfHintController> pipPerfHintControllerOptional, PipDisplayTransferHandler pipDisplayTransferHandler) { return new PipTouchHandler(context, shellInit, shellCommandHandler, menuPhoneController, return new PipTouchHandler(context, pipSurfaceTransactionHelper, shellInit, shellCommandHandler, menuPhoneController, pipBoundsAlgorithm, pipBoundsState, pipTransitionState, pipScheduler, sizeSpecSource, pipDisplayLayoutState, pipDesktopState, displayController, pipMotionHelper, floatingContentCoordinator, pipUiEventLogger, mainExecutor, Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/PipSurfaceTransactionHelper.java +8 −0 Original line number Diff line number Diff line Loading @@ -40,6 +40,14 @@ public class PipSurfaceTransactionHelper { mShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_shadow_radius); } /** * Gets corner radius which is loaded from resources. * @return the corner radius. */ public int getCornerRadius() { return mCornerRadius; } /** * Operates the scale (setMatrix) on a given transaction and leash * @return same {@link PipSurfaceTransactionHelper} instance for method chaining Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipAlphaAnimator.java +6 −8 Original line number Diff line number Diff line Loading @@ -53,9 +53,6 @@ public class PipAlphaAnimator extends ValueAnimator { private final SurfaceControl.Transaction mFinishTransaction; private final int mDirection; private final int mCornerRadius; private final int mShadowRadius; private final Animator.AnimatorListener mAnimatorListener = new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { Loading Loading @@ -99,8 +96,10 @@ public class PipAlphaAnimator extends ValueAnimator { @NonNull private PipSurfaceTransactionHelper.SurfaceControlTransactionFactory mSurfaceControlTransactionFactory; @NonNull private final PipSurfaceTransactionHelper mSurfaceTransactionHelper; public PipAlphaAnimator(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, SurfaceControl leash, SurfaceControl.Transaction startTransaction, SurfaceControl.Transaction finishTransaction, Loading @@ -108,6 +107,7 @@ public class PipAlphaAnimator extends ValueAnimator { mLeash = leash; mStartTransaction = startTransaction; mFinishTransaction = finishTransaction; mSurfaceTransactionHelper = pipSurfaceTransactionHelper; mDirection = direction; setFloatValues(getStartAlphaValue(), getEndAlphaValue()); Loading @@ -115,8 +115,6 @@ public class PipAlphaAnimator extends ValueAnimator { new PipSurfaceTransactionHelper.VsyncSurfaceControlTransactionFactory(); final int enterAnimationDuration = context.getResources() .getInteger(R.integer.config_pipEnterAnimationDuration); mCornerRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_corner_radius); mShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_shadow_radius); setDuration(enterAnimationDuration); addListener(mAnimatorListener); addUpdateListener(mAnimatorUpdateListener); Loading @@ -132,9 +130,9 @@ public class PipAlphaAnimator extends ValueAnimator { private void onAlphaAnimationUpdate(float alpha, SurfaceControl.Transaction tx) { // only set shadow radius on fade in tx.setAlpha(mLeash, alpha) .setCornerRadius(mLeash, mCornerRadius) .setShadowRadius(mLeash, mDirection == FADE_IN ? mShadowRadius : 0f); tx.setAlpha(mLeash, alpha); mSurfaceTransactionHelper.round(tx, mLeash, true /* applyCornerRadius */); mSurfaceTransactionHelper.shadow(tx, mLeash, mDirection == FADE_IN /* applyCornerRadius */); tx.apply(); } Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipEnterAnimator.java +6 −6 Original line number Diff line number Diff line Loading @@ -52,9 +52,6 @@ public class PipEnterAnimator extends ValueAnimator { private final SurfaceControl.Transaction mStartTransaction; private final SurfaceControl.Transaction mFinishTransaction; private final int mCornerRadius; private final int mShadowRadius; // Bounds updated by the evaluator as animator is running. private final Rect mAnimatedRect = new Rect(); Loading Loading @@ -113,7 +110,10 @@ public class PipEnterAnimator extends ValueAnimator { } }; private final @NonNull PipSurfaceTransactionHelper mSurfaceTransactionHelper; public PipEnterAnimator(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, @NonNull SurfaceControl leash, SurfaceControl.Transaction startTransaction, SurfaceControl.Transaction finishTransaction, Loading @@ -128,11 +128,10 @@ public class PipEnterAnimator extends ValueAnimator { mSurfaceControlTransactionFactory = new PipSurfaceTransactionHelper.VsyncSurfaceControlTransactionFactory(); mPipAppIconOverlaySupplier = this::getAppIconOverlay; mSurfaceTransactionHelper = pipSurfaceTransactionHelper; final int enterAnimationDuration = context.getResources() .getInteger(R.integer.config_pipEnterAnimationDuration); mCornerRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_corner_radius); mShadowRadius = context.getResources().getDimensionPixelSize(R.dimen.pip_shadow_radius); setDuration(enterAnimationDuration); setFloatValues(0f, 1f); setInterpolator(Interpolators.FAST_OUT_SLOW_IN); Loading Loading @@ -182,7 +181,8 @@ public class PipEnterAnimator extends ValueAnimator { mTransformTensor.postRotate(degrees); tx.setMatrix(mLeash, mTransformTensor, mMatrixTmp); tx.setCornerRadius(mLeash, mCornerRadius).setShadowRadius(mLeash, mShadowRadius); mSurfaceTransactionHelper.round(tx, mLeash, true /* applyCornerRadius */); mSurfaceTransactionHelper.shadow(tx, mLeash, true /* applyShadow */); if (mContentOverlay != null) { mContentOverlay.onAnimationUpdate(tx, 1f / scaleX, fraction, mEndBounds); Loading
libs/WindowManager/Shell/src/com/android/wm/shell/pip2/animation/PipExpandAnimator.java +3 −2 Original line number Diff line number Diff line Loading @@ -66,7 +66,7 @@ public class PipExpandAnimator extends ValueAnimator { mSurfaceControlTransactionFactory; private final RectEvaluator mRectEvaluator; private final RectEvaluator mInsetEvaluator; private final PipSurfaceTransactionHelper mPipSurfaceTransactionHelper; private @NonNull final PipSurfaceTransactionHelper mPipSurfaceTransactionHelper; private final Animator.AnimatorListener mAnimatorListener = new AnimatorListenerAdapter() { @Override Loading Loading @@ -106,6 +106,7 @@ public class PipExpandAnimator extends ValueAnimator { }; public PipExpandAnimator(Context context, @NonNull PipSurfaceTransactionHelper pipSurfaceTransactionHelper, @NonNull SurfaceControl leash, SurfaceControl.Transaction startTransaction, SurfaceControl.Transaction finishTransaction, Loading @@ -124,7 +125,7 @@ public class PipExpandAnimator extends ValueAnimator { mEndBounds.set(endBounds); mRectEvaluator = new RectEvaluator(mAnimatedRect); mInsetEvaluator = new RectEvaluator(new Rect()); mPipSurfaceTransactionHelper = new PipSurfaceTransactionHelper(context); mPipSurfaceTransactionHelper = pipSurfaceTransactionHelper; mRotation = rotation; mIsPipInDesktopMode = isPipInDesktopMode; Loading