From 50d3f8f4070599cec3a5a9ca1344e16c2fa1b295 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Wed, 27 Dec 2017 17:41:25 +0100 Subject: [PATCH] Fix child windows of windows with surface insets We need to undo the outsetting when positioning the child. Test: Open Dialog, enter text, select text, make sure handle is positioned correctly Fixes: 70777791 Change-Id: Ia64e25122499782c977a6ab45113481fd2d9f965 --- services/core/java/com/android/server/wm/WindowState.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index a5c46e00ad5a..dfb385bddcdf 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -4443,8 +4443,12 @@ class WindowState extends WindowContainer implements WindowManagerP if (isChildWindow()) { // TODO: This probably falls apart at some point and we should // actually compute relative coordinates. + + // Since the parent was outset by its surface insets, we need to undo the outsetting + // with insetting by the same amount. final WindowState parent = getParentWindow(); - outPoint.offset(-parent.mFrame.left, -parent.mFrame.top); + outPoint.offset(-parent.mFrame.left + parent.mAttrs.surfaceInsets.left, + -parent.mFrame.top + parent.mAttrs.surfaceInsets.top); } else if (parentWindowContainer != null) { final Rect parentBounds = parentWindowContainer.getBounds(); outPoint.offset(-parentBounds.left, -parentBounds.top); -- 2.11.0