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 26 import com.android.internal.inputmethod.ICharSequenceResultCallback; 27 import com.android.internal.inputmethod.IExtractedTextResultCallback; 28 import com.android.internal.inputmethod.IIntResultCallback; 29 import com.android.internal.inputmethod.ISurroundingTextResultCallback; 30 31 /** 32 * Interface from an input method to the application, allowing it to perform 33 * edits on the current input field and other interactions with the application. 34 * {@hide} 35 */ 36 oneway interface IInputContext { getTextBeforeCursor(int length, int flags, ICharSequenceResultCallback callback)37 void getTextBeforeCursor(int length, int flags, ICharSequenceResultCallback callback); 38 getTextAfterCursor(int length, int flags, ICharSequenceResultCallback callback)39 void getTextAfterCursor(int length, int flags, ICharSequenceResultCallback callback); 40 getCursorCapsMode(int reqModes, IIntResultCallback callback)41 void getCursorCapsMode(int reqModes, IIntResultCallback callback); 42 getExtractedText(in ExtractedTextRequest request, int flags, IExtractedTextResultCallback callback)43 void getExtractedText(in ExtractedTextRequest request, int flags, 44 IExtractedTextResultCallback callback); 45 deleteSurroundingText(int beforeLength, int afterLength)46 void deleteSurroundingText(int beforeLength, int afterLength); deleteSurroundingTextInCodePoints(int beforeLength, int afterLength)47 void deleteSurroundingTextInCodePoints(int beforeLength, int afterLength); 48 setComposingText(CharSequence text, int newCursorPosition)49 void setComposingText(CharSequence text, int newCursorPosition); 50 finishComposingText()51 void finishComposingText(); 52 commitText(CharSequence text, int newCursorPosition)53 void commitText(CharSequence text, int newCursorPosition); 54 commitCompletion(in CompletionInfo completion)55 void commitCompletion(in CompletionInfo completion); 56 commitCorrection(in CorrectionInfo correction)57 void commitCorrection(in CorrectionInfo correction); 58 setSelection(int start, int end)59 void setSelection(int start, int end); 60 performEditorAction(int actionCode)61 void performEditorAction(int actionCode); 62 performContextMenuAction(int id)63 void performContextMenuAction(int id); 64 beginBatchEdit()65 void beginBatchEdit(); 66 endBatchEdit()67 void endBatchEdit(); 68 sendKeyEvent(in KeyEvent event)69 void sendKeyEvent(in KeyEvent event); 70 clearMetaKeyStates(int states)71 void clearMetaKeyStates(int states); 72 performSpellCheck()73 void performSpellCheck(); 74 performPrivateCommand(String action, in Bundle data)75 void performPrivateCommand(String action, in Bundle data); 76 setComposingRegion(int start, int end)77 void setComposingRegion(int start, int end); 78 getSelectedText(int flags, ICharSequenceResultCallback callback)79 void getSelectedText(int flags, ICharSequenceResultCallback callback); 80 requestUpdateCursorAnchorInfo(int cursorUpdateMode, IIntResultCallback callback)81 void requestUpdateCursorAnchorInfo(int cursorUpdateMode, IIntResultCallback callback); 82 commitContent(in InputContentInfo inputContentInfo, int flags, in Bundle opts, IIntResultCallback callback)83 void commitContent(in InputContentInfo inputContentInfo, int flags, in Bundle opts, 84 IIntResultCallback callback); 85 getSurroundingText(int beforeLength, int afterLength, int flags, ISurroundingTextResultCallback callback)86 void getSurroundingText(int beforeLength, int afterLength, int flags, 87 ISurroundingTextResultCallback callback); 88 setImeConsumesInput(boolean imeConsumesInput)89 void setImeConsumesInput(boolean imeConsumesInput); 90 } 91