Commit c25e5659 authored by Tarun Bansal's avatar Tarun Bansal Committed by Commit Bot

Enable DataReductionProxyMainMenu by default

Enable DataReductionProxyMainMenu by default. This has been
enabled for 99% of population for over a year.

Also, remove the variation param
"persistent_menu_item_enabled"
since we decided not to launch with that setting.
See the bug for more details.

Change-Id: I551f90132e3a5daaedd544cd7847c0949400f09f
Bug: 905911
Reviewed-on: https://chromium-review.googlesource.com/c/1338883Reviewed-by: default avatarMegan Jablonski <megjablon@chromium.org>
Reviewed-by: default avatarRobert Kaplow <rkaplow@chromium.org>
Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: Tarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#608939}
parent 634cdbfc
...@@ -201,9 +201,6 @@ public abstract class ChromeFeatureList { ...@@ -201,9 +201,6 @@ public abstract class ChromeFeatureList {
public static final String CUSTOM_CONTEXT_MENU = "CustomContextMenu"; public static final String CUSTOM_CONTEXT_MENU = "CustomContextMenu";
public static final String CUSTOM_FEEDBACK_UI = "CustomFeedbackUi"; public static final String CUSTOM_FEEDBACK_UI = "CustomFeedbackUi";
public static final String DEVELOPER_PREFERENCES = "DeveloperPreferences"; public static final String DEVELOPER_PREFERENCES = "DeveloperPreferences";
// Enables the Data Reduction Proxy menu item in the main menu rather than under Settings on
// Android.
public static final String DATA_REDUCTION_MAIN_MENU = "DataReductionProxyMainMenu";
public static final String DONT_PREFETCH_LIBRARIES = "DontPrefetchLibraries"; public static final String DONT_PREFETCH_LIBRARIES = "DontPrefetchLibraries";
public static final String DOWNLOAD_HOME_SHOW_STORAGE_INFO = "DownloadHomeShowStorageInfo"; public static final String DOWNLOAD_HOME_SHOW_STORAGE_INFO = "DownloadHomeShowStorageInfo";
public static final String DOWNLOAD_PROGRESS_INFOBAR = "DownloadProgressInfoBar"; public static final String DOWNLOAD_PROGRESS_INFOBAR = "DownloadProgressInfoBar";
......
...@@ -11,7 +11,6 @@ import org.chromium.base.ContextUtils; ...@@ -11,7 +11,6 @@ import org.chromium.base.ContextUtils;
import org.chromium.base.ThreadUtils; import org.chromium.base.ThreadUtils;
import org.chromium.base.VisibleForTesting; import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative; import org.chromium.base.annotations.CalledByNative;
import org.chromium.chrome.browser.ChromeFeatureList;
import org.chromium.chrome.browser.UrlConstants; import org.chromium.chrome.browser.UrlConstants;
import org.chromium.chrome.browser.preferences.datareduction.DataReductionDataUseItem; import org.chromium.chrome.browser.preferences.datareduction.DataReductionDataUseItem;
import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils; import org.chromium.chrome.browser.preferences.datareduction.DataReductionPromoUtils;
...@@ -66,13 +65,9 @@ public class DataReductionProxySettings { ...@@ -66,13 +65,9 @@ public class DataReductionProxySettings {
private static DataReductionProxySettings sSettings; private static DataReductionProxySettings sSettings;
private static final String DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF =
"BANDWIDTH_REDUCTION_PROXY_HAS_EVER_BEEN_ENABLED";
public static final String DATA_REDUCTION_FIRST_ENABLED_TIME = public static final String DATA_REDUCTION_FIRST_ENABLED_TIME =
"BANDWIDTH_REDUCTION_FIRST_ENABLED_TIME"; "BANDWIDTH_REDUCTION_FIRST_ENABLED_TIME";
private static final String PARAM_PERSISTENT_MENU_ITEM_ENABLED = "persistent_menu_item_enabled";
private static final long DATA_REDUCTION_MAIN_MENU_ITEM_SAVED_KB_THRESHOLD = 100; private static final long DATA_REDUCTION_MAIN_MENU_ITEM_SAVED_KB_THRESHOLD = 100;
private Callback<List<DataReductionDataUseItem>> mQueryDataUsageCallback; private Callback<List<DataReductionDataUseItem>> mQueryDataUsageCallback;
...@@ -176,32 +171,10 @@ public class DataReductionProxySettings { ...@@ -176,32 +171,10 @@ public class DataReductionProxySettings {
* Returns true if the Data Reduction Proxy menu item should be shown in the main menu. * Returns true if the Data Reduction Proxy menu item should be shown in the main menu.
*/ */
public boolean shouldUseDataReductionMainMenuItem() { public boolean shouldUseDataReductionMainMenuItem() {
if (!ChromeFeatureList.isEnabled(ChromeFeatureList.DATA_REDUCTION_MAIN_MENU)) return false; if (!isDataReductionProxyEnabled()) return false;
boolean data_reduction_main_menu_item_allowed = false;
if (ChromeFeatureList.getFieldTrialParamByFeatureAsBoolean(
ChromeFeatureList.DATA_REDUCTION_MAIN_MENU, PARAM_PERSISTENT_MENU_ITEM_ENABLED,
false)) {
// If the Data Reduction Proxy is enabled, set the pref storing that the proxy has
// ever been enabled.
if (isDataReductionProxyEnabled()) {
ContextUtils.getAppSharedPreferences()
.edit()
.putBoolean(DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF, true)
.apply();
}
data_reduction_main_menu_item_allowed =
ContextUtils.getAppSharedPreferences().getBoolean(
DATA_REDUCTION_HAS_EVER_BEEN_ENABLED_PREF, false);
} else {
data_reduction_main_menu_item_allowed = isDataReductionProxyEnabled();
}
if (data_reduction_main_menu_item_allowed) { return ConversionUtils.bytesToKilobytes(getContentLengthSavedInHistorySummary())
return ConversionUtils.bytesToKilobytes(getContentLengthSavedInHistorySummary()) >= DATA_REDUCTION_MAIN_MENU_ITEM_SAVED_KB_THRESHOLD;
>= DATA_REDUCTION_MAIN_MENU_ITEM_SAVED_KB_THRESHOLD;
}
return false;
} }
/** Returns true if the SPDY proxy is managed by an administrator's policy. */ /** Returns true if the SPDY proxy is managed by an administrator's policy. */
......
...@@ -91,31 +91,12 @@ public class DataSaverAppMenuTest { ...@@ -91,31 +91,12 @@ public class DataSaverAppMenuTest {
DataReductionProxySettings.setInstanceForTesting(mSettings); DataReductionProxySettings.setInstanceForTesting(mSettings);
} }
/**
* Verify the Data Saver item does not show when the feature isn't on, and the proxy is enabled.
*/
@Test
@SmallTest
@CommandLineFlags.Add("disable-field-trial-config")
@Feature({"Browser", "Main"})
public void testMenuDataSaverNoFeature() throws Throwable {
mActivityTestRule.runOnUiThread((Runnable) () -> {
ContextUtils.getAppSharedPreferences().edit().clear().apply();
Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId());
DataReductionProxySettings.getInstance().setDataReductionProxyEnabled(
mActivityTestRule.getActivity().getApplicationContext(), true);
Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId());
});
}
/** /**
* Verify the Data Saver footer shows with the flag when the proxy is on and the user has saved * Verify the Data Saver footer shows with the flag when the proxy is on and the user has saved
* at least 100KB of data. * at least 100KB of data.
*/ */
@Test @Test
@SmallTest @SmallTest
@CommandLineFlags.Add({"enable-features=DataReductionProxyMainMenu",
"disable-field-trial-config"})
@Feature({"Browser", "Main"}) @Feature({"Browser", "Main"})
public void testMenuDataSaver() throws Throwable { public void testMenuDataSaver() throws Throwable {
mActivityTestRule.runOnUiThread((Runnable) () -> { mActivityTestRule.runOnUiThread((Runnable) () -> {
...@@ -145,46 +126,4 @@ public class DataSaverAppMenuTest { ...@@ -145,46 +126,4 @@ public class DataSaverAppMenuTest {
Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId()); Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId());
}); });
} }
/**
* Verify the Data Saver footer shows with the flag when the proxy turns on and remains in the
* main menu.
*/
@Test
@SmallTest
@CommandLineFlags.Add({"enable-features=DataReductionProxyMainMenu<DataReductionProxyMainMenu",
"force-fieldtrials=DataReductionProxyMainMenu/Enabled",
"force-fieldtrial-params=DataReductionProxyMainMenu.Enabled:"
+ "persistent_menu_item_enabled/true",
"disable-field-trial-config"})
@Feature({"Browser", "Main"})
public void testMenuDataSaverPersistent() throws Throwable {
mActivityTestRule.runOnUiThread((Runnable) () -> {
ContextUtils.getAppSharedPreferences().edit().clear().apply();
// Data Saver hasn't been turned on, the footer shouldn't show.
Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId());
// Turn Data Saver on, the footer should not be shown, as the user hasn't saved any
// bytes yet.
DataReductionProxySettings.getInstance().setDataReductionProxyEnabled(
mActivityTestRule.getActivity().getApplicationContext(), true);
Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId());
// The user has only saved 50KB so far. Ensure footer is not shown since it is not above
// the threshold yet.
mSettings.setContentLengthSavedInHistorySummary(50 * 1024);
Assert.assertEquals(0, mAppMenuHandler.getDelegate().getFooterResourceId());
// The user has now saved 100KB. Ensure the footer is shown.
mSettings.setContentLengthSavedInHistorySummary(100 * 1024);
Assert.assertEquals(R.layout.data_reduction_main_menu_item,
mAppMenuHandler.getDelegate().getFooterResourceId());
// Ensure the footer remains if the proxy is turned off.
DataReductionProxySettings.getInstance().setDataReductionProxyEnabled(
mActivityTestRule.getActivity().getApplicationContext(), false);
Assert.assertEquals(R.layout.data_reduction_main_menu_item,
mAppMenuHandler.getDelegate().getFooterResourceId());
});
}
} }
...@@ -988,15 +988,6 @@ const FeatureEntry::FeatureVariation ...@@ -988,15 +988,6 @@ const FeatureEntry::FeatureVariation
nullptr}}; nullptr}};
#endif // OS_ANDROID #endif // OS_ANDROID
#if defined(OS_ANDROID)
const FeatureEntry::FeatureParam kPersistentMenuItemEnabled[] = {
{"persistent_menu_item_enabled", "true"}};
const FeatureEntry::FeatureVariation kDataReductionMainMenuFeatureVariations[] =
{{"(persistent)", kPersistentMenuItemEnabled,
base::size(kPersistentMenuItemEnabled), nullptr}};
#endif // OS_ANDROID
const FeatureEntry::FeatureParam kDetectingHeavyPagesLowThresholdEnabled[] = { const FeatureEntry::FeatureParam kDetectingHeavyPagesLowThresholdEnabled[] = {
{"PageCapMiB", "1"}, {"PageCapMiB", "1"},
{"MediaPageCapMiB", "1"}}; {"MediaPageCapMiB", "1"}};
...@@ -2229,14 +2220,6 @@ const FeatureEntry kFeatureEntries[] = { ...@@ -2229,14 +2220,6 @@ const FeatureEntry kFeatureEntries[] = {
kOsAndroid, kOsAndroid,
SINGLE_VALUE_TYPE(data_reduction_proxy::switches:: SINGLE_VALUE_TYPE(data_reduction_proxy::switches::
kEnableDataReductionProxySavingsPromo)}, kEnableDataReductionProxySavingsPromo)},
{"enable-data-reduction-proxy-main-menu",
flag_descriptions::kEnableDataReductionProxyMainMenuName,
flag_descriptions::kEnableDataReductionProxyMainMenuDescription,
kOsAndroid,
FEATURE_WITH_PARAMS_VALUE_TYPE(
data_reduction_proxy::features::kDataReductionMainMenu,
kDataReductionMainMenuFeatureVariations,
"DataReductionProxyMainMenu")},
{"enable-offline-previews", flag_descriptions::kEnableOfflinePreviewsName, {"enable-offline-previews", flag_descriptions::kEnableOfflinePreviewsName,
flag_descriptions::kEnableOfflinePreviewsDescription, kOsAndroid, flag_descriptions::kEnableOfflinePreviewsDescription, kOsAndroid,
FEATURE_VALUE_TYPE(previews::features::kOfflinePreviews)}, FEATURE_VALUE_TYPE(previews::features::kOfflinePreviews)},
......
...@@ -108,7 +108,6 @@ const base::Feature* kFeaturesExposedToJava[] = { ...@@ -108,7 +108,6 @@ const base::Feature* kFeaturesExposedToJava[] = {
&kDownloadProgressInfoBar, &kDownloadProgressInfoBar,
&kDownloadHomeV2, &kDownloadHomeV2,
&kDownloadHomeShowStorageInfo, &kDownloadHomeShowStorageInfo,
&data_reduction_proxy::features::kDataReductionMainMenu,
&kEphemeralTab, &kEphemeralTab,
&kExploreSites, &kExploreSites,
&kFullscreenActivity, &kFullscreenActivity,
......
...@@ -2428,11 +2428,6 @@ const char kEnableCustomFeedbackUiDescription[] = ...@@ -2428,11 +2428,6 @@ const char kEnableCustomFeedbackUiDescription[] =
"Enables a custom feedback UI when submitting feedback through Google " "Enables a custom feedback UI when submitting feedback through Google "
"Feedback. Works with Google Play Services v10.2+"; "Feedback. Works with Google Play Services v10.2+";
const char kEnableDataReductionProxyMainMenuName[] =
"Enable Data Saver main menu item";
const char kEnableDataReductionProxyMainMenuDescription[] =
"Enables the Data Saver menu item in the main menu";
const char kEnableMediaControlsExpandGestureName[] = const char kEnableMediaControlsExpandGestureName[] =
"Enable Media Controls Expand Gesture"; "Enable Media Controls Expand Gesture";
const char kEnableMediaControlsExpandGestureDescription[] = const char kEnableMediaControlsExpandGestureDescription[] =
......
...@@ -1461,9 +1461,6 @@ extern const char kEnableCustomContextMenuDescription[]; ...@@ -1461,9 +1461,6 @@ extern const char kEnableCustomContextMenuDescription[];
extern const char kEnableCustomFeedbackUiName[]; extern const char kEnableCustomFeedbackUiName[];
extern const char kEnableCustomFeedbackUiDescription[]; extern const char kEnableCustomFeedbackUiDescription[];
extern const char kEnableDataReductionProxyMainMenuName[];
extern const char kEnableDataReductionProxyMainMenuDescription[];
extern const char kEnableMediaControlsExpandGestureName[]; extern const char kEnableMediaControlsExpandGestureName[];
extern const char kEnableMediaControlsExpandGestureDescription[]; extern const char kEnableMediaControlsExpandGestureDescription[];
......
...@@ -9,10 +9,6 @@ ...@@ -9,10 +9,6 @@
namespace data_reduction_proxy { namespace data_reduction_proxy {
namespace features { namespace features {
// Enables the Data Reduction Proxy menu item in the main menu on Android.
const base::Feature kDataReductionMainMenu{"DataReductionProxyMainMenu",
base::FEATURE_DISABLED_BY_DEFAULT};
// Enables a new version of the data reduction proxy protocol where the server // Enables a new version of the data reduction proxy protocol where the server
// decides if a server-generated preview should be served. The previous // decides if a server-generated preview should be served. The previous
// version required the client to make this decision. The new protocol relies // version required the client to make this decision. The new protocol relies
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
namespace data_reduction_proxy { namespace data_reduction_proxy {
namespace features { namespace features {
extern const base::Feature kDataReductionMainMenu;
extern const base::Feature kDataReductionProxyDecidesTransform; extern const base::Feature kDataReductionProxyDecidesTransform;
extern const base::Feature kDataReductionProxyLowMemoryDevicePromo; extern const base::Feature kDataReductionProxyLowMemoryDevicePromo;
extern const base::Feature kDataReductionProxyRobustConnection; extern const base::Feature kDataReductionProxyRobustConnection;
......
...@@ -1469,30 +1469,6 @@ ...@@ -1469,30 +1469,6 @@
] ]
} }
], ],
"DataReductionProxyMainMenu": [
{
"platforms": [
"android"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"DataReductionProxyMainMenu"
]
},
{
"name": "Enabled_Persistent",
"params": {
"persistent_menu_item_enabled": "true"
},
"enable_features": [
"DataReductionProxyMainMenu"
]
}
]
}
],
"DataReductionProxyServerExperiments": [ "DataReductionProxyServerExperiments": [
{ {
"platforms": [ "platforms": [
......
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