From 5142257ec88adbe78555cb27d122984123e183b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Ciche=C5=84ski?= Date: Wed, 16 Aug 2023 20:36:18 +0000 Subject: [PATCH] Bring back the extra offset above IME for PiP This is to account for text input and buttons in messaging apps. Ideally at some point they will report those as keep clear areas. Bug: 296266376 Test: manually Change-Id: I3ef8d014f52a378bb6d674ac906dba025f988c2b --- .../wm/shell/pip/phone/PhonePipKeepClearAlgorithm.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithm.java b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithm.java index f9332e4bdb2e7..2d34035994846 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithm.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/pip/phone/PhonePipKeepClearAlgorithm.java @@ -40,6 +40,7 @@ public class PhonePipKeepClearAlgorithm implements PipKeepClearAlgorithmInterfac "persist.wm.debug.enable_pip_keep_clear_algorithm_gravity", false); protected int mKeepClearAreasPadding; + private int mImeOffset; public PhonePipKeepClearAlgorithm(Context context) { reloadResources(context); @@ -48,6 +49,7 @@ public class PhonePipKeepClearAlgorithm implements PipKeepClearAlgorithmInterfac private void reloadResources(Context context) { final Resources res = context.getResources(); mKeepClearAreasPadding = res.getDimensionPixelSize(R.dimen.pip_keep_clear_areas_padding); + mImeOffset = res.getDimensionPixelSize(R.dimen.pip_ime_offset); } /** @@ -61,7 +63,7 @@ public class PhonePipKeepClearAlgorithm implements PipKeepClearAlgorithmInterfac Rect insets = new Rect(); pipBoundsAlgorithm.getInsetBounds(insets); if (pipBoundsState.isImeShowing()) { - insets.bottom -= pipBoundsState.getImeHeight(); + insets.bottom -= (pipBoundsState.getImeHeight() + mImeOffset); } // if PiP is stashed we only adjust the vertical position if it's outside of insets and // ignore all keep clear areas, since it's already on the side