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

Commit 9b37fb63 authored by Automerger Merge Worker's avatar Automerger Merge Worker Committed by Android (Google) Code Review
Browse files

Merge "Merge "Ignore empty frames in ime-controller." into rvc-dev am:...

Merge "Merge "Ignore empty frames in ime-controller." into rvc-dev am: ec78cc5b am: 08bc23d0 am: f07407df" into rvc-qpr-dev-plus-aosp
parents bffa6e54 d6614dae
Loading
Loading
Loading
Loading
+13 −7
Original line number Diff line number Diff line
@@ -178,6 +178,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
        ValueAnimator mAnimation = null;
        int mRotation = Surface.ROTATION_0;
        boolean mImeShowing = false;
        final Rect mImeFrame = new Rect();

        PerDisplay(int displayId, int initialRotation) {
            mDisplayId = displayId;
@@ -254,8 +255,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
            }
        }

        private int imeTop(InsetsSource imeSource, float surfaceOffset) {
            return imeSource.getFrame().top + (int) surfaceOffset;
        private int imeTop(float surfaceOffset) {
            return mImeFrame.top + (int) surfaceOffset;
        }

        private void startAnimation(final boolean show, final boolean forceRestart) {
@@ -263,6 +264,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
            if (imeSource == null || mImeSourceControl == null) {
                return;
            }
            // Set frame, but only if the new frame isn't empty -- this maintains continuity
            final Rect newFrame = imeSource.getFrame();
            if (newFrame.height() != 0) {
                mImeFrame.set(newFrame);
            }
            mHandler.post(() -> {
                if (DEBUG) {
                    Slog.d(TAG, "Run startAnim  show:" + show + "  was:"
@@ -284,7 +290,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                }
                final float defaultY = mImeSourceControl.getSurfacePosition().y;
                final float x = mImeSourceControl.getSurfacePosition().x;
                final float hiddenY = defaultY + imeSource.getFrame().height();
                final float hiddenY = defaultY + mImeFrame.height();
                final float shownY = defaultY;
                final float startY = show ? hiddenY : shownY;
                final float endY = show ? shownY : hiddenY;
@@ -306,7 +312,7 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                    SurfaceControl.Transaction t = mTransactionPool.acquire();
                    float value = (float) animation.getAnimatedValue();
                    t.setPosition(mImeSourceControl.getLeash(), x, value);
                    dispatchPositionChanged(mDisplayId, imeTop(imeSource, value), t);
                    dispatchPositionChanged(mDisplayId, imeTop(value), t);
                    t.apply();
                    mTransactionPool.release(t);
                });
@@ -319,11 +325,11 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                        t.setPosition(mImeSourceControl.getLeash(), x, startY);
                        if (DEBUG) {
                            Slog.d(TAG, "onAnimationStart d:" + mDisplayId + " top:"
                                    + imeTop(imeSource, hiddenY) + "->" + imeTop(imeSource, shownY)
                                    + imeTop(hiddenY) + "->" + imeTop(shownY)
                                    + " showing:" + (mAnimationDirection == DIRECTION_SHOW));
                        }
                        dispatchStartPositioning(mDisplayId, imeTop(imeSource, hiddenY),
                                imeTop(imeSource, shownY), mAnimationDirection == DIRECTION_SHOW,
                        dispatchStartPositioning(mDisplayId, imeTop(hiddenY),
                                imeTop(shownY), mAnimationDirection == DIRECTION_SHOW,
                                t);
                        if (mAnimationDirection == DIRECTION_SHOW) {
                            t.show(mImeSourceControl.getLeash());