summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Liran Binyamin <liranb@google.com> 2025-01-09 11:44:04 -0500
committer Liran Binyamin <liranb@google.com> 2025-01-09 15:38:08 -0500
commita42b25dad65bb65599222930d7123beac1622bd4 (patch)
tree9adb32e1345714b51af675b9d1f1f918952e7cc0
parentd368357c39bd85932a2faf8e2bb42e1a7c714469 (diff)
Update imeTop calculation in DisplayImeController
The calculation of the imeTop value that's used in the callbacks of DisplayImeController.ImePositionProcessor is offset by the top inset of the surface. This change updates the calculation so that the value sent to consummers is in screen coordinates. The only consummers of the API at this moment are Split and Bubbles, neither of which uses the value directly to position views. Bubbles uses the values to calculate the IME height, and Split does IME height calculation as well as determining the progress of the animation. But the expression uses values that are equally offset, so the offset gets canceled out. This makes this change effectively a no-op. Bug: 377329425 Flag: EXEMPT bugfix Test: manual: - have 2 apps in vertical split (use an app with an input field at the bottom for the bottom split app, e.g. bubbles test app) - request IME in the bottom app - observe IME and split animations Test: manual: - repeat test above with horizontal split Test: manual: - have a floating bubble - move stack to bottom of the screen - launch app and request IME - observe stack animates above the IME - hide IME - observe stack animates back to its previous position - expand bubble and request IME - observe expanded view animates correctly Change-Id: I6e90fd140bc9577a9c10ffe76819b90330726601
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java15
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)