From 87e5c629e8ec896264f738d76e74a11e4678cb77 Mon Sep 17 00:00:00 2001 From: Adam He Date: Mon, 14 Jun 2021 21:41:37 -0700 Subject: [PATCH] Always let standard autofill try on new partitions even if session was marked as augmented only. * Currently if a session was marked as augmented only, we will never allow standard autofill a chance again. Sometimes activities contain views with IMPORTANT_FOR_AUTOFILL_NO which marks the session as augmenteed only, but other fields can still be filled by standard autofill. Fixes: 187555283 Test: atest android.autofillservice.cts.augmented.AugmentedLoginActivityTest Change-Id: I1c685a1159db4fc8b3d285b7c74d767555c9bf10 --- .../java/com/android/server/autofill/Session.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/services/autofill/java/com/android/server/autofill/Session.java b/services/autofill/java/com/android/server/autofill/Session.java index 320047fec66b8..078d908684bc0 100644 --- a/services/autofill/java/com/android/server/autofill/Session.java +++ b/services/autofill/java/com/android/server/autofill/Session.java @@ -2648,6 +2648,10 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState Slog.d(TAG, "Starting partition or augmented request for view id " + id + ": " + viewState.getStateAsString()); } + // Fix to always let standard autofill start. + // Sometimes activity contain IMPORTANT_FOR_AUTOFILL_NO fields which marks session as + // augmentedOnly, but other fields are still fillable by standard autofill. + mSessionFlags.mAugmentedAutofillOnly = false; requestNewFillResponseLocked(viewState, ViewState.STATE_STARTED_PARTITION, flags); return true; } @@ -2847,12 +2851,18 @@ final class Session implements RemoteFillService.FillServiceCallbacks, ViewState if (sDebug) Slog.d(TAG, "trigger augmented autofill."); triggerAugmentedAutofillLocked(flags); } else { - if (sDebug) Slog.d(TAG, "skip augmented autofill for same view."); + if (sDebug) { + Slog.d(TAG, "skip augmented autofill for same view: " + + "same view entered"); + } } return; } else if (mSessionFlags.mAugmentedAutofillOnly && isSameViewEntered) { // Regular autofill is disabled. - if (sDebug) Slog.d(TAG, "skip augmented autofill for same view."); + if (sDebug) { + Slog.d(TAG, "skip augmented autofill for same view: " + + "standard autofill disabled."); + } return; } }