Merge "[DO NOT MERGE] Handle landscape and portrait display for PIP rotation"

This commit is contained in:
Treehugger Robot
2021-05-12 00:33:54 +00:00
committed by Gerrit Code Review

View File

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