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

Commit befa7e20 authored by Adrian Roos's avatar Adrian Roos Committed by Automerger Merge Worker
Browse files

Merge changes I05b83c47,I5a840ec1 am: 49c52755

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1398233

Change-Id: I56b9faab494eacdcbfd6ca0df1b6684d7ee69d4f
parents 51ded686 49c52755
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
    }

    public void onServedEditorChanged(EditorInfo info) {
        if (isDummyOrEmptyEditor(info)) {
        if (isFallbackOrEmptyEditor(info)) {
            mShowOnNextImeRender = false;
        }
        mFocusedEditor = info;
@@ -112,15 +112,15 @@ public final class ImeInsetsSourceConsumer extends InsetsSourceConsumer {
        getImm().notifyImeHidden();
    }

    private boolean isDummyOrEmptyEditor(EditorInfo info) {
        // TODO(b/123044812): Handle dummy input gracefully in IME Insets API
    private boolean isFallbackOrEmptyEditor(EditorInfo info) {
        // TODO(b/123044812): Handle fallback input gracefully in IME Insets API
        return info == null || (info.fieldId <= 0 && info.inputType <= 0);
    }

    private boolean isServedEditorRendered() {
        if (mFocusedEditor == null || mPreRenderedEditor == null
                || isDummyOrEmptyEditor(mFocusedEditor)
                || isDummyOrEmptyEditor(mPreRenderedEditor)) {
                || isFallbackOrEmptyEditor(mFocusedEditor)
                || isFallbackOrEmptyEditor(mPreRenderedEditor)) {
            // No view is focused or ready.
            return false;
        }
+10 −10
Original line number Diff line number Diff line
@@ -54,7 +54,7 @@ public class BaseInputConnection implements InputConnection {
    /** @hide */
    protected final InputMethodManager mIMM;
    final View mTargetView;
    final boolean mDummyMode;
    final boolean mFallbackMode;

    private Object[] mDefaultComposingSpans;

@@ -64,14 +64,14 @@ public class BaseInputConnection implements InputConnection {
    BaseInputConnection(InputMethodManager mgr, boolean fullEditor) {
        mIMM = mgr;
        mTargetView = null;
        mDummyMode = !fullEditor;
        mFallbackMode = !fullEditor;
    }

    public BaseInputConnection(View targetView, boolean fullEditor) {
        mIMM = (InputMethodManager)targetView.getContext().getSystemService(
                Context.INPUT_METHOD_SERVICE);
        mTargetView = targetView;
        mDummyMode = !fullEditor;
        mFallbackMode = !fullEditor;
    }

    public static final void removeComposingSpans(Spannable text) {
@@ -189,7 +189,7 @@ public class BaseInputConnection implements InputConnection {

    /**
     * Default implementation replaces any existing composing text with
     * the given text.  In addition, only if dummy mode, a key event is
     * the given text.  In addition, only if fallback mode, a key event is
     * sent for the new text and the current editable buffer cleared.
     */
    public boolean commitText(CharSequence text, int newCursorPosition) {
@@ -428,7 +428,7 @@ public class BaseInputConnection implements InputConnection {

    /**
     * The default implementation removes the composing state from the
     * current editable text.  In addition, only if dummy mode, a key event is
     * current editable text.  In addition, only if fallback mode, a key event is
     * sent for the new text and the current editable buffer cleared.
     */
    public boolean finishComposingText() {
@@ -437,7 +437,7 @@ public class BaseInputConnection implements InputConnection {
        if (content != null) {
            beginBatchEdit();
            removeComposingSpans(content);
            // Note: sendCurrentText does nothing unless mDummyMode is set
            // Note: sendCurrentText does nothing unless mFallbackMode is set
            sendCurrentText();
            endBatchEdit();
        }
@@ -447,10 +447,10 @@ public class BaseInputConnection implements InputConnection {
    /**
     * The default implementation uses TextUtils.getCapsMode to get the
     * cursor caps mode for the current selection position in the editable
     * text, unless in dummy mode in which case 0 is always returned.
     * text, unless in fallback mode in which case 0 is always returned.
     */
    public int getCursorCapsMode(int reqModes) {
        if (mDummyMode) return 0;
        if (mFallbackMode) return 0;

        final Editable content = getEditable();
        if (content == null) return 0;
@@ -647,7 +647,7 @@ public class BaseInputConnection implements InputConnection {
            content.setSpan(COMPOSING, a, b,
                    Spanned.SPAN_EXCLUSIVE_EXCLUSIVE | Spanned.SPAN_COMPOSING);

            // Note: sendCurrentText does nothing unless mDummyMode is set
            // Note: sendCurrentText does nothing unless mFallbackMode is set
            sendCurrentText();
            endBatchEdit();
        }
@@ -698,7 +698,7 @@ public class BaseInputConnection implements InputConnection {
    }

    private void sendCurrentText() {
        if (!mDummyMode) {
        if (!mFallbackMode) {
            return;
        }

+1 −1
Original line number Diff line number Diff line
@@ -81,7 +81,7 @@ public abstract class InputMethodManagerInternal {
            };

    /**
     * @return Global instance if exists.  Otherwise, a dummy no-op instance.
     * @return Global instance if exists.  Otherwise, a fallback no-op instance.
     */
    @NonNull
    public static InputMethodManagerInternal get() {
+1 −2
Original line number Diff line number Diff line
@@ -1869,8 +1869,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub
     * @param client {@link android.os.Binder} proxy that is associated with the singleton instance
     *               of {@link android.view.inputmethod.InputMethodManager} that runs on the client
     *               process
     * @param inputContext communication channel for the dummy
     *                     {@link android.view.inputmethod.InputConnection}
     * @param inputContext communication channel for the fallback {@link InputConnection}
     * @param selfReportedDisplayId self-reported display ID to which the client is associated.
     *                              Whether the client is still allowed to access to this display
     *                              or not needs to be evaluated every time the client interacts
+1 −1
Original line number Diff line number Diff line
@@ -1590,7 +1590,7 @@ public final class MultiClientInputMethodManagerService {
                }

                if (editorInfo == null) {
                    // So-called dummy InputConnection scenario.  For app compatibility, we still
                    // So-called fallback InputConnection scenario.  For app compatibility, we still
                    // notify this to the IME.
                    switch (clientInfo.mState) {
                        case InputMethodClientState.READY_TO_SEND_FIRST_BIND_RESULT:
Loading