From 6e9768e9023b11e565a86e3590abbf53a244d7e7 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Thu, 14 May 2020 18:14:24 -0700 Subject: [PATCH] Make sure to call SomeArgs#recycle() in IMMS#handleMessage This is a small follow up CL to our previous CL [1], which added a new internal message MSG_INLINE_SUGGESTIONS_REQUEST and its handler that rely on SomeArgs but forget to call SomeArgs#recycle(). Although not calling SomeArgs#recycle() doesn't immediately cause any fatal issue, not doing so basically spoils the purpose of SomeArgs. With this CL, InputMethodManagerService#handleMessage should call SomeArgs#recycle() when necessary. Other than that there is no behavior change. [1]: Id222500c373898d576661cacb7a1cb51061041d4 bc67f2e15813ec05c07f18ef961e7303fd344ff1 Bug: 147037345 Test: atest CtsAutoFillServiceTestCases Change-Id: I763bb78c7d1ada327abaa110d423309b17d831d8 --- .../android/server/inputmethod/InputMethodManagerService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java index 6efc88e017af1..93ef1264755b1 100644 --- a/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java +++ b/services/core/java/com/android/server/inputmethod/InputMethodManagerService.java @@ -4262,7 +4262,7 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } // --------------------------------------------------------------- - case MSG_INLINE_SUGGESTIONS_REQUEST: + case MSG_INLINE_SUGGESTIONS_REQUEST: { args = (SomeArgs) msg.obj; final InlineSuggestionsRequestInfo requestInfo = (InlineSuggestionsRequestInfo) args.arg2; @@ -4274,7 +4274,9 @@ public class InputMethodManagerService extends IInputMethodManager.Stub } catch (RemoteException e) { Slog.w(TAG, "RemoteException calling onCreateInlineSuggestionsRequest(): " + e); } + args.recycle(); return true; + } } return false; }