1 /*
2  * Copyright (C) 2019 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.view.autofill.AutofillId;
20 import android.view.inputmethod.InlineSuggestionsRequest;
21 
22 import com.android.internal.inputmethod.IInlineSuggestionsResponseCallback;
23 
24 /**
25  * Binder interface for the IME service to send {@link InlineSuggestionsRequest} or notify other IME
26  * service events to the system.
27  */
28 oneway interface IInlineSuggestionsRequestCallback {
29     /** Indicates that the current IME does not support inline suggestion. */
onInlineSuggestionsUnsupported()30     void onInlineSuggestionsUnsupported();
31 
32     /**
33      * Sends the inline suggestions request from IME to Autofill. Calling this method indicates
34      * that the IME input is started on the view corresponding to the request.
35      */
onInlineSuggestionsRequest(in InlineSuggestionsRequest request, in IInlineSuggestionsResponseCallback callback)36     void onInlineSuggestionsRequest(in InlineSuggestionsRequest request,
37             in IInlineSuggestionsResponseCallback callback);
38 
39     /**
40      * Signals that {@link android.inputmethodservice.InputMethodService
41      * #onStartInput(EditorInfo, boolean)} is called on the given focused field.
42      */
onInputMethodStartInput(in AutofillId imeFieldId)43     void onInputMethodStartInput(in AutofillId imeFieldId);
44 
45     /**
46      * Signals that {@link android.inputmethodservice.InputMethodService
47      * #dispatchOnShowInputRequested(int, boolean)} is called and shares the call result.
48      * The true value of {@code requestResult} means the IME is about to be shown, while
49      * false value means the IME will not be shown.
50      */
onInputMethodShowInputRequested(boolean requestResult)51     void onInputMethodShowInputRequested(boolean requestResult);
52 
53     /**
54      * Signals that {@link android.inputmethodservice.InputMethodService
55      * #onStartInputView(EditorInfo, boolean)} is called on the field specified by the earlier
56      * {@link #onInputMethodStartInput(AutofillId)}.
57      */
onInputMethodStartInputView()58     void onInputMethodStartInputView();
59 
60     /**
61      * Signals that {@link android.inputmethodservice.InputMethodService
62      * #onFinishInputView(boolean)} is called on the field specified by the earlier
63      * {@link #onInputMethodStartInput(AutofillId)}.
64      */
onInputMethodFinishInputView()65     void onInputMethodFinishInputView();
66 
67     /**
68      * Signals that {@link android.inputmethodservice.InputMethodService
69      * #onFinishInput()} is called on the field specified by the earlier
70      * {@link #onInputMethodStartInput(AutofillId)}.
71      */
onInputMethodFinishInput()72     void onInputMethodFinishInput();
73 
74     // Indicates that the current IME changes inline suggestion session.
onInlineSuggestionsSessionInvalidated()75     void onInlineSuggestionsSessionInvalidated();
76 }
77