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

Commit ffa53334 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[IMPROVE FILL DIALOG] Setup DeviceConfig flags" into main

parents 1140b314 8fce1360
Loading
Loading
Loading
Loading
+84 −0
Original line number Diff line number Diff line
@@ -316,6 +316,35 @@ public class AutofillFeatureFlags {

    // END AUTOFILL PCC CLASSIFICATION FLAGS

    // START AUTOFILL REMOVE PRE_TRIGGER FLAGS

    /**
     * Whether pre-trigger flow is disabled.
     *
     * @hide
     */
    public static final String DEVICE_CONFIG_IMPROVE_FILL_DIALOG_ENABLED = "improve_fill_dialog";

    /**
     * Minimum amount of time (in milliseconds) to wait after IME animation finishes, and before
     * starting fill dialog animation.
     *
     * @hide
     */
    public static final String DEVICE_CONFIG_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS =
            "fill_dialog_min_wait_after_animation_end_ms";

    /**
     * Sets a value of timeout in milliseconds, measured after animation end, during which fill
     * dialog can be shown. If we are at time > animation_end_time + this timeout, fill dialog
     * wouldn't be shown.
     *
     * @hide
     */
    public static final String DEVICE_CONFIG_FILL_DIALOG_TIMEOUT_MS = "fill_dialog_timeout_ms";

    // END AUTOFILL REMOVE PRE_TRIGGER FLAGS

    /**
     * Define the max input length for autofill to show suggesiton UI
     *
@@ -366,6 +395,17 @@ public class AutofillFeatureFlags {
            DEFAULT_AFAA_SHOULD_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE = true;
    // END AUTOFILL FOR ALL APPS DEFAULTS

    // START AUTOFILL REMOVE PRE_TRIGGER FLAGS DEFAULTS
    // Default for whether the pre trigger removal is enabled.
    /** @hide */
    public static final boolean DEFAULT_IMPROVE_FILL_DIALOG_ENABLED = true;
    // Default for whether the pre trigger removal is enabled.
    /** @hide */
    public static final long DEFAULT_FILL_DIALOG_TIMEOUT_MS = 300; // 300 ms
    /** @hide */
    public static final long DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS = 0; // 0 ms
    // END AUTOFILL REMOVE PRE_TRIGGER FLAGS DEFAULTS

    /**
     * @hide
     */
@@ -611,4 +651,48 @@ public class AutofillFeatureFlags {
    }

    // END AUTOFILL PCC CLASSIFICATION FUNCTIONS


    // START AUTOFILL REMOVE PRE_TRIGGER
    /**
     * Whether Autofill Pre Trigger Removal is enabled.
     *
     * @hide
     */
    public static boolean isImproveFillDialogEnabled() {
        // TODO(b/266379948): Add condition for checking whether device has PCC first

        return DeviceConfig.getBoolean(
                DeviceConfig.NAMESPACE_AUTOFILL,
                DEVICE_CONFIG_IMPROVE_FILL_DIALOG_ENABLED,
                DEFAULT_IMPROVE_FILL_DIALOG_ENABLED);
    }

    /**
     * Whether Autofill Pre Trigger Removal is enabled.
     *
     * @hide
     */
    public static long getFillDialogTimeoutMs() {
        // TODO(b/266379948): Add condition for checking whether device has PCC first

        return DeviceConfig.getLong(
                DeviceConfig.NAMESPACE_AUTOFILL,
                DEVICE_CONFIG_FILL_DIALOG_TIMEOUT_MS,
                DEFAULT_FILL_DIALOG_TIMEOUT_MS);
    }

    /**
     * Whether Autofill Pre Trigger Removal is enabled.
     *
     * @hide
     */
    public static long getFillDialogMinWaitAfterImeAnimationtEndMs() {
        // TODO(b/266379948): Add condition for checking whether device has PCC first

        return DeviceConfig.getLong(
                DeviceConfig.NAMESPACE_AUTOFILL,
                DEVICE_CONFIG_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS,
                DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS);
    }
}