diff options
author | 2025-01-13 07:05:04 -0800 | |
---|---|---|
committer | 2025-01-13 07:05:04 -0800 | |
commit | 1361c81128c5724a1b5ee6fb1c6643ea02bf1786 (patch) | |
tree | 889ea67f0aa89426522a496e7ad4f849a81bb9d9 | |
parent | a2bdd5d108c92d3b15d4c0a22113ebe26dc755a3 (diff) | |
parent | a42b25dad65bb65599222930d7123beac1622bd4 (diff) |
Merge "Update imeTop calculation in DisplayImeController" into main
-rw-r--r-- | libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java index eb1e72790a25..c9890a5b4963 100644 --- a/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java +++ b/libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java @@ -447,8 +447,10 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged } } - private int imeTop(float surfaceOffset) { - return mImeFrame.top + (int) surfaceOffset; + private int imeTop(float surfaceOffset, float surfacePositionY) { + // surfaceOffset is already offset by the surface's top inset, so we need to subtract + // the top inset so that the return value is in screen coordinates. + return mImeFrame.top + (int) (surfaceOffset - surfacePositionY); } private boolean calcIsFloating(InsetsSource imeSource) { @@ -581,7 +583,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged final float alpha = (mAnimateAlpha || isFloating) ? (value - hiddenY) / (shownY - hiddenY) : 1f; t.setAlpha(animatingLeash, alpha); - dispatchPositionChanged(mDisplayId, imeTop(value), t); + dispatchPositionChanged(mDisplayId, imeTop(value, defaultY), t); t.apply(); mTransactionPool.release(t); }); @@ -600,11 +602,12 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged t.setPosition(animatingLeash, x, value); if (DEBUG) { Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:" - + imeTop(hiddenY) + "->" + imeTop(shownY) + + imeTop(hiddenY, defaultY) + "->" + imeTop(shownY, defaultY) + " showing:" + (mAnimationDirection == DIRECTION_SHOW)); } - int flags = dispatchStartPositioning(mDisplayId, imeTop(hiddenY), - imeTop(shownY), mAnimationDirection == DIRECTION_SHOW, isFloating, t); + int flags = dispatchStartPositioning(mDisplayId, imeTop(hiddenY, defaultY), + imeTop(shownY, defaultY), mAnimationDirection == DIRECTION_SHOW, + isFloating, t); mAnimateAlpha = (flags & ImePositionProcessor.IME_ANIMATION_NO_ALPHA) == 0; final float alpha = (mAnimateAlpha || isFloating) ? (value - hiddenY) / (shownY - hiddenY) |