1 /*
2  * Copyright (C) 2008 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.internal.inputmethod;
18 
19 import android.graphics.RectF;
20 import android.os.Bundle;
21 import android.os.IBinder;
22 import android.os.ICancellationSignal;
23 import android.os.ResultReceiver;
24 import android.view.KeyEvent;
25 import android.view.inputmethod.CompletionInfo;
26 import android.view.inputmethod.CorrectionInfo;
27 import android.view.inputmethod.ExtractedTextRequest;
28 import android.view.inputmethod.InputContentInfo;
29 import android.view.inputmethod.ParcelableHandwritingGesture;
30 import android.view.inputmethod.TextAttribute;
31 
32 import com.android.internal.infra.AndroidFuture;
33 import com.android.internal.inputmethod.InputConnectionCommandHeader;
34 
35 /**
36  * Interface from an input method to the application, allowing it to perform
37  * edits on the current input field and other interactions with the application.
38  */
39  oneway interface IRemoteInputConnection {
getTextBeforeCursor(in InputConnectionCommandHeader header, int length, int flags, in AndroidFuture future )40     void getTextBeforeCursor(in InputConnectionCommandHeader header, int length, int flags,
41             in AndroidFuture future /* T=CharSequence */);
42 
getTextAfterCursor(in InputConnectionCommandHeader header, int length, int flags, in AndroidFuture future )43     void getTextAfterCursor(in InputConnectionCommandHeader header, int length, int flags,
44             in AndroidFuture future /* T=CharSequence */);
45 
getCursorCapsMode(in InputConnectionCommandHeader header, int reqModes, in AndroidFuture future )46     void getCursorCapsMode(in InputConnectionCommandHeader header, int reqModes,
47             in AndroidFuture future /* T=Integer */);
48 
getExtractedText(in InputConnectionCommandHeader header, in ExtractedTextRequest request, int flags, in AndroidFuture future )49     void getExtractedText(in InputConnectionCommandHeader header, in ExtractedTextRequest request,
50             int flags, in AndroidFuture future /* T=ExtractedText */);
51 
deleteSurroundingText(in InputConnectionCommandHeader header, int beforeLength, int afterLength)52     void deleteSurroundingText(in InputConnectionCommandHeader header, int beforeLength,
53             int afterLength);
deleteSurroundingTextInCodePoints(in InputConnectionCommandHeader header, int beforeLength, int afterLength)54     void deleteSurroundingTextInCodePoints(in InputConnectionCommandHeader header, int beforeLength,
55             int afterLength);
56 
setComposingText(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition)57     void setComposingText(in InputConnectionCommandHeader header, CharSequence text,
58             int newCursorPosition);
59 
setComposingTextWithTextAttribute(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition, in TextAttribute textAttribute)60     void setComposingTextWithTextAttribute(in InputConnectionCommandHeader header,
61                 CharSequence text, int newCursorPosition, in TextAttribute textAttribute);
62 
finishComposingText(in InputConnectionCommandHeader header)63     void finishComposingText(in InputConnectionCommandHeader header);
64 
commitText(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition)65     void commitText(in InputConnectionCommandHeader header, CharSequence text,
66                 int newCursorPosition);
67 
commitTextWithTextAttribute(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition, in TextAttribute textAttribute)68     void commitTextWithTextAttribute(in InputConnectionCommandHeader header, CharSequence text,
69             int newCursorPosition, in TextAttribute textAttribute);
70 
commitCompletion(in InputConnectionCommandHeader header, in CompletionInfo completion)71     void commitCompletion(in InputConnectionCommandHeader header, in CompletionInfo completion);
72 
commitCorrection(in InputConnectionCommandHeader header, in CorrectionInfo correction)73     void commitCorrection(in InputConnectionCommandHeader header, in CorrectionInfo correction);
74 
setSelection(in InputConnectionCommandHeader header, int start, int end)75     void setSelection(in InputConnectionCommandHeader header, int start, int end);
76 
performEditorAction(in InputConnectionCommandHeader header, int actionCode)77     void performEditorAction(in InputConnectionCommandHeader header, int actionCode);
78 
performContextMenuAction(in InputConnectionCommandHeader header, int id)79     void performContextMenuAction(in InputConnectionCommandHeader header, int id);
80 
beginBatchEdit(in InputConnectionCommandHeader header)81     void beginBatchEdit(in InputConnectionCommandHeader header);
82 
endBatchEdit(in InputConnectionCommandHeader header)83     void endBatchEdit(in InputConnectionCommandHeader header);
84 
sendKeyEvent(in InputConnectionCommandHeader header, in KeyEvent event)85     void sendKeyEvent(in InputConnectionCommandHeader header, in KeyEvent event);
86 
clearMetaKeyStates(in InputConnectionCommandHeader header, int states)87     void clearMetaKeyStates(in InputConnectionCommandHeader header, int states);
88 
performSpellCheck(in InputConnectionCommandHeader header)89     void performSpellCheck(in InputConnectionCommandHeader header);
90 
performPrivateCommand(in InputConnectionCommandHeader header, String action, in Bundle data)91     void performPrivateCommand(in InputConnectionCommandHeader header, String action,
92             in Bundle data);
93 
performHandwritingGesture(in InputConnectionCommandHeader header, in ParcelableHandwritingGesture gesture, in ResultReceiver resultReceiver)94     void performHandwritingGesture(in InputConnectionCommandHeader header,
95             in ParcelableHandwritingGesture gesture, in ResultReceiver resultReceiver);
96 
previewHandwritingGesture(in InputConnectionCommandHeader header, in ParcelableHandwritingGesture gesture, in IBinder cancellationSignal)97     void previewHandwritingGesture(in InputConnectionCommandHeader header,
98             in ParcelableHandwritingGesture gesture, in IBinder cancellationSignal);
99 
setComposingRegion(in InputConnectionCommandHeader header, int start, int end)100     void setComposingRegion(in InputConnectionCommandHeader header, int start, int end);
101 
setComposingRegionWithTextAttribute(in InputConnectionCommandHeader header, int start, int end, in TextAttribute textAttribute)102     void setComposingRegionWithTextAttribute(in InputConnectionCommandHeader header, int start,
103             int end, in TextAttribute textAttribute);
104 
getSelectedText(in InputConnectionCommandHeader header, int flags, in AndroidFuture future )105     void getSelectedText(in InputConnectionCommandHeader header, int flags,
106             in AndroidFuture future /* T=CharSequence */);
107 
requestCursorUpdates(in InputConnectionCommandHeader header, int cursorUpdateMode, int imeDisplayId, in AndroidFuture future )108     void requestCursorUpdates(in InputConnectionCommandHeader header, int cursorUpdateMode,
109             int imeDisplayId, in AndroidFuture future /* T=Boolean */);
110 
requestCursorUpdatesWithFilter(in InputConnectionCommandHeader header, int cursorUpdateMode, int cursorUpdateFilter, int imeDisplayId, in AndroidFuture future )111     void requestCursorUpdatesWithFilter(in InputConnectionCommandHeader header,
112                 int cursorUpdateMode, int cursorUpdateFilter, int imeDisplayId,
113                  in AndroidFuture future /* T=Boolean */);
114 
requestTextBoundsInfo(in InputConnectionCommandHeader header, in RectF bounds, in ResultReceiver resultReceiver )115     void requestTextBoundsInfo(in InputConnectionCommandHeader header, in RectF bounds,
116            in ResultReceiver resultReceiver /* T=TextBoundsInfoResult */);
117 
commitContent(in InputConnectionCommandHeader header, in InputContentInfo inputContentInfo, int flags, in Bundle opts, in AndroidFuture future )118     void commitContent(in InputConnectionCommandHeader header, in InputContentInfo inputContentInfo,
119             int flags, in Bundle opts, in AndroidFuture future /* T=Boolean */);
120 
getSurroundingText(in InputConnectionCommandHeader header, int beforeLength, int afterLength, int flags, in AndroidFuture future )121     void getSurroundingText(in InputConnectionCommandHeader header, int beforeLength,
122             int afterLength, int flags, in AndroidFuture future /* T=SurroundingText */);
123 
setImeConsumesInput(in InputConnectionCommandHeader header, boolean imeConsumesInput)124     void setImeConsumesInput(in InputConnectionCommandHeader header, boolean imeConsumesInput);
125 
replaceText(in InputConnectionCommandHeader header, int start, int end, CharSequence text, int newCursorPosition,in TextAttribute textAttribute)126     void replaceText(in InputConnectionCommandHeader header, int start, int end, CharSequence text,
127             int newCursorPosition,in TextAttribute textAttribute);
128 
cancelCancellationSignal(in IBinder token)129     void cancelCancellationSignal(in IBinder token);
forgetCancellationSignal(in IBinder token)130     void forgetCancellationSignal(in IBinder token);
131 
132 }
133