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