Commit 3526bc38 authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Move names of prefs used only by FeatureUtilities into it.

This guarantees no other classes use the same prefs.

These pref names will be replaced eventually by a name generated from
the flag.

Bug: 1012975
Change-Id: If072aece06e1dd54a148e316f94c06e439f7032e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1854531
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705333}
parent 1adb1723
......@@ -104,13 +104,6 @@ public class ChromePreferenceManager {
public static final String CONTEXTUAL_SEARCH_PREVIOUS_INTERACTION_TIMESTAMP =
"contextual_search_previous_interaction_timestamp";
/**
* Key to cache whether
* {@link ChromeFeatureList#SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT} is enabled.
*/
public static final String SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT =
"swap_pixel_format_to_fix_convert_from_translucent";
/**
* Whether the promotion for data reduction has been skipped on first invocation.
* Default value is false.
......@@ -191,43 +184,6 @@ public class ChromePreferenceManager {
private static final String INFLATE_TOOLBAR_ON_BACKGROUND_THREAD_KEY =
"inflate_toolbar_on_background_thread";
/**
* Whether or not the bottom toolbar is enabled.
* Default value is false.
*/
public static final String BOTTOM_TOOLBAR_ENABLED_KEY = "bottom_toolbar_enabled";
/**
* Whether or not the adaptive toolbar is enabled.
* Default value is true.
*/
public static final String ADAPTIVE_TOOLBAR_ENABLED_KEY = "adaptive_toolbar_enabled";
/**
* Whether or not the labeled bottom toolbar is enabled.
* Default value is false.
*/
public static final String LABELED_BOTTOM_TOOLBAR_ENABLED_KEY =
"labeled_bottom_toolbar_enabled";
/**
* Whether or not night mode is available.
* Default value is false.
*/
public static final String NIGHT_MODE_AVAILABLE_KEY = "night_mode_available";
/**
* Whether or not night mode should set "light" as the default option.
* Default value is false.
*/
public static final String NIGHT_MODE_DEFAULT_TO_LIGHT = "night_mode_default_to_light";
/**
* Whether or not night mode is available for custom tabs.
* Default value is false.
*/
public static final String NIGHT_MODE_CCT_AVAILABLE_KEY = "night_mode_cct_available";
/**
* The current theme setting in the user settings.
* Default value is -1. Use NightModeUtils#getThemeSetting() to retrieve current setting or
......@@ -241,13 +197,6 @@ public class ChromePreferenceManager {
*/
public static final String DARKEN_WEBSITES_ENABLED_KEY = "darken_websites_enabled";
/**
* Whether or not the download auto-resumption is enabled in native.
* Default value is true.
*/
public static final String DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY =
"download_auto_resumption_in_native";
/**
* Marks that the content suggestions surface has been shown.
* Default value is false.
......@@ -279,13 +228,6 @@ public class ChromePreferenceManager {
@Deprecated
public static final String SOLE_INTEGRATION_ENABLED_KEY = "sole_integration_enabled";
/**
* Whether or not command line on non-rooted devices is enabled.
* Default value is false.
*/
public static final String COMMAND_LINE_ON_NON_ROOTED_ENABLED_KEY =
"command_line_on_non_rooted_enabled";
private static final String VERIFIED_DIGITAL_ASSET_LINKS =
"verified_digital_asset_links";
private static final String TRUSTED_WEB_ACTIVITY_DISCLOSURE_ACCEPTED_PACKAGES =
......@@ -329,27 +271,6 @@ public class ChromePreferenceManager {
/** Key for deferred recording of list of uninstalled WebAPK packages. */
public static final String WEBAPK_UNINSTALLED_PACKAGES = "webapk_uninstalled_packages";
public static final String INTEREST_FEED_CONTENT_SUGGESTIONS_KEY =
"interest_feed_content_suggestions";
/**
* Whether or not the start surface is enabled.
* Default value is false.
*/
public static final String START_SURFACE_ENABLED_KEY = "start_surface_enabled";
/**
* Whether or not the grid tab switcher is enabled.
* Default value is false.
*/
public static final String GRID_TAB_SWITCHER_ENABLED_KEY = "grid_tab_switcher_enabled";
/**
* Whether or not the tab group is enabled.
* Default value is false.
*/
public static final String TAB_GROUPS_ANDROID_ENABLED_KEY = "tab_group_android_enabled";
/**
* Whether or not the tab group UI improvement is enabled.
* Default value is false.
......@@ -357,21 +278,6 @@ public class ChromePreferenceManager {
public static final String TAB_GROUPS_UI_IMPROVEMENTS_ANDROID_ENABLED_KEY =
"tab_group_ui_improvements_android_enabled";
/**
* Key for whether PrefetchBackgroundTask should load native in service manager only mode.
* Default value is false.
*/
public static final String SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY =
"service_manager_for_background_prefetch";
/**
* Key for whether DownloadResumptionBackgroundTask should load native in service manager only
* mode.
* Default value is false.
*/
public static final String SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY =
"service_manager_for_download_resumption";
/**
* Key for whether it allows to start in service manager only mode.
* Default value is false.
......@@ -388,37 +294,12 @@ public class ChromePreferenceManager {
public static final String CHROME_HOME_INFO_PROMO_SHOWN_KEY = "chrome_home_info_promo_shown";
public static final String CHROME_HOME_SHARED_PREFERENCES_KEY = "chrome_home_enabled_date";
/**
* Whether or not bootstrap tasks should be prioritized (i.e. bootstrap task prioritization
* experiment is enabled). Default value is true.
*/
public static final String PRIORITIZE_BOOTSTRAP_TASKS_KEY = "prioritize_bootstrap_tasks";
/**
* Whether warming up network service is enabled.
* Default value is false.
*/
public static final String NETWORK_SERVICE_WARM_UP_ENABLED_KEY =
"network_service_warm_up_enabled";
/**
* Contains a trial group that was used to determine whether the reached code profiler should be
* enabled.
*/
public static final String REACHED_CODE_PROFILER_GROUP_KEY = "reached_code_profiler_group";
/**
* Whether or not we should directly open the dialer when a click to call notification is
* received. Default value is false.
*/
public static final String CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY =
"click_to_call_open_dialer_directly";
/**
* Key to cache whether immersive ui mode is enabled.
*/
public static final String IMMERSIVE_UI_MODE_ENABLED = "immersive_ui_mode_enabled";
/**
* Key to cache whether offline indicator v2 (persistent offline indicator) is enabled.
*/
......
......@@ -71,6 +71,125 @@ import java.util.Map;
public class FeatureUtilities {
private static final String TAG = "FeatureUtilities";
/**
* Key for whether DownloadResumptionBackgroundTask should load native in service manager only
* mode.
* Default value is false.
*/
private static final String SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY =
"service_manager_for_download_resumption";
/**
* Key for whether PrefetchBackgroundTask should load native in service manager only mode.
* Default value is false.
*/
private static final String SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY =
"service_manager_for_background_prefetch";
private static final String INTEREST_FEED_CONTENT_SUGGESTIONS_KEY =
"interest_feed_content_suggestions";
/**
* Whether or not the download auto-resumption is enabled in native.
* Default value is true.
*/
private static final String DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY =
"download_auto_resumption_in_native";
/**
* Whether or not the bottom toolbar is enabled.
* Default value is false.
*/
private static final String BOTTOM_TOOLBAR_ENABLED_KEY = "bottom_toolbar_enabled";
/**
* Whether or not the adaptive toolbar is enabled.
* Default value is true.
*/
private static final String ADAPTIVE_TOOLBAR_ENABLED_KEY = "adaptive_toolbar_enabled";
/**
* Whether or not the labeled bottom toolbar is enabled.
* Default value is false.
*/
private static final String LABELED_BOTTOM_TOOLBAR_ENABLED_KEY =
"labeled_bottom_toolbar_enabled";
/**
* Whether or not night mode is available.
* Default value is false.
*/
private static final String NIGHT_MODE_AVAILABLE_KEY = "night_mode_available";
/**
* Whether or not night mode should set "light" as the default option.
* Default value is false.
*/
private static final String NIGHT_MODE_DEFAULT_TO_LIGHT = "night_mode_default_to_light";
/**
* Whether or not night mode is available for custom tabs.
* Default value is false.
*/
private static final String NIGHT_MODE_CCT_AVAILABLE_KEY = "night_mode_cct_available";
/**
* Whether or not command line on non-rooted devices is enabled.
* Default value is false.
*/
private static final String COMMAND_LINE_ON_NON_ROOTED_ENABLED_KEY =
"command_line_on_non_rooted_enabled";
/**
* Whether or not the start surface is enabled.
* Default value is false.
*/
private static final String START_SURFACE_ENABLED_KEY = "start_surface_enabled";
/**
* Whether or not the grid tab switcher is enabled.
* Default value is false.
*/
private static final String GRID_TAB_SWITCHER_ENABLED_KEY = "grid_tab_switcher_enabled";
/**
* Whether or not the tab group is enabled.
* Default value is false.
*/
private static final String TAB_GROUPS_ANDROID_ENABLED_KEY = "tab_group_android_enabled";
/**
* Whether or not bootstrap tasks should be prioritized (i.e. bootstrap task prioritization
* experiment is enabled). Default value is true.
*/
private static final String PRIORITIZE_BOOTSTRAP_TASKS_KEY = "prioritize_bootstrap_tasks";
/**
* Whether warming up network service is enabled.
* Default value is false.
*/
private static final String NETWORK_SERVICE_WARM_UP_ENABLED_KEY =
"network_service_warm_up_enabled";
/**
* Key to cache whether immersive ui mode is enabled.
*/
private static final String IMMERSIVE_UI_MODE_ENABLED = "immersive_ui_mode_enabled";
/**
* Key to cache whether
* {@link ChromeFeatureList#SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT} is enabled.
*/
private static final String SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT =
"swap_pixel_format_to_fix_convert_from_translucent";
/**
* Whether or not we should directly open the dialer when a click to call notification is
* received. Default value is false.
*/
private static final String CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY =
"click_to_call_open_dialer_directly";
private static Map<String, Boolean> sFlags = new HashMap<>();
private static Boolean sHasGoogleAccountAuthenticator;
private static Boolean sHasRecognitionIntentHandler;
......@@ -199,7 +318,7 @@ public class FeatureUtilities {
}
private static void cacheServiceManagerForDownloadResumption() {
cacheFlag(ChromePreferenceManager.SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY,
cacheFlag(SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY,
ChromeFeatureList.SERVICE_MANAGER_FOR_DOWNLOAD);
}
......@@ -207,12 +326,11 @@ public class FeatureUtilities {
* @return if DownloadResumptionBackgroundTask should load native in service manager only mode.
*/
public static boolean isServiceManagerForDownloadResumptionEnabled() {
return isFlagEnabled(
ChromePreferenceManager.SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY, false);
return isFlagEnabled(SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION_KEY, false);
}
public static void cacheServiceManagerForBackgroundPrefetch() {
cacheFlag(ChromePreferenceManager.SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY,
cacheFlag(SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY,
ChromeFeatureList.SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH);
}
......@@ -220,9 +338,7 @@ public class FeatureUtilities {
* @return if PrefetchBackgroundTask should load native in service manager only mode.
*/
public static boolean isServiceManagerForBackgroundPrefetchEnabled() {
return isFlagEnabled(
ChromePreferenceManager.SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY, false)
&& isFeedEnabled();
return isFlagEnabled(SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH_KEY, false) && isFeedEnabled();
}
/**
......@@ -230,7 +346,7 @@ public class FeatureUtilities {
* native is loaded.
*/
public static void cacheFeedEnabled() {
cacheFlag(ChromePreferenceManager.INTEREST_FEED_CONTENT_SUGGESTIONS_KEY,
cacheFlag(INTEREST_FEED_CONTENT_SUGGESTIONS_KEY,
ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS);
}
......@@ -238,7 +354,7 @@ public class FeatureUtilities {
* @return Whether or not the Feed is enabled (based on the cached value in SharedPrefs).
*/
public static boolean isFeedEnabled() {
return isFlagEnabled(ChromePreferenceManager.INTEREST_FEED_CONTENT_SUGGESTIONS_KEY, false);
return isFlagEnabled(INTEREST_FEED_CONTENT_SUGGESTIONS_KEY, false);
}
/**
......@@ -246,7 +362,7 @@ public class FeatureUtilities {
*/
@CalledByNative
public static boolean isDownloadAutoResumptionEnabledInNative() {
return isFlagEnabled(ChromePreferenceManager.DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY, true);
return isFlagEnabled(DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY, true);
}
/**
......@@ -254,8 +370,7 @@ public class FeatureUtilities {
* be made available immediately.
*/
public static void cacheBottomToolbarEnabled() {
cacheFlag(
ChromePreferenceManager.BOTTOM_TOOLBAR_ENABLED_KEY, ChromeFeatureList.CHROME_DUET);
cacheFlag(BOTTOM_TOOLBAR_ENABLED_KEY, ChromeFeatureList.CHROME_DUET);
}
/**
......@@ -263,8 +378,7 @@ public class FeatureUtilities {
* be made available immediately.
*/
public static void cacheAdaptiveToolbarEnabled() {
cacheFlag(ChromePreferenceManager.ADAPTIVE_TOOLBAR_ENABLED_KEY,
ChromeFeatureList.CHROME_DUET_ADAPTIVE);
cacheFlag(ADAPTIVE_TOOLBAR_ENABLED_KEY, ChromeFeatureList.CHROME_DUET_ADAPTIVE);
}
/**
......@@ -272,8 +386,7 @@ public class FeatureUtilities {
* be made available immediately.
*/
public static void cacheLabeledBottomToolbarEnabled() {
cacheFlag(ChromePreferenceManager.LABELED_BOTTOM_TOOLBAR_ENABLED_KEY,
ChromeFeatureList.CHROME_DUET_LABELED);
cacheFlag(LABELED_BOTTOM_TOOLBAR_ENABLED_KEY, ChromeFeatureList.CHROME_DUET_LABELED);
}
/**
......@@ -281,13 +394,13 @@ public class FeatureUtilities {
* value can be made available immediately.
*/
private static void cacheDownloadAutoResumptionEnabledInNative() {
cacheFlag(ChromePreferenceManager.DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY,
cacheFlag(DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY,
ChromeFeatureList.DOWNLOADS_AUTO_RESUMPTION_NATIVE);
}
@VisibleForTesting
public static void setDownloadAutoResumptionEnabledInNativeForTesting(Boolean value) {
sFlags.put(ChromePreferenceManager.DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY, value);
sFlags.put(DOWNLOAD_AUTO_RESUMPTION_IN_NATIVE_KEY, value);
}
/**
......@@ -295,7 +408,7 @@ public class FeatureUtilities {
*/
public static boolean isBottomToolbarEnabled() {
// TODO(crbug.com/944228): TabGroupsAndroid and ChromeDuet are incompatible for now.
return isFlagEnabled(ChromePreferenceManager.BOTTOM_TOOLBAR_ENABLED_KEY, false)
return isFlagEnabled(BOTTOM_TOOLBAR_ENABLED_KEY, false)
&& !DeviceFormFactor.isNonMultiDisplayContextOnTablet(
ContextUtils.getApplicationContext())
&& !isTabGroupsAndroidEnabled();
......@@ -306,23 +419,22 @@ public class FeatureUtilities {
*/
@VisibleForTesting
public static void setIsBottomToolbarEnabledForTesting(Boolean enabled) {
sFlags.put(ChromePreferenceManager.BOTTOM_TOOLBAR_ENABLED_KEY, enabled);
sFlags.put(BOTTOM_TOOLBAR_ENABLED_KEY, enabled);
}
/**
* @return Whether or not the adaptive toolbar is enabled.
*/
public static boolean isAdaptiveToolbarEnabled() {
return isFlagEnabled(ChromePreferenceManager.ADAPTIVE_TOOLBAR_ENABLED_KEY, true)
&& isBottomToolbarEnabled() && !isGridTabSwitcherEnabled();
return isFlagEnabled(ADAPTIVE_TOOLBAR_ENABLED_KEY, true) && isBottomToolbarEnabled()
&& !isGridTabSwitcherEnabled();
}
/**
* @return Whether or not the labeled bottom toolbar is enabled.
*/
public static boolean isLabeledBottomToolbarEnabled() {
return isFlagEnabled(ChromePreferenceManager.LABELED_BOTTOM_TOOLBAR_ENABLED_KEY, false)
&& isBottomToolbarEnabled();
return isFlagEnabled(LABELED_BOTTOM_TOOLBAR_ENABLED_KEY, false) && isBottomToolbarEnabled();
}
/**
......@@ -333,8 +445,7 @@ public class FeatureUtilities {
boolean available = ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_NIGHT_MODE)
|| (BuildInfo.isAtLeastQ()
&& ChromeFeatureList.isEnabled(ChromeFeatureList.ANDROID_NIGHT_MODE_FOR_Q));
ChromePreferenceManager.getInstance().writeBoolean(
ChromePreferenceManager.NIGHT_MODE_AVAILABLE_KEY, available);
ChromePreferenceManager.getInstance().writeBoolean(NIGHT_MODE_AVAILABLE_KEY, available);
}
/**
......@@ -342,7 +453,7 @@ public class FeatureUtilities {
* enabled).
*/
public static boolean isNightModeAvailable() {
return isFlagEnabled(ChromePreferenceManager.NIGHT_MODE_AVAILABLE_KEY, false);
return isFlagEnabled(NIGHT_MODE_AVAILABLE_KEY, false);
}
/**
......@@ -351,7 +462,7 @@ public class FeatureUtilities {
*/
@VisibleForTesting
public static void setNightModeAvailableForTesting(@Nullable Boolean available) {
sFlags.put(ChromePreferenceManager.NIGHT_MODE_AVAILABLE_KEY, available);
sFlags.put(NIGHT_MODE_AVAILABLE_KEY, available);
}
/**
......@@ -370,7 +481,7 @@ public class FeatureUtilities {
ChromeFeatureList.ANDROID_NIGHT_MODE, lightModeDefaultParam, false);
ChromePreferenceManager.getInstance().writeBoolean(
ChromePreferenceManager.NIGHT_MODE_DEFAULT_TO_LIGHT, lightModeAsDefault);
NIGHT_MODE_DEFAULT_TO_LIGHT, lightModeAsDefault);
}
/**
......@@ -380,7 +491,7 @@ public class FeatureUtilities {
if (BuildInfo.isAtLeastQ()) {
return false;
}
return isFlagEnabled(ChromePreferenceManager.NIGHT_MODE_DEFAULT_TO_LIGHT, false);
return isFlagEnabled(NIGHT_MODE_DEFAULT_TO_LIGHT, false);
}
/**
......@@ -389,7 +500,7 @@ public class FeatureUtilities {
*/
@VisibleForTesting
public static void setNightModeDefaultToLightForTesting(@Nullable Boolean available) {
sFlags.put(ChromePreferenceManager.NIGHT_MODE_DEFAULT_TO_LIGHT, available);
sFlags.put(NIGHT_MODE_DEFAULT_TO_LIGHT, available);
}
/**
......@@ -397,8 +508,7 @@ public class FeatureUtilities {
* enabled), so the value is immediately available on next start-up.
*/
public static void cacheNightModeForCustomTabsAvailable() {
cacheFlag(ChromePreferenceManager.NIGHT_MODE_CCT_AVAILABLE_KEY,
ChromeFeatureList.ANDROID_NIGHT_MODE_CCT);
cacheFlag(NIGHT_MODE_CCT_AVAILABLE_KEY, ChromeFeatureList.ANDROID_NIGHT_MODE_CCT);
}
/**
......@@ -406,7 +516,7 @@ public class FeatureUtilities {
* enabled) for custom tabs.
*/
public static boolean isNightModeForCustomTabsAvailable() {
return isFlagEnabled(ChromePreferenceManager.NIGHT_MODE_CCT_AVAILABLE_KEY, true);
return isFlagEnabled(NIGHT_MODE_CCT_AVAILABLE_KEY, true);
}
/**
......@@ -414,19 +524,19 @@ public class FeatureUtilities {
* testing. Should be reset back to NULL after the test has finished.
*/
public static void setNightModeForCustomTabsAvailableForTesting(Boolean available) {
sFlags.put(ChromePreferenceManager.NIGHT_MODE_CCT_AVAILABLE_KEY, available);
sFlags.put(NIGHT_MODE_CCT_AVAILABLE_KEY, available);
}
/**
* Cache whether or not command line is enabled on non-rooted devices.
*/
private static void cacheCommandLineOnNonRootedEnabled() {
cacheFlag(ChromePreferenceManager.COMMAND_LINE_ON_NON_ROOTED_ENABLED_KEY,
cacheFlag(COMMAND_LINE_ON_NON_ROOTED_ENABLED_KEY,
ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED);
}
public static boolean isCommandLineOnNonRootedEnabled() {
return isFlagEnabled(ChromePreferenceManager.COMMAND_LINE_ON_NON_ROOTED_ENABLED_KEY, false);
return isFlagEnabled(COMMAND_LINE_ON_NON_ROOTED_ENABLED_KEY, false);
}
/**
......@@ -437,20 +547,18 @@ public class FeatureUtilities {
}
private static void cacheStartSurfaceEnabled() {
cacheFlag(ChromePreferenceManager.START_SURFACE_ENABLED_KEY,
ChromeFeatureList.START_SURFACE_ANDROID);
cacheFlag(START_SURFACE_ENABLED_KEY, ChromeFeatureList.START_SURFACE_ANDROID);
}
/**
* @return Whether the Start Surface is enabled.
*/
public static boolean isStartSurfaceEnabled() {
return isFlagEnabled(ChromePreferenceManager.START_SURFACE_ENABLED_KEY, false);
return isFlagEnabled(START_SURFACE_ENABLED_KEY, false);
}
private static void cacheGridTabSwitcherEnabled() {
ChromePreferenceManager.getInstance().writeBoolean(
ChromePreferenceManager.GRID_TAB_SWITCHER_ENABLED_KEY,
ChromePreferenceManager.getInstance().writeBoolean(GRID_TAB_SWITCHER_ENABLED_KEY,
!DeviceClassManager.enableAccessibilityLayout()
&& (ChromeFeatureList.isEnabled(
ChromeFeatureList.DOWNLOAD_TAB_MANAGEMENT_MODULE)
......@@ -467,8 +575,7 @@ public class FeatureUtilities {
// TODO(yusufo): AccessibilityLayout check should not be here and the flow should support
// changing that setting while Chrome is alive.
// Having Tab Groups implies Grid Tab Switcher.
return isFlagEnabled(ChromePreferenceManager.GRID_TAB_SWITCHER_ENABLED_KEY, false)
|| isTabGroupsAndroidEnabled();
return isFlagEnabled(GRID_TAB_SWITCHER_ENABLED_KEY, false) || isTabGroupsAndroidEnabled();
}
/**
......@@ -477,12 +584,11 @@ public class FeatureUtilities {
*/
@VisibleForTesting
public static void setGridTabSwitcherEnabledForTesting(@Nullable Boolean enabled) {
sFlags.put(ChromePreferenceManager.GRID_TAB_SWITCHER_ENABLED_KEY, enabled);
sFlags.put(GRID_TAB_SWITCHER_ENABLED_KEY, enabled);
}
private static void cacheTabGroupsAndroidEnabled() {
ChromePreferenceManager.getInstance().writeBoolean(
ChromePreferenceManager.TAB_GROUPS_ANDROID_ENABLED_KEY,
ChromePreferenceManager.getInstance().writeBoolean(TAB_GROUPS_ANDROID_ENABLED_KEY,
!DeviceClassManager.enableAccessibilityLayout()
&& (ChromeFeatureList.isEnabled(
ChromeFeatureList.DOWNLOAD_TAB_MANAGEMENT_MODULE)
......@@ -497,7 +603,7 @@ public class FeatureUtilities {
* @return Whether the tab group feature is enabled and available for use.
*/
public static boolean isTabGroupsAndroidEnabled() {
return isFlagEnabled(ChromePreferenceManager.TAB_GROUPS_ANDROID_ENABLED_KEY, false);
return isFlagEnabled(TAB_GROUPS_ANDROID_ENABLED_KEY, false);
}
/**
......@@ -506,7 +612,7 @@ public class FeatureUtilities {
*/
@VisibleForTesting
public static void setTabGroupsAndroidEnabledForTesting(@Nullable Boolean available) {
sFlags.put(ChromePreferenceManager.TAB_GROUPS_ANDROID_ENABLED_KEY, available);
sFlags.put(TAB_GROUPS_ANDROID_ENABLED_KEY, available);
}
/**
......@@ -515,7 +621,7 @@ public class FeatureUtilities {
*/
@VisibleForTesting
public static void setStartSurfaceEnabledForTesting(@Nullable Boolean isEnabled) {
sFlags.put(ChromePreferenceManager.START_SURFACE_ENABLED_KEY, isEnabled);
sFlags.put(START_SURFACE_ENABLED_KEY, isEnabled);
}
/**
......@@ -572,8 +678,7 @@ public class FeatureUtilities {
* can be made available immediately.
*/
public static void cachePrioritizeBootstrapTasks() {
cacheFlag(ChromePreferenceManager.PRIORITIZE_BOOTSTRAP_TASKS_KEY,
ChromeFeatureList.PRIORITIZE_BOOTSTRAP_TASKS);
cacheFlag(PRIORITIZE_BOOTSTRAP_TASKS_KEY, ChromeFeatureList.PRIORITIZE_BOOTSTRAP_TASKS);
}
/**
......@@ -581,7 +686,7 @@ public class FeatureUtilities {
* prioritization experiment is enabled).
*/
public static boolean shouldPrioritizeBootstrapTasks() {
return isFlagEnabled(ChromePreferenceManager.PRIORITIZE_BOOTSTRAP_TASKS_KEY, true);
return isFlagEnabled(PRIORITIZE_BOOTSTRAP_TASKS_KEY, true);
}
/**
......@@ -589,8 +694,7 @@ public class FeatureUtilities {
* can be made available immediately on next start up.
*/
private static void cacheNetworkServiceWarmUpEnabled() {
ChromePreferenceManager.getInstance().writeBoolean(
ChromePreferenceManager.NETWORK_SERVICE_WARM_UP_ENABLED_KEY,
ChromePreferenceManager.getInstance().writeBoolean(NETWORK_SERVICE_WARM_UP_ENABLED_KEY,
FeatureUtilitiesJni.get().isNetworkServiceWarmUpEnabled());
}
......@@ -598,19 +702,18 @@ public class FeatureUtilities {
* @return whether warming up network service is enabled.
*/
public static boolean isNetworkServiceWarmUpEnabled() {
return isFlagEnabled(ChromePreferenceManager.NETWORK_SERVICE_WARM_UP_ENABLED_KEY, false);
return isFlagEnabled(NETWORK_SERVICE_WARM_UP_ENABLED_KEY, false);
}
private static void cacheImmersiveUiModeEnabled() {
cacheFlag(ChromePreferenceManager.IMMERSIVE_UI_MODE_ENABLED,
ChromeFeatureList.IMMERSIVE_UI_MODE);
cacheFlag(IMMERSIVE_UI_MODE_ENABLED, ChromeFeatureList.IMMERSIVE_UI_MODE);
}
/**
* @return Whether immersive ui mode is enabled.
*/
public static boolean isImmersiveUiModeEnabled() {
return isFlagEnabled(ChromePreferenceManager.IMMERSIVE_UI_MODE_ENABLED, false);
return isFlagEnabled(IMMERSIVE_UI_MODE_ENABLED, false);
}
/**
......@@ -619,11 +722,11 @@ public class FeatureUtilities {
*/
public static boolean isSwapPixelFormatToFixConvertFromTranslucentEnabled() {
return ChromePreferenceManager.getInstance().readBoolean(
ChromePreferenceManager.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT, true);
SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT, true);
}
public static void cacheSwapPixelFormatToFixConvertFromTranslucentEnabled() {
cacheFlag(ChromePreferenceManager.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT,
cacheFlag(SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT,
ChromeFeatureList.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT);
}
......@@ -631,7 +734,7 @@ public class FeatureUtilities {
* Cache the value of the flag whether or not to directly open the dialer for click to call.
*/
public static void cacheClickToCallOpenDialerDirectlyEnabled() {
cacheFlag(ChromePreferenceManager.CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY,
cacheFlag(CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY,
ChromeFeatureList.CLICK_TO_CALL_OPEN_DIALER_DIRECTLY);
}
......@@ -640,7 +743,7 @@ public class FeatureUtilities {
* value in SharedPrefs).
*/
public static boolean isClickToCallOpenDialerDirectlyEnabled() {
return isFlagEnabled(ChromePreferenceManager.CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY, false);
return isFlagEnabled(CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY, false);
}
/**
......@@ -650,7 +753,7 @@ public class FeatureUtilities {
@VisibleForTesting
public static void setIsClickToCallOpenDialerDirectlyEnabledForTesting(
@Nullable Boolean isEnabled) {
sFlags.put(ChromePreferenceManager.CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY, isEnabled);
sFlags.put(CLICK_TO_CALL_OPEN_DIALER_DIRECTLY_KEY, isEnabled);
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment