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 5d6a5346b471a8cb53ce69cb53663eaff8562cda..d5b5a2258f6f8a9dfec5497c09f3a4bb2ab48bd3 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 |
@@ -11,7 +11,6 @@ import android.net.NetworkInfo; |
import android.preference.PreferenceManager; |
import org.chromium.base.CommandLine; |
-import org.chromium.base.FieldTrialList; |
import org.chromium.base.VisibleForTesting; |
import org.chromium.chrome.ChromeSwitches; |
import org.chromium.chrome.R; |
@@ -42,10 +41,6 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage |
private final String mCrashDumpWifiOnlyUpload; |
private final String mCrashDumpAlwaysUpload; |
- // Using Boolean class type here for distinguishing set and unset modes. Helps to for testing |
- // and also for querying user experiments once. |
- private Boolean mIsCellularUploadingEnabled; |
- |
@VisibleForTesting |
PrivacyPreferencesManager(Context context) { |
mContext = context; |
@@ -56,14 +51,6 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage |
mCrashDumpAlwaysUpload = context.getString(R.string.crash_dump_always_upload_value); |
} |
- /* |
- * Sets whether cellular experiment is enabled or not. Used for testing. |
- */ |
- @VisibleForTesting |
- public void setCellularExperimentForTesting(boolean isCellularUploadingEnabled) { |
- mIsCellularUploadingEnabled = Boolean.valueOf(isCellularUploadingEnabled); |
- } |
- |
public static PrivacyPreferencesManager getInstance(Context context) { |
if (sInstance == null) { |
sInstance = new PrivacyPreferencesManager(context); |
@@ -220,75 +207,17 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage |
* 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 whether to allow uploading crash dump. |
+ * @return boolean to whether to allow uploading crash dump. |
*/ |
private boolean allowUploadCrashDump() { |
- PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance(); |
- |
- if (isCellularUploadingEnabled() && prefServiceBridge.hasSetMetricsReporting()) { |
- return prefServiceBridge.isMetricsReportingEnabled(); |
- } |
- |
- 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); |
- } |
- |
- /** |
- * Checks whether uploads are allowed by new preference or old preference |
- * based on the experiment assigned to the user. Also sets the new pref if it |
- * needs to be set. |
- * |
- * @return boolean whether uploads are allowed at all or not. |
- */ |
- public boolean isUsageAndCrashReportingEnabled() { |
- boolean isCellularEnabledByExperiment = isCellularUploadingEnabled(); |
- PrefServiceBridge prefServiceBridge = PrefServiceBridge.getInstance(); |
- |
- if (isCellularEnabledByExperiment && prefServiceBridge.hasSetMetricsReporting()) { |
- return prefServiceBridge.isMetricsReportingEnabled(); |
- } |
- boolean isEnabled = isUploadCrashDumpEnabled(); |
- if (isCellularEnabledByExperiment && !prefServiceBridge.hasSetMetricsReporting()) { |
- prefServiceBridge.setMetricsReportingEnabled(isEnabled); |
- } |
- return isEnabled; |
- } |
- |
- /** |
- * Checks whether old Crash_dump_upload pref allows any (e.g. always on or |
- * only wifi) uploads or not. |
- * |
- * @return boolean whether uploads are enabled by old pref. |
- */ |
- public boolean isUploadCrashDumpEnabled() { |
- if (isMobileNetworkCapable()) { |
- String option = |
- mSharedPreferences.getString(PREF_CRASH_DUMP_UPLOAD, mCrashDumpNeverUpload); |
- if (option.equals(mCrashDumpNeverUpload)) return false; |
- return true; |
- } |
- |
- return mSharedPreferences.getBoolean(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false); |
- } |
- |
- /** |
- * Checks whether user is assigned to experimental group for enabling new cellular uploads |
- * functionality or returns the value explicitly set by tests. |
- * |
- * @return boolean whether user is assigned to experimental group. |
- */ |
- public boolean isCellularUploadingEnabled() { |
- if (mIsCellularUploadingEnabled == null) { |
- String group_name = FieldTrialList.findFullName("UMA_EnableCellularLogUpload"); |
- mIsCellularUploadingEnabled = Boolean.valueOf(group_name.equals("Enabled")); |
- } |
- return mIsCellularUploadingEnabled; |
} |
/** |
@@ -313,6 +242,22 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage |
} |
/** |
+ * 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() { |
+ boolean option; |
+ if (isMobileNetworkCapable()) { |
+ option = mSharedPreferences.getString(PREF_CRASH_DUMP_UPLOAD, mCrashDumpNeverUpload) |
+ .equals(mCrashDumpNeverUpload); |
+ } else { |
+ option = !mSharedPreferences.getBoolean(PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR, false); |
+ } |
+ return option; |
+ } |
+ |
+ /** |
* Sets the initial value for whether crash stacks may be uploaded. |
* This should be called only once, the first time Chrome is launched. |
*/ |