From 92ffb9955b23251f5c6cb119d9cb227b8fe2737c Mon Sep 17 00:00:00 2001 From: TYM Tsai Date: Tue, 25 Apr 2023 06:32:11 +0000 Subject: [PATCH] Fix some views not being tracked Should keep track of all views that attempt to notify the view entered for the fill dialog. But none of the views are tracked until the first FillRsponse is obtained, because mTrackedViews is initialized empty. So move the tracking logic out of mTrackedViews. Bug: 274067633 Test: atest CtsAutoFillServiceTestCases Change-Id: Ic93324b57ca527a2c3e311260593f454eefeeed3 --- core/java/android/view/autofill/AutofillManager.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index f7b7d33879386..f103e5f5fd110 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1479,6 +1479,13 @@ public final class AutofillManager { } synchronized (mLock) { + if (mAllTrackedViews.contains(id)) { + // The id is tracked and will not trigger pre-fill request again. + return; + } + + // Add the id as tracked to avoid triggering fill request again and again. + mAllTrackedViews.add(id); if (mTrackedViews != null) { // To support the fill dialog can show for the autofillable Views in // different pages but in the same Activity. We need to reset the @@ -4132,11 +4139,6 @@ public final class AutofillManager { } void checkViewState(AutofillId id) { - if (mAllTrackedViews.contains(id)) { - return; - } - // Add the id as tracked to avoid triggering fill request again and again. - mAllTrackedViews.add(id); if (mHasNewTrackedView) { return; }