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