Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(539)

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java

Issue 1101073003: Revert of New UMA settings fragment using Android prefs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
index 8d8bc99c708343536bff9aa0c1617fe28919dc82..10156b1637b930621a7b7d447e2f7e2df90c0363 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/preferences/privacy/PrivacyPreferencesManager.java
@@ -29,8 +29,6 @@
private static final String PREF_NETWORK_PREDICTIONS = "network_predictions";
private static final String PREF_BANDWIDTH_OLD = "prefetch_bandwidth";
private static final String PREF_BANDWIDTH_NO_CELLULAR_OLD = "prefetch_bandwidth_no_cellular";
- private static final String PREF_METRICS_REPORTING = "metrics_reporting";
- private static final String PREF_CELLULAR_EXPERIMENT = "cellular_experiment";
private static final String ALLOW_PRERENDER_OLD = "allow_prefetch";
private static PrivacyPreferencesManager sInstance;
@@ -206,65 +204,20 @@
}
/**
- * Check whether to allow uploading usage and crash reporting. The option should be either
- * "always upload", or "wifi only" with current connection being wifi/ethernet for the
- * three-choice pref or ON for the new two-choice pref.
- *
- * @return boolean whether to allow uploading crash dump.
+ * Check whether to allow uploading crash dump. The option should be either
+ * "always upload", or "wifi only" with current connection being wifi/ethernet.
+ *
+ * @return boolean to whether to allow uploading crash dump.
*/
private boolean allowUploadCrashDump() {
- if (isCellularExperimentEnabled()) return isUsageAndCrashReportingEnabled();
-
- if (isMobileNetworkCapable()) {
+ if (!isMobileNetworkCapable()) {
+ return mSharedPreferences.getBoolean(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false);
+ } else {
String option =
mSharedPreferences.getString(PREF_CRASH_DUMP_UPLOAD, mCrashDumpNeverUpload);
return option.equals(mCrashDumpAlwaysUpload)
|| (option.equals(mCrashDumpWifiOnlyUpload) && isWiFiOrEthernetNetwork());
}
-
- return mSharedPreferences.getBoolean(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false);
- }
-
- /**
- * Check whether usage and crash reporting set to ON. Also initializes the new pref if
- * necessary.
- *
- * @return boolean whether usage and crash reporting set to ON.
- */
- public boolean isUsageAndCrashReportingEnabled() {
- // If the preference is not set initialize it based on the old preference value.
- if (!mSharedPreferences.contains(PREF_METRICS_REPORTING)) {
- setUsageAndCrashReporting(isUploadCrashDumpEnabled());
- }
-
- return mSharedPreferences.getBoolean(PREF_METRICS_REPORTING, false);
- }
-
- /**
- * Sets the usage and crash reporting preference ON or OFF.
- *
- * @param enabled A boolean corresponding whether usage and crash reports uploads are allowed.
- */
- public void setUsageAndCrashReporting(boolean enabled) {
- mSharedPreferences.edit().putBoolean(PREF_METRICS_REPORTING, enabled).apply();
- }
-
- /**
- * Sets whether cellular experiment is enabled or not.
- */
- @VisibleForTesting
- public void setCellularExperiment(boolean enabled) {
- mSharedPreferences.edit().putBoolean(PREF_CELLULAR_EXPERIMENT, enabled).apply();
- }
-
- /**
- * Checks whether user is assigned to experimental group for enabling new cellular uploads
- * functionality.
- *
- * @return boolean whether user is assigned to experimental group.
- */
- public boolean isCellularExperimentEnabled() {
- return mSharedPreferences.getBoolean(PREF_CELLULAR_EXPERIMENT, false);
}
/**
@@ -289,27 +242,19 @@
}
/**
- * Check whether crash dump upload preference is disabled according to corresponding preference.
- *
- * @return boolean {@code true} if the option is set to not send.
+ * Check whether crash dump upload preference is set to NEVER only.
+ *
+ * @return boolean {@code true} if the option is set to NEVER
*/
public boolean isNeverUploadCrashDump() {
- if (isCellularExperimentEnabled()) return !isUsageAndCrashReportingEnabled();
- return !isUploadCrashDumpEnabled();
- }
-
- /**
- * Check whether crash dump upload preference is set to NEVER only.
- *
- * @return boolean {@code true} if the option is set to NEVER.
- */
- public boolean isUploadCrashDumpEnabled() {
+ boolean option;
if (isMobileNetworkCapable()) {
- return !mSharedPreferences.getString(PREF_CRASH_DUMP_UPLOAD, mCrashDumpNeverUpload)
- .equals(mCrashDumpNeverUpload);
- }
-
- return mSharedPreferences.getBoolean(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false);
+ option = mSharedPreferences.getString(PREF_CRASH_DUMP_UPLOAD, mCrashDumpNeverUpload)
+ .equals(mCrashDumpNeverUpload);
+ } else {
+ option = !mSharedPreferences.getBoolean(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false);
+ }
+ return option;
}
/**
@@ -337,9 +282,6 @@
* {@link #allowUploadCrashDump()} should return {@code true},
* and the network should be connected as well.
*
- * This function should not result in a native call as it can be called in circumstances where
- * natives are not guaranteed to be loaded.
- *
* @return boolean to whether to allow uploading crash dump now.
*/
@Override

Powered by Google App Engine
This is Rietveld 408576698