Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 44498f2e authored by Jorge Gil's avatar Jorge Gil Committed by Automerger Merge Worker
Browse files

Merge changes Ia84b998e,Ic6d973e3 into sc-dev am: 8168b608

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13562341

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: Ia26314f3228584e12e1d74eb518acf52c4ed9abc
parents de1ea964 8168b608
Loading
Loading
Loading
Loading
+14 −11
Original line number Diff line number Diff line
@@ -375,17 +375,29 @@ public class PhonePipMenuController implements PipMenuController {
    }

    /**
     * Hides the menu activity.
     * Hides the menu view.
     */
    public void hideMenu() {
        hideMenu(true /* animate */, true /* resize */);
    }

    /**
     * Hides the menu view.
     *
     * @param animate whether to animate the menu fadeout
     * @param resize whether or not to resize the PiP with the state change
     */
    public void hideMenu(boolean animate, boolean resize) {
        final boolean isMenuVisible = isMenuVisible();
        if (DEBUG) {
            Log.d(TAG, "hideMenu() state=" + mMenuState
                    + " isMenuVisible=" + isMenuVisible
                    + " animate=" + animate
                    + " resize=" + resize
                    + " callers=\n" + Debug.getCallers(5, "    "));
        }
        if (isMenuVisible) {
            mPipMenuView.hideMenu();
            mPipMenuView.hideMenu(animate, resize);
        }
    }

@@ -403,15 +415,6 @@ public class PhonePipMenuController implements PipMenuController {
        }
    }

    /**
     * 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 */, null /* callback */);
    }

    /**
     * Sets the menu actions to the actions provided by the current PiP menu.
     */
+12 −6
Original line number Diff line number Diff line
@@ -89,7 +89,6 @@ public class PipMenuView extends FrameLayout {
    private static final boolean ENABLE_RESIZE_HANDLE = false;

    private int mMenuState;
    private boolean mResize = true;
    private boolean mAllowMenuTimeout = true;
    private boolean mAllowTouches = true;

@@ -329,16 +328,21 @@ public class PipMenuView extends FrameLayout {
        hideMenu(null);
    }

    void hideMenu(boolean animate, boolean resize) {
        hideMenu(null, true /* notifyMenuVisibility */, animate, resize);
    }

    void hideMenu(Runnable animationEndCallback) {
        hideMenu(animationEndCallback, true /* notifyMenuVisibility */, true /* animate */);
        hideMenu(animationEndCallback, true /* notifyMenuVisibility */, true /* animate */,
                true /* resize */);
    }

    private void hideMenu(final Runnable animationFinishedRunnable, boolean notifyMenuVisibility,
            boolean animate) {
            boolean animate, boolean resize) {
        if (mMenuState != MENU_STATE_NONE) {
            cancelDelayedHide();
            if (notifyMenuVisibility) {
                notifyMenuStateChange(MENU_STATE_NONE, mResize, null);
                notifyMenuStateChange(MENU_STATE_NONE, resize, null);
            }
            mMenuContainerAnimator = new AnimatorSet();
            ObjectAnimator menuAnim = ObjectAnimator.ofFloat(mMenuContainer, View.ALPHA,
@@ -469,7 +473,8 @@ public class PipMenuView extends FrameLayout {
    private void expandPip() {
        // Do not notify menu visibility when hiding the menu, the controller will do this when it
        // handles the message
        hideMenu(mController::onPipExpand, false /* notifyMenuVisibility */, true /* animate */);
        hideMenu(mController::onPipExpand, false /* notifyMenuVisibility */, true /* animate */,
                true /* resize */);
    }

    private void dismissPip() {
@@ -479,7 +484,8 @@ public class PipMenuView extends FrameLayout {
        final boolean animate = mMenuState != MENU_STATE_CLOSE;
        // Do not notify menu visibility when hiding the menu, the controller will do this when it
        // handles the message
        hideMenu(mController::onPipDismiss, false /* notifyMenuVisibility */, animate);
        hideMenu(mController::onPipDismiss, false /* notifyMenuVisibility */, animate,
                true /* resize */);
    }

    private void showSettings() {
+2 −2
Original line number Diff line number Diff line
@@ -325,7 +325,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
                    + " callers=\n" + Debug.getCallers(5, "    "));
        }
        cancelPhysicsAnimation();
        mMenuController.hideMenuWithoutResize();
        mMenuController.hideMenu(false /* animate */, false /* resize */);
        mPipTaskOrganizer.exitPip(skipAnimation ? 0 : LEAVE_PIP_DURATION);
    }

@@ -338,7 +338,7 @@ public class PipMotionHelper implements PipAppOpsListener.Callback,
            Log.d(TAG, "removePip: callers=\n" + Debug.getCallers(5, "    "));
        }
        cancelPhysicsAnimation();
        mMenuController.hideMenuWithoutResize();
        mMenuController.hideMenu(true /* animate*/, false /* resize */);
        mPipTaskOrganizer.removePip();
    }

+2 −2
Original line number Diff line number Diff line
@@ -516,8 +516,8 @@ public class PipResizeGestureHandler {
                    }
                    if (mThresholdCrossed) {
                        if (mPhonePipMenuController.isMenuVisible()) {
                            mPhonePipMenuController.hideMenuWithoutResize();
                            mPhonePipMenuController.hideMenu();
                            mPhonePipMenuController.hideMenu(false /* animate */,
                                    false /* resize */);
                        }
                        final Rect currentPipBounds = mPipBoundsState.getBounds();
                        mLastResizeBounds.set(TaskResizingAlgorithm.resizeDrag(x, y,
+3 −0
Original line number Diff line number Diff line
@@ -876,6 +876,9 @@ public class PipTouchHandler {
                            < mPipBoundsState.getMaxSize().x
                            && mPipBoundsState.getBounds().height()
                            < mPipBoundsState.getMaxSize().y;
                    if (mMenuController.isMenuVisible()) {
                        mMenuController.hideMenu(false /* animate */, false /* resize */);
                    }
                    if (toExpand) {
                        mPipResizeGestureHandler.setUserResizeBounds(mPipBoundsState.getBounds());
                        animateToMaximizedState(null);