Commit 5652aa6d authored by Henrique Nakashima's avatar Henrique Nakashima Committed by Commit Bot

Cleanup kAndroidNightModeCCT feature flag

Night mode flags are default enabled and can be removed to simplify the
code.

Bug: 1012975, 1018268
Change-Id: Ib380598ebcd0ca3ae1b2dc26df8cf7e311219adf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2070115Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Reviewed-by: default avatarPeter Conn <peconn@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744359}
parent db4ef552
...@@ -41,7 +41,6 @@ public class ChromeCachedFlags { ...@@ -41,7 +41,6 @@ public class ChromeCachedFlags {
List<String> featuresToCache = Arrays.asList(ChromeFeatureList.HOMEPAGE_LOCATION_POLICY, List<String> featuresToCache = Arrays.asList(ChromeFeatureList.HOMEPAGE_LOCATION_POLICY,
ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED, ChromeFeatureList.CHROME_DUET, ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED, ChromeFeatureList.CHROME_DUET,
ChromeFeatureList.CHROME_DUET_ADAPTIVE, ChromeFeatureList.CHROME_DUET_LABELED, ChromeFeatureList.CHROME_DUET_ADAPTIVE, ChromeFeatureList.CHROME_DUET_LABELED,
ChromeFeatureList.ANDROID_NIGHT_MODE_CCT,
ChromeFeatureList.DOWNLOADS_AUTO_RESUMPTION_NATIVE, ChromeFeatureList.DOWNLOADS_AUTO_RESUMPTION_NATIVE,
ChromeFeatureList.PRIORITIZE_BOOTSTRAP_TASKS, ChromeFeatureList.PRIORITIZE_BOOTSTRAP_TASKS,
ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS, ChromeFeatureList.INTEREST_FEED_CONTENT_SUGGESTIONS,
......
...@@ -12,7 +12,6 @@ import androidx.annotation.Nullable; ...@@ -12,7 +12,6 @@ import androidx.annotation.Nullable;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import org.chromium.base.ObserverList; import org.chromium.base.ObserverList;
import org.chromium.chrome.browser.flags.CachedFeatureFlags;
import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.chrome.browser.lifecycle.Destroyable; import org.chromium.chrome.browser.lifecycle.Destroyable;
import org.chromium.chrome.browser.night_mode.NightModeStateProvider; import org.chromium.chrome.browser.night_mode.NightModeStateProvider;
...@@ -57,8 +56,7 @@ public class CustomTabNightModeStateController implements Destroyable, NightMode ...@@ -57,8 +56,7 @@ public class CustomTabNightModeStateController implements Destroyable, NightMode
* @param intent The {@link Intent} to retrieve information about the initial state. * @param intent The {@link Intent} to retrieve information about the initial state.
*/ */
void initialize(AppCompatDelegate delegate, Intent intent) { void initialize(AppCompatDelegate delegate, Intent intent) {
if (!NightModeUtils.isNightModeSupported() if (!NightModeUtils.isNightModeSupported()) {
|| !CachedFeatureFlags.isNightModeForCustomTabsAvailable()) {
// Always stay in light mode if night mode is not available. // Always stay in light mode if night mode is not available.
mRequestedColorScheme = CustomTabsIntent.COLOR_SCHEME_LIGHT; mRequestedColorScheme = CustomTabsIntent.COLOR_SCHEME_LIGHT;
return; return;
......
...@@ -64,7 +64,6 @@ public class CachedFeatureFlags { ...@@ -64,7 +64,6 @@ public class CachedFeatureFlags {
put(ChromeFeatureList.PRIORITIZE_BOOTSTRAP_TASKS, true); put(ChromeFeatureList.PRIORITIZE_BOOTSTRAP_TASKS, true);
put(ChromeFeatureList.IMMERSIVE_UI_MODE, false); put(ChromeFeatureList.IMMERSIVE_UI_MODE, false);
put(ChromeFeatureList.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT, true); put(ChromeFeatureList.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT, true);
put(ChromeFeatureList.ANDROID_NIGHT_MODE_CCT, true);
put(ChromeFeatureList.START_SURFACE_ANDROID, false); put(ChromeFeatureList.START_SURFACE_ANDROID, false);
put(ChromeFeatureList.PAINT_PREVIEW_TEST, false); put(ChromeFeatureList.PAINT_PREVIEW_TEST, false);
put(ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID, false); put(ChromeFeatureList.TAB_GRID_LAYOUT_ANDROID, false);
...@@ -104,8 +103,6 @@ public class CachedFeatureFlags { ...@@ -104,8 +103,6 @@ public class CachedFeatureFlags {
put(ChromeFeatureList.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT, put(ChromeFeatureList.SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT,
ChromePreferenceKeys ChromePreferenceKeys
.FLAGS_CACHED_SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT); .FLAGS_CACHED_SWAP_PIXEL_FORMAT_TO_FIX_CONVERT_FROM_TRANSLUCENT);
put(ChromeFeatureList.ANDROID_NIGHT_MODE_CCT,
ChromePreferenceKeys.FLAGS_CACHED_NIGHT_MODE_CCT_AVAILABLE);
put(ChromeFeatureList.START_SURFACE_ANDROID, put(ChromeFeatureList.START_SURFACE_ANDROID,
ChromePreferenceKeys.FLAGS_CACHED_START_SURFACE_ENABLED); ChromePreferenceKeys.FLAGS_CACHED_START_SURFACE_ENABLED);
put(ChromeFeatureList.PAINT_PREVIEW_TEST, put(ChromeFeatureList.PAINT_PREVIEW_TEST,
...@@ -284,22 +281,6 @@ public class CachedFeatureFlags { ...@@ -284,22 +281,6 @@ public class CachedFeatureFlags {
return isEnabled(ChromeFeatureList.CHROME_DUET_LABELED) && isBottomToolbarEnabled(); return isEnabled(ChromeFeatureList.CHROME_DUET_LABELED) && isBottomToolbarEnabled();
} }
/**
* @return Whether or not night mode experiment is enabled (i.e. night mode experiment is
* enabled) for custom tabs.
*/
public static boolean isNightModeForCustomTabsAvailable() {
return isEnabled(ChromeFeatureList.ANDROID_NIGHT_MODE_CCT);
}
/**
* Toggles whether the night mode for custom tabs experiment is enabled. Must only be used for
* testing. Should be reset back to NULL after the test has finished.
*/
public static void setNightModeForCustomTabsAvailableForTesting(Boolean available) {
setForTesting(ChromeFeatureList.ANDROID_NIGHT_MODE_CCT, available);
}
public static boolean isCommandLineOnNonRootedEnabled() { public static boolean isCommandLineOnNonRootedEnabled() {
return isEnabled(ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED); return isEnabled(ChromeFeatureList.COMMAND_LINE_ON_NON_ROOTED);
} }
......
...@@ -93,7 +93,6 @@ import org.chromium.chrome.browser.browserservices.SessionDataHolder; ...@@ -93,7 +93,6 @@ import org.chromium.chrome.browser.browserservices.SessionDataHolder;
import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason; import org.chromium.chrome.browser.customtabs.content.CustomTabActivityNavigationController.FinishReason;
import org.chromium.chrome.browser.document.ChromeLauncherActivity; import org.chromium.chrome.browser.document.ChromeLauncherActivity;
import org.chromium.chrome.browser.firstrun.FirstRunStatus; import org.chromium.chrome.browser.firstrun.FirstRunStatus;
import org.chromium.chrome.browser.flags.CachedFeatureFlags;
import org.chromium.chrome.browser.history.BrowsingHistoryBridge; import org.chromium.chrome.browser.history.BrowsingHistoryBridge;
import org.chromium.chrome.browser.history.HistoryItem; import org.chromium.chrome.browser.history.HistoryItem;
import org.chromium.chrome.browser.history.TestBrowsingHistoryObserver; import org.chromium.chrome.browser.history.TestBrowsingHistoryObserver;
...@@ -2326,8 +2325,6 @@ public class CustomTabActivityTest { ...@@ -2326,8 +2325,6 @@ public class CustomTabActivityTest {
@SmallTest @SmallTest
@DisableIf.Build(sdk_is_greater_than = 20) @DisableIf.Build(sdk_is_greater_than = 20)
public void testLaunchCustomTabWithColorSchemeDark_Kitkat() { public void testLaunchCustomTabWithColorSchemeDark_Kitkat() {
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(true);
Intent intent = createMinimalCustomTabIntent(); Intent intent = createMinimalCustomTabIntent();
addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK); addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK);
...@@ -2338,16 +2335,12 @@ public class CustomTabActivityTest { ...@@ -2338,16 +2335,12 @@ public class CustomTabActivityTest {
Assert.assertNotNull(cctActivity.getNightModeStateProvider()); Assert.assertNotNull(cctActivity.getNightModeStateProvider());
Assert.assertFalse("Night mode should be disabled on K with dark color scheme set.", Assert.assertFalse("Night mode should be disabled on K with dark color scheme set.",
cctActivity.getNightModeStateProvider().isInNightMode()); cctActivity.getNightModeStateProvider().isInNightMode());
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(null);
} }
@Test @Test
@SmallTest @SmallTest
@DisableIf.Build(sdk_is_less_than = 21) @DisableIf.Build(sdk_is_less_than = 21)
public void testLaunchCustomTabWithColorSchemeDark_PostKitkat() { public void testLaunchCustomTabWithColorSchemeDark_PostKitkat() {
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(true);
Intent intent = createMinimalCustomTabIntent(); Intent intent = createMinimalCustomTabIntent();
addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK); addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_DARK);
...@@ -2359,15 +2352,11 @@ public class CustomTabActivityTest { ...@@ -2359,15 +2352,11 @@ public class CustomTabActivityTest {
Assert.assertTrue("Night mode should be enabled on K+ with dark color scheme set.", Assert.assertTrue("Night mode should be enabled on K+ with dark color scheme set.",
cctActivity.getNightModeStateProvider().isInNightMode()); cctActivity.getNightModeStateProvider().isInNightMode());
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(null);
} }
@Test @Test
@SmallTest @SmallTest
public void testLaunchCustomTabWithColorSchemeLight() { public void testLaunchCustomTabWithColorSchemeLight() {
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(true);
Intent intent = createMinimalCustomTabIntent(); Intent intent = createMinimalCustomTabIntent();
addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_LIGHT); addColorSchemeToIntent(intent, CustomTabsIntent.COLOR_SCHEME_LIGHT);
...@@ -2377,8 +2366,6 @@ public class CustomTabActivityTest { ...@@ -2377,8 +2366,6 @@ public class CustomTabActivityTest {
Assert.assertNotNull(cctActivity.getNightModeStateProvider()); Assert.assertNotNull(cctActivity.getNightModeStateProvider());
Assert.assertFalse(cctActivity.getNightModeStateProvider().isInNightMode()); Assert.assertFalse(cctActivity.getNightModeStateProvider().isInNightMode());
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(null);
} }
private void addColorSchemeToIntent(Intent intent, int colorScheme) { private void addColorSchemeToIntent(Intent intent, int colorScheme) {
......
...@@ -21,7 +21,6 @@ import android.support.v7.app.AppCompatDelegate; ...@@ -21,7 +21,6 @@ import android.support.v7.app.AppCompatDelegate;
import androidx.browser.customtabs.CustomTabsIntent; import androidx.browser.customtabs.CustomTabsIntent;
import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
...@@ -32,7 +31,6 @@ import org.mockito.MockitoAnnotations; ...@@ -32,7 +31,6 @@ import org.mockito.MockitoAnnotations;
import org.robolectric.annotation.Config; import org.robolectric.annotation.Config;
import org.chromium.base.test.BaseRobolectricTestRunner; import org.chromium.base.test.BaseRobolectricTestRunner;
import org.chromium.chrome.browser.flags.CachedFeatureFlags;
import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher; import org.chromium.chrome.browser.lifecycle.ActivityLifecycleDispatcher;
import org.chromium.chrome.browser.night_mode.NightModeStateProvider; import org.chromium.chrome.browser.night_mode.NightModeStateProvider;
import org.chromium.chrome.browser.night_mode.PowerSavingModeMonitor; import org.chromium.chrome.browser.night_mode.PowerSavingModeMonitor;
...@@ -68,12 +66,6 @@ public class CustomTabNightModeStateControllerTest { ...@@ -68,12 +66,6 @@ public class CustomTabNightModeStateControllerTest {
mPowerSavingObserverCaptor.capture()); mPowerSavingObserverCaptor.capture());
mNightModeController = new CustomTabNightModeStateController(mActivityLifecycleDispatcher, mNightModeController = new CustomTabNightModeStateController(mActivityLifecycleDispatcher,
mSystemNightModeMonitor, mPowerSavingModeMonitor); mSystemNightModeMonitor, mPowerSavingModeMonitor);
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(true);
}
@After
public void tearDown() {
CachedFeatureFlags.setNightModeForCustomTabsAvailableForTesting(false);
} }
@Test @Test
......
...@@ -97,7 +97,6 @@ const base::Feature* kFeaturesExposedToJava[] = { ...@@ -97,7 +97,6 @@ const base::Feature* kFeaturesExposedToJava[] = {
&kAllowNewIncognitoTabIntents, &kAllowNewIncognitoTabIntents,
&kAllowRemoteContextForNotifications, &kAllowRemoteContextForNotifications,
&kAndroidBlockIntentNonSafelistedHeaders, &kAndroidBlockIntentNonSafelistedHeaders,
&kAndroidNightModeCCT,
&kAndroidNightModeTabReparenting, &kAndroidNightModeTabReparenting,
&kAndroidPayIntegrationV1, &kAndroidPayIntegrationV1,
&kAndroidPayIntegrationV2, &kAndroidPayIntegrationV2,
...@@ -271,9 +270,6 @@ const base::Feature kAndroidBlockIntentNonSafelistedHeaders{ ...@@ -271,9 +270,6 @@ const base::Feature kAndroidBlockIntentNonSafelistedHeaders{
"AndroidBlockIntentNonSafelistedHeaders", "AndroidBlockIntentNonSafelistedHeaders",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAndroidNightModeCCT{"AndroidNightModeCCT",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kAndroidNightModeTabReparenting{ const base::Feature kAndroidNightModeTabReparenting{
"AndroidNightModeTabReparenting", base::FEATURE_ENABLED_BY_DEFAULT}; "AndroidNightModeTabReparenting", base::FEATURE_ENABLED_BY_DEFAULT};
......
...@@ -16,7 +16,6 @@ extern const base::Feature kAdjustWebApkInstallationSpace; ...@@ -16,7 +16,6 @@ extern const base::Feature kAdjustWebApkInstallationSpace;
extern const base::Feature kAllowNewIncognitoTabIntents; extern const base::Feature kAllowNewIncognitoTabIntents;
extern const base::Feature kAllowRemoteContextForNotifications; extern const base::Feature kAllowRemoteContextForNotifications;
extern const base::Feature kAndroidBlockIntentNonSafelistedHeaders; extern const base::Feature kAndroidBlockIntentNonSafelistedHeaders;
extern const base::Feature kAndroidNightModeCCT;
extern const base::Feature kAndroidNightModeTabReparenting; extern const base::Feature kAndroidNightModeTabReparenting;
extern const base::Feature kAndroidPayIntegrationV1; extern const base::Feature kAndroidPayIntegrationV1;
extern const base::Feature kAndroidPayIntegrationV2; extern const base::Feature kAndroidPayIntegrationV2;
......
...@@ -208,7 +208,6 @@ public abstract class ChromeFeatureList { ...@@ -208,7 +208,6 @@ public abstract class ChromeFeatureList {
public static final String ADJUST_WEBAPK_INSTALLATION_SPACE = "AdjustWebApkInstallationSpace"; public static final String ADJUST_WEBAPK_INSTALLATION_SPACE = "AdjustWebApkInstallationSpace";
public static final String ANDROID_BLOCK_INTENT_NON_SAFELISTED_HEADERS = public static final String ANDROID_BLOCK_INTENT_NON_SAFELISTED_HEADERS =
"AndroidBlockIntentNonSafelistedHeaders"; "AndroidBlockIntentNonSafelistedHeaders";
public static final String ANDROID_NIGHT_MODE_CCT = "AndroidNightModeCCT";
public static final String ANDROID_NIGHT_MODE_TAB_REPARENTING = public static final String ANDROID_NIGHT_MODE_TAB_REPARENTING =
"AndroidNightModeTabReparenting"; "AndroidNightModeTabReparenting";
public static final String ANDROID_PAY_INTEGRATION_V1 = "AndroidPayIntegrationV1"; public static final String ANDROID_PAY_INTEGRATION_V1 = "AndroidPayIntegrationV1";
......
...@@ -332,11 +332,6 @@ public final class ChromePreferenceKeys { ...@@ -332,11 +332,6 @@ public final class ChromePreferenceKeys {
*/ */
public static final String FLAGS_CACHED_NETWORK_SERVICE_WARM_UP_ENABLED = public static final String FLAGS_CACHED_NETWORK_SERVICE_WARM_UP_ENABLED =
"network_service_warm_up_enabled"; "network_service_warm_up_enabled";
/**
* Whether or not night mode is available for custom tabs.
* Default value is false.
*/
public static final String FLAGS_CACHED_NIGHT_MODE_CCT_AVAILABLE = "night_mode_cct_available";
/** /**
* Whether the Paint Preview Capture menu item is enabled. * Whether the Paint Preview Capture menu item is enabled.
* Default value is false. * Default value is false.
...@@ -734,6 +729,7 @@ public final class ChromePreferenceKeys { ...@@ -734,6 +729,7 @@ public final class ChromePreferenceKeys {
"homepage_tile_enabled", "homepage_tile_enabled",
"inflate_toolbar_on_background_thread", "inflate_toolbar_on_background_thread",
"night_mode_available", "night_mode_available",
"night_mode_cct_available",
"night_mode_default_to_light", "night_mode_default_to_light",
"ntp_button_enabled", "ntp_button_enabled",
"ntp_button_variant", "ntp_button_variant",
...@@ -830,7 +826,6 @@ public final class ChromePreferenceKeys { ...@@ -830,7 +826,6 @@ public final class ChromePreferenceKeys {
FLAGS_CACHED_INTEREST_FEED_CONTENT_SUGGESTIONS, FLAGS_CACHED_INTEREST_FEED_CONTENT_SUGGESTIONS,
FLAGS_CACHED_LABELED_BOTTOM_TOOLBAR_ENABLED, FLAGS_CACHED_LABELED_BOTTOM_TOOLBAR_ENABLED,
FLAGS_CACHED_NETWORK_SERVICE_WARM_UP_ENABLED, FLAGS_CACHED_NETWORK_SERVICE_WARM_UP_ENABLED,
FLAGS_CACHED_NIGHT_MODE_CCT_AVAILABLE,
FLAGS_CACHED_PRIORITIZE_BOOTSTRAP_TASKS, FLAGS_CACHED_PRIORITIZE_BOOTSTRAP_TASKS,
FLAGS_CACHED_SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH, FLAGS_CACHED_SERVICE_MANAGER_FOR_BACKGROUND_PREFETCH,
FLAGS_CACHED_SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION, FLAGS_CACHED_SERVICE_MANAGER_FOR_DOWNLOAD_RESUMPTION,
......
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