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.os.IBinder;
20 import android.os.ResultReceiver;
21 import android.view.InputChannel;
22 import android.view.MotionEvent;
23 import android.view.inputmethod.CursorAnchorInfo;
24 import android.view.inputmethod.EditorInfo;
25 import android.view.inputmethod.ImeTracker;
26 import android.view.inputmethod.InputBinding;
27 import android.view.inputmethod.InputMethodSubtype;
28 import android.window.ImeOnBackInvokedDispatcher;
29 import com.android.internal.inputmethod.IConnectionlessHandwritingCallback;
30 import com.android.internal.inputmethod.IInlineSuggestionsRequestCallback;
31 import com.android.internal.inputmethod.IInputMethodPrivilegedOperations;
32 import com.android.internal.inputmethod.IInputMethodSession;
33 import com.android.internal.inputmethod.IInputMethodSessionCallback;
34 import com.android.internal.inputmethod.IRemoteInputConnection;
35 import com.android.internal.inputmethod.InlineSuggestionsRequestInfo;
36 
37 /**
38  * Top-level interface to an input method component (implemented in a Service).
39  */
40 oneway interface IInputMethod {
41 
42     parcelable InitParams {
43         IBinder token;
44         IInputMethodPrivilegedOperations privilegedOperations;
45         int navigationBarFlags;
46     }
47 
initializeInternal(in InitParams params)48     void initializeInternal(in InitParams params);
49 
onCreateInlineSuggestionsRequest(in InlineSuggestionsRequestInfo requestInfo, in IInlineSuggestionsRequestCallback cb)50     void onCreateInlineSuggestionsRequest(in InlineSuggestionsRequestInfo requestInfo,
51             in IInlineSuggestionsRequestCallback cb);
52 
bindInput(in InputBinding binding)53     void bindInput(in InputBinding binding);
54 
unbindInput()55     void unbindInput();
56 
57     parcelable StartInputParams {
58         IBinder startInputToken;
59         IRemoteInputConnection remoteInputConnection;
60         EditorInfo editorInfo;
61         boolean restarting;
62         int navigationBarFlags;
63         ImeOnBackInvokedDispatcher imeDispatcher;
64     }
65 
startInput(in StartInputParams params)66     void startInput(in StartInputParams params);
67 
onNavButtonFlagsChanged(int navButtonFlags)68     void onNavButtonFlagsChanged(int navButtonFlags);
69 
createSession(in InputChannel channel, IInputMethodSessionCallback callback)70     void createSession(in InputChannel channel, IInputMethodSessionCallback callback);
71 
setSessionEnabled(IInputMethodSession session, boolean enabled)72     void setSessionEnabled(IInputMethodSession session, boolean enabled);
73 
showSoftInput(in IBinder showInputToken, in ImeTracker.Token statsToken, int flags, in ResultReceiver resultReceiver)74     void showSoftInput(in IBinder showInputToken, in ImeTracker.Token statsToken, int flags,
75             in ResultReceiver resultReceiver);
76 
hideSoftInput(in IBinder hideInputToken, in ImeTracker.Token statsToken, int flags, in ResultReceiver resultReceiver)77     void hideSoftInput(in IBinder hideInputToken, in ImeTracker.Token statsToken, int flags,
78             in ResultReceiver resultReceiver);
79 
updateEditorToolType(int toolType)80     void updateEditorToolType(int toolType);
81 
changeInputMethodSubtype(in InputMethodSubtype subtype)82     void changeInputMethodSubtype(in InputMethodSubtype subtype);
83 
canStartStylusHandwriting(int requestId, in IConnectionlessHandwritingCallback connectionlessCallback, in CursorAnchorInfo cursorAnchorInfo, boolean isConnectionlessForDelegation)84     void canStartStylusHandwriting(int requestId,
85             in IConnectionlessHandwritingCallback connectionlessCallback,
86             in CursorAnchorInfo cursorAnchorInfo, boolean isConnectionlessForDelegation);
87 
startStylusHandwriting(int requestId, in InputChannel channel, in List<MotionEvent> events)88     void startStylusHandwriting(int requestId, in InputChannel channel,
89             in List<MotionEvent> events);
90 
commitHandwritingDelegationTextIfAvailable()91     void commitHandwritingDelegationTextIfAvailable();
92 
discardHandwritingDelegationText()93     void discardHandwritingDelegationText();
94 
initInkWindow()95     void initInkWindow();
96 
finishStylusHandwriting()97     void finishStylusHandwriting();
98 
removeStylusHandwritingWindow()99     void removeStylusHandwritingWindow();
100 
setStylusWindowIdleTimeoutForTest(long timeout)101     void setStylusWindowIdleTimeoutForTest(long timeout);
102 }
103