From 401162563844fe484e21082b25cf1843f393aaff Mon Sep 17 00:00:00 2001 From: Adam He Date: Tue, 4 Feb 2020 14:55:39 -0800 Subject: Move rendering logic for inline suggestions to ExtServices. Added a render service in ExtServices to connect to the renderer in androidx.autofill for inline suggestion slices. Cleaned up old UI rendering code that lived in system_server. Bug: 146453086 Test: atest ExtServicesUnitTests Change-Id: I25a7ea438afe524683671c850625ae80dacccfaa --- .../java/android/inputmethodservice/InputMethodService.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/java/android/inputmethodservice/InputMethodService.java') diff --git a/core/java/android/inputmethodservice/InputMethodService.java b/core/java/android/inputmethodservice/InputMethodService.java index 49e1d5e4f213..a95938b5db2d 100644 --- a/core/java/android/inputmethodservice/InputMethodService.java +++ b/core/java/android/inputmethodservice/InputMethodService.java @@ -789,6 +789,7 @@ public class InputMethodService extends AbstractInputMethodService { Log.w(TAG, "onCreateInlineSuggestionsRequest() returned null request"); requestCallback.onInlineSuggestionsUnsupported(); } else { + request.setHostInputToken(getHostInputToken()); final IInlineSuggestionsResponseCallback inlineSuggestionsResponseCallback = new InlineSuggestionsResponseCallbackImpl(this, mInlineSuggestionsRequestInfo.mComponentName, @@ -833,6 +834,18 @@ public class InputMethodService extends AbstractInputMethodService { onInlineSuggestionsResponse(response); } + /** + * Returns the {@link IBinder} input token from the host view root. + */ + @Nullable + private IBinder getHostInputToken() { + ViewRootImpl viewRoot = null; + if (mRootView != null) { + viewRoot = mRootView.getViewRootImpl(); + } + return viewRoot == null ? null : viewRoot.getInputToken(); + } + private void notifyImeHidden() { setImeWindowStatus(IME_ACTIVE | IME_INVISIBLE, mBackDisposition); onPreRenderedWindowVisibilityChanged(false /* setVisible */); -- cgit v1.2.3