diff options
Diffstat (limited to 'core/java/android/inputmethodservice/InputMethodService.java')
| -rw-r--r-- | core/java/android/inputmethodservice/InputMethodService.java | 13 |
1 files changed, 13 insertions, 0 deletions
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 */); |
