diff --git a/libs/WindowManager/Shell/res/values/config.xml b/libs/WindowManager/Shell/res/values/config.xml index c2f591b9d7aff..2c2b4041eac37 100644 --- a/libs/WindowManager/Shell/res/values/config.xml +++ b/libs/WindowManager/Shell/res/values/config.xml @@ -15,7 +15,13 @@ limitations under the License. --> - + + 425 + + + 250 + + 425 diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java index f663d553cf5ed..88fec7c0f9ba7 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/PipTaskOrganizer.java @@ -63,6 +63,7 @@ import android.window.WindowContainerTransaction; import com.android.internal.annotations.VisibleForTesting; import com.android.wm.shell.R; import com.android.wm.shell.ShellTaskOrganizer; +import com.android.wm.shell.animation.Interpolators; import com.android.wm.shell.common.DisplayController; import com.android.wm.shell.common.ShellExecutor; import com.android.wm.shell.common.SyncTransactionQueue; @@ -131,7 +132,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, private final PipAnimationController mPipAnimationController; private final PipTransitionController mPipTransitionController; private final PipUiEventLogger mPipUiEventLoggerLogger; - private final int mEnterExitAnimationDuration; + private final int mEnterAnimationDuration; + private final int mExitAnimationDuration; private final PipSurfaceTransactionHelper mSurfaceTransactionHelper; private final Optional mSplitScreenOptional; protected final ShellTaskOrganizer mTaskOrganizer; @@ -225,8 +227,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mPipBoundsAlgorithm = boundsHandler; mPipMenuController = pipMenuController; mPipTransitionController = pipTransitionController; - mEnterExitAnimationDuration = context.getResources() - .getInteger(R.integer.config_pipResizeAnimationDuration); + mEnterAnimationDuration = context.getResources() + .getInteger(R.integer.config_pipEnterAnimationDuration); + mExitAnimationDuration = context.getResources() + .getInteger(R.integer.config_pipExitAnimationDuration); mSurfaceTransactionHelper = surfaceTransactionHelper; mPipAnimationController = pipAnimationController; mPipUiEventLoggerLogger = pipUiEventLogger; @@ -378,12 +382,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, } // removePipImmediately is expected when the following animation finishes. - mPipAnimationController + ValueAnimator animator = mPipAnimationController .getAnimator(mTaskInfo, mLeash, mPipBoundsState.getBounds(), 1f, 0f) .setTransitionDirection(TRANSITION_DIRECTION_REMOVE_STACK) - .setPipAnimationCallback(mPipAnimationCallback) - .setDuration(mEnterExitAnimationDuration) - .start(); + .setPipAnimationCallback(mPipAnimationCallback); + animator.setDuration(mExitAnimationDuration); + animator.setInterpolator(Interpolators.ALPHA_OUT); + animator.start(); mState = State.EXITING_PIP; } @@ -465,11 +470,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect( info.pictureInPictureParams, currentBounds); scheduleAnimateResizePip(currentBounds, destinationBounds, 0 /* startingAngle */, - sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration, + sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterAnimationDuration, null /* updateBoundsCallback */); mState = State.ENTERING_PIP; } else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) { - enterPipWithAlphaAnimation(destinationBounds, mEnterExitAnimationDuration); + enterPipWithAlphaAnimation(destinationBounds, mEnterAnimationDuration); mOneShotAnimationType = ANIM_TYPE_BOUNDS; } else { throw new RuntimeException("Unrecognized animation type: " + mOneShotAnimationType); @@ -596,7 +601,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, final Rect destinationBounds = mPipBoundsAlgorithm.getAdjustedDestinationBounds( mPipBoundsState.getBounds(), mPipBoundsState.getAspectRatio()); Objects.requireNonNull(destinationBounds, "Missing destination bounds"); - scheduleAnimateResizePip(destinationBounds, mEnterExitAnimationDuration, + scheduleAnimateResizePip(destinationBounds, mEnterAnimationDuration, null /* updateBoundsCallback */); } @@ -965,7 +970,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener, mMainExecutor.execute(() -> { // Start animation to fade out the snapshot. final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f); - animator.setDuration(mEnterExitAnimationDuration); + animator.setDuration(mEnterAnimationDuration); animator.addUpdateListener(animation -> { final float alpha = (float) animation.getAnimatedValue(); final SurfaceControl.Transaction transaction = diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java index 580861cf49740..65f3d3a924769 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipMenuController.java @@ -244,9 +244,11 @@ public class PhonePipMenuController implements PipMenuController { */ public void showMenuWithPossibleDelay(int menuState, Rect stackBounds, boolean allowMenuTimeout, boolean willResizeMenu, boolean showResizeHandle) { - // hide all visible controls including close button and etc. first, this is to ensure - // menu is totally invisible during the transition to eliminate unpleasant artifacts - fadeOutMenu(); + if (willResizeMenu) { + // hide all visible controls including close button and etc. first, this is to ensure + // menu is totally invisible during the transition to eliminate unpleasant artifacts + fadeOutMenu(); + } showMenuInternal(menuState, stackBounds, allowMenuTimeout, willResizeMenu, willResizeMenu /* withDelay=willResizeMenu here */, showResizeHandle); } diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java index 8ab405bca7dbc..1bfae53853c3c 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PipMenuView.java @@ -76,7 +76,6 @@ public class PipMenuView extends FrameLayout { private static final int INITIAL_DISMISS_DELAY = 3500; private static final int POST_INTERACTION_DISMISS_DELAY = 2000; private static final long MENU_FADE_DURATION = 125; - private static final long MENU_SLOW_FADE_DURATION = 175; private static final long MENU_SHOW_ON_EXPAND_START_DELAY = 30; private static final float MENU_BACKGROUND_ALPHA = 0.3f; @@ -253,9 +252,7 @@ public class PipMenuView extends FrameLayout { mMenuContainerAnimator.playTogether(dismissAnim, resizeAnim); } mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN); - mMenuContainerAnimator.setDuration(menuState == MENU_STATE_CLOSE - ? MENU_FADE_DURATION - : MENU_SLOW_FADE_DURATION); + mMenuContainerAnimator.setDuration(MENU_FADE_DURATION); if (allowMenuTimeout) { mMenuContainerAnimator.addListener(new AnimatorListenerAdapter() { @Override