From e218e7324663543777e4a4b3ef0da010dd10258c Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Fri, 21 Jan 2022 07:43:44 -0800 Subject: [PATCH] Remove IMMS#MSG_INLINE_SUGGESTIONS_REQUEST This CL inlines InputMethodManagerService#MSG_INLINE_SUGGESTIONS_REQUEST handler as it has always been executed from the calling thread. There should be no observable behavior change. Bug: 215609403 Test: presubmit Change-Id: I40e3e42112bbecd1bd0fc64cd75b00b98ffbe113 --- .../InputMethodManagerService.java | 34 +++++-------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 60f335b134b82..58c064597546f 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -237,8 +237,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub private static final int MSG_SYSTEM_UNLOCK_USER = 5000; private static final int MSG_DISPATCH_ON_INPUT_METHOD_LIST_UPDATED = 5010; - private static final int MSG_INLINE_SUGGESTIONS_REQUEST = 6000; - private static final int MSG_NOTIFY_IME_UID_TO_AUDIO_SERVICE = 7000; private static final int NOT_A_SUBTYPE_ID = InputMethodUtils.NOT_A_SUBTYPE_ID; @@ -1957,12 +1955,15 @@ public class InputMethodManagerService extends IInputMethodManager.Stub IInputMethod curMethod = getCurMethodLocked(); if (userId == mSettings.getCurrentUserId() && imi != null && imi.isInlineSuggestionsEnabled() && curMethod != null) { - executeOrSendMessage(curMethod, - mCaller.obtainMessageOOO(MSG_INLINE_SUGGESTIONS_REQUEST, curMethod, - requestInfo, new InlineSuggestionsRequestCallbackDecorator(callback, - imi.getPackageName(), mCurTokenDisplayId, - getCurTokenLocked(), - this))); + final IInlineSuggestionsRequestCallback callbackImpl = + new InlineSuggestionsRequestCallbackDecorator(callback, + imi.getPackageName(), mCurTokenDisplayId, getCurTokenLocked(), + this); + try { + curMethod.onCreateInlineSuggestionsRequest(requestInfo, callbackImpl); + } catch (RemoteException e) { + Slog.w(TAG, "RemoteException calling onCreateInlineSuggestionsRequest()", e); + } } else { callback.onInlineSuggestionsUnsupported(); } @@ -4380,23 +4381,6 @@ public class InputMethodManagerService extends IInputMethodManager.Stub return true; } - // --------------------------------------------------------------- - case MSG_INLINE_SUGGESTIONS_REQUEST: { - args = (SomeArgs) msg.obj; - final InlineSuggestionsRequestInfo requestInfo = - (InlineSuggestionsRequestInfo) args.arg2; - final IInlineSuggestionsRequestCallback callback = - (IInlineSuggestionsRequestCallback) args.arg3; - try { - ((IInputMethod) args.arg1).onCreateInlineSuggestionsRequest(requestInfo, - callback); - } catch (RemoteException e) { - Slog.w(TAG, "RemoteException calling onCreateInlineSuggestionsRequest(): " + e); - } - args.recycle(); - return true; - } - // --------------------------------------------------------------- case MSG_NOTIFY_IME_UID_TO_AUDIO_SERVICE: { if (mAudioManagerInternal == null) {