Merge "[Autofill Framework] Change fill_fields_from_current_session_only from aconfig flag to device config flag" into main
diff --git a/core/java/android/view/autofill/AutofillFeatureFlags.java b/core/java/android/view/autofill/AutofillFeatureFlags.java
index 644a7a9..5cdcf0a 100644
--- a/core/java/android/view/autofill/AutofillFeatureFlags.java
+++ b/core/java/android/view/autofill/AutofillFeatureFlags.java
@@ -255,6 +255,17 @@
     public static final String DEVICE_CONFIG_IGNORE_RELAYOUT_WHEN_AUTH_PENDING =
             "ignore_relayout_auth_pending";
 
+    /**
+     * Bugfix flag, Autofill should only fill in value from current session.
+     *
+     * See frameworks/base/services/autofill/bugfixes.aconfig#fill_fields_from_current_session_only
+     * for more information
+     *
+     * @hide
+     */
+    public static final String DEVICE_CONFIG_FILL_FIELDS_FROM_CURRENT_SESSION_ONLY =
+            "fill_fields_from_current_session_only";
+
     // END AUTOFILL FOR ALL APPS FLAGS //
 
 
@@ -532,6 +543,14 @@
                 false);
     }
 
+    /** @hide **/
+    public static boolean shouldFillFieldsFromCurrentSessionOnly() {
+        return DeviceConfig.getBoolean(
+                DeviceConfig.NAMESPACE_AUTOFILL,
+                DEVICE_CONFIG_FILL_FIELDS_FROM_CURRENT_SESSION_ONLY,
+                false);
+    }
+
     /**
      * Whether should enable multi-line filter
      *
diff --git a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
index 07fcb50..fef3216 100644
--- a/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
+++ b/services/autofill/java/com/android/server/autofill/AutofillManagerService.java
@@ -363,6 +363,7 @@
                 case AutofillFeatureFlags.DEVICE_CONFIG_AUTOFILL_PCC_FEATURE_PROVIDER_HINTS:
                 case AutofillFeatureFlags.DEVICE_CONFIG_PREFER_PROVIDER_OVER_PCC:
                 case AutofillFeatureFlags.DEVICE_CONFIG_PCC_USE_FALLBACK:
+                case AutofillFeatureFlags.DEVICE_CONFIG_FILL_FIELDS_FROM_CURRENT_SESSION_ONLY:
                 case Flags.FLAG_AUTOFILL_CREDMAN_INTEGRATION:
                     setDeviceConfigProperties();
                     break;
@@ -710,7 +711,8 @@
                     AutofillFeatureFlags.DEVICE_CONFIG_MAX_INPUT_LENGTH_FOR_AUTOFILL,
                     AutofillFeatureFlags.DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL);
             mAutofillCredmanIntegrationEnabled = Flags.autofillCredmanIntegration();
-            mIsFillFieldsFromCurrentSessionOnly = Flags.fillFieldsFromCurrentSessionOnly();
+            mIsFillFieldsFromCurrentSessionOnly = AutofillFeatureFlags
+                    .shouldFillFieldsFromCurrentSessionOnly();
             if (verbose) {
                 Slog.v(mTag, "setDeviceConfigProperties() for PCC: "
                         + "mPccClassificationEnabled=" + mPccClassificationEnabled