From 661e0a6a6b7bcbd729bd9fe94735dd2a01ab5117 Mon Sep 17 00:00:00 2001 From: Simranjit Kohli Date: Fri, 27 Jan 2023 16:33:33 -0800 Subject: [PATCH] [Autofill PCC]: Define Autofill PCC classification flag Test: None BUG: 242704846 Change-Id: Iafe603dfa60dccd8577672dfc54813bf35176f2c --- core/api/test-current.txt | 1 + .../view/autofill/AutofillFeatureFlags.java | 48 +++++++++++++++---- 2 files changed, 40 insertions(+), 9 deletions(-) diff --git a/core/api/test-current.txt b/core/api/test-current.txt index 5f2f623683762..7a30242be736e 100644 --- a/core/api/test-current.txt +++ b/core/api/test-current.txt @@ -3249,6 +3249,7 @@ package android.view.autofill { field public static final String DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_ENABLED = "autofill_credential_manager_enabled"; field public static final String DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_IGNORE_VIEWS = "autofill_credential_manager_ignore_views"; field public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED = "autofill_dialog_enabled"; + field public static final String DEVICE_CONFIG_AUTOFILL_PCC_CLASSIFICATION_ENABLED = "pcc_classification_enabled"; field public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES = "smart_suggestion_supported_modes"; field public static final String DEVICE_CONFIG_NON_AUTOFILLABLE_IME_ACTION_IDS = "non_autofillable_ime_action_ids"; field public static final String DEVICE_CONFIG_PACKAGE_DENYLIST_FOR_UNIMPORTANT_VIEW = "package_deny_list_for_unimportant_view"; diff --git a/core/java/android/view/autofill/AutofillFeatureFlags.java b/core/java/android/view/autofill/AutofillFeatureFlags.java index cba399f996b2f..e7c610b8bd8de 100644 --- a/core/java/android/view/autofill/AutofillFeatureFlags.java +++ b/core/java/android/view/autofill/AutofillFeatureFlags.java @@ -145,19 +145,13 @@ public class AutofillFeatureFlags { *

For example, a list with only 1 package would be, {@code Package1:;}. A list with one * denied activity {@code Activity1} under {@code Package1} and a full denied package * {@code Package2} would be {@code Package1:Activity1;Package2:;} - * - * @hide */ - @TestApi public static final String DEVICE_CONFIG_PACKAGE_DENYLIST_FOR_UNIMPORTANT_VIEW = "package_deny_list_for_unimportant_view"; /** * Whether the heuristics check for view is enabled - * - * @hide */ - @TestApi public static final String DEVICE_CONFIG_TRIGGER_FILL_REQUEST_ON_UNIMPORTANT_VIEW = "trigger_fill_request_on_unimportant_view"; @@ -169,15 +163,24 @@ public class AutofillFeatureFlags { * *

For example, a imeAction list could be "2,3,4", corresponding to ime_action definition * in {@link android.view.inputmethod.EditorInfo.java}

- * - * @hide */ - @TestApi @SuppressLint("IntentName") public static final String DEVICE_CONFIG_NON_AUTOFILLABLE_IME_ACTION_IDS = "non_autofillable_ime_action_ids"; // END AUTOFILL FOR ALL APPS FLAGS // + + // START AUTOFILL PCC CLASSIFICATION FLAGS + + /** + * Sets the fill dialog feature enabled or not. + */ + public static final String DEVICE_CONFIG_AUTOFILL_PCC_CLASSIFICATION_ENABLED = + "pcc_classification_enabled"; + + // END AUTOFILL PCC CLASSIFICATION FLAGS + + /** * Sets a value of delay time to show up the inline tooltip view. * @@ -191,6 +194,7 @@ public class AutofillFeatureFlags { private static final boolean DEFAULT_HAS_FILL_DIALOG_UI_FEATURE = false; private static final String DEFAULT_FILL_DIALOG_ENABLED_HINTS = ""; + // CREDENTIAL MANAGER DEFAULTS // Credential manager is enabled by default so as to allow testing by app developers private static final boolean DEFAULT_CREDENTIAL_MANAGER_ENABLED = true; @@ -199,6 +203,13 @@ public class AutofillFeatureFlags { private static final boolean DEFAULT_CREDENTIAL_MANAGER_SUPPRESS_SAVE_DIALOG = false; // END CREDENTIAL MANAGER DEFAULTS + + // AUTOFILL PCC CLASSIFICATION FLAGS DEFAULTS + // Default for whether the pcc classification is enabled for autofill. + private static final boolean DEFAULT_AUTOFILL_PCC_CLASSIFICATION_ENABLED = false; + // END AUTOFILL PCC CLASSIFICATION FLAGS DEFAULTS + + private AutofillFeatureFlags() {}; /** @@ -302,4 +313,23 @@ public class AutofillFeatureFlags { DeviceConfig.NAMESPACE_AUTOFILL, DEVICE_CONFIG_PACKAGE_DENYLIST_FOR_UNIMPORTANT_VIEW, ""); } + + + // START AUTOFILL PCC CLASSIFICATION FUNCTIONS + + /** + * Whether Autofill PCC Detection is enabled. + * + * @hide + */ + public static boolean isAutofillPccClassificationEnabled() { + // TODO(b/266379948): Add condition for checking whether device has PCC first + + return DeviceConfig.getBoolean( + DeviceConfig.NAMESPACE_AUTOFILL, + DEVICE_CONFIG_AUTOFILL_PCC_CLASSIFICATION_ENABLED, + DEFAULT_AUTOFILL_PCC_CLASSIFICATION_ENABLED); + } + + // END AUTOFILL PCC CLASSIFICATION FUNCTIONS }