Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0fdb26d authored by Felix Stern's avatar Felix Stern Committed by Android (Google) Code Review
Browse files

Merge "Fix IME show delay when having a RemoteInsetsControlTarget" into main

parents 0fc279fb 798f9846
Loading
Loading
Loading
Loading
+11 −2
Original line number Original line Diff line number Diff line
@@ -403,6 +403,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                // activity A is focussed), we will not get a call of #insetsControlChanged, and
                // activity A is focussed), we will not get a call of #insetsControlChanged, and
                // therefore have to start the show animation from here
                // therefore have to start the show animation from here
                startAnimation(mImeRequestedVisible /* show */, false /* forceRestart */);
                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);
                    show ? ANIMATION_DURATION_SHOW_MS : ANIMATION_DURATION_HIDE_MS);
            if (seek) {
            if (seek) {
                mAnimation.setCurrentFraction((seekValue - startY) / (endY - startY));
                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 -> {
            mAnimation.addUpdateListener(animation -> {
@@ -621,6 +627,9 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                                ImeTracker.PHASE_WM_ANIMATION_RUNNING);
                                ImeTracker.PHASE_WM_ANIMATION_RUNNING);
                        t.hide(animatingLeash);
                        t.hide(animatingLeash);
                        removeImeSurface(mDisplayId);
                        removeImeSurface(mDisplayId);
                        if (android.view.inputmethod.Flags.refactorInsetsController()) {
                            setVisibleDirectly(false /* visible */);
                        }
                        ImeTracker.forLogging().onHidden(mStatsToken);
                        ImeTracker.forLogging().onHidden(mStatsToken);
                    } else if (mAnimationDirection == DIRECTION_SHOW && !mCancelled) {
                    } else if (mAnimationDirection == DIRECTION_SHOW && !mCancelled) {
                        ImeTracker.forLogging().onShown(mStatsToken);
                        ImeTracker.forLogging().onShown(mStatsToken);
@@ -645,13 +654,13 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                    animatingControl.release(SurfaceControl::release);
                    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
                // When going away, queue up insets change first, otherwise any bounds changes
                // can have a "flicker" of ime-provided insets.
                // can have a "flicker" of ime-provided insets.
                setVisibleDirectly(false /* visible */);
                setVisibleDirectly(false /* visible */);
            }
            }
            mAnimation.start();
            mAnimation.start();
            if (show) {
            if (!android.view.inputmethod.Flags.refactorInsetsController() && show) {
                // When showing away, queue up insets change last, otherwise any bounds changes
                // When showing away, queue up insets change last, otherwise any bounds changes
                // can have a "flicker" of ime-provided insets.
                // can have a "flicker" of ime-provided insets.
                setVisibleDirectly(true /* visible */);
                setVisibleDirectly(true /* visible */);