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
This commit is contained in:
Feng Cao
2020-04-13 18:07:41 -07:00
parent 2b40d3c462
commit 4f99c15ceb
2 changed files with 5 additions and 11 deletions

View File

@@ -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

View File

@@ -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);