Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 91dae475 authored by Feng Cao's avatar Feng Cao
Browse files

Fix a bug where we didn't call IME before calling augmented autofill

* For inline autofill, we always need to get an IME callback before
  calling the augmented autofill service. This is because although
  autofill keeps a list of undestroyed sessions, the IME side
  always discards the old callback for autofill when a new one
  is created. So in case of switching back to an existing autofill
  session, we need to make sure we ask the IME to return a new
  callback.
* we current have the check which missed a case where we are
  re-entering an existing autofill session, but the standard
  autofill was returning null the previous time,
  so it goes to trigger augmented autofill directly. In this case,
  we need to call IME onCreateInlineSuggestionsRequest to get a
  callback before calling the augmented autofill. We didn't, and
  this patch fixes it.

Test: atest android.autofillservice.cts.inline
Test: manual
Bug: 158877106
Change-Id: Ie15cf0763ae49a204ad09c2eaac798890388622e
parent f3e7dfe1
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -3208,16 +3208,19 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                };

        // When the inline suggestion render service is available and the view is focused, there
        // are 2 cases when augmented autofill should ask IME for inline suggestion request,
        // are 3 cases when augmented autofill should ask IME for inline suggestion request,
        // because standard autofill flow didn't:
        // 1. the field is augmented autofill only (when standard autofill provider is None or
        // when it returns null response)
        // 2. standard autofill provider doesn't support inline suggestion
        // 3. we re-entered the autofill session and standard autofill was not re-triggered, this is
        //    recognized by seeing mExpiredResponse == true
        final RemoteInlineSuggestionRenderService remoteRenderService =
                mService.getRemoteInlineSuggestionRenderServiceLocked();
        if (remoteRenderService != null
                && (mForAugmentedAutofillOnly
                || !isInlineSuggestionsEnabledByAutofillProviderLocked())
                || !isInlineSuggestionsEnabledByAutofillProviderLocked()
                || mExpiredResponse)
                && isViewFocusedLocked(flags)) {
            if (sDebug) Slog.d(TAG, "Create inline request for augmented autofill");
            remoteRenderService.getInlineSuggestionsRendererInfo(new RemoteCallback(