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

Commit 97bd8baa authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[DO NOT MERGE] DisplayImeController: fix out-of-sync IME visibility" into rvc-qpr-dev

parents 96f010c3 f03366ee
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -203,6 +203,8 @@ public class DisplayImeController implements DisplayController.OnDisplaysChanged
                    return;
                }

                mImeShowing = insetsState.getSourceOrDefaultVisibility(InsetsState.ITYPE_IME);

                final InsetsSource newSource = insetsState.getSource(InsetsState.ITYPE_IME);
                final Rect newFrame = newSource.getFrame();
                final Rect oldFrame = mInsetsState.getSource(InsetsState.ITYPE_IME).getFrame();
+5 −0
Original line number Diff line number Diff line
@@ -5877,6 +5877,11 @@ class DisplayContent extends WindowContainer<DisplayContent.DisplayChildWindowCo
                Slog.w(TAG, "Failed to deliver showInsets", e);
            }
        }

        @Override
        public boolean getImeRequestedVisibility(@InternalInsetsType int type) {
            return getInsetsStateController().getImeSourceProvider().isImeShowing();
        }
    }

    /**
+23 −3
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {
    private InsetsControlTarget mImeTargetFromIme;
    private Runnable mShowImeRunner;
    private boolean mIsImeLayoutDrawn;
    private boolean mImeShowing;

    ImeInsetsSourceProvider(InsetsSource source,
            InsetsStateController stateController, DisplayContent displayContent) {
@@ -74,6 +75,7 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {

                ProtoLog.i(WM_DEBUG_IME, "call showInsets(ime) on %s",
                        target.getWindow() != null ? target.getWindow().getName() : "");
                setImeShowing(true);
                target.showInsets(WindowInsets.Type.ime(), true /* fromIme */);
                if (target != mImeTargetFromIme && mImeTargetFromIme != null) {
                    ProtoLog.w(WM_DEBUG_IME,
@@ -147,11 +149,29 @@ class ImeInsetsSourceProvider extends InsetsSourceProvider {
    @Override
    public void dump(PrintWriter pw, String prefix) {
        super.dump(pw, prefix);
        if (mImeTargetFromIme != null) {
        pw.print(prefix);
        pw.print("mImeShowing=");
        pw.print(mImeShowing);
        if (mImeTargetFromIme != null) {
            pw.print(" showImePostLayout pending for mImeTargetFromIme=");
            pw.print(mImeTargetFromIme);
        }
        pw.println();
    }

    /**
     * Sets whether the IME is currently supposed to be showing according to
     * InputMethodManagerService.
     */
    public void setImeShowing(boolean imeShowing) {
        mImeShowing = imeShowing;
    }

    /**
     * Returns whether the IME is currently supposed to be showing according to
     * InputMethodManagerService.
     */
    public boolean isImeShowing() {
        return mImeShowing;
    }
}
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,13 @@ interface InsetsControlTarget {
        return null;
    }

    /**
     * @return The requested visibility of this target.
     */
    default boolean getImeRequestedVisibility(@InsetsState.InternalInsetsType int type) {
        return InsetsState.getDefaultVisibility(type);
    }

    /**
     * @return The requested {@link InsetsState} of this target.
     */
+1 −1
Original line number Diff line number Diff line
@@ -279,7 +279,7 @@ class InsetsSourceProvider {
        }
        mAdapter = new ControlAdapter();
        if (getSource().getType() == ITYPE_IME) {
            setClientVisible(InsetsState.getDefaultVisibility(mSource.getType()));
            setClientVisible(target.getImeRequestedVisibility(mSource.getType()));
        }
        final Transaction t = mDisplayContent.getPendingTransaction();
        mWin.startAnimation(t, mAdapter, !mClientVisible /* hidden */,
Loading