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