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.view; 18 19 import android.os.Bundle; 20 import android.view.KeyEvent; 21 import android.view.inputmethod.CompletionInfo; 22 import android.view.inputmethod.CorrectionInfo; 23 import android.view.inputmethod.ExtractedTextRequest; 24 import android.view.inputmethod.InputContentInfo; 25 import android.view.inputmethod.TextAttribute; 26 27 import com.android.internal.infra.AndroidFuture; 28 import com.android.internal.inputmethod.InputConnectionCommandHeader; 29 30 /** 31 * Interface from an input method to the application, allowing it to perform 32 * edits on the current input field and other interactions with the application. 33 * {@hide} 34 */ 35 oneway interface IInputContext { getTextBeforeCursor(in InputConnectionCommandHeader header, int length, int flags, in AndroidFuture future )36 void getTextBeforeCursor(in InputConnectionCommandHeader header, int length, int flags, 37 in AndroidFuture future /* T=CharSequence */); 38 getTextAfterCursor(in InputConnectionCommandHeader header, int length, int flags, in AndroidFuture future )39 void getTextAfterCursor(in InputConnectionCommandHeader header, int length, int flags, 40 in AndroidFuture future /* T=CharSequence */); 41 getCursorCapsMode(in InputConnectionCommandHeader header, int reqModes, in AndroidFuture future )42 void getCursorCapsMode(in InputConnectionCommandHeader header, int reqModes, 43 in AndroidFuture future /* T=Integer */); 44 getExtractedText(in InputConnectionCommandHeader header, in ExtractedTextRequest request, int flags, in AndroidFuture future )45 void getExtractedText(in InputConnectionCommandHeader header, in ExtractedTextRequest request, 46 int flags, in AndroidFuture future /* T=ExtractedText */); 47 deleteSurroundingText(in InputConnectionCommandHeader header, int beforeLength, int afterLength)48 void deleteSurroundingText(in InputConnectionCommandHeader header, int beforeLength, 49 int afterLength); deleteSurroundingTextInCodePoints(in InputConnectionCommandHeader header, int beforeLength, int afterLength)50 void deleteSurroundingTextInCodePoints(in InputConnectionCommandHeader header, int beforeLength, 51 int afterLength); 52 setComposingText(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition)53 void setComposingText(in InputConnectionCommandHeader header, CharSequence text, 54 int newCursorPosition); 55 setComposingTextWithTextAttribute(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition, in TextAttribute textAttribute)56 void setComposingTextWithTextAttribute(in InputConnectionCommandHeader header, 57 CharSequence text, int newCursorPosition, in TextAttribute textAttribute); 58 finishComposingText(in InputConnectionCommandHeader header)59 void finishComposingText(in InputConnectionCommandHeader header); 60 commitText(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition)61 void commitText(in InputConnectionCommandHeader header, CharSequence text, 62 int newCursorPosition); 63 commitTextWithTextAttribute(in InputConnectionCommandHeader header, CharSequence text, int newCursorPosition, in TextAttribute textAttribute)64 void commitTextWithTextAttribute(in InputConnectionCommandHeader header, CharSequence text, 65 int newCursorPosition, in TextAttribute textAttribute); 66 commitCompletion(in InputConnectionCommandHeader header, in CompletionInfo completion)67 void commitCompletion(in InputConnectionCommandHeader header, in CompletionInfo completion); 68 commitCorrection(in InputConnectionCommandHeader header, in CorrectionInfo correction)69 void commitCorrection(in InputConnectionCommandHeader header, in CorrectionInfo correction); 70 setSelection(in InputConnectionCommandHeader header, int start, int end)71 void setSelection(in InputConnectionCommandHeader header, int start, int end); 72 performEditorAction(in InputConnectionCommandHeader header, int actionCode)73 void performEditorAction(in InputConnectionCommandHeader header, int actionCode); 74 performContextMenuAction(in InputConnectionCommandHeader header, int id)75 void performContextMenuAction(in InputConnectionCommandHeader header, int id); 76 beginBatchEdit(in InputConnectionCommandHeader header)77 void beginBatchEdit(in InputConnectionCommandHeader header); 78 endBatchEdit(in InputConnectionCommandHeader header)79 void endBatchEdit(in InputConnectionCommandHeader header); 80 sendKeyEvent(in InputConnectionCommandHeader header, in KeyEvent event)81 void sendKeyEvent(in InputConnectionCommandHeader header, in KeyEvent event); 82 clearMetaKeyStates(in InputConnectionCommandHeader header, int states)83 void clearMetaKeyStates(in InputConnectionCommandHeader header, int states); 84 performSpellCheck(in InputConnectionCommandHeader header)85 void performSpellCheck(in InputConnectionCommandHeader header); 86 performPrivateCommand(in InputConnectionCommandHeader header, String action, in Bundle data)87 void performPrivateCommand(in InputConnectionCommandHeader header, String action, 88 in Bundle data); 89 setComposingRegion(in InputConnectionCommandHeader header, int start, int end)90 void setComposingRegion(in InputConnectionCommandHeader header, int start, int end); 91 setComposingRegionWithTextAttribute(in InputConnectionCommandHeader header, int start, int end, in TextAttribute textAttribute)92 void setComposingRegionWithTextAttribute(in InputConnectionCommandHeader header, int start, 93 int end, in TextAttribute textAttribute); 94 getSelectedText(in InputConnectionCommandHeader header, int flags, in AndroidFuture future )95 void getSelectedText(in InputConnectionCommandHeader header, int flags, 96 in AndroidFuture future /* T=CharSequence */); 97 requestCursorUpdates(in InputConnectionCommandHeader header, int cursorUpdateMode, int imeDisplayId, in AndroidFuture future )98 void requestCursorUpdates(in InputConnectionCommandHeader header, int cursorUpdateMode, 99 int imeDisplayId, in AndroidFuture future /* T=Boolean */); 100 requestCursorUpdatesWithFilter(in InputConnectionCommandHeader header, int cursorUpdateMode, int cursorUpdateFilter, int imeDisplayId, in AndroidFuture future )101 void requestCursorUpdatesWithFilter(in InputConnectionCommandHeader header, 102 int cursorUpdateMode, int cursorUpdateFilter, int imeDisplayId, 103 in AndroidFuture future /* T=Boolean */); 104 commitContent(in InputConnectionCommandHeader header, in InputContentInfo inputContentInfo, int flags, in Bundle opts, in AndroidFuture future )105 void commitContent(in InputConnectionCommandHeader header, in InputContentInfo inputContentInfo, 106 int flags, in Bundle opts, in AndroidFuture future /* T=Boolean */); 107 getSurroundingText(in InputConnectionCommandHeader header, int beforeLength, int afterLength, int flags, in AndroidFuture future )108 void getSurroundingText(in InputConnectionCommandHeader header, int beforeLength, 109 int afterLength, int flags, in AndroidFuture future /* T=SurroundingText */); 110 setImeConsumesInput(in InputConnectionCommandHeader header, boolean imeConsumesInput)111 void setImeConsumesInput(in InputConnectionCommandHeader header, boolean imeConsumesInput); 112 } 113