summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Felix Stern <fstern@google.com> 2024-08-27 14:44:52 +0000
committer Felix Stern <fstern@google.com> 2024-09-30 16:07:52 +0000
commit798f9846e5dc64d6ff5a0f3b0eb888096ba04801 (patch)
tree101ca3e0960ef57d9b77a7bc5ef6ef325e74bf27
parent617f5961d9288e3ab2184e8826afb054a0a81608 (diff)
Fix IME show delay when having a RemoteInsetsControlTarget
With the refactor in [1] and [2], the IME did not appear immediately when having a controlTarget that is not the app, but with 1-2s delay. The IME leash is only dispatched when it is successfully drawn. To set that state, it has to be serverVisible and clientVisible. Before, we did not set the mClientVisible in the ImeInsetsSourceProvider. By setting the clientVisibility directly (based on the requestedVisibility of the app for the IME), there will be no more delay. [1]: I8e3a74ee579f085cb582040fdba725e7a63d6b85 [2]: I5aeb3ccfbfe7d4cd0b7b5f0e0400769e65bb70a4 Test: manual: Open Bubbles and try to show the IME. Verify that there is no noticeable delay between focussing and when the IME appears. Flag: android.view.inputmethod.refactor_insets_controller Fix: 362478040 Change-Id: I2d37f74a16205f6a75a2fa035b91641fc5246077
-rw-r--r--libs/WindowManager/Shell/src/com/android/wm/shell/common/DisplayImeController.java13
1 files changed, 11 insertions, 2 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 c4082d9f649c..0047ec503504 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
@@ -403,6 +403,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
// activity A is focussed), we will not get a call of #insetsControlChanged, and
// therefore have to start the show animation from here
startAnimation(mImeRequestedVisible /* show */, false /* forceRestart */);
+
+ setVisibleDirectly(mImeRequestedVisible || mAnimation != null);
}
}
@@ -540,6 +542,10 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
show ? ANIMATION_DURATION_SHOW_MS : ANIMATION_DURATION_HIDE_MS);
if (seek) {
mAnimation.setCurrentFraction((seekValue - startY) / (endY - startY));
+ } else {
+ // In some cases the value in onAnimationStart is zero, therefore setting it
+ // explicitly to startY
+ mAnimation.setCurrentFraction(0);
}
mAnimation.addUpdateListener(animation -> {
@@ -621,6 +627,9 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
ImeTracker.PHASE_WM_ANIMATION_RUNNING);
t.hide(animatingLeash);
removeImeSurface(mDisplayId);
+ if (android.view.inputmethod.Flags.refactorInsetsController()) {
+ setVisibleDirectly(false /* visible */);
+ }
ImeTracker.forLogging().onHidden(mStatsToken);
} else if (mAnimationDirection == DIRECTION_SHOW && !mCancelled) {
ImeTracker.forLogging().onShown(mStatsToken);
@@ -645,13 +654,13 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
animatingControl.release(SurfaceControl::release);
}
});
- if (!show) {
+ if (!android.view.inputmethod.Flags.refactorInsetsController() && !show) {
// When going away, queue up insets change first, otherwise any bounds changes
// can have a "flicker" of ime-provided insets.
setVisibleDirectly(false /* visible */);
}
mAnimation.start();
- if (show) {
+ if (!android.view.inputmethod.Flags.refactorInsetsController() && show) {
// When showing away, queue up insets change last, otherwise any bounds changes
// can have a "flicker" of ime-provided insets.
setVisibleDirectly(true /* visible */);