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

Commit 91888933 authored by Jacqueline Bronger's avatar Jacqueline Bronger
Browse files

Fix RTL TV PiP position

Gravity.END doesn't seem to work, even when adding the correct layout
direction to Gravity.apply(...). Therefore manually check for RTL and
using left and right gravities.

Bug: 245290804
Test: atest TvPipGravityTest
Test: manual - change system language to RTL language e.g. Arabic, start
regular PiP + start expanded PiP and collapse via menu -> PiP should be
in the bottom-left corner

Change-Id: Id8fb19271d6b31515420b298693cb5eb01678c44
parent 44af4ad1
Loading
Loading
Loading
Loading
+36 −86
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@ import static android.view.KeyEvent.KEYCODE_DPAD_RIGHT;
import static android.view.KeyEvent.KEYCODE_DPAD_UP;

import static com.android.wm.shell.pip.tv.TvPipBoundsState.ORIENTATION_HORIZONTAL;
import static com.android.wm.shell.pip.tv.TvPipBoundsState.ORIENTATION_UNDETERMINED;
import static com.android.wm.shell.pip.tv.TvPipBoundsState.ORIENTATION_VERTICAL;

import android.content.Context;
@@ -63,7 +62,8 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
            @NonNull TvPipBoundsState tvPipBoundsState,
            @NonNull PipSnapAlgorithm pipSnapAlgorithm) {
        super(context, tvPipBoundsState, pipSnapAlgorithm,
                new PipKeepClearAlgorithm() {});
                new PipKeepClearAlgorithm() {
                });
        this.mTvPipBoundsState = tvPipBoundsState;
        this.mKeepClearAlgorithm = new TvPipKeepClearAlgorithm();
        reloadResources(context);
@@ -98,7 +98,7 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
                && mTvPipBoundsState.getDesiredTvExpandedAspectRatio() != 0
                && !mTvPipBoundsState.isTvPipManuallyCollapsed();
        if (isPipExpanded) {
            updateGravityOnExpandToggled(Gravity.NO_GRAVITY, true);
            updateGravityOnExpansionToggled(/* expanding= */ true);
        }
        mTvPipBoundsState.setTvPipExpanded(isPipExpanded);
        return adjustBoundsForTemporaryDecor(getTvPipPlacement().getBounds());
