diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 7d970ed2c62c9..f14a7e906c5da 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -2459,18 +2459,24 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState return; } - if (!isSameViewEntered - && (flags & FLAG_MANUAL_REQUEST) == 0 - && mAugmentedAutofillableIds != null - && mAugmentedAutofillableIds.contains(id)) { - // View was already reported when server could not handle a response, but it - // triggered augmented autofill - - if (sDebug) Slog.d(TAG, "updateLocked(" + id + "): augmented-autofillable"); - - // ...then trigger the augmented autofill UI - triggerAugmentedAutofillLocked(); - return; + if ((flags & FLAG_MANUAL_REQUEST) == 0) { + // Not a manual request + if (mAugmentedAutofillableIds != null && mAugmentedAutofillableIds.contains( + id)) { + // Regular autofill handled the view and returned null response, but it + // triggered augmented autofill + if (!isSameViewEntered) { + if (sDebug) Slog.d(TAG, "trigger augmented autofill."); + triggerAugmentedAutofillLocked(); + } else { + if (sDebug) Slog.d(TAG, "skip augmented autofill for same view."); + } + return; + } else if (mForAugmentedAutofillOnly && isSameViewEntered) { + // Regular autofill is disabled. + if (sDebug) Slog.d(TAG, "skip augmented autofill for same view."); + return; + } } if (requestNewFillResponseOnViewEnteredIfNecessaryLocked(id, viewState, flags)) {