Merge "Deprecate MENU_STATE_CLOSE for PiP menu" into sc-v2-dev

This commit is contained in:
Hongwei Wang
2021-08-31 19:46:25 +00:00
committed by Android (Google) Code Review
3 changed files with 5 additions and 18 deletions

View File

@@ -60,8 +60,7 @@ public class PhonePipMenuController implements PipMenuController {
private static final boolean DEBUG = false; private static final boolean DEBUG = false;
public static final int MENU_STATE_NONE = 0; public static final int MENU_STATE_NONE = 0;
public static final int MENU_STATE_CLOSE = 1; public static final int MENU_STATE_FULL = 1;
public static final int MENU_STATE_FULL = 2;
/** /**
* A listener interface to receive notification on changes in PIP. * A listener interface to receive notification on changes in PIP.

View File

@@ -23,7 +23,6 @@ import static android.view.accessibility.AccessibilityManager.FLAG_CONTENT_CONTR
import static android.view.accessibility.AccessibilityManager.FLAG_CONTENT_ICONS; import static android.view.accessibility.AccessibilityManager.FLAG_CONTENT_ICONS;
import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK; import static android.view.accessibility.AccessibilityNodeInfo.ACTION_CLICK;
import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_CLOSE;
import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_FULL; import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_FULL;
import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_NONE; import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_NONE;
@@ -203,7 +202,7 @@ public class PipMenuView extends FrameLayout {
@Override @Override
public boolean performAccessibilityAction(View host, int action, Bundle args) { public boolean performAccessibilityAction(View host, int action, Bundle args) {
if (action == ACTION_CLICK && mMenuState == MENU_STATE_CLOSE) { if (action == ACTION_CLICK && mMenuState != MENU_STATE_FULL) {
mController.showMenu(); mController.showMenu();
} }
return super.performAccessibilityAction(host, action, args); return super.performAccessibilityAction(host, action, args);
@@ -271,13 +270,12 @@ public class PipMenuView extends FrameLayout {
mDismissButton.getAlpha(), 1f); mDismissButton.getAlpha(), 1f);
ObjectAnimator resizeAnim = ObjectAnimator.ofFloat(mResizeHandle, View.ALPHA, ObjectAnimator resizeAnim = ObjectAnimator.ofFloat(mResizeHandle, View.ALPHA,
mResizeHandle.getAlpha(), mResizeHandle.getAlpha(),
ENABLE_RESIZE_HANDLE && menuState == MENU_STATE_CLOSE && showResizeHandle ENABLE_RESIZE_HANDLE && showResizeHandle ? 1f : 0f);
? 1f : 0f);
if (menuState == MENU_STATE_FULL) { if (menuState == MENU_STATE_FULL) {
mMenuContainerAnimator.playTogether(menuAnim, settingsAnim, dismissAnim, mMenuContainerAnimator.playTogether(menuAnim, settingsAnim, dismissAnim,
resizeAnim); resizeAnim);
} else { } else {
mMenuContainerAnimator.playTogether(dismissAnim, resizeAnim); mMenuContainerAnimator.playTogether(resizeAnim);
} }
mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN); mMenuContainerAnimator.setInterpolator(Interpolators.ALPHA_IN);
mMenuContainerAnimator.setDuration(ANIMATION_HIDE_DURATION_MS); mMenuContainerAnimator.setDuration(ANIMATION_HIDE_DURATION_MS);
@@ -429,7 +427,7 @@ public class PipMenuView extends FrameLayout {
FrameLayout.LayoutParams expandedLp = FrameLayout.LayoutParams expandedLp =
(FrameLayout.LayoutParams) expandContainer.getLayoutParams(); (FrameLayout.LayoutParams) expandContainer.getLayoutParams();
if (mActions.isEmpty() || menuState == MENU_STATE_CLOSE || menuState == MENU_STATE_NONE) { if (mActions.isEmpty() || menuState == MENU_STATE_NONE) {
actionsContainer.setVisibility(View.INVISIBLE); actionsContainer.setVisibility(View.INVISIBLE);
// Update the expand container margin to adjust the center of the expand button to // Update the expand container margin to adjust the center of the expand button to

View File

@@ -22,7 +22,6 @@ import static com.android.wm.shell.pip.PipAnimationController.TRANSITION_DIRECTI
import static com.android.wm.shell.pip.PipBoundsState.STASH_TYPE_LEFT; import static com.android.wm.shell.pip.PipBoundsState.STASH_TYPE_LEFT;
import static com.android.wm.shell.pip.PipBoundsState.STASH_TYPE_NONE; import static com.android.wm.shell.pip.PipBoundsState.STASH_TYPE_NONE;
import static com.android.wm.shell.pip.PipBoundsState.STASH_TYPE_RIGHT; import static com.android.wm.shell.pip.PipBoundsState.STASH_TYPE_RIGHT;
import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_CLOSE;
import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_FULL; import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_FULL;
import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_NONE; import static com.android.wm.shell.pip.phone.PhonePipMenuController.MENU_STATE_NONE;
import static com.android.wm.shell.pip.phone.PipMenuView.ANIM_TYPE_NONE; import static com.android.wm.shell.pip.phone.PipMenuView.ANIM_TYPE_NONE;
@@ -81,7 +80,6 @@ public class PipTouchHandler {
private final PhonePipMenuController mMenuController; private final PhonePipMenuController mMenuController;
private final AccessibilityManager mAccessibilityManager; private final AccessibilityManager mAccessibilityManager;
private boolean mShowPipMenuOnAnimationEnd = false;
/** /**
* Whether PIP stash is enabled or not. When enabled, if the user flings toward the edge of the * Whether PIP stash is enabled or not. When enabled, if the user flings toward the edge of the
@@ -280,7 +278,6 @@ public class PipTouchHandler {
public void onActivityPinned() { public void onActivityPinned() {
mPipDismissTargetHandler.createOrUpdateDismissTarget(); mPipDismissTargetHandler.createOrUpdateDismissTarget();
mShowPipMenuOnAnimationEnd = true;
mPipResizeGestureHandler.onActivityPinned(); mPipResizeGestureHandler.onActivityPinned();
mFloatingContentCoordinator.onContentAdded(mMotionHelper); mFloatingContentCoordinator.onContentAdded(mMotionHelper);
} }
@@ -304,13 +301,6 @@ public class PipTouchHandler {
// Set the initial bounds as the user resize bounds. // Set the initial bounds as the user resize bounds.
mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds()); mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
} }
if (mShowPipMenuOnAnimationEnd) {
mMenuController.showMenu(MENU_STATE_CLOSE, mPipBoundsState.getBounds(),
true /* allowMenuTimeout */, false /* willResizeMenu */,
shouldShowResizeHandle());
mShowPipMenuOnAnimationEnd = false;
}
} }
public void onConfigurationChanged() { public void onConfigurationChanged() {