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..5583d97d47647145445861199a7293247302ac4f 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,6 +29,7 @@ public class PrivacyPreferencesManager implements CrashReportingPermissionManage |
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_IN_SAMPLE = "metrics_in_sample"; |
Alexei Svitkine (slow)
2016/08/18 06:16:39
Nit: Move this right below PREF_METRICS_REPORTING
jwd
2016/08/23 18:40:03
Done.
|
private static final String PREF_CELLULAR_EXPERIMENT = "cellular_experiment"; |
private static final String ALLOW_PRERENDER_OLD = "allow_prefetch"; |
private static final String PREF_PHYSICAL_WEB = "physical_web"; |
@@ -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); |
+ } |
+ |
+ /** |
* Sets the crash upload preference, which determines whether crash dumps will be uploaded |
* always, never, or only on wifi. |
* |