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

Commit 40a525de authored by Yohei Yukawa's avatar Yohei Yukawa
Browse files

Add InputConnectionCommandHeader

This is a preparation CL to make InputConnection tasks cancellable.

In order to introduce a concept of sub session within a single
IInputContext, every IPC method defined there soon requires a common
data header.  This CL adds a placeholder object

  InputConnectionCommandHeader

for that purpose.

Note that this CL does nothing except for introducing such a
placeholder object.  Hence there should no observable behavior change
yet.

Bug: 195115071
Test: presubmit
Change-Id: Ib1465f4d80a6cc9a38e266995a163e5f0bef1115
parent e43a10f2
Loading
Loading
Loading
Loading
+71 −55
Original line number Diff line number Diff line
@@ -57,9 +57,14 @@ public final class IInputContextInvoker {
        return new IInputContextInvoker(inputContext);
    }

    @NonNull
    InputConnectionCommandHeader createHeader() {
        return new InputConnectionCommandHeader();
    }

    /**
     * Invokes {@link IInputContext#getTextAfterCursor(int, int,
     * com.android.internal.inputmethod.ICharSequenceResultCallback)}.
     * Invokes {@link IInputContext#getTextAfterCursor(InputConnectionCommandHeader, int, int,
     * AndroidFuture)}.
     *
     * @param length {@code length} parameter to be passed.
     * @param flags {@code flags} parameter to be passed.
@@ -71,7 +76,7 @@ public final class IInputContextInvoker {
    public AndroidFuture<CharSequence> getTextAfterCursor(int length, int flags) {
        final AndroidFuture<CharSequence> future = new AndroidFuture<>();
        try {
            mIInputContext.getTextAfterCursor(length, flags, future);
            mIInputContext.getTextAfterCursor(createHeader(), length, flags, future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -79,7 +84,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#getTextBeforeCursor(int, int, ICharSequenceResultCallback)}.
     * Invokes {@link IInputContext#getTextBeforeCursor(InputConnectionCommandHeader, int, int,
     * AndroidFuture)}.
     *
     * @param length {@code length} parameter to be passed.
     * @param flags {@code flags} parameter to be passed.
@@ -91,7 +97,7 @@ public final class IInputContextInvoker {
    public AndroidFuture<CharSequence> getTextBeforeCursor(int length, int flags) {
        final AndroidFuture<CharSequence> future = new AndroidFuture<>();
        try {
            mIInputContext.getTextBeforeCursor(length, flags, future);
            mIInputContext.getTextBeforeCursor(createHeader(), length, flags, future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -99,7 +105,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#getSelectedText(int, ICharSequenceResultCallback)}.
     * Invokes
     * {@link IInputContext#getSelectedText(InputConnectionCommandHeader, int, AndroidFuture)}.
     *
     * @param flags {@code flags} parameter to be passed.
     * @return {@link AndroidFuture<CharSequence>} that can be used to retrieve the invocation
@@ -110,7 +117,7 @@ public final class IInputContextInvoker {
    public AndroidFuture<CharSequence> getSelectedText(int flags) {
        final AndroidFuture<CharSequence> future = new AndroidFuture<>();
        try {
            mIInputContext.getSelectedText(flags, future);
            mIInputContext.getSelectedText(createHeader(), flags, future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -119,7 +126,8 @@ public final class IInputContextInvoker {

    /**
     * Invokes
     * {@link IInputContext#getSurroundingText(int, int, int, ISurroundingTextResultCallback)}.
     * {@link IInputContext#getSurroundingText(InputConnectionCommandHeader, int, int, int,
     * AndroidFuture)}.
     *
     * @param beforeLength {@code beforeLength} parameter to be passed.
     * @param afterLength {@code afterLength} parameter to be passed.
@@ -133,7 +141,8 @@ public final class IInputContextInvoker {
            int flags) {
        final AndroidFuture<SurroundingText> future = new AndroidFuture<>();
        try {
            mIInputContext.getSurroundingText(beforeLength, afterLength, flags, future);
            mIInputContext.getSurroundingText(createHeader(), beforeLength, afterLength, flags,
                    future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -141,7 +150,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#getCursorCapsMode(int, IIntResultCallback)}.
     * Invokes
     * {@link IInputContext#getCursorCapsMode(InputConnectionCommandHeader, int, AndroidFuture)}.
     *
     * @param reqModes {@code reqModes} parameter to be passed.
     * @return {@link AndroidFuture<Integer>} that can be used to retrieve the invocation
@@ -152,7 +162,7 @@ public final class IInputContextInvoker {
    public AndroidFuture<Integer> getCursorCapsMode(int reqModes) {
        final AndroidFuture<Integer> future = new AndroidFuture<>();
        try {
            mIInputContext.getCursorCapsMode(reqModes, future);
            mIInputContext.getCursorCapsMode(createHeader(), reqModes, future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -160,8 +170,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#getExtractedText(ExtractedTextRequest, int,
     * IExtractedTextResultCallback)}.
     * Invokes {@link IInputContext#getExtractedText(InputConnectionCommandHeader,
     * ExtractedTextRequest, int, AndroidFuture)}.
     *
     * @param request {@code request} parameter to be passed.
     * @param flags {@code flags} parameter to be passed.
@@ -174,7 +184,7 @@ public final class IInputContextInvoker {
            int flags) {
        final AndroidFuture<ExtractedText> future = new AndroidFuture<>();
        try {
            mIInputContext.getExtractedText(request, flags, future);
            mIInputContext.getExtractedText(createHeader(), request, flags, future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -182,7 +192,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#commitText(CharSequence, int)}.
     * Invokes {@link IInputContext#commitText(InputConnectionCommandHeader, CharSequence, int)}.
     *
     * @param text {@code text} parameter to be passed.
     * @param newCursorPosition {@code newCursorPosition} parameter to be passed.
@@ -192,7 +202,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean commitText(CharSequence text, int newCursorPosition) {
        try {
            mIInputContext.commitText(text, newCursorPosition);
            mIInputContext.commitText(createHeader(), text, newCursorPosition);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -200,7 +210,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#commitCompletion(CompletionInfo)}.
     * Invokes {@link IInputContext#commitCompletion(InputConnectionCommandHeader, CompletionInfo)}.
     *
     * @param text {@code text} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -209,7 +219,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean commitCompletion(CompletionInfo text) {
        try {
            mIInputContext.commitCompletion(text);
            mIInputContext.commitCompletion(createHeader(), text);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -217,7 +227,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#commitCorrection(CorrectionInfo)}.
     * Invokes {@link IInputContext#commitCorrection(InputConnectionCommandHeader, CorrectionInfo)}.
     *
     * @param correctionInfo {@code correctionInfo} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -226,7 +236,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean commitCorrection(CorrectionInfo correctionInfo) {
        try {
            mIInputContext.commitCorrection(correctionInfo);
            mIInputContext.commitCorrection(createHeader(), correctionInfo);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -234,7 +244,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#setSelection(int, int)}.
     * Invokes {@link IInputContext#setSelection(InputConnectionCommandHeader, int, int)}.
     *
     * @param start {@code start} parameter to be passed.
     * @param end {@code start} parameter to be passed.
@@ -244,7 +254,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean setSelection(int start, int end) {
        try {
            mIInputContext.setSelection(start, end);
            mIInputContext.setSelection(createHeader(), start, end);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -252,7 +262,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#performEditorAction(int)}.
     * Invokes {@link IInputContext#performEditorAction(InputConnectionCommandHeader, int)}.
     *
     * @param actionCode {@code start} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -261,7 +271,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean performEditorAction(int actionCode) {
        try {
            mIInputContext.performEditorAction(actionCode);
            mIInputContext.performEditorAction(createHeader(), actionCode);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -269,7 +279,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#performContextMenuAction(id)}.
     * Invokes {@link IInputContext#performContextMenuAction(InputConnectionCommandHeader, int)}.
     *
     * @param id {@code id} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -278,7 +288,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean performContextMenuAction(int id) {
        try {
            mIInputContext.performContextMenuAction(id);
            mIInputContext.performContextMenuAction(createHeader(), id);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -286,7 +296,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#setComposingRegion(int, int)}.
     * Invokes {@link IInputContext#setComposingRegion(InputConnectionCommandHeader, int, int)}.
     *
     * @param start {@code id} parameter to be passed.
     * @param end {@code id} parameter to be passed.
@@ -296,7 +306,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean setComposingRegion(int start, int end) {
        try {
            mIInputContext.setComposingRegion(start, end);
            mIInputContext.setComposingRegion(createHeader(), start, end);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -304,7 +314,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#setComposingText(CharSequence, int)}.
     * Invokes
     * {@link IInputContext#setComposingText(InputConnectionCommandHeader, CharSequence, int)}.
     *
     * @param text {@code text} parameter to be passed.
     * @param newCursorPosition {@code newCursorPosition} parameter to be passed.
@@ -314,7 +325,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean setComposingText(CharSequence text, int newCursorPosition) {
        try {
            mIInputContext.setComposingText(text, newCursorPosition);
            mIInputContext.setComposingText(createHeader(), text, newCursorPosition);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -322,7 +333,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#finishComposingText()}.
     * Invokes {@link IInputContext#finishComposingText(InputConnectionCommandHeader)}.
     *
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
     *         {@code false} otherwise.
@@ -330,7 +341,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean finishComposingText() {
        try {
            mIInputContext.finishComposingText();
            mIInputContext.finishComposingText(createHeader());
            return true;
        } catch (RemoteException e) {
            return false;
@@ -338,7 +349,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#beginBatchEdit()}.
     * Invokes {@link IInputContext#beginBatchEdit(InputConnectionCommandHeader)}.
     *
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
     *         {@code false} otherwise.
@@ -346,7 +357,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean beginBatchEdit() {
        try {
            mIInputContext.beginBatchEdit();
            mIInputContext.beginBatchEdit(createHeader());
            return true;
        } catch (RemoteException e) {
            return false;
@@ -354,7 +365,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#endBatchEdit()}.
     * Invokes {@link IInputContext#endBatchEdit(InputConnectionCommandHeader)}.
     *
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
     *         {@code false} otherwise.
@@ -362,7 +373,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean endBatchEdit() {
        try {
            mIInputContext.endBatchEdit();
            mIInputContext.endBatchEdit(createHeader());
            return true;
        } catch (RemoteException e) {
            return false;
@@ -370,7 +381,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#sendKeyEvent(KeyEvent)}.
     * Invokes {@link IInputContext#sendKeyEvent(InputConnectionCommandHeader, KeyEvent)}.
     *
     * @param event {@code event} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -379,7 +390,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean sendKeyEvent(KeyEvent event) {
        try {
            mIInputContext.sendKeyEvent(event);
            mIInputContext.sendKeyEvent(createHeader(), event);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -387,7 +398,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#clearMetaKeyStates(int)}.
     * Invokes {@link IInputContext#clearMetaKeyStates(InputConnectionCommandHeader, int)}.
     *
     * @param states {@code states} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -396,7 +407,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean clearMetaKeyStates(int states) {
        try {
            mIInputContext.clearMetaKeyStates(states);
            mIInputContext.clearMetaKeyStates(createHeader(), states);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -404,7 +415,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#deleteSurroundingText(int, int)}.
     * Invokes {@link IInputContext#deleteSurroundingText(InputConnectionCommandHeader, int, int)}.
     *
     * @param beforeLength {@code beforeLength} parameter to be passed.
     * @param afterLength {@code afterLength} parameter to be passed.
@@ -414,7 +425,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean deleteSurroundingText(int beforeLength, int afterLength) {
        try {
            mIInputContext.deleteSurroundingText(beforeLength, afterLength);
            mIInputContext.deleteSurroundingText(createHeader(), beforeLength, afterLength);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -422,7 +433,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#deleteSurroundingTextInCodePoints(int, int)}.
     * Invokes {@link IInputContext#deleteSurroundingTextInCodePoints(InputConnectionCommandHeader,
     * int, int)}.
     *
     * @param beforeLength {@code beforeLength} parameter to be passed.
     * @param afterLength {@code afterLength} parameter to be passed.
@@ -432,7 +444,8 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean deleteSurroundingTextInCodePoints(int beforeLength, int afterLength) {
        try {
            mIInputContext.deleteSurroundingTextInCodePoints(beforeLength, afterLength);
            mIInputContext.deleteSurroundingTextInCodePoints(createHeader(), beforeLength,
                    afterLength);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -440,7 +453,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#performSpellCheck()}.
     * Invokes {@link IInputContext#performSpellCheck(InputConnectionCommandHeader)}.
     *
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
     *         {@code false} otherwise.
@@ -448,7 +461,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean performSpellCheck() {
        try {
            mIInputContext.performSpellCheck();
            mIInputContext.performSpellCheck(createHeader());
            return true;
        } catch (RemoteException e) {
            return false;
@@ -456,7 +469,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#performPrivateCommand(String, Bundle)}.
     * Invokes
     * {@link IInputContext#performPrivateCommand(InputConnectionCommandHeader, String, Bundle)}.
     *
     * @param action {@code action} parameter to be passed.
     * @param data {@code data} parameter to be passed.
@@ -466,7 +480,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean performPrivateCommand(String action, Bundle data) {
        try {
            mIInputContext.performPrivateCommand(action, data);
            mIInputContext.performPrivateCommand(createHeader(), action, data);
            return true;
        } catch (RemoteException e) {
            return false;
@@ -474,7 +488,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#requestCursorUpdates(int, IIntResultCallback)}.
     * Invokes {@link IInputContext#requestCursorUpdates(InputConnectionCommandHeader, int, int,
     * AndroidFuture)}.
     *
     * @param cursorUpdateMode {@code cursorUpdateMode} parameter to be passed.
     * @param imeDisplayId the display ID that is associated with the IME.
@@ -486,7 +501,8 @@ public final class IInputContextInvoker {
    public AndroidFuture<Boolean> requestCursorUpdates(int cursorUpdateMode, int imeDisplayId) {
        final AndroidFuture<Boolean> future = new AndroidFuture<>();
        try {
            mIInputContext.requestCursorUpdates(cursorUpdateMode, imeDisplayId, future);
            mIInputContext.requestCursorUpdates(createHeader(), cursorUpdateMode, imeDisplayId,
                    future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -494,8 +510,8 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes
     * {@link IInputContext#commitContent(InputContentInfo, int, Bundle, IIntResultCallback)}.
     * Invokes {@link IInputContext#commitContent(InputConnectionCommandHeader, InputContentInfo,
     * int, Bundle, AndroidFuture)}.
     *
     * @param inputContentInfo {@code inputContentInfo} parameter to be passed.
     * @param flags {@code flags} parameter to be passed.
@@ -509,7 +525,7 @@ public final class IInputContextInvoker {
            Bundle opts) {
        final AndroidFuture<Boolean> future = new AndroidFuture<>();
        try {
            mIInputContext.commitContent(inputContentInfo, flags, opts, future);
            mIInputContext.commitContent(createHeader(), inputContentInfo, flags, opts, future);
        } catch (RemoteException e) {
            future.completeExceptionally(e);
        }
@@ -517,7 +533,7 @@ public final class IInputContextInvoker {
    }

    /**
     * Invokes {@link IInputContext#setImeConsumesInput(boolean)}.
     * Invokes {@link IInputContext#setImeConsumesInput(InputConnectionCommandHeader, boolean)}.
     *
     * @param imeConsumesInput {@code imeConsumesInput} parameter to be passed.
     * @return {@code true} if the invocation is completed without {@link RemoteException}.
@@ -526,7 +542,7 @@ public final class IInputContextInvoker {
    @AnyThread
    public boolean setImeConsumesInput(boolean imeConsumesInput) {
        try {
            mIInputContext.setImeConsumesInput(imeConsumesInput);
            mIInputContext.setImeConsumesInput(createHeader(), imeConsumesInput);
            return true;
        } catch (RemoteException e) {
            return false;
+19 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.inputmethod;

parcelable InputConnectionCommandHeader;
 No newline at end of file
+53 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2021 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.internal.inputmethod;

import android.annotation.NonNull;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * A common IPC header used behind {@link RemoteInputConnectionImpl} and
 * {@link android.inputmethodservice.RemoteInputConnection}.
 */
