Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ec86be9d authored by Simranjit Kohli's avatar Simranjit Kohli Committed by Android (Google) Code Review
Browse files

Merge "[Relayout] Part 1: Define flags" into main

parents d3e49178 e2bd0759
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -255,6 +255,21 @@ public class AutofillFeatureFlags {
    public static final String DEVICE_CONFIG_IGNORE_RELAYOUT_WHEN_AUTH_PENDING =
            "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.
     *
@@ -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(
+34 −5
Original line number Diff line number Diff line
@@ -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,10 +987,30 @@ 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
     *
@@ -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")