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

Commit 250f1b8f authored by Salini Venate's avatar Salini Venate Committed by Automerger Merge Worker
Browse files

[DO NOT MERGE] Handle landscape and portrait display for PIP rotation am: d7282448

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

Change-Id: I06add119b8e2a5cedf0c838ff0da15edb3632275
parents 05c6b40a d7282448
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -80,6 +80,7 @@ public class PipBoundsHandler {
    private int mImeHeight;
    private boolean mIsShelfShowing;
    private int mShelfHeight;
    private boolean mDefaultLandscape;

    private final DisplayController.OnDisplaysChangedListener mDisplaysChangedListener =
            new DisplayController.OnDisplaysChangedListener() {
@@ -87,6 +88,7 @@ public class PipBoundsHandler {
        public void onDisplayAdded(int displayId) {
            if (displayId == mContext.getDisplayId()) {
                mDisplayLayout.set(mDisplayController.getDisplayLayout(displayId));
                mDefaultLandscape = (mDisplayInfo.logicalWidth > mDisplayInfo.logicalHeight);
            }
        }
    };
@@ -362,10 +364,18 @@ public class PipBoundsHandler {
    private void updateDisplayInfoIfNeeded() {
        final boolean updateNeeded;
        if ((mDisplayInfo.rotation == ROTATION_0) || (mDisplayInfo.rotation == ROTATION_180)) {
            if (!mDefaultLandscape) {
                updateNeeded = (mDisplayInfo.logicalWidth > mDisplayInfo.logicalHeight);
            } else {
                updateNeeded = (mDisplayInfo.logicalWidth < mDisplayInfo.logicalHeight);
            }
        } else {
            if (!mDefaultLandscape) {
                updateNeeded = (mDisplayInfo.logicalWidth < mDisplayInfo.logicalHeight);
            } else {
                updateNeeded = (mDisplayInfo.logicalWidth > mDisplayInfo.logicalHeight);
            }
        }
        if (updateNeeded) {
            final int newLogicalHeight = mDisplayInfo.logicalWidth;
            mDisplayInfo.logicalWidth = mDisplayInfo.logicalHeight;