From e10f4192dbe7c3560775eff86c1737c4b1efacbf Mon Sep 17 00:00:00 2001 From: HEO SEUNG Date: Thu, 21 Nov 2019 10:21:04 +0900 Subject: [PATCH] [wm]: Freeform window layout while SIP showing 1. Set the input method target to all windows of the AppWindowToken which the input method target window belongs, when input method target is in freeform windowing mode. 2. If the freeform window has a dim, then apply an offset to dimBounds. Test: atest WindowFrameTests#testFreeformContentInsets Test: Run the test app (ex. PopupWithInput) > Launch to freeform mode > Move the app near the location of IME Bug: 123693028 Change-Id: Ib11d3ee05dd26ee1f28f12895ae300af7f3d0da7 (cherry picked from commit 4cbf77f88c3d7e323bcb6edd7aec1aa4ce58cd79) --- services/core/java/com/android/server/wm/Task.java | 8 +++++++- services/core/java/com/android/server/wm/WindowState.java | 8 ++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/services/core/java/com/android/server/wm/Task.java b/services/core/java/com/android/server/wm/Task.java index 987ecc5c736d8..f272b32ac7616 100644 --- a/services/core/java/com/android/server/wm/Task.java +++ b/services/core/java/com/android/server/wm/Task.java @@ -2712,7 +2712,13 @@ class Task extends WindowContainer { getDimBounds(mTmpDimBoundsRect); // Bounds need to be relative, as the dim layer is a child. - mTmpDimBoundsRect.offsetTo(0, 0); + if (inFreeformWindowingMode()) { + getBounds(mTmpRect); + mTmpDimBoundsRect.offsetTo(mTmpDimBoundsRect.left - mTmpRect.left, + mTmpDimBoundsRect.top - mTmpRect.top); + } else { + mTmpDimBoundsRect.offsetTo(0, 0); + } if (mDimmer.updateDims(getPendingTransaction(), mTmpDimBoundsRect)) { scheduleAnimation(); } diff --git a/services/core/java/com/android/server/wm/WindowState.java b/services/core/java/com/android/server/wm/WindowState.java index bb7c26c256707..0f927e5b2ad6c 100644 --- a/services/core/java/com/android/server/wm/WindowState.java +++ b/services/core/java/com/android/server/wm/WindowState.java @@ -958,8 +958,11 @@ class WindowState extends WindowContainer implements WindowManagerP final int layoutXDiff; final int layoutYDiff; final WindowState imeWin = mWmService.mRoot.getCurrentInputMethodWindow(); + final boolean isInputMethodAdjustTarget = windowsAreFloating + ? dc.mInputMethodTarget != null && task == dc.mInputMethodTarget.getTask() + : isInputMethodTarget(); final boolean isImeTarget = - imeWin != null && imeWin.isVisibleNow() && isInputMethodTarget(); + imeWin != null && imeWin.isVisibleNow() && isInputMethodAdjustTarget; if (isFullscreenAndFillsDisplay || layoutInParentFrame()) { // We use the parent frame as the containing frame for fullscreen and child windows mWindowFrames.mContainingFrame.set(mWindowFrames.mParentFrame); @@ -990,7 +993,8 @@ class WindowState extends WindowContainer implements WindowManagerP final int distanceToTop = Math.max(mWindowFrames.mContainingFrame.top - mWindowFrames.mContentFrame.top, 0); int offs = Math.min(bottomOverlap, distanceToTop); - mWindowFrames.mContainingFrame.top -= offs; + mWindowFrames.mContainingFrame.offset(0, -offs); + mInsetFrame.offset(0, -offs); } } else if (!inPinnedWindowingMode() && mWindowFrames.mContainingFrame.bottom > mWindowFrames.mParentFrame.bottom) {