From dbb7a364c87efa8b89fbac058d85810dfcfb827b Mon Sep 17 00:00:00 2001 From: Felipe Leme Date: Mon, 13 May 2019 15:28:46 -0700 Subject: [PATCH] Make sure view.setAutofilled() is called when autofilled by augmented-autofill only. Test: atest AugmentedLoginActivityTest#testAugmentedAutoFill_thenEditField Test: m update-api Fixes: 132576597 Change-Id: I88c341931f1cf23a0c99a916b7231e895b8e3699 --- api/test-current.txt | 1 + core/java/android/view/View.java | 1 + core/java/android/view/autofill/AutofillManager.java | 11 +++++++---- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/api/test-current.txt b/api/test-current.txt index 181932cf12601..015ce14cfd54e 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -3173,6 +3173,7 @@ package android.view { @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback { method public android.view.View getTooltipView(); + method public boolean isAutofilled(); method public static boolean isDefaultFocusHighlightEnabled(); method public boolean isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable); method protected void resetResolvedDrawables(); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 921294a78e5eb..23dc21f3eddb6 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -8852,6 +8852,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, /** * @hide */ + @TestApi public boolean isAutofilled() { return (mPrivateFlags3 & PFLAG3_IS_AUTOFILLED) != 0; } diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java index c36b8940b158f..1f7ae0e7e2456 100644 --- a/core/java/android/view/autofill/AutofillManager.java +++ b/core/java/android/view/autofill/AutofillManager.java @@ -1204,10 +1204,6 @@ public final class AutofillManager { AutofillValue value = null; synchronized (mLock) { - if (mForAugmentedAutofillOnly) { - if (sVerbose) Log.v(TAG, "notifyValueChanged(): ignoring on augmented only mode"); - return; - } // If the session is gone some fields might still be highlighted, hence we have to // remove the isAutofilled property even if no sessions are active. if (mLastAutofilledData == null) { @@ -1229,6 +1225,13 @@ 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 (sVerbose) { Log.v(TAG, "notifyValueChanged(" + view.getAutofillId()