From 4f99c15cebf754f51b58176be29ec4c430f640d1 Mon Sep 17 00:00:00 2001 From: Feng Cao Date: Mon, 13 Apr 2020 18:07:41 -0700 Subject: [PATCH] Hide augmented inline suggestion if field value is changed to not empty * For now filtering is not implemented for inline augmented autofill suggestions. So before this change,augmented autofill inline suggestions are displayed in the IME, and user starts typing, it's up to the IME to remove the suggestions. * After this change, any text view value change event will be sent to framework autofill manager service, which will be used to hide the existing augmented inline suggestion. * Caveat is that this may be less optimal for text heavy fields, such as the email compose field. Test: atest CtsAutoFillServiceTestCases Bug: 153765306 Change-Id: Id7387c3ef0aa0379cfe846ea0ca0b9033b67ce01 --- core/java/android/view/autofill/AutofillManager.java | 11 ----------- .../java/com/android/server/autofill/Session.java | 5 +++++ 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index 83a79344917c2..6d3dbfe16b780 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1258,13 +1258,6 @@ public final class AutofillManager { } } - if (mForAugmentedAutofillOnly) { - if (sVerbose) { - Log.v(TAG, "notifyValueChanged(): not notifying system server on " - + "augmented-only mode"); - } - return; - } if (!mEnabled || !isActiveLocked()) { if (!startAutofillIfNeededLocked(view)) { if (sVerbose) { @@ -1299,10 +1292,6 @@ public final class AutofillManager { return; } synchronized (mLock) { - if (mForAugmentedAutofillOnly) { - if (sVerbose) Log.v(TAG, "notifyValueChanged(): ignoring on augmented only mode"); - return; - } if (!mEnabled || !isActiveLocked()) { if (sVerbose) { Log.v(TAG, "notifyValueChanged(" + view.getAutofillId() + ":" + virtualId diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 3d6861898aafc..9d1ad4239a246 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -2653,6 +2653,11 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState } else if (viewState.id.equals(this.mCurrentViewId) && (viewState.getState() & ViewState.STATE_INLINE_SHOWN) != 0) { requestShowInlineSuggestionsLocked(viewState.getResponse(), filterText); + } else if (viewState.id.equals(this.mCurrentViewId) + && (viewState.getState() & ViewState.STATE_TRIGGERED_AUGMENTED_AUTOFILL) != 0) { + if (!TextUtils.isEmpty(filterText)) { + mInlineSessionController.hideInlineSuggestionsUiLocked(mCurrentViewId); + } } viewState.setState(ViewState.STATE_CHANGED);