@@ -172,135 +172,85 @@ public class TvPipBoundsAlgorithm extends PipBoundsAlgorithm {
        return placement;
    }

    /**
     * @return previous gravity if it is to be saved, or {@link Gravity#NO_GRAVITY} if not.
     */
    int updateGravityOnExpandToggled(int previousGravity, boolean expanding) {
    void updateGravityOnExpansionToggled(boolean expanding) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: updateGravityOnExpandToggled(), expanding: %b"
                        + ", mOrientation: %d, previous gravity: %s",
                TAG, expanding, mTvPipBoundsState.getTvFixedPipOrientation(),
                Gravity.toString(previousGravity));

        if (!mTvPipBoundsState.isTvExpandedPipSupported()) {
            return Gravity.NO_GRAVITY;
        }
                "%s: updateGravity, expanding: %b, fixedExpandedOrientation: %d",
                TAG, expanding, mTvPipBoundsState.getTvFixedPipOrientation());

        if (expanding && mTvPipBoundsState.getTvFixedPipOrientation() == ORIENTATION_UNDETERMINED) {
            float expandedRatio = mTvPipBoundsState.getDesiredTvExpandedAspectRatio();
            if (expandedRatio == 0) {
                return Gravity.NO_GRAVITY;
            }
            if (expandedRatio < 1) {
                mTvPipBoundsState.setTvFixedPipOrientation(ORIENTATION_VERTICAL);
            } else {
                mTvPipBoundsState.setTvFixedPipOrientation(ORIENTATION_HORIZONTAL);
            }
        }
        int currentX = mTvPipBoundsState.getTvPipGravity() & Gravity.HORIZONTAL_GRAVITY_MASK;
        int currentY = mTvPipBoundsState.getTvPipGravity() & Gravity.VERTICAL_GRAVITY_MASK;
        int previousCollapsedX = mTvPipBoundsState.getTvPipPreviousCollapsedGravity()
                & Gravity.HORIZONTAL_GRAVITY_MASK;
        int previousCollapsedY = mTvPipBoundsState.getTvPipPreviousCollapsedGravity()
                & Gravity.VERTICAL_GRAVITY_MASK;

        int gravityToSave = Gravity.NO_GRAVITY;
        int currentGravity = mTvPipBoundsState.getTvPipGravity();
        int updatedGravity;

        if (expanding) {
            // save collapsed gravity
            gravityToSave = mTvPipBoundsState.getTvPipGravity();
            // Save collapsed gravity.
            mTvPipBoundsState.setTvPipPreviousCollapsedGravity(mTvPipBoundsState.getTvPipGravity());

            if (mTvPipBoundsState.getTvFixedPipOrientation() == ORIENTATION_HORIZONTAL) {
                updatedGravity =
                        Gravity.CENTER_HORIZONTAL | (currentGravity
                                & Gravity.VERTICAL_GRAVITY_MASK);
                updatedGravity = Gravity.CENTER_HORIZONTAL | currentY;
            } else {
                updatedGravity =
                        Gravity.CENTER_VERTICAL | (currentGravity
                                & Gravity.HORIZONTAL_GRAVITY_MASK);
                updatedGravity = currentX | Gravity.CENTER_VERTICAL;
            }
        } else {
            if (previousGravity != Gravity.NO_GRAVITY) {
                // The pip hasn't been moved since expanding,
                // go back to previous collapsed position.
                updatedGravity = previousGravity;
            } else {
            // Collapse to the edge that the user moved to before.
            if (mTvPipBoundsState.getTvFixedPipOrientation() == ORIENTATION_HORIZONTAL) {
                    updatedGravity =
                            Gravity.RIGHT | (currentGravity & Gravity.VERTICAL_GRAVITY_MASK);
                updatedGravity = previousCollapsedX | currentY;
            } else {
                    updatedGravity =
                            Gravity.BOTTOM | (currentGravity & Gravity.HORIZONTAL_GRAVITY_MASK);
                }
                updatedGravity = currentX | previousCollapsedY;
            }
        }
        mTvPipBoundsState.setTvPipGravity(updatedGravity);
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: new gravity: %s", TAG, Gravity.toString(updatedGravity));

        return gravityToSave;
    }

    /**
     * @return true if gravity changed
     * @return true if the gravity changed
     */
    boolean updateGravity(int keycode) {
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: updateGravity, keycode: %d", TAG, keycode);

        // Check if position change is valid
        // Check if position change is valid.
        if (mTvPipBoundsState.isTvPipExpanded()) {
            int mOrientation = mTvPipBoundsState.getTvFixedPipOrientation();
            if (mOrientation == ORIENTATION_VERTICAL
            int fixedOrientation = mTvPipBoundsState.getTvFixedPipOrientation();
            if (fixedOrientation == ORIENTATION_VERTICAL
                    && (keycode == KEYCODE_DPAD_UP || keycode == KEYCODE_DPAD_DOWN)
                    || mOrientation == ORIENTATION_HORIZONTAL
                    || fixedOrientation == ORIENTATION_HORIZONTAL
                    && (keycode == KEYCODE_DPAD_RIGHT || keycode == KEYCODE_DPAD_LEFT)) {
                return false;
            }
        }

        int currentGravity = mTvPipBoundsState.getTvPipGravity();
        int updatedGravity;
        // First axis
        int updatedX = mTvPipBoundsState.getTvPipGravity() & Gravity.HORIZONTAL_GRAVITY_MASK;
        int updatedY = mTvPipBoundsState.getTvPipGravity() & Gravity.VERTICAL_GRAVITY_MASK;

        switch (keycode) {
            case KEYCODE_DPAD_UP:
                updatedGravity = Gravity.TOP;
                updatedY = Gravity.TOP;
                break;
            case KEYCODE_DPAD_DOWN:
                updatedGravity = Gravity.BOTTOM;
                updatedY = Gravity.BOTTOM;
                break;
            case KEYCODE_DPAD_LEFT:
                updatedGravity = Gravity.LEFT;
                updatedX = Gravity.LEFT;
                break;
            case KEYCODE_DPAD_RIGHT:
                updatedGravity = Gravity.RIGHT;
                updatedX = Gravity.RIGHT;
                break;
            default:
                updatedGravity = currentGravity;
                // NOOP - unsupported keycode
        }

        // Second axis
        switch (keycode) {
            case KEYCODE_DPAD_UP:
            case KEYCODE_DPAD_DOWN:
                if (mTvPipBoundsState.isTvPipExpanded()) {
                    updatedGravity |= Gravity.CENTER_HORIZONTAL;
                } else {
                    updatedGravity |= (currentGravity & Gravity.HORIZONTAL_GRAVITY_MASK);
                }
                break;
            case KEYCODE_DPAD_LEFT:
            case KEYCODE_DPAD_RIGHT:
                if (mTvPipBoundsState.isTvPipExpanded()) {
                    updatedGravity |= Gravity.CENTER_VERTICAL;
                } else {
                    updatedGravity |= (currentGravity & Gravity.VERTICAL_GRAVITY_MASK);
                }
                break;
            default:
                break;
        }
        int updatedGravity = updatedX | updatedY;

        if (updatedGravity != currentGravity) {
        if (updatedGravity != mTvPipBoundsState.getTvPipGravity()) {
            mTvPipBoundsState.setTvPipGravity(updatedGravity);
            ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                    "%s: new gravity: %s", TAG, Gravity.toString(updatedGravity));
                    "%s: updateGravity, new gravity: %s", TAG, Gravity.toString(updatedGravity));
            return true;
        }
        return false;
+71 −20
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import android.content.pm.PackageManager;
import android.graphics.Insets;
import android.util.Size;
import android.view.Gravity;
import android.view.View;

import com.android.wm.shell.pip.PipBoundsAlgorithm;
import com.android.wm.shell.pip.PipBoundsState;
@@ -52,24 +53,61 @@ public class TvPipBoundsState extends PipBoundsState {
    public @interface Orientation {
    }

    public static final int DEFAULT_TV_GRAVITY = Gravity.BOTTOM | Gravity.RIGHT;
    private final Context mContext;

    private int mDefaultGravity;
    private int mTvPipGravity;
    private int mPreviousCollapsedGravity;
    private boolean mIsRtl;

    private final boolean mIsTvExpandedPipSupported;
    private boolean mIsTvPipExpanded;
    private boolean mTvPipManuallyCollapsed;
    private float mDesiredTvExpandedAspectRatio;
    private @Orientation int mTvFixedPipOrientation;
    private int mTvPipGravity;
    private @Nullable Size mTvExpandedSize;
    private @NonNull Insets mPipMenuPermanentDecorInsets = Insets.NONE;
    private @NonNull Insets mPipMenuTemporaryDecorInsets = Insets.NONE;
    @Orientation
    private int mTvFixedPipOrientation;
    @Nullable
    private Size mTvExpandedSize;
    @NonNull
    private Insets mPipMenuPermanentDecorInsets = Insets.NONE;
    @NonNull
    private Insets mPipMenuTemporaryDecorInsets = Insets.NONE;

    public TvPipBoundsState(@NonNull Context context) {
        super(context);
        mContext = context;
        updateDefaultGravity();
        mPreviousCollapsedGravity = mDefaultGravity;
        mIsTvExpandedPipSupported = context.getPackageManager().hasSystemFeature(
                PackageManager.FEATURE_EXPANDED_PICTURE_IN_PICTURE);
    }

    public int getDefaultGravity() {
        return mDefaultGravity;
    }

    private void updateDefaultGravity() {
        boolean isRtl = mContext.getResources().getConfiguration().getLayoutDirection()
                == View.LAYOUT_DIRECTION_RTL;
        mDefaultGravity = Gravity.BOTTOM | (isRtl ? Gravity.LEFT : Gravity.RIGHT);

        if (mIsRtl != isRtl) {
            int prevGravityX = mPreviousCollapsedGravity & Gravity.HORIZONTAL_GRAVITY_MASK;
            int prevGravityY = mPreviousCollapsedGravity & Gravity.VERTICAL_GRAVITY_MASK;
            if ((prevGravityX & Gravity.RIGHT) == Gravity.RIGHT) {
                mPreviousCollapsedGravity = Gravity.LEFT | prevGravityY;
            } else if ((prevGravityX & Gravity.LEFT) == Gravity.LEFT) {
                mPreviousCollapsedGravity = Gravity.RIGHT | prevGravityY;
            }
        }
        mIsRtl = isRtl;
    }

    @Override
    public void onConfigurationChanged() {
        updateDefaultGravity();
    }

    /**
     * Initialize states when first entering PiP.
     */
@@ -86,7 +124,8 @@ public class TvPipBoundsState extends PipBoundsState {
    /** Resets the TV PiP state for a new activity. */
    public void resetTvPipState() {
        mTvFixedPipOrientation = ORIENTATION_UNDETERMINED;
        mTvPipGravity = DEFAULT_TV_GRAVITY;
        mTvPipGravity = mDefaultGravity;
        mPreviousCollapsedGravity = mDefaultGravity;
        mTvPipManuallyCollapsed = false;
    }

@@ -102,16 +141,23 @@ public class TvPipBoundsState extends PipBoundsState {
    }

    /** Set the PiP aspect ratio for the expanded PiP (TV) that is desired by the app. */
    public void setDesiredTvExpandedAspectRatio(float aspectRatio, boolean override) {
    public void setDesiredTvExpandedAspectRatio(float expandedAspectRatio, boolean override) {
        if (override || mTvFixedPipOrientation == ORIENTATION_UNDETERMINED) {
            mDesiredTvExpandedAspectRatio = aspectRatio;
            resetTvPipState();
            mDesiredTvExpandedAspectRatio = expandedAspectRatio;
            if (expandedAspectRatio != 0) {
                if (expandedAspectRatio > 1) {
                    mTvFixedPipOrientation = ORIENTATION_HORIZONTAL;
                } else {
                    mTvFixedPipOrientation = ORIENTATION_VERTICAL;
                }
            }
            return;
        }
        if ((aspectRatio > 1 && mTvFixedPipOrientation == ORIENTATION_HORIZONTAL)
                || (aspectRatio <= 1 && mTvFixedPipOrientation == ORIENTATION_VERTICAL)
                || aspectRatio == 0) {
            mDesiredTvExpandedAspectRatio = aspectRatio;
        if ((expandedAspectRatio > 1 && mTvFixedPipOrientation == ORIENTATION_HORIZONTAL)
                || (expandedAspectRatio <= 1 && mTvFixedPipOrientation == ORIENTATION_VERTICAL)
                || expandedAspectRatio == 0) {
            mDesiredTvExpandedAspectRatio = expandedAspectRatio;
        }
    }

@@ -123,11 +169,6 @@ public class TvPipBoundsState extends PipBoundsState {
        return mDesiredTvExpandedAspectRatio;
    }

    /** Sets the orientation the expanded TV PiP activity has been fixed to. */
    public void setTvFixedPipOrientation(@Orientation int orientation) {
        mTvFixedPipOrientation = orientation;
    }

    /** Returns the fixed orientation of the expanded PiP on TV. */
    @Orientation
    public int getTvFixedPipOrientation() {
@@ -144,6 +185,14 @@ public class TvPipBoundsState extends PipBoundsState {
        return mTvPipGravity;
    }

    public void setTvPipPreviousCollapsedGravity(int gravity) {
        mPreviousCollapsedGravity = gravity;
    }

    public int getTvPipPreviousCollapsedGravity() {
        return mPreviousCollapsedGravity;
    }

    /** Sets whether the TV PiP is currently expanded. */
    public void setTvPipExpanded(boolean expanded) {
        mIsTvPipExpanded = expanded;
@@ -173,7 +222,8 @@ public class TvPipBoundsState extends PipBoundsState {
        mPipMenuPermanentDecorInsets = permanentInsets;
    }

    public @NonNull Insets getPipMenuPermanentDecorInsets() {
    @NonNull
    public Insets getPipMenuPermanentDecorInsets() {
        return mPipMenuPermanentDecorInsets;
    }

@@ -181,7 +231,8 @@ public class TvPipBoundsState extends PipBoundsState {
        mPipMenuTemporaryDecorInsets = temporaryDecorInsets;
    }

    public @NonNull Insets getPipMenuTemporaryDecorInsets() {
    @NonNull
    public Insets getPipMenuTemporaryDecorInsets() {
        return mPipMenuTemporaryDecorInsets;
    }
}
+37 −36
Original line number Diff line number Diff line
@@ -18,6 +18,8 @@ package com.android.wm.shell.pip.tv;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
import static android.view.KeyEvent.KEYCODE_DPAD_LEFT;
import static android.view.KeyEvent.KEYCODE_DPAD_RIGHT;

import android.annotation.IntDef;
import android.app.ActivityManager;
@@ -137,7 +139,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal

    @State
    private int mState = STATE_NO_PIP;
    private int mPreviousGravity = TvPipBoundsState.DEFAULT_TV_GRAVITY;
    private int mPinnedTaskId = NONEXISTENT_TASK_ID;

    // How long the shell will wait for the app to close the PiP if a custom action is set.
@@ -214,6 +215,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        mTvPipBoundsState = tvPipBoundsState;
        mTvPipBoundsState.setDisplayId(context.getDisplayId());
        mTvPipBoundsState.setDisplayLayout(new DisplayLayout(context, context.getDisplay()));

        mTvPipBoundsAlgorithm = tvPipBoundsAlgorithm;
        mTvPipBoundsController = tvPipBoundsController;
        mTvPipBoundsController.setListener(this);
@@ -243,7 +245,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
    private void onInit() {
        mPipTransitionController.registerPipTransitionCallback(this);

        loadConfigurations();
        reloadResources();

        registerPipParamsChangedListener(mPipParamsChangedForwarder);
        registerTaskStackListenerCallback(mTaskStackListener);
@@ -266,9 +268,38 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: onConfigurationChanged(), state=%s", TAG, stateToName(mState));

        loadConfigurations();
        int previousDefaultGravityX = mTvPipBoundsState.getDefaultGravity()
                & Gravity.HORIZONTAL_GRAVITY_MASK;

        reloadResources();

        mPipNotificationController.onConfigurationChanged();
        mTvPipBoundsAlgorithm.onConfigurationChanged(mContext);
        mTvPipBoundsState.onConfigurationChanged();

        int defaultGravityX = mTvPipBoundsState.getDefaultGravity()
                & Gravity.HORIZONTAL_GRAVITY_MASK;
        if (isPipShown() && previousDefaultGravityX != defaultGravityX) {
            movePipToOppositeSide();
        }
    }

    private void reloadResources() {
        final Resources res = mContext.getResources();
        mResizeAnimationDuration = res.getInteger(R.integer.config_pipResizeAnimationDuration);
        mPipForceCloseDelay = res.getInteger(R.integer.config_pipForceCloseDelay);
        mEduTextWindowExitAnimationDuration =
                res.getInteger(R.integer.pip_edu_text_window_exit_animation_duration);
    }

    private void movePipToOppositeSide() {
        ProtoLog.i(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: movePipToOppositeSide", TAG);
        if ((mTvPipBoundsState.getTvPipGravity() & Gravity.RIGHT) == Gravity.RIGHT) {
            movePip(KEYCODE_DPAD_LEFT);
        } else if ((mTvPipBoundsState.getTvPipGravity() & Gravity.LEFT) == Gravity.LEFT) {
            movePip(KEYCODE_DPAD_RIGHT);
        }
    }

    /**
@@ -332,11 +363,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
                "%s: togglePipExpansion()", TAG);
        boolean expanding = !mTvPipBoundsState.isTvPipExpanded();
        int saveGravity = mTvPipBoundsAlgorithm
                .updateGravityOnExpandToggled(mPreviousGravity, expanding);
        if (saveGravity != Gravity.NO_GRAVITY) {
            mPreviousGravity = saveGravity;
        }
        mTvPipBoundsAlgorithm.updateGravityOnExpansionToggled(expanding);
        mTvPipBoundsState.setTvPipManuallyCollapsed(!expanding);
        mTvPipBoundsState.setTvPipExpanded(expanding);

@@ -347,7 +374,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
    public void movePip(int keycode) {
        if (mTvPipBoundsAlgorithm.updateGravity(keycode)) {
            mTvPipMenuController.updateGravity(mTvPipBoundsState.getTvPipGravity());
            mPreviousGravity = Gravity.NO_GRAVITY;
            updatePinnedStackBounds();
        } else {
            ProtoLog.d(ShellProtoLogGroup.WM_SHELL_PICTURE_IN_PICTURE,
@@ -355,15 +381,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        }
    }

    @Override
    public int getPipGravity() {
        return mTvPipBoundsState.getTvPipGravity();
    }

    public int getOrientation() {
        return mTvPipBoundsState.getTvFixedPipOrientation();
    }

    @Override
    public void onKeepClearAreasChanged(int displayId, Set<Rect> restricted,
            Set<Rect> unrestricted) {
@@ -516,14 +533,6 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
        mState = state;
    }

    private void loadConfigurations() {
        final Resources res = mContext.getResources();
        mResizeAnimationDuration = res.getInteger(R.integer.config_pipResizeAnimationDuration);
        mPipForceCloseDelay = res.getInteger(R.integer.config_pipForceCloseDelay);
        mEduTextWindowExitAnimationDuration =
                res.getInteger(R.integer.pip_edu_text_window_exit_animation_duration);
    }

    private void registerTaskStackListenerCallback(TaskStackListenerImpl taskStackListener) {
        taskStackListener.addListener(new TaskStackListenerCallback() {
            @Override
@@ -596,11 +605,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
                // 2) PiP is expanded, but expanded PiP was disabled
                // --> collapse PiP
                if (mTvPipBoundsState.isTvPipExpanded() && ratio == 0) {
                    int saveGravity = mTvPipBoundsAlgorithm
                            .updateGravityOnExpandToggled(mPreviousGravity, false);
                    if (saveGravity != Gravity.NO_GRAVITY) {
                        mPreviousGravity = saveGravity;
                    }
                    mTvPipBoundsAlgorithm.updateGravityOnExpansionToggled(/* expanding= */ false);
                    mTvPipBoundsState.setTvPipExpanded(false);
                    updatePinnedStackBounds();
                }
@@ -610,11 +615,7 @@ public class TvPipController implements PipTransitionController.PipTransitionCal
                if (!mTvPipBoundsState.isTvPipExpanded() && ratio != 0
                        && !mTvPipBoundsState.isTvPipManuallyCollapsed()) {
                    mTvPipBoundsAlgorithm.updateExpandedPipSize();
                    int saveGravity = mTvPipBoundsAlgorithm
                            .updateGravityOnExpandToggled(mPreviousGravity, true);
                    if (saveGravity != Gravity.NO_GRAVITY) {
                        mPreviousGravity = saveGravity;
                    }
                    mTvPipBoundsAlgorithm.updateGravityOnExpansionToggled(/* expanding= */ true);
                    mTvPipBoundsState.setTvPipExpanded(true);
                    updatePinnedStackBounds();
                }
+5 −5
Original line number Diff line number Diff line
@@ -199,7 +199,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
                "%s: showMovementMenuOnly()", TAG);
        setInMoveMode(true);
        if (mMenuIsOpen) {
            mPipMenuView.showMoveMenu(mDelegate.getPipGravity());
            mPipMenuView.showMoveMenu(mTvPipBoundsState.getTvPipGravity());
        } else {
            mCloseAfterExitMoveMenu = true;
            showMenuInternal();
@@ -222,7 +222,7 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
        mMenuIsOpen = true;
        grantPipMenuFocus(true);
        if (mInMoveMode) {
            mPipMenuView.showMoveMenu(mDelegate.getPipGravity());
            mPipMenuView.showMoveMenu(mTvPipBoundsState.getTvPipGravity());
        } else {
            mPipMenuView.showButtonsMenu(/* exitingMoveMode= */ false);
        }
@@ -236,8 +236,10 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis
    }

    void updateGravity(int gravity) {
        if (mInMoveMode) {
            mPipMenuView.showMovementHints(gravity);
        }
    }

    private Rect calculateMenuSurfaceBounds(Rect pipBounds) {
        return mPipMenuView.getPipMenuContainerBounds(pipBounds);
@@ -500,8 +502,6 @@ public class TvPipMenuController implements PipMenuController, TvPipMenuView.Lis

        void onInMoveModeChanged();

        int getPipGravity();

        void onMenuClosed();

        void closeEduText();
+324 −0

File added.

Preview size limit exceeded, changes collapsed.