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

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

Issue 2248243002: Enabling sampling of UMA and crash reports on Android. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Some missing changes Created 4 years, 4 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 cc67d03db34b1e97576af014bacf33add19b263c..ff6455abe9bd9ea1d5be24a951ee62fe54628df0 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
@@ -26,6 +26,7 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
static final String PREF_CRASH_DUMP_UPLOAD = "crash_dump_upload";
static final String PREF_CRASH_DUMP_UPLOAD_NO_CELLULAR = "crash_dump_upload_no_cellular";
static final String PREF_METRICS_REPORTING = "metrics_reporting";
+ private static final String PREF_METRICS_IN_SAMPLE = "metrics_in_sample";
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";
@@ -277,6 +278,24 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
}
/**
+ * Sets whether this client is eligible to send metrics. If they are, and there was user
+ * consent, then metrics and crashes would be reported.
+ */
+ public void setClientInMetricsSample(boolean inSample) {
+ mSharedPreferences.edit().putBoolean(PREF_METRICS_IN_SAMPLE, inSample).apply();
+ }
+
+ /**
+ * Checks whether this client is eligible to send metrics. If they are, and there was user
+ * consent, then metrics and crashes would be reported.
+ *
+ * @returns boolean Whether client is eligible to send metrics.
+ */
+ public boolean isClientInMetricsSample() {
+ return mSharedPreferences.getBoolean(PREF_METRICS_IN_SAMPLE, true);
Ilya Sherman 2016/08/23 21:32:17 Hmm, the default value is true? That seems riskie
jwd 2016/08/23 23:00:58 The default is that clients are in sample, so if t
Ilya Sherman 2016/08/24 05:02:50 Okay, that makes sense. Could you please add a br
jwd 2016/08/24 15:06:27 Done.
+ }
+
+ /**
* Sets the crash upload preference, which determines whether crash dumps will be uploaded
* always, never, or only on wifi.
*
@@ -326,7 +345,6 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage
/**
* Sets the initial value for whether crash stacks may be uploaded.
- * This should be called only once, the first time Chrome is launched.
Ilya Sherman 2016/08/23 21:32:17 Hmm, why did you remove this line? What are the s
jwd 2016/08/23 23:00:58 I should change the first line too, and maybe the
*/
public void initCrashUploadPreference(boolean allowCrashUpload) {
SharedPreferences.Editor ed = mSharedPreferences.edit();

Powered by Google App Engine
This is Rietveld 408576698