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

Commit 70fb3ee0 authored by Adam He's avatar Adam He
Browse files

Disable inline suggestions for afservice when talkback is enabled.

Bug: 194520863
Test: manual verification
Change-Id: Ifb37ac2a164a4564b74c6ab80a0c31fbba3495df
parent 77e32b89
Loading
Loading
Loading
Loading
+8 −1
Original line number Original line Diff line number Diff line
@@ -98,6 +98,7 @@ import android.util.Slog;
import android.util.SparseArray;
import android.util.SparseArray;
import android.util.TimeUtils;
import android.util.TimeUtils;
import android.view.KeyEvent;
import android.view.KeyEvent;
import android.view.accessibility.AccessibilityManager;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillManager.SmartSuggestionMode;
import android.view.autofill.AutofillManager.SmartSuggestionMode;
@@ -351,6 +352,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
    @Nullable
    @Nullable
    private ClientSuggestionsSession mClientSuggestionsSession;
    private ClientSuggestionsSession mClientSuggestionsSession;


    private final AccessibilityManager mAccessibilityManager;

    void onSwitchInputMethodLocked() {
    void onSwitchInputMethodLocked() {
        // One caveat is that for the case where the focus is on a field for which regular autofill
        // One caveat is that for the case where the focus is on a field for which regular autofill
        // returns null, and augmented autofill is triggered,  and then the user switches the input
        // returns null, and augmented autofill is triggered,  and then the user switches the input
@@ -472,7 +475,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
                    return;
                    return;
                }
                }


                if (mPendingInlineSuggestionsRequest.isServiceSupported()) {
                // If a11y touch exploration is enabled, then we do not send an inline fill request
                // to the regular af service, because dropdown UI is easier to use.
                if (mPendingInlineSuggestionsRequest.isServiceSupported()
                        && !mAccessibilityManager.isTouchExplorationEnabled()) {
                    mPendingFillRequest = new FillRequest(mPendingFillRequest.getId(),
                    mPendingFillRequest = new FillRequest(mPendingFillRequest.getId(),
                            mPendingFillRequest.getFillContexts(),
                            mPendingFillRequest.getFillContexts(),
                            mPendingFillRequest.getClientState(),
                            mPendingFillRequest.getClientState(),
@@ -941,6 +947,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState
        mRemoteFillService = serviceComponentName == null ? null
        mRemoteFillService = serviceComponentName == null ? null
                : new RemoteFillService(context, serviceComponentName, userId, this,
                : new RemoteFillService(context, serviceComponentName, userId, this,
                        bindInstantServiceAllowed);
                        bindInstantServiceAllowed);
        mAccessibilityManager = AccessibilityManager.getInstance(context);
        mActivityToken = activityToken;
        mActivityToken = activityToken;
        mHasCallback = hasCallback;
        mHasCallback = hasCallback;
        mUiLatencyHistory = uiLatencyHistory;
        mUiLatencyHistory = uiLatencyHistory;