Merge "Fix PIP window going offset in landscape mode." into pi-dev
diff --git a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
index 5c0576d..a0bdcd0 100644
--- a/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/pip/phone/PipTouchHandler.java
@@ -325,6 +325,9 @@
             return;
         }
         bounds.offset(0, toAdjustedBounds.bottom - bounds.top);
+        // In landscape mode, PIP window can go offset while launching IME. We want to align the
+        // the top of the PIP window with the top of the movement bounds in that case.
+        bounds.offset(0, Math.max(0, mMovementBounds.top - bounds.top));
         mMotionHelper.animateToOffset(bounds);
     }