Fix pip dismiss not visible on phone landscape

The increase to the gradient height doesn't work well for phone
landscape since it can be larger. This meant the calculation to
place the dismiss target window is incorrect.

This change fixes it by capping the height to the window size.

Test: visual - have PIP in landscape on phone and verify drag to
               dismiss target is fully visible
Bug: 223467425
Change-Id: I78a5565c8e09f010fad46ccd96c137f1c4de93b0
This commit is contained in:
Mady Mellor
2022-03-15 00:32:18 +00:00
parent 5095a52843
commit d9685e2406

View File

@@ -253,11 +253,11 @@ public class PipDismissTargetHandler implements ViewTreeObserver.OnPreDrawListen
private WindowManager.LayoutParams getDismissTargetLayoutParams() {
final Point windowSize = new Point();
mWindowManager.getDefaultDisplay().getRealSize(windowSize);
int height = Math.min(windowSize.y, mDismissAreaHeight);
final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
WindowManager.LayoutParams.MATCH_PARENT,
mDismissAreaHeight,
0, windowSize.y - mDismissAreaHeight,
height,
0, windowSize.y - height,
WindowManager.LayoutParams.TYPE_NAVIGATION_BAR_PANEL,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE