Merge "Fix regression of View visibleChanges times" into udc-dev

This commit is contained in:
Tim Yu
2023-03-08 21:19:02 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 7 deletions

View File

@@ -142,7 +142,6 @@ import android.view.accessibility.AccessibilityWindowInfo;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.Transformation;
import android.view.autofill.AutofillFeatureFlags;
import android.view.autofill.AutofillId;
import android.view.autofill.AutofillManager;
import android.view.autofill.AutofillValue;
@@ -10363,15 +10362,21 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
private boolean isAutofillable() {
if (getAutofillType() == AUTOFILL_TYPE_NONE) return false;
final AutofillManager afm = getAutofillManager();
if (afm == null) {
return false;
}
// Disable triggering autofill if the view is integrated with CredentialManager.
if (AutofillFeatureFlags.shouldIgnoreCredentialViews()
&& isCredential()) return false;
if (afm.shouldIgnoreCredentialViews() && isCredential()) {
return false;
}
if (!isImportantForAutofill()) {
// If view matches heuristics and is not denied, it will be treated same as view that's
// important for autofill
if (isMatchingAutofillableHeuristics()
&& !isActivityDeniedForAutofillForUnimportantView()) {
if (afm.isMatchingAutofillableHeuristics(this)
&& !afm.isActivityDeniedForAutofillForUnimportantView()) {
return getAutofillViewId() > LAST_APP_AUTOFILL_ID;
}
// View is not important for "regular" autofill, so we must check if Augmented Autofill
@@ -10380,8 +10385,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
if (options == null || !options.isAugmentedAutofillEnabled(mContext)) {
return false;
}
final AutofillManager afm = getAutofillManager();
if (afm == null) return false;
afm.notifyViewEnteredForAugmentedAutofill(this);
}

View File

@@ -691,6 +691,9 @@ public final class AutofillManager {
// Indicates whether called the showAutofillDialog() method.
private boolean mShowAutofillDialogCalled = false;
// Cached autofill feature flag
private boolean mShouldIgnoreCredentialViews = false;
private final String[] mFillDialogEnabledHints;
// Tracked all views that have appeared, including views that there are no
@@ -838,6 +841,7 @@ public final class AutofillManager {
mIsFillDialogEnabled = AutofillFeatureFlags.isFillDialogEnabled();
mFillDialogEnabledHints = AutofillFeatureFlags.getFillDialogEnabledHints();
mShouldIgnoreCredentialViews = AutofillFeatureFlags.shouldIgnoreCredentialViews();
if (sDebug) {
Log.d(TAG, "Fill dialog is enabled:" + mIsFillDialogEnabled
+ ", hints=" + Arrays.toString(mFillDialogEnabledHints));
@@ -2080,6 +2084,11 @@ public final class AutofillManager {
return client != null && client.autofillClientIsFillUiShowing();
}
/** @hide */
public boolean shouldIgnoreCredentialViews() {
return mShouldIgnoreCredentialViews;
}
/** @hide */
public void onAuthenticationResult(int authenticationId, Intent data, View focusView) {
if (!hasAutofillFeature()) {