1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package org.chromium.chrome.browser.flags;
6 
7 import androidx.annotation.VisibleForTesting;
8 
9 import org.chromium.base.FeatureList;
10 import org.chromium.base.annotations.JNINamespace;
11 import org.chromium.base.annotations.MainDex;
12 import org.chromium.base.annotations.NativeMethods;
13 
14 import java.util.Map;
15 
16 /**
17  * Java accessor for base/feature_list.h state.
18  *
19  * This class provides methods to access values of feature flags registered in
20  * |kFeaturesExposedToJava| in chrome/browser/android/flags/chrome_feature_list.cc and as a constant
21  * in this class.
22  *
23  * This class also provides methods to access values of field trial parameters associated to those
24  * flags.
25  */
26 @JNINamespace("chrome::android")
27 @MainDex
28 public abstract class ChromeFeatureList {
29     /** Prevent instantiation. */
ChromeFeatureList()30     private ChromeFeatureList() {}
31 
32     /**
33      * @see FeatureList#setTestCanUseDefaultsForTesting
34      */
35     // TODO(crbug.com/1060097): Migrate callers to the FeatureList equivalent function.
36     @VisibleForTesting
setTestCanUseDefaultsForTesting()37     public static void setTestCanUseDefaultsForTesting() {
38         FeatureList.setTestCanUseDefaultsForTesting();
39     }
40 
41     /**
42      * @see FeatureList#resetTestCanUseDefaultsForTesting
43      */
44     // TODO(crbug.com/1060097): Migrate callers to the FeatureList equivalent function.
45     @VisibleForTesting
resetTestCanUseDefaultsForTesting()46     public static void resetTestCanUseDefaultsForTesting() {
47         FeatureList.resetTestCanUseDefaultsForTesting();
48     }
49 
50     /**
51      * @see FeatureList#setTestFeatures
52      * Sets the feature flags to use in JUnit tests, since native calls are not available there.
53      * Do not use directly, prefer using the {@link Features} annotation.
54      *
55      * @see Features
56      * @see Features.Processor
57      *
58      * @deprecated
59      * https://crbug.com/1058993
60      */
61     // TODO(crbug.com/1060097): Migrate callers to the FeatureList equivalent function.
62     @VisibleForTesting
63     @Deprecated
setTestFeatures(Map<String, Boolean> features)64     public static void setTestFeatures(Map<String, Boolean> features) {
65         FeatureList.setTestFeatures(features);
66     }
67 
68     /**
69      * @return Whether the native FeatureList has been initialized. If this method returns false,
70      *         none of the methods in this class that require native access should be called (except
71      *         in tests if test features have been set).
72      */
73     // TODO(crbug.com/1060097): Migrate callers to the FeatureList equivalent function.
74     @Deprecated
isInitialized()75     public static boolean isInitialized() {
76         return FeatureList.isInitialized();
77     }
78 
79     /*
80      * Returns whether the specified feature is enabled or not in native.
81      *
82      * @param featureName The name of the feature to query.
83      * @return Whether the feature is enabled or not.
84      */
isEnabledInNative(String featureName)85     private static boolean isEnabledInNative(String featureName) {
86         assert FeatureList.isNativeInitialized();
87         return ChromeFeatureListJni.get().isEnabled(featureName);
88     }
89 
90     /**
91      * Returns whether the specified feature is enabled or not.
92      *
93      * Note: Features queried through this API must be added to the array
94      * |kFeaturesExposedToJava| in chrome/browser/android/chrome_feature_list.cc
95      *
96      * Calling this has the side effect of bucketing this client, which may cause an experiment to
97      * be marked as active.
98      *
99      * Should be called only after native is loaded. If {@link #isInitialized()} return true, this
100      * method is safe to call.  In tests, this will return any values set through
101      * {@link #setTestFeatures(Map)}, even before native is loaded.
102      *
103      * @param featureName The name of the feature to query.
104      * @return Whether the feature is enabled or not.
105      */
isEnabled(String featureName)106     public static boolean isEnabled(String featureName) {
107         // FeatureFlags set for testing override the native default value.
108         Boolean testValue = FeatureList.getTestValueForFeature(featureName);
109         if (testValue != null) return testValue;
110         return isEnabledInNative(featureName);
111     }
112 
113     /**
114      * Returns a field trial param for the specified feature.
115      *
116      * Note: Features queried through this API must be added to the array
117      * |kFeaturesExposedToJava| in chrome/browser/android/chrome_feature_list.cc
118      *
119      * @param featureName The name of the feature to retrieve a param for.
120      * @param paramName The name of the param for which to get as an integer.
121      * @return The parameter value as a String. The string is empty if the feature does not exist or
122      *   the specified parameter does not exist.
123      */
getFieldTrialParamByFeature(String featureName, String paramName)124     public static String getFieldTrialParamByFeature(String featureName, String paramName) {
125         if (FeatureList.hasTestFeatures()) return "";
126         assert FeatureList.isInitialized();
127         return ChromeFeatureListJni.get().getFieldTrialParamByFeature(featureName, paramName);
128     }
129 
130     /**
131      * Returns a field trial param as an int for the specified feature.
132      *
133      * Note: Features queried through this API must be added to the array
134      * |kFeaturesExposedToJava| in chrome/browser/android/chrome_feature_list.cc
135      *
136      * @param featureName The name of the feature to retrieve a param for.
137      * @param paramName The name of the param for which to get as an integer.
138      * @param defaultValue The integer value to use if the param is not available.
139      * @return The parameter value as an int. Default value if the feature does not exist or the
140      *         specified parameter does not exist or its string value does not represent an int.
141      */
getFieldTrialParamByFeatureAsInt( String featureName, String paramName, int defaultValue)142     public static int getFieldTrialParamByFeatureAsInt(
143             String featureName, String paramName, int defaultValue) {
144         if (FeatureList.hasTestFeatures()) return defaultValue;
145         assert FeatureList.isInitialized();
146         return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsInt(
147                 featureName, paramName, defaultValue);
148     }
149 
150     /**
151      * Returns a field trial param as a double for the specified feature.
152      *
153      * Note: Features queried through this API must be added to the array
154      * |kFeaturesExposedToJava| in chrome/browser/android/chrome_feature_list.cc
155      *
156      * @param featureName The name of the feature to retrieve a param for.
157      * @param paramName The name of the param for which to get as an integer.
158      * @param defaultValue The double value to use if the param is not available.
159      * @return The parameter value as a double. Default value if the feature does not exist or the
160      *         specified parameter does not exist or its string value does not represent a double.
161      */
getFieldTrialParamByFeatureAsDouble( String featureName, String paramName, double defaultValue)162     public static double getFieldTrialParamByFeatureAsDouble(
163             String featureName, String paramName, double defaultValue) {
164         if (FeatureList.hasTestFeatures()) return defaultValue;
165         assert FeatureList.isInitialized();
166         return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsDouble(
167                 featureName, paramName, defaultValue);
168     }
169 
170     /**
171      * Returns a field trial param as a boolean for the specified feature.
172      *
173      * Note: Features queried through this API must be added to the array
174      * |kFeaturesExposedToJava| in chrome/browser/android/chrome_feature_list.cc
175      *
176      * @param featureName The name of the feature to retrieve a param for.
177      * @param paramName The name of the param for which to get as an integer.
178      * @param defaultValue The boolean value to use if the param is not available.
179      * @return The parameter value as a boolean. Default value if the feature does not exist or the
180      *         specified parameter does not exist or its string value is neither "true" nor "false".
181      */
getFieldTrialParamByFeatureAsBoolean( String featureName, String paramName, boolean defaultValue)182     public static boolean getFieldTrialParamByFeatureAsBoolean(
183             String featureName, String paramName, boolean defaultValue) {
184         if (FeatureList.hasTestFeatures()) return defaultValue;
185         assert FeatureList.isInitialized();
186         return ChromeFeatureListJni.get().getFieldTrialParamByFeatureAsBoolean(
187                 featureName, paramName, defaultValue);
188     }
189 
190     /** Alphabetical: */
191     public static final String ALLOW_NEW_INCOGNITO_TAB_INTENTS = "AllowNewIncognitoTabIntents";
192     public static final String ALLOW_REMOTE_CONTEXT_FOR_NOTIFICATIONS =
193             "AllowRemoteContextForNotifications";
194     public static final String AUTOFILL_ALLOW_NON_HTTP_ACTIVATION =
195             "AutofillAllowNonHttpActivation";
196     public static final String AUTOFILL_CREDIT_CARD_AUTHENTICATION =
197             "AutofillCreditCardAuthentication";
198     public static final String AUTOFILL_DOWNSTREAM_CVC_PROMPT_USE_GOOGLE_LOGO =
199             "AutofillDownstreamCvcPromptUseGooglePayLogo";
200     public static final String AUTOFILL_ENABLE_CARD_NICKNAME_MANAGEMENT =
201             "AutofillEnableCardNicknameManagement";
202     public static final String AUTOFILL_ENABLE_GOOGLE_ISSUED_CARD =
203             "AutofillEnableGoogleIssuedCard";
204     public static final String AUTOFILL_ENABLE_PASSWORD_INFO_BAR_ACCOUNT_INDICATION_FOOTER =
205             "AutofillEnablePasswordInfoBarAccountIndicationFooter";
206     public static final String AUTOFILL_ENABLE_SAVE_CARD_INFO_BAR_ACCOUNT_INDICATION_FOOTER =
207             "AutofillEnableSaveCardInfoBarAccountIndicationFooter";
208     public static final String ADJUST_WEBAPK_INSTALLATION_SPACE = "AdjustWebApkInstallationSpace";
209     public static final String ANDROID_DEFAULT_BROWSER_PROMO = "AndroidDefaultBrowserPromo";
210     public static final String ANDROID_MANAGED_BY_MENU_ITEM = "AndroidManagedByMenuItem";
211     public static final String ANDROID_MULTIPLE_DISPLAY = "AndroidMultipleDisplay";
212     public static final String ANDROID_NIGHT_MODE_TAB_REPARENTING =
213             "AndroidNightModeTabReparenting";
214     public static final String ANDROID_PARTNER_CUSTOMIZATION_PHENOTYPE =
215             "AndroidPartnerCustomizationPhenotype";
216     public static final String ANDROID_PAY_INTEGRATION_V2 = "AndroidPayIntegrationV2";
217     public static final String ANDROID_SEARCH_ENGINE_CHOICE_NOTIFICATION =
218             "AndroidSearchEngineChoiceNotification";
219     public static final String ASSISTANT_INTENT_PAGE_URL = "AssistantIntentPageUrl";
220     public static final String AUTOFILL_ASSISTANT = "AutofillAssistant";
221     public static final String AUTOFILL_ASSISTANT_CHROME_ENTRY = "AutofillAssistantChromeEntry";
222     public static final String AUTOFILL_ASSISTANT_DIRECT_ACTIONS = "AutofillAssistantDirectActions";
223     public static final String AUTOFILL_ASSISTANT_DISABLE_ONBOARDING_FLOW =
224             "AutofillAssistantDisableOnboardingFlow";
225     public static final String AUTOFILL_ASSISTANT_FEEDBACK_CHIP = "AutofillAssistantFeedbackChip";
226     public static final String AUTOFILL_ASSISTANT_LOAD_DFM_FOR_TRIGGER_SCRIPTS =
227             "AutofillAssistantLoadDFMForTriggerScripts";
228     public static final String AUTOFILL_ASSISTANT_PROACTIVE_HELP = "AutofillAssistantProactiveHelp";
229     public static final String AUTOFILL_ASSISTANT_DISABLE_PROACTIVE_HELP_TIED_TO_MSBB =
230             "AutofillAssistantDisableProactiveHelpTiedToMSBB";
231     public static final String AUTOFILL_MANUAL_FALLBACK_ANDROID = "AutofillManualFallbackAndroid";
232     public static final String AUTOFILL_REFRESH_STYLE_ANDROID = "AutofillRefreshStyleAndroid";
233     public static final String AUTOFILL_KEYBOARD_ACCESSORY = "AutofillKeyboardAccessory";
234     public static final String BACKGROUND_TASK_SCHEDULER_FOR_BACKGROUND_SYNC =
235             "BackgroundTaskSchedulerForBackgroundSync";
236     public static final String BENTO_OFFLINE = "BentoOffline";
237     public static final String BIOMETRIC_TOUCH_TO_FILL = "BiometricTouchToFill";
238     public static final String CAPTIVE_PORTAL_CERTIFICATE_LIST = "CaptivePortalCertificateList";
239     public static final String CCT_BACKGROUND_TAB = "CCTBackgroundTab";
240     public static final String CCT_CLIENT_DATA_HEADER = "CCTClientDataHeader";
241     public static final String CCT_INCOGNITO = "CCTIncognito";
242     public static final String CCT_EXTERNAL_LINK_HANDLING = "CCTExternalLinkHandling";
243     public static final String CCT_POST_MESSAGE_API = "CCTPostMessageAPI";
244     public static final String CCT_REDIRECT_PRECONNECT = "CCTRedirectPreconnect";
245     public static final String CCT_RESOURCE_PREFETCH = "CCTResourcePrefetch";
246     public static final String CCT_REPORT_PARALLEL_REQUEST_STATUS =
247             "CCTReportParallelRequestStatus";
248     public static final String CLOSE_TAB_SUGGESTIONS = "CloseTabSuggestions";
249     public static final String DONT_AUTO_HIDE_BROWSER_CONTROLS = "DontAutoHideBrowserControls";
250     public static final String CHROME_SHARE_HIGHLIGHTS_ANDROID = "ChromeShareHighlightsAndroid";
251     public static final String CHROME_SHARE_LONG_SCREENSHOT = "ChromeShareLongScreenshot";
252     public static final String CHROME_SHARE_QRCODE = "ChromeShareQRCode";
253     public static final String CHROME_SHARE_SCREENSHOT = "ChromeShareScreenshot";
254     public static final String CHROME_SHARING_HUB = "ChromeSharingHub";
255     public static final String CHROME_SHARING_HUB_V15 = "ChromeSharingHubV15";
256     public static final String CHROME_STARTUP_DELEGATE = "ChromeStartupDelegate";
257     public static final String CLEAR_OLD_BROWSING_DATA = "ClearOldBrowsingData";
258     public static final String COMMAND_LINE_ON_NON_ROOTED = "CommandLineOnNonRooted";
259     public static final String CONDITIONAL_TAB_STRIP_ANDROID = "ConditionalTabStripAndroid";
260     public static final String CONTACTS_PICKER_SELECT_ALL = "ContactsPickerSelectAll";
261     public static final String CONTENT_SUGGESTIONS_SCROLL_TO_LOAD =
262             "ContentSuggestionsScrollToLoad";
263     public static final String CONTEXT_MENU_ENABLE_LENS_SHOPPING_ALLOWLIST =
264             "ContextMenuEnableLensShoppingAllowlist";
265     public static final String CONTEXT_MENU_GOOGLE_LENS_CHIP = "ContextMenuGoogleLensChip";
266     public static final String CONTEXT_MENU_SEARCH_WITH_GOOGLE_LENS =
267             "ContextMenuSearchWithGoogleLens";
268     public static final String CONTEXT_MENU_SHOP_WITH_GOOGLE_LENS = "ContextMenuShopWithGoogleLens";
269     public static final String CONTEXT_MENU_SEARCH_AND_SHOP_WITH_GOOGLE_LENS =
270             "ContextMenuSearchAndShopWithGoogleLens";
271     public static final String CONTEXTUAL_SEARCH_DEBUG = "ContextualSearchDebug";
272     public static final String CONTEXTUAL_SEARCH_DEFINITIONS = "ContextualSearchDefinitions";
273     public static final String CONTEXTUAL_SEARCH_LEGACY_HTTP_POLICY =
274             "ContextualSearchLegacyHttpPolicy";
275     public static final String CONTEXTUAL_SEARCH_LITERAL_SEARCH_TAP =
276             "ContextualSearchLiteralSearchTap";
277     public static final String CONTEXTUAL_SEARCH_ML_TAP_SUPPRESSION =
278             "ContextualSearchMlTapSuppression";
279     public static final String CONTEXTUAL_SEARCH_LONGPRESS_RESOLVE =
280             "ContextualSearchLongpressResolve";
281     public static final String CONTEXTUAL_SEARCH_SECOND_TAP = "ContextualSearchSecondTap";
282     public static final String CONTEXTUAL_SEARCH_TAP_DISABLE_OVERRIDE =
283             "ContextualSearchTapDisableOverride";
284     public static final String CONTEXTUAL_SEARCH_TRANSLATIONS = "ContextualSearchTranslations";
285     public static final String COOKIES_WITHOUT_SAME_SITE_MUST_BE_SECURE =
286             "CookiesWithoutSameSiteMustBeSecure";
287     public static final String CRITICAL_PERSISTED_TAB_DATA = "CriticalPersistedTabData";
288     public static final String DARKEN_WEBSITES_CHECKBOX_IN_THEMES_SETTING =
289             "DarkenWebsitesCheckboxInThemesSetting";
290     public static final String DECOUPLE_SYNC_FROM_ANDROID_MASTER_SYNC =
291             "DecoupleSyncFromAndroidMasterSync";
292     public static final String DETAILED_LANGUAGE_SETTINGS = "DetailedLanguageSettings";
293     public static final String DIRECT_ACTIONS = "DirectActions";
294     public static final String DNS_OVER_HTTPS = "DnsOverHttps";
295     public static final String DOWNLOAD_FILE_PROVIDER = "DownloadFileProvider";
296     public static final String DOWNLOAD_NOTIFICATION_BADGE = "DownloadNotificationBadge";
297     public static final String DOWNLOAD_PROGRESS_INFOBAR = "DownloadProgressInfoBar";
298     public static final String DOWNLOADS_FOREGROUND = "DownloadsForeground";
299     public static final String DOWNLOADS_AUTO_RESUMPTION_NATIVE = "DownloadsAutoResumptionNative";
300     public static final String DOWNLOAD_OFFLINE_CONTENT_PROVIDER =
301             "UseDownloadOfflineContentProvider";
302     public static final String DOWNLOADS_LOCATION_CHANGE = "DownloadsLocationChange";
303     public static final String DOWNLOAD_LATER = "DownloadLater";
304     public static final String EDIT_PASSWORDS_IN_SETTINGS = "EditPasswordsInSettings";
305     public static final String EARLY_LIBRARY_LOAD = "EarlyLibraryLoad";
306     public static final String ENHANCED_PROTECTION_PROMO_CARD = "EnhancedProtectionPromoCard";
307     public static final String EPHEMERAL_TAB_USING_BOTTOM_SHEET = "EphemeralTabUsingBottomSheet";
308     public static final String EXPLICIT_LANGUAGE_ASK = "ExplicitLanguageAsk";
309     public static final String EXPLORE_SITES = "ExploreSites";
310     public static final String FILLING_PASSWORDS_FROM_ANY_ORIGIN = "FillingPasswordsFromAnyOrigin";
311     public static final String FOCUS_OMNIBOX_IN_INCOGNITO_TAB_INTENTS =
312             "FocusOmniboxInIncognitoTabIntents";
313     public static final String GRANT_NOTIFICATIONS_TO_DSE = "GrantNotificationsToDSE";
314     public static final String HANDLE_MEDIA_INTENTS = "HandleMediaIntents";
315     public static final String HIDE_FROM_API_3_TRANSITIONS_FROM_HISTORY =
316             "HideFromApi3TransitionsFromHistory";
317     public static final String HOMEPAGE_PROMO_CARD = "HomepagePromoCard";
318     public static final String HOMEPAGE_PROMO_SYNTHETIC_PROMO_SEEN_ENABLED =
319             "HomepagePromoSyntheticPromoSeenEnabled";
320     public static final String HOMEPAGE_PROMO_SYNTHETIC_PROMO_SEEN_TRACKING =
321             "HomepagePromoSyntheticPromoSeenTracking";
322     public static final String HOMEPAGE_SETTINGS_UI_CONVERSION = "HomepageSettingsUIConversion";
323     public static final String HORIZONTAL_TAB_SWITCHER_ANDROID = "HorizontalTabSwitcherAndroid";
324     public static final String IMMERSIVE_UI_MODE = "ImmersiveUiMode";
325     public static final String INCOGNITO_SCREENSHOT = "IncognitoScreenshot";
326     public static final String INLINE_UPDATE_FLOW = "InlineUpdateFlow";
327     public static final String INSTALLABLE_AMBIENT_BADGE_INFOBAR = "InstallableAmbientBadgeInfoBar";
328     public static final String INSTANT_START = "InstantStart";
329     public static final String INTEREST_FEEDV1_CLICKS_AND_VIEWS_CONDITIONAL_UPLOAD =
330             "InterestFeedV1ClickAndViewActionsConditionalUpload";
331     public static final String INTEREST_FEED_CONTENT_SUGGESTIONS = "InterestFeedContentSuggestions";
332     public static final String INTEREST_FEED_NOTICE_CARD_AUTO_DISMISS =
333             "InterestFeedNoticeCardAutoDismiss";
334     public static final String INTEREST_FEED_SPINNER_ALWAYS_ANIMATE =
335             "InterestFeedSpinnerAlwaysAnimate";
336     public static final String INTEREST_FEED_V2 = "InterestFeedV2";
337     public static final String KITKAT_SUPPORTED = "KitKatSupported";
338     public static final String LOOKALIKE_NAVIGATION_URL_SUGGESTIONS_UI =
339             "LookalikeUrlNavigationSuggestionsUI";
340     public static final String MARK_HTTP_AS = "MarkHttpAs";
341     public static final String MESSAGES_FOR_ANDROID_INFRASTRUCTURE =
342             "MessagesForAndroidInfrastructure";
343     public static final String MOBILE_IDENTITY_CONSISTENCY = "MobileIdentityConsistency";
344     public static final String MODAL_PERMISSION_DIALOG_VIEW = "ModalPermissionDialogView";
345     public static final String METRICS_SETTINGS_ANDROID = "MetricsSettingsAndroid";
346     public static final String NEW_PHOTO_PICKER = "NewPhotoPicker";
347     public static final String NOTIFICATION_SUSPENDER = "NotificationSuspender";
348     public static final String OFFLINE_INDICATOR = "OfflineIndicator";
349     public static final String OFFLINE_INDICATOR_ALWAYS_HTTP_PROBE =
350             "OfflineIndicatorAlwaysHttpProbe";
351     public static final String OFFLINE_INDICATOR_V2 = "OfflineIndicatorV2";
352     public static final String OFFLINE_PAGES_DESCRIPTIVE_FAIL_STATUS =
353             "OfflinePagesDescriptiveFailStatus";
354     public static final String OFFLINE_PAGES_DESCRIPTIVE_PENDING_STATUS =
355             "OfflinePagesDescriptivePendingStatus";
356     public static final String OFFLINE_PAGES_LIVE_PAGE_SHARING = "OfflinePagesLivePageSharing";
357     public static final String OFFLINE_PAGES_PREFETCHING = "OfflinePagesPrefetching";
358     public static final String OMNIBOX_ADAPTIVE_SUGGESTIONS_COUNT =
359             "OmniboxAdaptiveSuggestionsCount";
360     public static final String OMNIBOX_ASSISTANT_VOICE_SEARCH = "OmniboxAssistantVoiceSearch";
361     public static final String OMNIBOX_COMPACT_SUGGESTIONS = "OmniboxCompactSuggestions";
362     public static final String OMNIBOX_ENABLE_CLIPBOARD_PROVIDER_IMAGE_SUGGESTIONS =
363             "OmniboxEnableClipboardProviderImageSuggestions";
364     public static final String OMNIBOX_HIDE_VISITS_FROM_CCT = "OmniboxHideVisitsFromCct";
365     public static final String OMNIBOX_MOST_VISITED_TILES = "OmniboxMostVisitedTiles";
366     public static final String OMNIBOX_SEARCH_ENGINE_LOGO = "OmniboxSearchEngineLogo";
367     public static final String OMNIBOX_SEARCH_READY_INCOGNITO = "OmniboxSearchReadyIncognito";
368     public static final String OMNIBOX_SPARE_RENDERER = "OmniboxSpareRenderer";
369     public static final String OVERLAY_NEW_LAYOUT = "OverlayNewLayout";
370     public static final String OVERSCROLL_HISTORY_NAVIGATION = "OverscrollHistoryNavigation";
371     public static final String PAGE_INFO_PERFORMANCE_HINTS = "PageInfoPerformanceHints";
372     public static final String PAINT_PREVIEW_DEMO = "PaintPreviewDemo";
373     public static final String PAINT_PREVIEW_SHOW_ON_STARTUP = "PaintPreviewShowOnStartup";
374     public static final String PASSWORD_CHECK = "PasswordCheck";
375     public static final String PASSWORD_SCRIPTS_FETCHING = "PasswordScriptsFetching";
376     public static final String PAY_WITH_GOOGLE_V1 = "PayWithGoogleV1";
377     public static final String PERMISSION_DELEGATION = "PermissionDelegation";
378     public static final String PHOTO_PICKER_VIDEO_SUPPORT = "PhotoPickerVideoSupport";
379     public static final String PHOTO_PICKER_ZOOM = "PhotoPickerZoom";
380     public static final String PORTALS = "Portals";
381     public static final String PORTALS_CROSS_ORIGIN = "PortalsCrossOrigin";
382     public static final String PREDICTIVE_PREFETCHING_ALLOWED_ON_ALL_CONNECTION_TYPES =
383             "PredictivePrefetchingAllowedOnAllConnectionTypes";
384     public static final String PREFETCH_NOTIFICATION_SCHEDULING_INTEGRATION =
385             "PrefetchNotificationSchedulingIntegration";
386     public static final String PRIORITIZE_BOOTSTRAP_TASKS = "PrioritizeBootstrapTasks";
387     public static final String PRIVACY_REORDERED_ANDROID = "PrivacyReorderedAndroid";
388     public static final String PROBABILISTIC_CRYPTID_RENDERER = "ProbabilisticCryptidRenderer";
389     public static final String QUERY_TILES_GEO_FILTER = "QueryTilesGeoFilter";
390     public static final String QUERY_TILES = "QueryTiles";
391     public static final String QUERY_TILES_IN_NTP = "QueryTilesInNTP";
392     public static final String QUERY_TILES_IN_OMNIBOX = "QueryTilesInOmnibox";
393     public static final String QUERY_TILES_ENABLE_QUERY_EDITING = "QueryTilesEnableQueryEditing";
394     public static final String QUERY_TILES_LOCAL_ORDERING = "QueryTilesLocalOrdering";
395     public static final String QUIET_NOTIFICATION_PROMPTS = "QuietNotificationPrompts";
396     public static final String REACHED_CODE_PROFILER = "ReachedCodeProfiler";
397     public static final String READ_LATER = "ReadLater";
398     public static final String READER_MODE_IN_CCT = "ReaderModeInCCT";
399     public static final String RECOVER_FROM_NEVER_SAVE_ANDROID = "RecoverFromNeverSaveAndroid";
400     public static final String REENGAGEMENT_NOTIFICATION = "ReengagementNotification";
401     public static final String REMOVE_NAVIGATION_HISTORY = "RemoveNavigationHistory";
402     public static final String RELATED_SEARCHES = "RelatedSearches";
403     public static final String REPORT_FEED_USER_ACTIONS = "ReportFeedUserActions";
404     public static final String SAFETY_CHECK_ANDROID = "SafetyCheckAndroid";
405     public static final String SAFE_BROWSING_DELAYED_WARNINGS = "SafeBrowsingDelayedWarnings";
406     public static final String SAFE_BROWSING_ENHANCED_PROTECTION_ENABLED =
407             "SafeBrowsingEnhancedProtection";
408     public static final String SAFE_BROWSING_SECTION_UI = "SafeBrowsingSecuritySectionUIAndroid";
409     public static final String SAME_SITE_BY_DEFAULT_COOKIES = "SameSiteByDefaultCookies";
410     public static final String SEARCH_ENGINE_PROMO_EXISTING_DEVICE =
411             "SearchEnginePromo.ExistingDevice";
412     public static final String SEARCH_ENGINE_PROMO_NEW_DEVICE = "SearchEnginePromo.NewDevice";
413     public static final String SEND_TAB_TO_SELF = "SyncSendTabToSelf";
414     public static final String SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH =
415             "ServiceManagerForBackgroundPrefetch";
416     public static final String SERVICE_MANAGER_FOR_DOWNLOAD = "ServiceManagerForDownload";
417     public static final String SHARE_BUTTON_IN_TOP_TOOLBAR = "ShareButtonInTopToolbar";
418     public static final String SHARE_BY_DEFAULT_IN_CCT = "ShareByDefaultInCCT";
419     public static final String SHARED_CLIPBOARD_UI = "SharedClipboardUI";
420     public static final String SHARING_QR_CODE_ANDROID = "SharingQrCodeAndroid";
421     public static final String SHOW_TRUSTED_PUBLISHER_URL = "ShowTrustedPublisherURL";
422     public static final String SMART_SUGGESTION_FOR_LARGE_DOWNLOADS =
423             "SmartSuggestionForLargeDownloads";
424     public static final String SPANNABLE_INLINE_AUTOCOMPLETE = "SpannableInlineAutocomplete";
425     public static final String SPLIT_CACHE_BY_NETWORK_ISOLATION_KEY =
426             "SplitCacheByNetworkIsolationKey";
427     public static final String START_SURFACE_ANDROID = "StartSurfaceAndroid";
428     public static final String SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT =
429             "SwapPixelFormatToFixConvertFromTranslucent";
430     public static final String SYNC_USE_SESSIONS_UNREGISTER_DELAY =
431             "SyncUseSessionsUnregisterDelay";
432     public static final String TAB_ENGAGEMENT_REPORTING_ANDROID = "TabEngagementReportingAndroid";
433     public static final String TAB_GROUPS_ANDROID = "TabGroupsAndroid";
434     public static final String TAB_GROUPS_UI_IMPROVEMENTS_ANDROID =
435             "TabGroupsUiImprovementsAndroid";
436     public static final String TAB_GROUPS_CONTINUATION_ANDROID = "TabGroupsContinuationAndroid";
437     public static final String TAB_GRID_LAYOUT_ANDROID = "TabGridLayoutAndroid";
438     public static final String TAB_REPARENTING = "TabReparenting";
439     public static final String TAB_SWITCHER_ON_RETURN = "TabSwitcherOnReturn";
440     public static final String TAB_TO_GTS_ANIMATION = "TabToGTSAnimation";
441     public static final String TABBED_APP_OVERFLOW_MENU_ICONS = "TabbedAppOverflowMenuIcons";
442     public static final String TABBED_APP_OVERFLOW_MENU_REGROUP = "TabbedAppOverflowMenuRegroup";
443     public static final String TABBED_APP_OVERFLOW_MENU_THREE_BUTTON_ACTIONBAR =
444             "TabbedAppOverflowMenuThreeButtonActionbar";
445     public static final String TEST_DEFAULT_DISABLED = "TestDefaultDisabled";
446     public static final String TEST_DEFAULT_ENABLED = "TestDefaultEnabled";
447     public static final String TOOLBAR_IPH_ANDROID = "ToolbarIphAndroid";
448     public static final String TRANSLATE_ASSIST_CONTENT = "TranslateAssistContent";
449     public static final String TRANSLATE_INTENT = "TranslateIntent";
450     public static final String TRUSTED_WEB_ACTIVITY_LOCATION_DELEGATION =
451             "TrustedWebActivityLocationDelegation";
452     public static final String TRUSTED_WEB_ACTIVITY_NEW_DISCLOSURE =
453             "TrustedWebActivityNewDisclosure";
454     public static final String TRUSTED_WEB_ACTIVITY_POST_MESSAGE = "TrustedWebActivityPostMessage";
455     public static final String TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT =
456             "TrustedWebActivityQualityEnforcement";
457     public static final String TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT_FORCED =
458             "TrustedWebActivityQualityEnforcementForced";
459     public static final String TRUSTED_WEB_ACTIVITY_QUALITY_ENFORCEMENT_WARNING =
460             "TrustedWebActivityQualityEnforcementWarning";
461     public static final String VIDEO_TUTORIALS = "VideoTutorials";
462     public static final String UPDATE_NOTIFICATION_SCHEDULING_INTEGRATION =
463             "UpdateNotificationSchedulingIntegration";
464     public static final String UPDATE_NOTIFICATION_IMMEDIATE_SHOW_OPTION =
465             "UpdateNotificationScheduleServiceImmediateShowOption";
466     public static final String USE_CHIME_ANDROID_SDK = "UseChimeAndroidSdk";
467     public static final String VOICE_SEARCH_AUDIO_CAPTURE_POLICY = "VoiceSearchAudioCapturePolicy";
468     public static final String VOICE_BUTTON_IN_TOP_TOOLBAR = "VoiceButtonInTopToolbar";
469     public static final String VR_BROWSING_FEEDBACK = "VrBrowsingFeedback";
470     public static final String WEBAPK_ADAPTIVE_ICON = "WebApkAdaptiveIcon";
471     public static final String WEB_AUTH = "WebAuthentication";
472     public static final String WEB_AUTH_PHONE_SUPPORT = "WebAuthenticationPhoneSupport";
473 
474     @NativeMethods
475     interface Natives {
isEnabled(String featureName)476         boolean isEnabled(String featureName);
getFieldTrialParamByFeature(String featureName, String paramName)477         String getFieldTrialParamByFeature(String featureName, String paramName);
getFieldTrialParamByFeatureAsInt( String featureName, String paramName, int defaultValue)478         int getFieldTrialParamByFeatureAsInt(
479                 String featureName, String paramName, int defaultValue);
getFieldTrialParamByFeatureAsDouble( String featureName, String paramName, double defaultValue)480         double getFieldTrialParamByFeatureAsDouble(
481                 String featureName, String paramName, double defaultValue);
getFieldTrialParamByFeatureAsBoolean( String featureName, String paramName, boolean defaultValue)482         boolean getFieldTrialParamByFeatureAsBoolean(
483                 String featureName, String paramName, boolean defaultValue);
484     }
485 }
486