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

Commit 8040c5bc authored by Simranjit Kohli's avatar Simranjit Kohli
Browse files

IME should notify autofill

Notify autofill always even if the IME doesn't support
InlineSuggestions. This is useful to decide whether IME is showing
up for fill dialog to make the decision to show.

Bug: 377868687
Flag: android.service.autofill.improve_fill_dialog_aconfig
Test: atest CtsAutoFillServiceTestCases
      atest CtsInputMethodTestCases
Change-Id: I6e15b1044a1060bafb31a36a829a197b2f2566c4
parent 0b3b6a65
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@ import android.os.Handler;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;
import android.view.autofill.AutofillFeatureFlags;
import android.view.autofill.AutofillId;
import android.view.inputmethod.InlineSuggestionsRequest;
import android.view.inputmethod.InlineSuggestionsResponse;
@@ -81,6 +82,7 @@ class InlineSuggestionSession {
    @Nullable
    private Boolean mPreviousResponseIsEmpty;

    private boolean mAlwaysNotifyAutofill = false;

    /**
     * Indicates whether {@link #makeInlineSuggestionRequestUncheck()} has been called or not,
@@ -105,6 +107,7 @@ class InlineSuggestionSession {
        mResponseConsumer = responseConsumer;
        mInlineSuggestionSessionController = inlineSuggestionSessionController;
        mMainThreadHandler = mainThreadHandler;
        mAlwaysNotifyAutofill = AutofillFeatureFlags.isImproveFillDialogEnabled();
    }

    @MainThread
@@ -176,6 +179,9 @@ class InlineSuggestionSession {
        try {
            final InlineSuggestionsRequest request = mRequestSupplier.apply(
                    mRequestInfo.getUiExtras());
            if (mAlwaysNotifyAutofill) {
                mResponseCallback = new InlineSuggestionsResponseCallbackImpl(this);
            }
            if (request == null) {
                if (DEBUG) {
                    Log.d(TAG, "onCreateInlineSuggestionsRequest() returned null request");
@@ -184,7 +190,9 @@ class InlineSuggestionSession {
            } else {
                request.setHostInputToken(mHostInputTokenSupplier.get());
                request.filterContentTypes();
                if (!mAlwaysNotifyAutofill) {
                    mResponseCallback = new InlineSuggestionsResponseCallbackImpl(this);
                }
                mCallback.onInlineSuggestionsRequest(request, mResponseCallback);
            }
        } catch (RemoteException e) {
+3 −1
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@

package android.view.autofill;

import static android.service.autofill.Flags.improveFillDialogAconfig;

import android.annotation.SuppressLint;
import android.annotation.TestApi;
import android.provider.DeviceConfig;
@@ -662,7 +664,7 @@ public class AutofillFeatureFlags {
    public static boolean isImproveFillDialogEnabled() {
        // TODO(b/266379948): Add condition for checking whether device has PCC first

        return DeviceConfig.getBoolean(
        return improveFillDialogAconfig() && DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_AUTOFILL,
                DEVICE_CONFIG_IMPROVE_FILL_DIALOG_ENABLED,
                DEFAULT_IMPROVE_FILL_DIALOG_ENABLED);