summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/autofill/AutofillFeatureFlags.java31
-rw-r--r--core/java/android/view/autofill/AutofillManager.java39
2 files changed, 65 insertions, 5 deletions
diff --git a/core/java/android/view/autofill/AutofillFeatureFlags.java b/core/java/android/view/autofill/AutofillFeatureFlags.java
index 199a69a723d8..5b1c7d54ddb7 100644
--- a/core/java/android/view/autofill/AutofillFeatureFlags.java
+++ b/core/java/android/view/autofill/AutofillFeatureFlags.java
@@ -256,6 +256,21 @@ public class AutofillFeatureFlags {
"ignore_relayout_auth_pending";
/**
+ * Fixes to handle apps relaying out, and causing problems for autofill.
+ *
+ * @hide
+ */
+ public static final String DEVICE_CONFIG_ENABLE_RELAYOUT = "enable_relayout";
+
+ /**
+ * Enable relative location of views for fingerprinting for relayout.
+ *
+ * @hide
+ */
+ public static final String DEVICE_CONFIG_ENABLE_RELATIVE_LOCATION_FOR_RELAYOUT =
+ "enable_relative_location_for_relayout";
+
+ /**
* Bugfix flag, Autofill should only fill in value from current session.
*
* See frameworks/base/services/autofill/bugfixes.aconfig#fill_fields_from_current_session_only
@@ -543,6 +558,22 @@ public class AutofillFeatureFlags {
false);
}
+ /** @hide */
+ public static boolean enableRelayoutFixes() {
+ return DeviceConfig.getBoolean(
+ DeviceConfig.NAMESPACE_AUTOFILL,
+ DEVICE_CONFIG_ENABLE_RELAYOUT,
+ true);
+ }
+
+ /** @hide */
+ public static boolean enableRelativeLocationForRelayout() {
+ return DeviceConfig.getBoolean(
+ DeviceConfig.NAMESPACE_AUTOFILL,
+ DEVICE_CONFIG_ENABLE_RELATIVE_LOCATION_FOR_RELAYOUT,
+ false);
+ }
+
/** @hide **/
public static boolean shouldFillFieldsFromCurrentSessionOnly() {
return DeviceConfig.getBoolean(
diff --git a/core/java/android/view/autofill/AutofillManager.java b/core/java/android/view/autofill/AutofillManager.java
index 0d4c5560837c..8f349fecc0e6 100644
--- a/core/java/android/view/autofill/AutofillManager.java
+++ b/core/java/android/view/autofill/AutofillManager.java
@@ -748,7 +748,16 @@ public final class AutofillManager {
// Controls logic around apps changing some properties of their views when activity loses
// focus due to autofill showing biometric activity, password manager, or password breach check.
- private boolean mRelayoutFix;
+ // Deprecated. TODO: Remove it after ramp of new solution.
+ private boolean mRelayoutFixDeprecated;
+
+ // Controls logic around apps changing some properties of their views when activity loses
+ // focus due to autofill showing biometric activity, password manager, or password breach check.
+ private final boolean mRelayoutFix;
+
+ // Controls logic around apps changing some properties of their views when activity loses
+ // focus due to autofill showing biometric activity, password manager, or password breach check.
+ private final boolean mRelativePositionForRelayout;
// Indicates whether the credman integration is enabled.
private final boolean mIsCredmanIntegrationEnabled;
@@ -978,11 +987,31 @@ public final class AutofillManager {
mShouldIncludeInvisibleViewInAssistStructure =
AutofillFeatureFlags.shouldIncludeInvisibleViewInAssistStructure();
- mRelayoutFix = AutofillFeatureFlags.shouldIgnoreRelayoutWhenAuthPending();
+ mRelayoutFixDeprecated = AutofillFeatureFlags.shouldIgnoreRelayoutWhenAuthPending();
+ mRelayoutFix = AutofillFeatureFlags.enableRelayoutFixes();
+ mRelativePositionForRelayout = AutofillFeatureFlags.enableRelativeLocationForRelayout();
mIsCredmanIntegrationEnabled = Flags.autofillCredmanIntegration();
}
/**
+ * Whether to apply relayout fixes.
+ *
+ * @hide
+ */
+ public boolean isRelayoutFixEnabled() {
+ return mRelayoutFix;
+ }
+
+ /**
+ * Whether to use relative positions and locations of the views for disambiguation.
+ *
+ * @hide
+ */
+ public boolean isRelativePositionForRelayoutEnabled() {
+ return mRelativePositionForRelayout;
+ }
+
+ /**
* Whether to apply heuristic check on important views before triggering fill request
*
* @hide
@@ -1779,7 +1808,7 @@ public final class AutofillManager {
}
return;
}
- if (mRelayoutFix && mState == STATE_PENDING_AUTHENTICATION) {
+ if (mRelayoutFixDeprecated && mState == STATE_PENDING_AUTHENTICATION) {
if (sVerbose) {
Log.v(TAG, "notifyViewVisibilityChanged(): ignoring in auth pending mode");
}
@@ -2917,7 +2946,7 @@ public final class AutofillManager {
Intent fillInIntent, boolean authenticateInline) {
synchronized (mLock) {
if (sessionId == mSessionId) {
- if (mRelayoutFix) {
+ if (mRelayoutFixDeprecated) {
mState = STATE_PENDING_AUTHENTICATION;
}
final AutofillClient client = getClient();
@@ -3778,7 +3807,7 @@ public final class AutofillManager {
@GuardedBy("mLock")
private boolean isPendingAuthenticationLocked() {
- return mRelayoutFix && mState == STATE_PENDING_AUTHENTICATION;
+ return mRelayoutFixDeprecated && mState == STATE_PENDING_AUTHENTICATION;
}
@GuardedBy("mLock")