Fix regression of View visibleChanges times
onVisibilityAggregated slow down is due to Autofill code directly request a feature flag from Device config, which is slow and not cached. This change caches that value. Bug: 265356545 Test: atest android.view.contentcapture.LoginTest Change-Id: Icccf4831b2168e4dcad79475ac2a06162e7910cb
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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()) {
|
||||
|
||||
Reference in New Issue
Block a user