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

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

Issue 1461883003: Separate out experimental flag behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add comment. Created 5 years 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 48de32563b9739e951ac47cbbe52354756b99bdd..0831a04bd89121f9c341a353b81c11351e892a54 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
@@ -32,7 +32,7 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
private final Context mContext;
private final SharedPreferences mSharedPreferences;
- private boolean mCrashUploadingEnabled;
+ private boolean mCrashUploadingCommandLineDisabled;
private final String mCrashDumpNeverUpload;
private final String mCrashDumpWifiOnlyUpload;
private final String mCrashDumpAlwaysUpload;
@@ -41,7 +41,13 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
PrivacyPreferencesManager(Context context) {
mContext = context;
mSharedPreferences = PreferenceManager.getDefaultSharedPreferences(context);
- mCrashUploadingEnabled = true;
+
+ // Crash dump uploading preferences.
+ // We default the command line flag to disable uploads unless altered on deferred startup
+ // to prevent unwanted uploads at startup. If the command line flag to enable uploading is
+ // turned on, the other options for when to upload (depending on user/network preferences
+ // apply.
+ mCrashUploadingCommandLineDisabled = true;
mCrashDumpNeverUpload = context.getString(R.string.crash_dump_never_upload_value);
mCrashDumpWifiOnlyUpload = context.getString(R.string.crash_dump_only_with_wifi_value);
mCrashDumpAlwaysUpload = context.getString(R.string.crash_dump_always_upload_value);
@@ -178,11 +184,14 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
}
/**
- * Provides a way to disable crash uploading entirely, regardless of the preferences.
- * Used by tests that trigger crashers intentionally, so these crashers are not uploaded.
+ * Provides a way to remove disabling crash uploading entirely.
+ * Enable crash uploading based on user's preference when an overriding flag
+ * does not exist in commandline.
+ * Used to differentiate from tests that trigger crashers intentionally, so these crashers are
+ * not uploaded.
*/
- public void disableCrashUploading() {
- mCrashUploadingEnabled = false;
+ public void enablePotentialCrashUploading() {
+ mCrashUploadingCommandLineDisabled = false;
}
/**
@@ -241,20 +250,33 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
*/
@Override
public boolean isUploadPermitted() {
- return mCrashUploadingEnabled && isNetworkAvailable() && (allowUploadCrashDump()
- || CommandLine.getInstance().hasSwitch(ChromeSwitches.FORCE_CRASH_DUMP_UPLOAD));
+ return !mCrashUploadingCommandLineDisabled && isNetworkAvailable()
+ && (allowUploadCrashDump() || CommandLine.getInstance().hasSwitch(
+ ChromeSwitches.FORCE_CRASH_DUMP_UPLOAD));
+ }
+
+ /**
+ * Check whether not to disable uploading crash dump by command line flag.
+ * If command line flag disables crash dump uploading, do not retry, but also do not delete.
+ * TODO(jchinlee): this is not quite a boolean. Depending on other refactoring, change to enum.
+ *
+ * @return whether experimental flag doesn't disable uploading crash dump.
+ */
+ @Override
+ public boolean isUploadCommandLineDisabled() {
+ return mCrashUploadingCommandLineDisabled;
}
/**
* Check whether the user allows uploading.
- * This doesn't take network condition into consideration.
+ * This doesn't take network condition or experimental state (i.e. disabling upload) into
+ * consideration.
* A crash dump may be retried if this check passes.
*
* @return whether user's preference allows uploading crash dump.
*/
@Override
public boolean isUploadUserPermitted() {
- if (!mCrashUploadingEnabled) return false;
if (isCellularExperimentEnabled()) return isUsageAndCrashReportingEnabled();
if (isMobileNetworkCapable()) {

Powered by Google App Engine
This is Rietveld 408576698