From 70fb3ee0f10f42da80ab771ba5c4396f91d9c44f Mon Sep 17 00:00:00 2001 From: Adam He Date: Mon, 26 Jul 2021 14:20:36 -0700 Subject: [PATCH] Disable inline suggestions for afservice when talkback is enabled. Bug: 194520863 Test: manual verification Change-Id: Ifb37ac2a164a4564b74c6ab80a0c31fbba3495df --- .../java/com/android/server/autofill/Session.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 11df87135ee35..5910fd7212f42 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -98,6 +98,7 @@ import android.util.Slog; import android.util.SparseArray; import android.util.TimeUtils; import android.view.KeyEvent; +import android.view.accessibility.AccessibilityManager; import android.view.autofill.AutofillId; import android.view.autofill.AutofillManager; import android.view.autofill.AutofillManager.SmartSuggestionMode; @@ -351,6 +352,8 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState @Nullable private ClientSuggestionsSession mClientSuggestionsSession; + private final AccessibilityManager mAccessibilityManager; + void onSwitchInputMethodLocked() { // 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 @@ -472,7 +475,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState 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.getFillContexts(), mPendingFillRequest.getClientState(), @@ -941,6 +947,7 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState mRemoteFillService = serviceComponentName == null ? null : new RemoteFillService(context, serviceComponentName, userId, this, bindInstantServiceAllowed); + mAccessibilityManager = AccessibilityManager.getInstance(context); mActivityToken = activityToken; mHasCallback = hasCallback; mUiLatencyHistory = uiLatencyHistory;