Merge "Minor pip menu changes" into sc-dev
This commit is contained in:
@@ -15,7 +15,13 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
-->
|
-->
|
||||||
<resources>
|
<resources>
|
||||||
<!-- Animation duration for resizing of PIP when entering/exiting. -->
|
<!-- Animation duration for PIP when entering. -->
|
||||||
|
<integer name="config_pipEnterAnimationDuration">425</integer>
|
||||||
|
|
||||||
|
<!-- Animation duration for PIP when exiting. -->
|
||||||
|
<integer name="config_pipExitAnimationDuration">250</integer>
|
||||||
|
|
||||||
|
<!-- Animation duration for resizing of PIP. -->
|
||||||
<integer name="config_pipResizeAnimationDuration">425</integer>
|
<integer name="config_pipResizeAnimationDuration">425</integer>
|
||||||
|
|
||||||
<!-- Allow dragging the PIP to a location to close it -->
|
<!-- Allow dragging the PIP to a location to close it -->
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ import android.window.WindowContainerTransaction;
|
|||||||
import com.android.internal.annotations.VisibleForTesting;
|
import com.android.internal.annotations.VisibleForTesting;
|
||||||
import com.android.wm.shell.R;
|
import com.android.wm.shell.R;
|
||||||
import com.android.wm.shell.ShellTaskOrganizer;
|
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.DisplayController;
|
||||||
import com.android.wm.shell.common.ShellExecutor;
|
import com.android.wm.shell.common.ShellExecutor;
|
||||||
import com.android.wm.shell.common.SyncTransactionQueue;
|
import com.android.wm.shell.common.SyncTransactionQueue;
|
||||||
@@ -131,7 +132,8 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
private final PipAnimationController mPipAnimationController;
|
private final PipAnimationController mPipAnimationController;
|
||||||
private final PipTransitionController mPipTransitionController;
|
private final PipTransitionController mPipTransitionController;
|
||||||
private final PipUiEventLogger mPipUiEventLoggerLogger;
|
private final PipUiEventLogger mPipUiEventLoggerLogger;
|
||||||
private final int mEnterExitAnimationDuration;
|
private final int mEnterAnimationDuration;
|
||||||
|
private final int mExitAnimationDuration;
|
||||||
private final PipSurfaceTransactionHelper mSurfaceTransactionHelper;
|
private final PipSurfaceTransactionHelper mSurfaceTransactionHelper;
|
||||||
private final Optional<LegacySplitScreenController> mSplitScreenOptional;
|
private final Optional<LegacySplitScreenController> mSplitScreenOptional;
|
||||||
protected final ShellTaskOrganizer mTaskOrganizer;
|
protected final ShellTaskOrganizer mTaskOrganizer;
|
||||||
@@ -225,8 +227,10 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
mPipBoundsAlgorithm = boundsHandler;
|
mPipBoundsAlgorithm = boundsHandler;
|
||||||
mPipMenuController = pipMenuController;
|
mPipMenuController = pipMenuController;
|
||||||
mPipTransitionController = pipTransitionController;
|
mPipTransitionController = pipTransitionController;
|
||||||
mEnterExitAnimationDuration = context.getResources()
|
mEnterAnimationDuration = context.getResources()
|
||||||
.getInteger(R.integer.config_pipResizeAnimationDuration);
|
.getInteger(R.integer.config_pipEnterAnimationDuration);
|
||||||
|
mExitAnimationDuration = context.getResources()
|
||||||
|
.getInteger(R.integer.config_pipExitAnimationDuration);
|
||||||
mSurfaceTransactionHelper = surfaceTransactionHelper;
|
mSurfaceTransactionHelper = surfaceTransactionHelper;
|
||||||
mPipAnimationController = pipAnimationController;
|
mPipAnimationController = pipAnimationController;
|
||||||
mPipUiEventLoggerLogger = pipUiEventLogger;
|
mPipUiEventLoggerLogger = pipUiEventLogger;
|
||||||
@@ -378,12 +382,13 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// removePipImmediately is expected when the following animation finishes.
|
// removePipImmediately is expected when the following animation finishes.
|
||||||
mPipAnimationController
|
ValueAnimator animator = mPipAnimationController
|
||||||
.getAnimator(mTaskInfo, mLeash, mPipBoundsState.getBounds(), 1f, 0f)
|
.getAnimator(mTaskInfo, mLeash, mPipBoundsState.getBounds(), 1f, 0f)
|
||||||
.setTransitionDirection(TRANSITION_DIRECTION_REMOVE_STACK)
|
.setTransitionDirection(TRANSITION_DIRECTION_REMOVE_STACK)
|
||||||
.setPipAnimationCallback(mPipAnimationCallback)
|
.setPipAnimationCallback(mPipAnimationCallback);
|
||||||
.setDuration(mEnterExitAnimationDuration)
|
animator.setDuration(mExitAnimationDuration);
|
||||||
.start();
|
animator.setInterpolator(Interpolators.ALPHA_OUT);
|
||||||
|
animator.start();
|
||||||
mState = State.EXITING_PIP;
|
mState = State.EXITING_PIP;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,11 +470,11 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
|
final Rect sourceHintRect = PipBoundsAlgorithm.getValidSourceHintRect(
|
||||||
info.pictureInPictureParams, currentBounds);
|
info.pictureInPictureParams, currentBounds);
|
||||||
scheduleAnimateResizePip(currentBounds, destinationBounds, 0 /* startingAngle */,
|
scheduleAnimateResizePip(currentBounds, destinationBounds, 0 /* startingAngle */,
|
||||||
sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterExitAnimationDuration,
|
sourceHintRect, TRANSITION_DIRECTION_TO_PIP, mEnterAnimationDuration,
|
||||||
null /* updateBoundsCallback */);
|
null /* updateBoundsCallback */);
|
||||||
mState = State.ENTERING_PIP;
|
mState = State.ENTERING_PIP;
|
||||||
} else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) {
|
} else if (mOneShotAnimationType == ANIM_TYPE_ALPHA) {
|
||||||
enterPipWithAlphaAnimation(destinationBounds, mEnterExitAnimationDuration);
|
enterPipWithAlphaAnimation(destinationBounds, mEnterAnimationDuration);
|
||||||
mOneShotAnimationType = ANIM_TYPE_BOUNDS;
|
mOneShotAnimationType = ANIM_TYPE_BOUNDS;
|
||||||
} else {
|
} else {
|
||||||
throw new RuntimeException("Unrecognized animation type: " + mOneShotAnimationType);
|
throw new RuntimeException("Unrecognized animation type: " + mOneShotAnimationType);
|
||||||
@@ -596,7 +601,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
final Rect destinationBounds = mPipBoundsAlgorithm.getAdjustedDestinationBounds(
|
final Rect destinationBounds = mPipBoundsAlgorithm.getAdjustedDestinationBounds(
|
||||||
mPipBoundsState.getBounds(), mPipBoundsState.getAspectRatio());
|
mPipBoundsState.getBounds(), mPipBoundsState.getAspectRatio());
|
||||||
Objects.requireNonNull(destinationBounds, "Missing destination bounds");
|
Objects.requireNonNull(destinationBounds, "Missing destination bounds");
|
||||||
scheduleAnimateResizePip(destinationBounds, mEnterExitAnimationDuration,
|
scheduleAnimateResizePip(destinationBounds, mEnterAnimationDuration,
|
||||||
null /* updateBoundsCallback */);
|
null /* updateBoundsCallback */);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -965,7 +970,7 @@ public class PipTaskOrganizer implements ShellTaskOrganizer.TaskListener,
|
|||||||
mMainExecutor.execute(() -> {
|
mMainExecutor.execute(() -> {
|
||||||
// Start animation to fade out the snapshot.
|
// Start animation to fade out the snapshot.
|
||||||
final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
|
final ValueAnimator animator = ValueAnimator.ofFloat(1.0f, 0.0f);
|
||||||
animator.setDuration(mEnterExitAnimationDuration);
|
animator.setDuration(mEnterAnimationDuration);
|
||||||
animator.addUpdateListener(animation -> {
|
animator.addUpdateListener(animation -> {
|
||||||
final float alpha = (float) animation.getAnimatedValue();
|
final float alpha = (float) animation.getAnimatedValue();
|
||||||
final SurfaceControl.Transaction transaction =
|
final SurfaceControl.Transaction transaction =
|
||||||
|
|||||||
@@ -244,9 +244,11 @@ public class PhonePipMenuController implements PipMenuController {
|
|||||||
*/
|
*/
|
||||||
public void showMenuWithPossibleDelay(int menuState, Rect stackBounds, boolean allowMenuTimeout,
|
public void showMenuWithPossibleDelay(int menuState, Rect stackBounds, boolean allowMenuTimeout,
|
||||||
boolean willResizeMenu, boolean showResizeHandle) {
|
boolean willResizeMenu, boolean showResizeHandle) {
|
||||||
// hide all visible controls including close button and etc. first, this is to ensure
|
if (willResizeMenu) {
|
||||||
// menu is totally invisible during the transition to eliminate unpleasant artifacts
|
// hide all visible controls including close button and etc. first, this is to ensure
|
||||||
fadeOutMenu();
|
// menu is totally invisible during the transition to eliminate unpleasant artifacts
|
||||||
|
fadeOutMenu();
|
||||||
|
}
|
||||||
showMenuInternal(menuState, stackBounds, allowMenuTimeout, willResizeMenu,
|
showMenuInternal(menuState, stackBounds, allowMenuTimeout, willResizeMenu,
|
||||||
willResizeMenu /* withDelay=willResizeMenu here */, showResizeHandle);
|
willResizeMenu /* withDelay=willResizeMenu here */, showResizeHandle);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class PipMenuView extends FrameLayout {
|
|||||||
private static final int INITIAL_DISMISS_DELAY = 3500;
|
private static final int INITIAL_DISMISS_DELAY = 3500;
|
||||||
private static final int POST_INTERACTION_DISMISS_DELAY = 2000;
|
private static final int POST_INTERACTION_DISMISS_DELAY = 2000;
|
||||||
private static final long MENU_FADE_DURATION = 125;
|
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 long MENU_SHOW_ON_EXPAND_START_DELAY = 30;
|
||||||
|
|
||||||
private static final float MENU_BACKGROUND_ALPHA = 0.3f;
|
private static final float MENU_BACKGROUND_ALPHA = 0.3f;
|
||||||
@@ -253,9 +252,7 @@ public class PipMenuView extends FrameLayout {
|
|||||||
mMenuContainerAnimator.playTogether(dismissAnim, resizeAnim);
|
mMenuContainerAnimator.playTogether(dismissAnim, resizeAnim);
|
||||||
}
|
}
|
||||||
mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN);
|
mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN);
|
||||||
mMenuContainerAnimator.setDuration(menuState == MENU_STATE_CLOSE
|
mMenuContainerAnimator.setDuration(MENU_FADE_DURATION);
|
||||||
? MENU_FADE_DURATION
|
|
||||||
: MENU_SLOW_FADE_DURATION);
|
|
||||||
if (allowMenuTimeout) {
|
if (allowMenuTimeout) {
|
||||||
mMenuContainerAnimator.addListener(new AnimatorListenerAdapter() {
|
mMenuContainerAnimator.addListener(new AnimatorListenerAdapter() {
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user