public final class InputConnectionCommandHeader implements Parcelable {
    public InputConnectionCommandHeader() {
    }

    @Override
    public int describeContents() {
        return 0;
    }

    @NonNull
    public static final Parcelable.Creator<InputConnectionCommandHeader> CREATOR =
            new Parcelable.Creator<InputConnectionCommandHeader>() {
                @NonNull
                public InputConnectionCommandHeader createFromParcel(Parcel in) {
                    return new InputConnectionCommandHeader();
                }

                @NonNull
                public InputConnectionCommandHeader[] newArray(int size) {
                    return new InputConnectionCommandHeader[size];
                }
            };

    @Override
    public void writeToParcel(@NonNull Parcel dest, int flags) {
    }
}
+37 −29

File changed.

Preview size limit exceeded, changes collapsed.

+40 −30
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ import android.view.inputmethod.ExtractedTextRequest;
import android.view.inputmethod.InputContentInfo;

import com.android.internal.infra.AndroidFuture;
import com.android.internal.inputmethod.InputConnectionCommandHeader;

/**
 * Interface from an input method to the application, allowing it to perform
@@ -31,58 +32,67 @@ import com.android.internal.infra.AndroidFuture;
 * {@hide}
 */
 oneway interface IInputContext {
    void getTextBeforeCursor(int length, int flags, in AndroidFuture future /* T=CharSequence */);
    void getTextBeforeCursor(in InputConnectionCommandHeader header, int length, int flags,
            in AndroidFuture future /* T=CharSequence */);

    void getTextAfterCursor(int length, int flags, in AndroidFuture future /* T=CharSequence */);
    void getTextAfterCursor(in InputConnectionCommandHeader header, int length, int flags,
            in AndroidFuture future /* T=CharSequence */);

    void getCursorCapsMode(int reqModes, in AndroidFuture future /* T=Integer */);
    void getCursorCapsMode(in InputConnectionCommandHeader header, int reqModes,
            in AndroidFuture future /* T=Integer */);

    void getExtractedText(in ExtractedTextRequest request, int flags,
            in AndroidFuture future /* T=ExtractedText */);
    void getExtractedText(in InputConnectionCommandHeader header, in ExtractedTextRequest request,
            int flags, in AndroidFuture future /* T=ExtractedText */);

    void deleteSurroundingText(int beforeLength, int afterLength);
    void deleteSurroundingTextInCodePoints(int beforeLength, int afterLength);
    void deleteSurroundingText(in InputConnectionCommandHeader header, int beforeLength,
            int afterLength);
    void deleteSurroundingTextInCodePoints(in InputConnectionCommandHeader header, int beforeLength,
            int afterLength);

    void setComposingText(CharSequence text, int newCursorPosition);
    void setComposingText(in InputConnectionCommandHeader header, CharSequence text,
            int newCursorPosition);

    void finishComposingText();
    void finishComposingText(in InputConnectionCommandHeader header);

    void commitText(CharSequence text, int newCursorPosition);
    void commitText(in InputConnectionCommandHeader header, CharSequence text,
            int newCursorPosition);

    void commitCompletion(in CompletionInfo completion);
    void commitCompletion(in InputConnectionCommandHeader header, in CompletionInfo completion);

    void commitCorrection(in CorrectionInfo correction);
    void commitCorrection(in InputConnectionCommandHeader header, in CorrectionInfo correction);

    void setSelection(int start, int end);
    void setSelection(in InputConnectionCommandHeader header, int start, int end);

    void performEditorAction(int actionCode);
    void performEditorAction(in InputConnectionCommandHeader header, int actionCode);

    void performContextMenuAction(int id);
    void performContextMenuAction(in InputConnectionCommandHeader header, int id);

    void beginBatchEdit();
    void beginBatchEdit(in InputConnectionCommandHeader header);

    void endBatchEdit();
    void endBatchEdit(in InputConnectionCommandHeader header);

    void sendKeyEvent(in KeyEvent event);
    void sendKeyEvent(in InputConnectionCommandHeader header, in KeyEvent event);

    void clearMetaKeyStates(int states);
    void clearMetaKeyStates(in InputConnectionCommandHeader header, int states);

    void performSpellCheck();
    void performSpellCheck(in InputConnectionCommandHeader header);

    void performPrivateCommand(String action, in Bundle data);
    void performPrivateCommand(in InputConnectionCommandHeader header, String action,
            in Bundle data);

    void setComposingRegion(int start, int end);
    void setComposingRegion(in InputConnectionCommandHeader header, int start, int end);

    void getSelectedText(int flags, in AndroidFuture future /* T=CharSequence */);
    void getSelectedText(in InputConnectionCommandHeader header, int flags,
            in AndroidFuture future /* T=CharSequence */);

    void requestCursorUpdates(int cursorUpdateMode, int imeDisplayId,
            in AndroidFuture future /* T=Boolean */);
    void requestCursorUpdates(in InputConnectionCommandHeader header, int cursorUpdateMode,
            int imeDisplayId, in AndroidFuture future /* T=Boolean */);

    void commitContent(in InputContentInfo inputContentInfo, int flags, in Bundle opts,
            in AndroidFuture future /* T=Boolean */);
    void commitContent(in InputConnectionCommandHeader header, in InputContentInfo inputContentInfo,
            int flags, in Bundle opts, in AndroidFuture future /* T=Boolean */);

    void getSurroundingText(int beforeLength, int afterLength, int flags,
            in AndroidFuture future /* T=SurroundingText */);
    void getSurroundingText(in InputConnectionCommandHeader header, int beforeLength,
            int afterLength, int flags, in AndroidFuture future /* T=SurroundingText */);

    void setImeConsumesInput(boolean imeConsumesInput);
    void setImeConsumesInput(in InputConnectionCommandHeader header, boolean imeConsumesInput);
}