1 /*
2  * Copyright (C) 2024 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.server.inputmethod;
18 
19 import static java.lang.annotation.ElementType.METHOD;
20 import static java.lang.annotation.RetentionPolicy.SOURCE;
21 
22 import android.Manifest;
23 import android.annotation.BinderThread;
24 import android.annotation.EnforcePermission;
25 import android.annotation.NonNull;
26 import android.annotation.Nullable;
27 import android.annotation.UserIdInt;
28 import android.os.Binder;
29 import android.os.IBinder;
30 import android.os.ResultReceiver;
31 import android.os.ShellCallback;
32 import android.view.MotionEvent;
33 import android.view.WindowManager;
34 import android.view.inputmethod.CursorAnchorInfo;
35 import android.view.inputmethod.EditorInfo;
36 import android.view.inputmethod.ImeTracker;
37 import android.view.inputmethod.InputMethodInfo;
38 import android.view.inputmethod.InputMethodManager;
39 import android.view.inputmethod.InputMethodSubtype;
40 import android.window.ImeOnBackInvokedDispatcher;
41 
42 import com.android.internal.inputmethod.DirectBootAwareness;
43 import com.android.internal.inputmethod.IBooleanListener;
44 import com.android.internal.inputmethod.IConnectionlessHandwritingCallback;
45 import com.android.internal.inputmethod.IImeTracker;
46 import com.android.internal.inputmethod.IInputMethodClient;
47 import com.android.internal.inputmethod.IRemoteAccessibilityInputConnection;
48 import com.android.internal.inputmethod.IRemoteInputConnection;
49 import com.android.internal.inputmethod.InputBindResult;
50 import com.android.internal.inputmethod.InputMethodInfoSafeList;
51 import com.android.internal.inputmethod.SoftInputShowHideReason;
52 import com.android.internal.inputmethod.StartInputFlags;
53 import com.android.internal.inputmethod.StartInputReason;
54 import com.android.internal.view.IInputMethodManager;
55 
56 import java.io.FileDescriptor;
57 import java.io.PrintWriter;
58 import java.lang.annotation.Retention;
59 import java.lang.annotation.Target;
60 import java.util.List;
61 
62 /**
63  * An actual implementation class of {@link IInputMethodManager.Stub} to allow other classes to
64  * focus on handling IPC callbacks.
65  */
66 final class IInputMethodManagerImpl extends IInputMethodManager.Stub {
67 
68     /**
69      * Tells that the given permission is already verified before the annotated method gets called.
70      */
71     @Retention(SOURCE)
72     @Target({METHOD})
73     @interface PermissionVerified {
value()74         String value() default "";
75     }
76 
77     @BinderThread
78     interface Callback {
addClient(IInputMethodClient client, IRemoteInputConnection inputConnection, int selfReportedDisplayId)79         void addClient(IInputMethodClient client, IRemoteInputConnection inputConnection,
80                 int selfReportedDisplayId);
81 
getCurrentInputMethodInfoAsUser(@serIdInt int userId)82         InputMethodInfo getCurrentInputMethodInfoAsUser(@UserIdInt int userId);
83 
84         @NonNull
getInputMethodList(@serIdInt int userId, @DirectBootAwareness int directBootAwareness)85         InputMethodInfoSafeList getInputMethodList(@UserIdInt int userId,
86                 @DirectBootAwareness int directBootAwareness);
87 
88         @NonNull
getEnabledInputMethodList(@serIdInt int userId)89         InputMethodInfoSafeList getEnabledInputMethodList(@UserIdInt int userId);
90 
91         @NonNull
getInputMethodListLegacy(@serIdInt int userId, @DirectBootAwareness int directBootAwareness)92         List<InputMethodInfo> getInputMethodListLegacy(@UserIdInt int userId,
93                 @DirectBootAwareness int directBootAwareness);
94 
95         @NonNull
getEnabledInputMethodListLegacy(@serIdInt int userId)96         List<InputMethodInfo> getEnabledInputMethodListLegacy(@UserIdInt int userId);
97 
getEnabledInputMethodSubtypeList(String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId)98         List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
99                 boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId);
100 
getLastInputMethodSubtype(@serIdInt int userId)101         InputMethodSubtype getLastInputMethodSubtype(@UserIdInt int userId);
102 
showSoftInput(IInputMethodClient client, IBinder windowToken, @Nullable ImeTracker.Token statsToken, @InputMethodManager.ShowFlags int flags, @MotionEvent.ToolType int lastClickToolType, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason)103         boolean showSoftInput(IInputMethodClient client, IBinder windowToken,
104                 @Nullable ImeTracker.Token statsToken, @InputMethodManager.ShowFlags int flags,
105                 @MotionEvent.ToolType int lastClickToolType, ResultReceiver resultReceiver,
106                 @SoftInputShowHideReason int reason);
107 
hideSoftInput(IInputMethodClient client, IBinder windowToken, @Nullable ImeTracker.Token statsToken, @InputMethodManager.HideFlags int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason)108         boolean hideSoftInput(IInputMethodClient client, IBinder windowToken,
109                 @Nullable ImeTracker.Token statsToken, @InputMethodManager.HideFlags int flags,
110                 ResultReceiver resultReceiver, @SoftInputShowHideReason int reason);
111 
112         @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
hideSoftInputFromServerForTest()113         void hideSoftInputFromServerForTest();
114 
startInputOrWindowGainedFocusAsync( @tartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, int startInputSeq)115         void startInputOrWindowGainedFocusAsync(
116                 @StartInputReason int startInputReason, IInputMethodClient client,
117                 IBinder windowToken, @StartInputFlags int startInputFlags,
118                 @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags,
119                 @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection,
120                 IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
121                 int unverifiedTargetSdkVersion, @UserIdInt int userId,
122                 @NonNull ImeOnBackInvokedDispatcher imeDispatcher, int startInputSeq);
123 
startInputOrWindowGainedFocus( @tartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher)124         InputBindResult startInputOrWindowGainedFocus(
125                 @StartInputReason int startInputReason, IInputMethodClient client,
126                 IBinder windowToken, @StartInputFlags int startInputFlags,
127                 @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags,
128                 @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection,
129                 IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
130                 int unverifiedTargetSdkVersion, @UserIdInt int userId,
131                 @NonNull ImeOnBackInvokedDispatcher imeDispatcher);
132 
showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode)133         void showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode);
134 
135         @PermissionVerified(Manifest.permission.WRITE_SECURE_SETTINGS)
showInputMethodPickerFromSystem(int auxiliarySubtypeMode, int displayId)136         void showInputMethodPickerFromSystem(int auxiliarySubtypeMode, int displayId);
137 
138         @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
isInputMethodPickerShownForTest()139         boolean isInputMethodPickerShownForTest();
140 
getCurrentInputMethodSubtype(@serIdInt int userId)141         InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId);
142 
setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes, @UserIdInt int userId)143         void setAdditionalInputMethodSubtypes(String imiId, InputMethodSubtype[] subtypes,
144                 @UserIdInt int userId);
145 
setExplicitlyEnabledInputMethodSubtypes(String imeId, @NonNull int[] subtypeHashCodes, @UserIdInt int userId)146         void setExplicitlyEnabledInputMethodSubtypes(String imeId,
147                 @NonNull int[] subtypeHashCodes, @UserIdInt int userId);
148 
getInputMethodWindowVisibleHeight(IInputMethodClient client)149         int getInputMethodWindowVisibleHeight(IInputMethodClient client);
150 
reportPerceptibleAsync(IBinder windowToken, boolean perceptible)151         void reportPerceptibleAsync(IBinder windowToken, boolean perceptible);
152 
153         @PermissionVerified(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
removeImeSurface()154         void removeImeSurface();
155 
removeImeSurfaceFromWindowAsync(IBinder windowToken)156         void removeImeSurfaceFromWindowAsync(IBinder windowToken);
157 
startProtoDump(byte[] bytes, int i, String s)158         void startProtoDump(byte[] bytes, int i, String s);
159 
isImeTraceEnabled()160         boolean isImeTraceEnabled();
161 
162         @PermissionVerified(Manifest.permission.CONTROL_UI_TRACING)
startImeTrace()163         void startImeTrace();
164 
165         @PermissionVerified(Manifest.permission.CONTROL_UI_TRACING)
stopImeTrace()166         void stopImeTrace();
167 
startStylusHandwriting(IInputMethodClient client)168         void startStylusHandwriting(IInputMethodClient client);
169 
startConnectionlessStylusHandwriting(IInputMethodClient client, @UserIdInt int userId, @Nullable CursorAnchorInfo cursorAnchorInfo, @Nullable String delegatePackageName, @Nullable String delegatorPackageName, @NonNull IConnectionlessHandwritingCallback callback)170         void startConnectionlessStylusHandwriting(IInputMethodClient client, @UserIdInt int userId,
171                 @Nullable CursorAnchorInfo cursorAnchorInfo, @Nullable String delegatePackageName,
172                 @Nullable String delegatorPackageName,
173                 @NonNull IConnectionlessHandwritingCallback callback);
174 
acceptStylusHandwritingDelegation(@onNull IInputMethodClient client, @UserIdInt int userId, @NonNull String delegatePackageName, @NonNull String delegatorPackageName, @InputMethodManager.HandwritingDelegateFlags int flags)175         boolean acceptStylusHandwritingDelegation(@NonNull IInputMethodClient client,
176                 @UserIdInt int userId, @NonNull String delegatePackageName,
177                 @NonNull String delegatorPackageName,
178                 @InputMethodManager.HandwritingDelegateFlags int flags);
179 
acceptStylusHandwritingDelegationAsync(@onNull IInputMethodClient client, @UserIdInt int userId, @NonNull String delegatePackageName, @NonNull String delegatorPackageName, @InputMethodManager.HandwritingDelegateFlags int flags, IBooleanListener callback)180         void acceptStylusHandwritingDelegationAsync(@NonNull IInputMethodClient client,
181                 @UserIdInt int userId, @NonNull String delegatePackageName,
182                 @NonNull String delegatorPackageName,
183                 @InputMethodManager.HandwritingDelegateFlags int flags, IBooleanListener callback);
184 
prepareStylusHandwritingDelegation(@onNull IInputMethodClient client, @UserIdInt int userId, @NonNull String delegatePackageName, @NonNull String delegatorPackageName)185         void prepareStylusHandwritingDelegation(@NonNull IInputMethodClient client,
186                 @UserIdInt int userId, @NonNull String delegatePackageName,
187                 @NonNull String delegatorPackageName);
188 
isStylusHandwritingAvailableAsUser(@serIdInt int userId, boolean connectionless)189         boolean isStylusHandwritingAvailableAsUser(@UserIdInt int userId, boolean connectionless);
190 
191         @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
addVirtualStylusIdForTestSession(IInputMethodClient client)192         void addVirtualStylusIdForTestSession(IInputMethodClient client);
193 
194         @PermissionVerified(Manifest.permission.TEST_INPUT_METHOD)
setStylusWindowIdleTimeoutForTest(IInputMethodClient client, long timeout)195         void setStylusWindowIdleTimeoutForTest(IInputMethodClient client, long timeout);
196 
getImeTrackerService()197         IImeTracker getImeTrackerService();
198 
onShellCommand(@ullable FileDescriptor in, @Nullable FileDescriptor out, @Nullable FileDescriptor err, @NonNull String[] args, @Nullable ShellCallback callback, @NonNull ResultReceiver resultReceiver, @NonNull Binder self)199         void onShellCommand(@Nullable FileDescriptor in, @Nullable FileDescriptor out,
200                 @Nullable FileDescriptor err, @NonNull String[] args,
201                 @Nullable ShellCallback callback, @NonNull ResultReceiver resultReceiver,
202                 @NonNull Binder self);
203 
dump(@onNull FileDescriptor fd, @NonNull PrintWriter fout, @Nullable String[] args)204         void dump(@NonNull FileDescriptor fd, @NonNull PrintWriter fout, @Nullable String[] args);
205     }
206 
207     @NonNull
208     private final Callback mCallback;
209 
IInputMethodManagerImpl(@onNull Callback callback)210     private IInputMethodManagerImpl(@NonNull Callback callback) {
211         mCallback = callback;
212     }
213 
create(@onNull Callback callback)214     static IInputMethodManagerImpl create(@NonNull Callback callback) {
215         return new IInputMethodManagerImpl(callback);
216     }
217 
218     @Override
addClient(IInputMethodClient client, IRemoteInputConnection inputmethod, int untrustedDisplayId)219     public void addClient(IInputMethodClient client, IRemoteInputConnection inputmethod,
220             int untrustedDisplayId) {
221         mCallback.addClient(client, inputmethod, untrustedDisplayId);
222     }
223 
224     @Override
getCurrentInputMethodInfoAsUser(@serIdInt int userId)225     public InputMethodInfo getCurrentInputMethodInfoAsUser(@UserIdInt int userId) {
226         return mCallback.getCurrentInputMethodInfoAsUser(userId);
227     }
228 
229     @NonNull
230     @Override
getInputMethodList(@serIdInt int userId, int directBootAwareness)231     public InputMethodInfoSafeList getInputMethodList(@UserIdInt int userId,
232             int directBootAwareness) {
233         return mCallback.getInputMethodList(userId, directBootAwareness);
234     }
235 
236     @NonNull
237     @Override
getEnabledInputMethodList(@serIdInt int userId)238     public InputMethodInfoSafeList getEnabledInputMethodList(@UserIdInt int userId) {
239         return mCallback.getEnabledInputMethodList(userId);
240     }
241 
242     @NonNull
243     @Override
getInputMethodListLegacy(@serIdInt int userId, int directBootAwareness)244     public List<InputMethodInfo> getInputMethodListLegacy(@UserIdInt int userId,
245             int directBootAwareness) {
246         return mCallback.getInputMethodListLegacy(userId, directBootAwareness);
247     }
248 
249     @NonNull
250     @Override
getEnabledInputMethodListLegacy(@serIdInt int userId)251     public List<InputMethodInfo> getEnabledInputMethodListLegacy(@UserIdInt int userId) {
252         return mCallback.getEnabledInputMethodListLegacy(userId);
253     }
254 
255     @Override
getEnabledInputMethodSubtypeList(String imiId, boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId)256     public List<InputMethodSubtype> getEnabledInputMethodSubtypeList(String imiId,
257             boolean allowsImplicitlyEnabledSubtypes, @UserIdInt int userId) {
258         return mCallback.getEnabledInputMethodSubtypeList(imiId, allowsImplicitlyEnabledSubtypes,
259                 userId);
260     }
261 
262     @Override
getLastInputMethodSubtype(@serIdInt int userId)263     public InputMethodSubtype getLastInputMethodSubtype(@UserIdInt int userId) {
264         return mCallback.getLastInputMethodSubtype(userId);
265     }
266 
267     @Override
showSoftInput(IInputMethodClient client, IBinder windowToken, @NonNull ImeTracker.Token statsToken, @InputMethodManager.ShowFlags int flags, @MotionEvent.ToolType int lastClickToolType, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason)268     public boolean showSoftInput(IInputMethodClient client, IBinder windowToken,
269             @NonNull ImeTracker.Token statsToken, @InputMethodManager.ShowFlags int flags,
270             @MotionEvent.ToolType int lastClickToolType, ResultReceiver resultReceiver,
271             @SoftInputShowHideReason int reason) {
272         return mCallback.showSoftInput(client, windowToken, statsToken, flags, lastClickToolType,
273                 resultReceiver, reason);
274     }
275 
276     @Override
hideSoftInput(IInputMethodClient client, IBinder windowToken, @NonNull ImeTracker.Token statsToken, @InputMethodManager.HideFlags int flags, ResultReceiver resultReceiver, @SoftInputShowHideReason int reason)277     public boolean hideSoftInput(IInputMethodClient client, IBinder windowToken,
278             @NonNull ImeTracker.Token statsToken, @InputMethodManager.HideFlags int flags,
279             ResultReceiver resultReceiver, @SoftInputShowHideReason int reason) {
280         return mCallback.hideSoftInput(client, windowToken, statsToken, flags, resultReceiver,
281                 reason);
282     }
283 
284     @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
285     @Override
hideSoftInputFromServerForTest()286     public void hideSoftInputFromServerForTest() {
287         super.hideSoftInputFromServerForTest_enforcePermission();
288 
289         mCallback.hideSoftInputFromServerForTest();
290     }
291 
292     @Override
startInputOrWindowGainedFocus( @tartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher)293     public InputBindResult startInputOrWindowGainedFocus(
294             @StartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken,
295             @StartInputFlags int startInputFlags,
296             @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
297             int windowFlags, @Nullable EditorInfo editorInfo,
298             IRemoteInputConnection inputConnection,
299             IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
300             int unverifiedTargetSdkVersion, @UserIdInt int userId,
301             @NonNull ImeOnBackInvokedDispatcher imeDispatcher) {
302         return mCallback.startInputOrWindowGainedFocus(
303                 startInputReason, client, windowToken, startInputFlags, softInputMode,
304                 windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection,
305                 unverifiedTargetSdkVersion, userId, imeDispatcher);
306     }
307 
308     @Override
startInputOrWindowGainedFocusAsync(@tartInputReason int startInputReason, IInputMethodClient client, IBinder windowToken, @StartInputFlags int startInputFlags, @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode, int windowFlags, @Nullable EditorInfo editorInfo, IRemoteInputConnection inputConnection, IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection, int unverifiedTargetSdkVersion, @UserIdInt int userId, @NonNull ImeOnBackInvokedDispatcher imeDispatcher, int startInputSeq)309     public void startInputOrWindowGainedFocusAsync(@StartInputReason int startInputReason,
310             IInputMethodClient client, IBinder windowToken,
311             @StartInputFlags int startInputFlags,
312             @WindowManager.LayoutParams.SoftInputModeFlags int softInputMode,
313             int windowFlags, @Nullable EditorInfo editorInfo,
314             IRemoteInputConnection inputConnection,
315             IRemoteAccessibilityInputConnection remoteAccessibilityInputConnection,
316             int unverifiedTargetSdkVersion, @UserIdInt int userId,
317             @NonNull ImeOnBackInvokedDispatcher imeDispatcher, int startInputSeq) {
318         mCallback.startInputOrWindowGainedFocusAsync(
319                 startInputReason, client, windowToken, startInputFlags, softInputMode,
320                 windowFlags, editorInfo, inputConnection, remoteAccessibilityInputConnection,
321                 unverifiedTargetSdkVersion, userId, imeDispatcher, startInputSeq);
322     }
323 
324     @Override
showInputMethodPickerFromClient(IInputMethodClient client, int auxiliarySubtypeMode)325     public void showInputMethodPickerFromClient(IInputMethodClient client,
326             int auxiliarySubtypeMode) {
327         mCallback.showInputMethodPickerFromClient(client, auxiliarySubtypeMode);
328     }
329 
330     @EnforcePermission(Manifest.permission.WRITE_SECURE_SETTINGS)
331     @Override
showInputMethodPickerFromSystem(int auxiliarySubtypeMode, int displayId)332     public void showInputMethodPickerFromSystem(int auxiliarySubtypeMode, int displayId) {
333         super.showInputMethodPickerFromSystem_enforcePermission();
334 
335         mCallback.showInputMethodPickerFromSystem(auxiliarySubtypeMode, displayId);
336 
337     }
338 
339     @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
340     @Override
isInputMethodPickerShownForTest()341     public boolean isInputMethodPickerShownForTest() {
342         super.isInputMethodPickerShownForTest_enforcePermission();
343 
344         return mCallback.isInputMethodPickerShownForTest();
345     }
346 
347     @Override
getCurrentInputMethodSubtype(@serIdInt int userId)348     public InputMethodSubtype getCurrentInputMethodSubtype(@UserIdInt int userId) {
349         return mCallback.getCurrentInputMethodSubtype(userId);
350     }
351 
352     @Override
setAdditionalInputMethodSubtypes(String id, InputMethodSubtype[] subtypes, @UserIdInt int userId)353     public void setAdditionalInputMethodSubtypes(String id, InputMethodSubtype[] subtypes,
354             @UserIdInt int userId) {
355         mCallback.setAdditionalInputMethodSubtypes(id, subtypes, userId);
356     }
357 
358     @Override
setExplicitlyEnabledInputMethodSubtypes(String imeId, int[] subtypeHashCodes, @UserIdInt int userId)359     public void setExplicitlyEnabledInputMethodSubtypes(String imeId, int[] subtypeHashCodes,
360             @UserIdInt int userId) {
361         mCallback.setExplicitlyEnabledInputMethodSubtypes(imeId, subtypeHashCodes, userId);
362     }
363 
364     @Override
getInputMethodWindowVisibleHeight(IInputMethodClient client)365     public int getInputMethodWindowVisibleHeight(IInputMethodClient client) {
366         return mCallback.getInputMethodWindowVisibleHeight(client);
367     }
368 
369     @Override
reportPerceptibleAsync(IBinder windowToken, boolean perceptible)370     public void reportPerceptibleAsync(IBinder windowToken, boolean perceptible) {
371         mCallback.reportPerceptibleAsync(windowToken, perceptible);
372     }
373 
374     @EnforcePermission(Manifest.permission.INTERNAL_SYSTEM_WINDOW)
375     @Override
removeImeSurface()376     public void removeImeSurface() {
377         super.removeImeSurface_enforcePermission();
378 
379         mCallback.removeImeSurface();
380     }
381 
382     @Override
removeImeSurfaceFromWindowAsync(IBinder windowToken)383     public void removeImeSurfaceFromWindowAsync(IBinder windowToken) {
384         mCallback.removeImeSurfaceFromWindowAsync(windowToken);
385     }
386 
387     @Override
startProtoDump(byte[] protoDump, int source, String where)388     public void startProtoDump(byte[] protoDump, int source, String where) {
389         mCallback.startProtoDump(protoDump, source, where);
390     }
391 
392     @Override
isImeTraceEnabled()393     public boolean isImeTraceEnabled() {
394         return mCallback.isImeTraceEnabled();
395     }
396 
397     @EnforcePermission(Manifest.permission.CONTROL_UI_TRACING)
398     @Override
startImeTrace()399     public void startImeTrace() {
400         super.startImeTrace_enforcePermission();
401 
402         mCallback.startImeTrace();
403     }
404 
405     @EnforcePermission(Manifest.permission.CONTROL_UI_TRACING)
406     @Override
stopImeTrace()407     public void stopImeTrace() {
408         super.stopImeTrace_enforcePermission();
409 
410         mCallback.stopImeTrace();
411     }
412 
413     @Override
startStylusHandwriting(IInputMethodClient client)414     public void startStylusHandwriting(IInputMethodClient client) {
415         mCallback.startStylusHandwriting(client);
416     }
417 
418     @Override
startConnectionlessStylusHandwriting(IInputMethodClient client, @UserIdInt int userId, CursorAnchorInfo cursorAnchorInfo, String delegatePackageName, String delegatorPackageName, IConnectionlessHandwritingCallback callback)419     public void startConnectionlessStylusHandwriting(IInputMethodClient client,
420             @UserIdInt int userId, CursorAnchorInfo cursorAnchorInfo,
421             String delegatePackageName, String delegatorPackageName,
422             IConnectionlessHandwritingCallback callback) {
423         mCallback.startConnectionlessStylusHandwriting(client, userId, cursorAnchorInfo,
424                 delegatePackageName, delegatorPackageName, callback);
425     }
426 
427     @Override
prepareStylusHandwritingDelegation(IInputMethodClient client, @UserIdInt int userId, String delegatePackageName, String delegatorPackageName)428     public void prepareStylusHandwritingDelegation(IInputMethodClient client, @UserIdInt int userId,
429             String delegatePackageName, String delegatorPackageName) {
430         mCallback.prepareStylusHandwritingDelegation(client, userId,
431                 delegatePackageName, delegatorPackageName);
432     }
433 
434     @Override
acceptStylusHandwritingDelegation(IInputMethodClient client, @UserIdInt int userId, String delegatePackageName, String delegatorPackageName, @InputMethodManager.HandwritingDelegateFlags int flags)435     public boolean acceptStylusHandwritingDelegation(IInputMethodClient client,
436             @UserIdInt int userId, String delegatePackageName, String delegatorPackageName,
437             @InputMethodManager.HandwritingDelegateFlags int flags) {
438         return mCallback.acceptStylusHandwritingDelegation(client, userId,
439                 delegatePackageName, delegatorPackageName, flags);
440     }
441 
442     @Override
acceptStylusHandwritingDelegationAsync(IInputMethodClient client, @UserIdInt int userId, String delegatePackageName, String delegatorPackageName, @InputMethodManager.HandwritingDelegateFlags int flags, IBooleanListener callback)443     public void acceptStylusHandwritingDelegationAsync(IInputMethodClient client,
444             @UserIdInt int userId, String delegatePackageName, String delegatorPackageName,
445             @InputMethodManager.HandwritingDelegateFlags int flags,
446             IBooleanListener callback) {
447         mCallback.acceptStylusHandwritingDelegationAsync(client, userId,
448                 delegatePackageName, delegatorPackageName, flags, callback);
449     }
450 
451     @Override
isStylusHandwritingAvailableAsUser(@serIdInt int userId, boolean connectionless)452     public boolean isStylusHandwritingAvailableAsUser(@UserIdInt int userId,
453             boolean connectionless) {
454         return mCallback.isStylusHandwritingAvailableAsUser(userId, connectionless);
455     }
456 
457     @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
458     @Override
addVirtualStylusIdForTestSession(IInputMethodClient client)459     public void addVirtualStylusIdForTestSession(IInputMethodClient client) {
460         super.addVirtualStylusIdForTestSession_enforcePermission();
461 
462         mCallback.addVirtualStylusIdForTestSession(client);
463     }
464 
465     @EnforcePermission(Manifest.permission.TEST_INPUT_METHOD)
466     @Override
setStylusWindowIdleTimeoutForTest(IInputMethodClient client, long timeout)467     public void setStylusWindowIdleTimeoutForTest(IInputMethodClient client, long timeout) {
468         super.setStylusWindowIdleTimeoutForTest_enforcePermission();
469 
470         mCallback.setStylusWindowIdleTimeoutForTest(client, timeout);
471     }
472 
473     @Override
getImeTrackerService()474     public IImeTracker getImeTrackerService() {
475         return mCallback.getImeTrackerService();
476     }
477 
478     @Override
onShellCommand(@ullable FileDescriptor in, @Nullable FileDescriptor out, @Nullable FileDescriptor err, @NonNull String[] args, @Nullable ShellCallback callback, @NonNull ResultReceiver resultReceiver)479     public void onShellCommand(@Nullable FileDescriptor in, @Nullable FileDescriptor out,
480             @Nullable FileDescriptor err, @NonNull String[] args, @Nullable ShellCallback callback,
481             @NonNull ResultReceiver resultReceiver) {
482         mCallback.onShellCommand(in, out, err, args, callback, resultReceiver, this);
483     }
484 
485     @Override
dump(FileDescriptor fd, PrintWriter pw, String[] args)486     public void dump(FileDescriptor fd, PrintWriter pw, String[] args) {
487         mCallback.dump(fd, pw, args);
488     }
489 }
490