• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2023 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.view.autofill;
18 
19 import static android.service.autofill.Flags.improveFillDialogAconfig;
20 
21 import android.annotation.SuppressLint;
22 import android.annotation.TestApi;
23 import android.provider.DeviceConfig;
24 import android.service.autofill.Flags;
25 import android.text.TextUtils;
26 import android.util.ArraySet;
27 import android.view.View;
28 
29 import com.android.internal.util.ArrayUtils;
30 
31 import java.util.Arrays;
32 import java.util.Set;
33 
34 /**
35  * Feature flags associated with autofill.
36  * @hide
37  */
38 @TestApi
39 public class AutofillFeatureFlags {
40 
41     /**
42      * {@code DeviceConfig} property used to set which Smart Suggestion modes for Augmented Autofill
43      * are available.
44      */
45     public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES =
46             "smart_suggestion_supported_modes";
47 
48     /**
49      * Sets how long (in ms) the augmented autofill service is bound while idle.
50      *
51      * <p>Use {@code 0} to keep it permanently bound.
52      *
53      * @hide
54      */
55     public static final String DEVICE_CONFIG_AUGMENTED_SERVICE_IDLE_UNBIND_TIMEOUT =
56             "augmented_service_idle_unbind_timeout";
57 
58     /**
59      * Sets how long (in ms) the augmented autofill service request is killed if not replied.
60      *
61      * @hide
62      */
63     public static final String DEVICE_CONFIG_AUGMENTED_SERVICE_REQUEST_TIMEOUT =
64             "augmented_service_request_timeout";
65 
66     /**
67      * Sets allowed list for the autofill compatibility mode.
68      *
69      * The list of packages is {@code ":"} colon delimited, and each entry has the name of the
70      * package and an optional list of url bar resource ids (the list is delimited by
71      * brackets&mdash{@code [} and {@code ]}&mdash and is also comma delimited).
72      *
73      * <p>For example, a list with 3 packages {@code p1}, {@code p2}, and {@code p3}, where
74      * package {@code p1} have one id ({@code url_bar}, {@code p2} has none, and {@code p3 }
75      * have 2 ids {@code url_foo} and {@code url_bas}) would be
76      * {@code p1[url_bar]:p2:p3[url_foo,url_bas]}
77      */
78     public static final String DEVICE_CONFIG_AUTOFILL_COMPAT_MODE_ALLOWED_PACKAGES =
79             "compat_mode_allowed_packages";
80 
81     /**
82      * Indicates Fill dialog feature enabled or not.
83      */
84     public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED =
85             "autofill_dialog_enabled";
86 
87     /**
88      * Sets the autofill hints allowed list for the fields that can trigger the fill dialog
89      * feature at Activity starting.
90      *
91      * The list of autofill hints is {@code ":"} colon delimited.
92      *
93      *  <p>For example, a list with 3 hints {@code password}, {@code phone}, and
94      * { @code emailAddress}, would be {@code password:phone:emailAddress}
95      *
96      * Note: By default the password field is enabled even there is no password hint in the list
97      *
98      * @see View#setAutofillHints(String...)
99      * @hide
100      */
101     public static final String DEVICE_CONFIG_AUTOFILL_DIALOG_HINTS =
102             "autofill_dialog_hints";
103 
104     // START CREDENTIAL MANAGER FLAGS //
105     /**
106      * Indicates whether credential manager tagged views should be ignored from autofill structures.
107      * This flag is further gated by {@link #DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_ENABLED}
108      */
109     public static final String DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_IGNORE_VIEWS =
110             "autofill_credential_manager_ignore_views";
111 
112     /**
113      * Indicates CredentialManager feature enabled or not.
114      * This is the overall feature flag. Individual behavior of credential manager may be controlled
115      * via a different flag, but gated by this flag.
116      */
117     public static final String DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_ENABLED =
118             "autofill_credential_manager_enabled";
119 
120     /**
121      * Indicates whether credential manager tagged views should suppress fill and save dialog.
122      * This flag is further gated by {@link #DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_ENABLED}
123      *
124      * @hide
125      */
126     public static final String DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_SUPPRESS_FILL_AND_SAVE_DIALOG =
127             "autofill_credential_manager_suppress_fill_and_save_dialog";
128     // END CREDENTIAL MANAGER FLAGS //
129 
130     // START AUTOFILL FOR ALL APPS FLAGS //
131     /**
132      * Sets the list of activities and packages denied for autofill
133      *
134      * The list is {@code ";"} colon delimited. Activities under a package is separated by
135      * {@code ","}. Each package name much be followed by a {@code ":"}. Each package entry must be
136      * ends with a {@code ";"}
137      *
138      * <p>For example, a list with only 1 package would be, {@code Package1:;}. A list with one
139      * denied activity {@code Activity1} under {@code Package1} and a full denied package
140      * {@code Package2} would be {@code Package1:Activity1;Package2:;}
141      */
142     public static final String DEVICE_CONFIG_PACKAGE_DENYLIST_FOR_UNIMPORTANT_VIEW =
143             "package_deny_list_for_unimportant_view";
144 
145     /**
146      * Sets the list of activities and packages allowed for autofill. The format is same with
147      * {@link #DEVICE_CONFIG_PACKAGE_DENYLIST_FOR_UNIMPORTANT_VIEW}
148      *
149      * @hide
150      */
151     public static final String DEVICE_CONFIG_PACKAGE_AND_ACTIVITY_ALLOWLIST_FOR_TRIGGERING_FILL_REQUEST =
152             "package_and_activity_allowlist_for_triggering_fill_request";
153 
154     /**
155      * Whether the heuristics check for view is enabled
156      */
157     public static final String DEVICE_CONFIG_TRIGGER_FILL_REQUEST_ON_UNIMPORTANT_VIEW =
158             "trigger_fill_request_on_unimportant_view";
159 
160     /**
161      * Whether to apply heuristic check on important views.
162      *
163      * @hide
164      */
165     public static final String DEVICE_CONFIG_TRIGGER_FILL_REQUEST_ON_FILTERED_IMPORTANT_VIEWS =
166             "trigger_fill_request_on_filtered_important_views";
167 
168     /**
169      * Continas imeAction ids that is irrelevant for autofill. For example, ime_action_search. We
170      * use this to avoid trigger fill request on unimportant views.
171      *
172      * The list is {@code ","} delimited.
173      *
174      * <p> For example, a imeAction list could be "2,3,4", corresponding to ime_action definition
175      * in {@link android.view.inputmethod.EditorInfo.java}</p>
176      */
177     @SuppressLint("IntentName")
178     public static final String DEVICE_CONFIG_NON_AUTOFILLABLE_IME_ACTION_IDS =
179             "non_autofillable_ime_action_ids";
180 
181     /**
182      * Whether to enable autofill on all view types (not just checkbox, spinner, datepicker etc...)
183      *
184      * @hide
185      */
186     public static final String DEVICE_CONFIG_SHOULD_ENABLE_AUTOFILL_ON_ALL_VIEW_TYPES =
187             "should_enable_autofill_on_all_view_types";
188 
189     /**
190      * Whether to enable multi-line filter when checking if view is autofillable
191      *
192      * @hide
193      */
194     public static final String DEVICE_CONFIG_MULTILINE_FILTER_ENABLED =
195             "multiline_filter_enabled";
196 
197     /**
198      * Whether include all autofill type not none views in assist structure
199      *
200      * @hide
201      */
202     public static final String
203         DEVICE_CONFIG_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE =
204             "include_all_autofill_type_not_none_views_in_assist_structure";
205 
206     /**
207      * Whether include all views in assist structure
208      *
209      * @hide
210      */
211     public static final String
212         DEVICE_CONFIG_INCLUDE_ALL_VIEWS_IN_ASSIST_STRUCTURE =
213             "include_all_views_in_assist_structure";
214 
215     /**
216      * Whether to always include WebView in assist structure. WebView is a container view that
217      * providers "virtual" views. We want to always include such a container view since it can
218      * contain arbitrary views in it, some of which could be fillable.
219      *
220      * @hide
221      */
222     public static final String
223             DEVICE_CONFIG_ALWAYS_INCLUDE_WEBVIEW_IN_ASSIST_STRUCTURE =
224             "always_include_webview_in_assist_structure";
225 
226     /**
227      * Whether to include invisible views in the assist structure. Including invisible views can fix
228      * some cases in which Session is destroyed earlier than it is suppose to.
229      *
230      * <p>See
231      * frameworks/base/services/autofill/bugfixes.aconfig#include_invisible_view_group_in_assist_structure
232      * for more information.
233      *
234      * @hide
235      */
236     public static final String DEVICE_CONFIG_INCLUDE_INVISIBLE_VIEW_GROUP_IN_ASSIST_STRUCTURE =
237             "include_invisible_view_group_in_assist_structure";
238 
239     /**
240      * Bugfix flag, Autofill should ignore views resetting to empty states.
241      *
242      * See frameworks/base/services/autofill/bugfixes.aconfig#ignore_view_state_reset_to_empty
243      * for more information.
244      *
245      * @hide
246      */
247     public static final String DEVICE_CONFIG_IGNORE_VIEW_STATE_RESET_TO_EMPTY =
248             "ignore_view_state_reset_to_empty";
249 
250     /**
251      * Bugfix flag, Autofill should ignore view updates if an Auth intent is showing.
252      *
253      * See frameworks/base/services/autofill/bugfixes.aconfig#relayout
254      * for more information.
255      *
256      * @hide
257      */
258     public static final String DEVICE_CONFIG_IGNORE_RELAYOUT_WHEN_AUTH_PENDING =
259             "ignore_relayout_auth_pending";
260 
261     /**
262      * Fixes to handle apps relaying out, and causing problems for autofill.
263      *
264      * @hide
265      */
266     public static final String DEVICE_CONFIG_ENABLE_RELAYOUT = "enable_relayout";
267 
268     /**
269      * Enable relative location of views for fingerprinting for relayout.
270      *
271      * @hide
272      */
273     public static final String DEVICE_CONFIG_ENABLE_RELATIVE_LOCATION_FOR_RELAYOUT =
274             "enable_relative_location_for_relayout";
275 
276     /**
277      * Bugfix flag, Autofill should only fill in value from current session.
278      *
279      * See frameworks/base/services/autofill/bugfixes.aconfig#fill_fields_from_current_session_only
280      * for more information
281      *
282      * @hide
283      */
284     public static final String DEVICE_CONFIG_FILL_FIELDS_FROM_CURRENT_SESSION_ONLY =
285             "fill_fields_from_current_session_only";
286 
287     // END AUTOFILL FOR ALL APPS FLAGS //
288 
289 
290     // START AUTOFILL PCC CLASSIFICATION FLAGS
291 
292     /**
293      * Sets the fill dialog feature enabled or not.
294      */
295     public static final String DEVICE_CONFIG_AUTOFILL_PCC_CLASSIFICATION_ENABLED =
296             "pcc_classification_enabled";
297 
298     /**
299      * Give preference to autofill provider's detection.
300      * @hide
301      */
302     public static final String DEVICE_CONFIG_PREFER_PROVIDER_OVER_PCC = "prefer_provider_over_pcc";
303 
304     /**
305      * Indicates the Autofill Hints that would be requested by the service from the Autofill
306      * Provider.
307      */
308     public static final String DEVICE_CONFIG_AUTOFILL_PCC_FEATURE_PROVIDER_HINTS =
309             "pcc_classification_hints";
310 
311     /**
312      * Use data from secondary source if primary not present .
313      * For eg: if we prefer PCC over provider, and PCC detection didn't classify a field, however,
314      * autofill provider did, this flag would decide whether we use that result, and show some
315      * presentation for that particular field.
316      * @hide
317      */
318     public static final String DEVICE_CONFIG_PCC_USE_FALLBACK = "pcc_use_fallback";
319 
320     // END AUTOFILL PCC CLASSIFICATION FLAGS
321 
322     // START AUTOFILL REMOVE PRE_TRIGGER FLAGS
323 
324     /**
325      * Whether pre-trigger flow is disabled.
326      *
327      * @hide
328      */
329     public static final String DEVICE_CONFIG_IMPROVE_FILL_DIALOG_ENABLED = "improve_fill_dialog";
330 
331     /**
332      * Minimum amount of time (in milliseconds) to wait after IME animation finishes, and before
333      * starting fill dialog animation.
334      *
335      * @hide
336      */
337     public static final String DEVICE_CONFIG_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS =
338             "fill_dialog_min_wait_after_animation_end_ms";
339 
340     /**
341      * Sets a value of timeout in milliseconds, measured after animation end, during which fill
342      * dialog can be shown. If we are at time > animation_end_time + this timeout, fill dialog
343      * wouldn't be shown.
344      *
345      * @hide
346      */
347     public static final String DEVICE_CONFIG_FILL_DIALOG_TIMEOUT_MS = "fill_dialog_timeout_ms";
348 
349     // END AUTOFILL REMOVE PRE_TRIGGER FLAGS
350 
351     /**
352      * Whether per Session FillEventHistory is enabled.
353      *
354      * @hide
355      */
356     public static final String DEVICE_CONFIG_SESSION_FILL_EVENT_HISTORY =
357             "session_fill_event_history";
358 
359     /**
360      * Define the max input length for autofill to show suggesiton UI
361      *
362      * E.g. if flag is set to 3, autofill will only show suggestions when user inputs less than 3
363      * characters
364      *
365      * @hide
366      */
367     public static final String DEVICE_CONFIG_MAX_INPUT_LENGTH_FOR_AUTOFILL =
368             "max_input_length_for_autofill";
369 
370     /**
371      * Sets a value of delay time to show up the inline tooltip view.
372      *
373      * @hide
374      */
375     public static final String DEVICE_CONFIG_AUTOFILL_TOOLTIP_SHOW_UP_DELAY =
376             "autofill_inline_tooltip_first_show_delay";
377 
378     private static final String DIALOG_HINTS_DELIMITER = ":";
379 
380     private static final boolean DEFAULT_HAS_FILL_DIALOG_UI_FEATURE = false;
381     private static final String DEFAULT_FILL_DIALOG_ENABLED_HINTS = "";
382 
383 
384     // CREDENTIAL MANAGER DEFAULTS
385     // Credential manager is enabled by default so as to allow testing by app developers
386     private static final boolean DEFAULT_CREDENTIAL_MANAGER_ENABLED = true;
387     private static final boolean DEFAULT_CREDENTIAL_MANAGER_SUPPRESS_FILL_AND_SAVE_DIALOG = true;
388     // END CREDENTIAL MANAGER DEFAULTS
389 
390 
391     // AUTOFILL PCC CLASSIFICATION FLAGS DEFAULTS
392     // Default for whether the pcc classification is enabled for autofill.
393     /** @hide */
394     public static final boolean DEFAULT_AUTOFILL_PCC_CLASSIFICATION_ENABLED = false;
395     // END AUTOFILL PCC CLASSIFICATION FLAGS DEFAULTS
396 
397     // AUTOFILL FOR ALL APPS DEFAULTS
398     private static final boolean DEFAULT_AFAA_ON_UNIMPORTANT_VIEW_ENABLED = true;
399     private static final boolean DEFAULT_AFAA_ON_IMPORTANT_VIEW_ENABLED = true;
400     private static final String DEFAULT_AFAA_DENYLIST = "";
401     private static final String DEFAULT_AFAA_ALLOWLIST = "";
402     private static final String DEFAULT_AFAA_NON_AUTOFILLABLE_IME_ACTIONS = "3,4";
403     private static final boolean DEFAULT_AFAA_SHOULD_ENABLE_AUTOFILL_ON_ALL_VIEW_TYPES = true;
404     private static final boolean DEFAULT_AFAA_SHOULD_ENABLE_MULTILINE_FILTER = true;
405     private static final boolean
406             DEFAULT_AFAA_SHOULD_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE = true;
407     // END AUTOFILL FOR ALL APPS DEFAULTS
408 
409     // START AUTOFILL REMOVE PRE_TRIGGER FLAGS DEFAULTS
410     // Default for whether the pre trigger removal is enabled.
411     /** @hide */
412     public static final boolean DEFAULT_IMPROVE_FILL_DIALOG_ENABLED = true;
413     // Default for whether the pre trigger removal is enabled.
414     /** @hide */
415     public static final long DEFAULT_FILL_DIALOG_TIMEOUT_MS = 400; // 400 ms
416     /** @hide */
417     public static final long DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS = 0; // 0 ms
418     // END AUTOFILL REMOVE PRE_TRIGGER FLAGS DEFAULTS
419 
420     /**
421      * Default for whether per Session FillEventHistory is enabled
422      *
423      * @hide
424      */
425     public static final boolean DEFAULT_SESSION_FILL_EVENT_HISTORY_ENABLED = true;
426 
427     /**
428      * @hide
429      */
430     public static final int DEFAULT_MAX_INPUT_LENGTH_FOR_AUTOFILL = 3;
AutofillFeatureFlags()431     private AutofillFeatureFlags() {};
432 
433     /**
434      * Whether the fill dialog feature is enabled or not
435      *
436      * @hide
437      */
isFillDialogEnabled()438     public static boolean isFillDialogEnabled() {
439         return DeviceConfig.getBoolean(
440                 DeviceConfig.NAMESPACE_AUTOFILL,
441                 DEVICE_CONFIG_AUTOFILL_DIALOG_ENABLED,
442                 DEFAULT_HAS_FILL_DIALOG_UI_FEATURE);
443     }
444 
445     /**
446      * Gets fill dialog enabled hints.
447      *
448      * @hide
449      */
getFillDialogEnabledHints()450     public static String[] getFillDialogEnabledHints() {
451         final String dialogHints = DeviceConfig.getString(
452                 DeviceConfig.NAMESPACE_AUTOFILL,
453                 DEVICE_CONFIG_AUTOFILL_DIALOG_HINTS,
454                 DEFAULT_FILL_DIALOG_ENABLED_HINTS);
455         if (TextUtils.isEmpty(dialogHints)) {
456             return new String[0];
457         }
458 
459         return ArrayUtils.filter(dialogHints.split(DIALOG_HINTS_DELIMITER), String[]::new,
460                 (str) -> !TextUtils.isEmpty(str));
461     }
462 
463     /* starts credman flag getter function */
464     /**
465      * Whether the Credential Manager feature is enabled or not
466      *
467      * @hide
468      */
isCredentialManagerEnabled()469     public static boolean isCredentialManagerEnabled() {
470         return DeviceConfig.getBoolean(
471                 DeviceConfig.NAMESPACE_AUTOFILL,
472                 DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_ENABLED,
473                 DEFAULT_CREDENTIAL_MANAGER_ENABLED);
474     }
475 
476     /**
477      * Whether credential manager tagged views should not trigger fill dialog requests.
478      *
479      * @hide
480      */
isFillAndSaveDialogDisabledForCredentialManager()481     public static boolean isFillAndSaveDialogDisabledForCredentialManager() {
482         return isCredentialManagerEnabled() && DeviceConfig.getBoolean(
483                     DeviceConfig.NAMESPACE_AUTOFILL,
484                     DEVICE_CONFIG_AUTOFILL_CREDENTIAL_MANAGER_SUPPRESS_FILL_AND_SAVE_DIALOG,
485                     DEFAULT_CREDENTIAL_MANAGER_SUPPRESS_FILL_AND_SAVE_DIALOG);
486     }
487     /* ends credman flag getter function */
488 
489     /**
490      * Whether triggering fill request on unimportant view is enabled.
491      *
492      * @hide
493      */
isTriggerFillRequestOnUnimportantViewEnabled()494     public static boolean isTriggerFillRequestOnUnimportantViewEnabled() {
495         return DeviceConfig.getBoolean(
496             DeviceConfig.NAMESPACE_AUTOFILL,
497             DEVICE_CONFIG_TRIGGER_FILL_REQUEST_ON_UNIMPORTANT_VIEW,
498             DEFAULT_AFAA_ON_UNIMPORTANT_VIEW_ENABLED);
499     }
500 
501     /**
502      * Whether to apply heuristic check on important views before triggering fill request
503      *
504      * @hide
505      */
isTriggerFillRequestOnFilteredImportantViewsEnabled()506     public static boolean isTriggerFillRequestOnFilteredImportantViewsEnabled() {
507         return DeviceConfig.getBoolean(
508             DeviceConfig.NAMESPACE_AUTOFILL,
509             DEVICE_CONFIG_TRIGGER_FILL_REQUEST_ON_FILTERED_IMPORTANT_VIEWS,
510             DEFAULT_AFAA_ON_IMPORTANT_VIEW_ENABLED);
511     }
512 
513     /**
514      * Whether to enable autofill on all view types.
515      *
516      * @hide
517      */
shouldEnableAutofillOnAllViewTypes()518     public static boolean shouldEnableAutofillOnAllViewTypes(){
519         return DeviceConfig.getBoolean(
520             DeviceConfig.NAMESPACE_AUTOFILL,
521             DEVICE_CONFIG_SHOULD_ENABLE_AUTOFILL_ON_ALL_VIEW_TYPES,
522             DEFAULT_AFAA_SHOULD_ENABLE_AUTOFILL_ON_ALL_VIEW_TYPES);
523     }
524 
525     /**
526      * Get the non-autofillable ime actions from flag. This will be used in filtering
527      * condition to trigger fill request.
528      *
529      * @hide
530      */
getNonAutofillableImeActionIdSetFromFlag()531     public static Set<String> getNonAutofillableImeActionIdSetFromFlag() {
532         final String mNonAutofillableImeActions = DeviceConfig.getString(
533                 DeviceConfig.NAMESPACE_AUTOFILL,
534                 DEVICE_CONFIG_NON_AUTOFILLABLE_IME_ACTION_IDS,
535                 DEFAULT_AFAA_NON_AUTOFILLABLE_IME_ACTIONS);
536         return new ArraySet<>(Arrays.asList(mNonAutofillableImeActions.split(",")));
537     }
538 
539     /**
540      * Get denylist string from flag.
541      *
542      * Note: This denylist works both on important view and not important views. The flag used here
543      * is legacy flag which will be replaced with soon.
544      *
545      * @hide
546      */
getDenylistStringFromFlag()547     public static String getDenylistStringFromFlag() {
548         return DeviceConfig.getString(
549             DeviceConfig.NAMESPACE_AUTOFILL,
550             DEVICE_CONFIG_PACKAGE_DENYLIST_FOR_UNIMPORTANT_VIEW,
551             DEFAULT_AFAA_DENYLIST);
552     }
553 
554     /**
555      * Get autofill allowlist from flag
556      *
557      * @hide
558      */
getAllowlistStringFromFlag()559     public static String getAllowlistStringFromFlag() {
560         return DeviceConfig.getString(
561             DeviceConfig.NAMESPACE_AUTOFILL,
562             DEVICE_CONFIG_PACKAGE_AND_ACTIVITY_ALLOWLIST_FOR_TRIGGERING_FILL_REQUEST,
563             DEFAULT_AFAA_ALLOWLIST);
564     }
565     /**
566      * Whether include all views that have autofill type not none in assist structure.
567      *
568      * @hide
569      */
shouldIncludeAllViewsAutofillTypeNotNoneInAssistStructrue()570     public static boolean shouldIncludeAllViewsAutofillTypeNotNoneInAssistStructrue() {
571         return DeviceConfig.getBoolean(
572             DeviceConfig.NAMESPACE_AUTOFILL,
573             DEVICE_CONFIG_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE,
574             DEFAULT_AFAA_SHOULD_INCLUDE_ALL_AUTOFILL_TYPE_NOT_NONE_VIEWS_IN_ASSIST_STRUCTURE);
575     }
576 
577     /**
578      * Whether include all views in assist structure.
579      *
580      * @hide
581      */
shouldIncludeAllChildrenViewInAssistStructure()582     public static boolean shouldIncludeAllChildrenViewInAssistStructure() {
583         return DeviceConfig.getBoolean(
584             DeviceConfig.NAMESPACE_AUTOFILL,
585             DEVICE_CONFIG_INCLUDE_ALL_VIEWS_IN_ASSIST_STRUCTURE, false);
586     }
587 
588     /** @hide */
shouldAlwaysIncludeWebviewInAssistStructure()589     public static boolean shouldAlwaysIncludeWebviewInAssistStructure() {
590         return DeviceConfig.getBoolean(
591             DeviceConfig.NAMESPACE_AUTOFILL,
592                 DEVICE_CONFIG_ALWAYS_INCLUDE_WEBVIEW_IN_ASSIST_STRUCTURE, true);
593     }
594 
595     /** @hide */
shouldIncludeInvisibleViewInAssistStructure()596     public static boolean shouldIncludeInvisibleViewInAssistStructure() {
597         return DeviceConfig.getBoolean(
598                 DeviceConfig.NAMESPACE_AUTOFILL,
599                 DEVICE_CONFIG_INCLUDE_INVISIBLE_VIEW_GROUP_IN_ASSIST_STRUCTURE,
600                 true);
601     }
602 
603     /** @hide */
shouldIgnoreViewStateResetToEmpty()604     public static boolean shouldIgnoreViewStateResetToEmpty() {
605         return DeviceConfig.getBoolean(
606                 DeviceConfig.NAMESPACE_AUTOFILL,
607                 DEVICE_CONFIG_IGNORE_VIEW_STATE_RESET_TO_EMPTY,
608                 true);
609     }
610 
611     /** @hide */
shouldIgnoreRelayoutWhenAuthPending()612     public static boolean shouldIgnoreRelayoutWhenAuthPending() {
613         return DeviceConfig.getBoolean(
614                 DeviceConfig.NAMESPACE_AUTOFILL,
615                 DEVICE_CONFIG_IGNORE_RELAYOUT_WHEN_AUTH_PENDING,
616                 false);
617     }
618 
619     /** @hide */
enableRelayoutFixes()620     public static boolean enableRelayoutFixes() {
621         return DeviceConfig.getBoolean(
622                 DeviceConfig.NAMESPACE_AUTOFILL,
623                 DEVICE_CONFIG_ENABLE_RELAYOUT,
624                 true);
625     }
626 
627     /** @hide */
enableRelativeLocationForRelayout()628     public static boolean enableRelativeLocationForRelayout() {
629         return DeviceConfig.getBoolean(
630                 DeviceConfig.NAMESPACE_AUTOFILL,
631                 DEVICE_CONFIG_ENABLE_RELATIVE_LOCATION_FOR_RELAYOUT,
632                 true);
633     }
634 
635     /** @hide **/
shouldFillFieldsFromCurrentSessionOnly()636     public static boolean shouldFillFieldsFromCurrentSessionOnly() {
637         return DeviceConfig.getBoolean(
638                 DeviceConfig.NAMESPACE_AUTOFILL,
639                 DEVICE_CONFIG_FILL_FIELDS_FROM_CURRENT_SESSION_ONLY,
640                 true);
641     }
642 
643     /**
644      * Whether should enable multi-line filter
645      *
646      * @hide
647      */
shouldEnableMultilineFilter()648     public static boolean shouldEnableMultilineFilter() {
649         return DeviceConfig.getBoolean(
650             DeviceConfig.NAMESPACE_AUTOFILL,
651             DEVICE_CONFIG_MULTILINE_FILTER_ENABLED,
652             DEFAULT_AFAA_SHOULD_ENABLE_MULTILINE_FILTER);
653     }
654 
655     // START AUTOFILL PCC CLASSIFICATION FUNCTIONS
656 
657     /**
658      * Whether Autofill PCC Detection is enabled.
659      *
660      * @hide
661      */
isAutofillPccClassificationEnabled()662     public static boolean isAutofillPccClassificationEnabled() {
663         // TODO(b/266379948): Add condition for checking whether device has PCC first
664 
665         return DeviceConfig.getBoolean(
666                 DeviceConfig.NAMESPACE_AUTOFILL,
667                 DEVICE_CONFIG_AUTOFILL_PCC_CLASSIFICATION_ENABLED,
668                 DEFAULT_AUTOFILL_PCC_CLASSIFICATION_ENABLED);
669     }
670 
671     // END AUTOFILL PCC CLASSIFICATION FUNCTIONS
672 
673 
674     // START AUTOFILL REMOVE PRE_TRIGGER
675     /**
676      * Whether Autofill Pre Trigger Removal is enabled.
677      *
678      * @hide
679      */
isImproveFillDialogEnabled()680     public static boolean isImproveFillDialogEnabled() {
681         // TODO(b/266379948): Add condition for checking whether device has PCC first
682 
683         return improveFillDialogAconfig() && DeviceConfig.getBoolean(
684                 DeviceConfig.NAMESPACE_AUTOFILL,
685                 DEVICE_CONFIG_IMPROVE_FILL_DIALOG_ENABLED,
686                 DEFAULT_IMPROVE_FILL_DIALOG_ENABLED);
687     }
688 
689     /**
690      * Whether Autofill Pre Trigger Removal is enabled.
691      *
692      * @hide
693      */
getFillDialogTimeoutMs()694     public static long getFillDialogTimeoutMs() {
695         // TODO(b/266379948): Add condition for checking whether device has PCC first
696 
697         return DeviceConfig.getLong(
698                 DeviceConfig.NAMESPACE_AUTOFILL,
699                 DEVICE_CONFIG_FILL_DIALOG_TIMEOUT_MS,
700                 DEFAULT_FILL_DIALOG_TIMEOUT_MS);
701     }
702 
703     /**
704      * Whether Autofill Pre Trigger Removal is enabled.
705      *
706      * @hide
707      */
getFillDialogMinWaitAfterImeAnimationtEndMs()708     public static long getFillDialogMinWaitAfterImeAnimationtEndMs() {
709         // TODO(b/266379948): Add condition for checking whether device has PCC first
710 
711         return DeviceConfig.getLong(
712                 DeviceConfig.NAMESPACE_AUTOFILL,
713                 DEVICE_CONFIG_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS,
714                 DEFAULT_FILL_DIALOG_MIN_WAIT_AFTER_IME_ANIMATION_END_MS);
715     }
716 
717     /**
718      * Whether tracking FillEventHistory per Session is enabled
719      *
720      * @hide
721      */
isMultipleFillEventHistoryEnabled()722     public static boolean isMultipleFillEventHistoryEnabled() {
723         if (!Flags.multipleFillHistory()) {
724             return false;
725         }
726 
727         return DeviceConfig.getBoolean(
728                 DeviceConfig.NAMESPACE_AUTOFILL,
729                 DEVICE_CONFIG_SESSION_FILL_EVENT_HISTORY,
730                 DEFAULT_SESSION_FILL_EVENT_HISTORY_ENABLED);
731     }
732 }
733