Merge "Ensure that we hide the menu without resizing when expanding." into oc-dev
This commit is contained in:
@@ -132,9 +132,6 @@ public class PipMenuActivityController {
|
||||
}
|
||||
case MESSAGE_EXPAND_PIP: {
|
||||
mListeners.forEach(l -> l.onPipExpand());
|
||||
// Preemptively mark the menu as invisible once we expand the PiP, but don't
|
||||
// resize as we will be animating the stack
|
||||
onMenuStateChanged(MENU_STATE_NONE, false /* resize */);
|
||||
break;
|
||||
}
|
||||
case MESSAGE_MINIMIZE_PIP: {
|
||||
@@ -143,9 +140,6 @@ public class PipMenuActivityController {
|
||||
}
|
||||
case MESSAGE_DISMISS_PIP: {
|
||||
mListeners.forEach(l -> l.onPipDismiss());
|
||||
// Preemptively mark the menu as invisible once we dismiss the PiP, but don't
|
||||
// resize as we'll be removing the stack in place
|
||||
onMenuStateChanged(MENU_STATE_NONE, false /* resize */);
|
||||
break;
|
||||
}
|
||||
case MESSAGE_SHOW_MENU: {
|
||||
@@ -307,6 +301,15 @@ public class PipMenuActivityController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Preemptively mark the menu as invisible, used when we are directly manipulating the pinned
|
||||
* stack and don't want to trigger a resize which can animate the stack in a conflicting way
|
||||
* (ie. when manually expanding or dismissing).
|
||||
*/
|
||||
public void hideMenuWithoutResize() {
|
||||
onMenuStateChanged(MENU_STATE_NONE, false /* resize */);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the current menu state.
|
||||
*/
|
||||
|
||||
@@ -77,6 +77,7 @@ public class PipMotionHelper {
|
||||
private SurfaceFlingerVsyncChoreographer mVsyncChoreographer;
|
||||
private Handler mHandler;
|
||||
|
||||
private PipMenuActivityController mMenuController;
|
||||
private PipSnapAlgorithm mSnapAlgorithm;
|
||||
private FlingAnimationUtils mFlingAnimationUtils;
|
||||
|
||||
@@ -93,10 +94,12 @@ public class PipMotionHelper {
|
||||
};
|
||||
|
||||
public PipMotionHelper(Context context, IActivityManager activityManager,
|
||||
PipSnapAlgorithm snapAlgorithm, FlingAnimationUtils flingAnimationUtils) {
|
||||
PipMenuActivityController menuController, PipSnapAlgorithm snapAlgorithm,
|
||||
FlingAnimationUtils flingAnimationUtils) {
|
||||
mContext = context;
|
||||
mHandler = BackgroundThread.getHandler();
|
||||
mActivityManager = activityManager;
|
||||
mMenuController = menuController;
|
||||
mSnapAlgorithm = snapAlgorithm;
|
||||
mFlingAnimationUtils = flingAnimationUtils;
|
||||
mVsyncChoreographer = new SurfaceFlingerVsyncChoreographer(mHandler, mContext.getDisplay(),
|
||||
@@ -148,6 +151,7 @@ public class PipMotionHelper {
|
||||
*/
|
||||
void expandPip(boolean skipAnimation) {
|
||||
cancelAnimations();
|
||||
mMenuController.hideMenuWithoutResize();
|
||||
mHandler.post(() -> {
|
||||
try {
|
||||
if (skipAnimation) {
|
||||
@@ -168,6 +172,7 @@ public class PipMotionHelper {
|
||||
*/
|
||||
void dismissPip() {
|
||||
cancelAnimations();
|
||||
mMenuController.hideMenuWithoutResize();
|
||||
mHandler.post(() -> {
|
||||
try {
|
||||
mActivityManager.removeStack(PINNED_STACK_ID);
|
||||
|
||||
@@ -191,8 +191,8 @@ public class PipTouchHandler implements TunerService.Tunable {
|
||||
mGestures = new PipTouchGesture[] {
|
||||
mDefaultMovementGesture
|
||||
};
|
||||
mMotionHelper = new PipMotionHelper(mContext, mActivityManager, mSnapAlgorithm,
|
||||
mFlingAnimationUtils);
|
||||
mMotionHelper = new PipMotionHelper(mContext, mActivityManager, mMenuController,
|
||||
mSnapAlgorithm, mFlingAnimationUtils);
|
||||
mExpandedShortestEdgeSize = context.getResources().getDimensionPixelSize(
|
||||
R.dimen.pip_expanded_shortest_edge_size);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user