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

Unified Diff: chrome/browser/android/metrics/uma_session_stats.cc

Issue 2222903004: Clear client id prefs when opting out of UMA. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove early return in ForceClientIdCreation(). 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/browser/android/metrics/uma_session_stats.cc
diff --git a/chrome/browser/android/metrics/uma_session_stats.cc b/chrome/browser/android/metrics/uma_session_stats.cc
index 4b8c6ab581ea6efee6e95f0cde7e4c6d02eaa7a5..6c9272b14f6ccf7330fcbde2f9ace0877ab21c8b 100644
--- a/chrome/browser/android/metrics/uma_session_stats.cc
+++ b/chrome/browser/android/metrics/uma_session_stats.cc
@@ -117,6 +117,17 @@ static void UpdateMetricsServiceState(JNIEnv* env,
may_record));
}
+ // Clear the client id pref when opting out. Note: Mirrors code in
+ // metrics_reporting_state.cc. TODO(asvitkine): Unify.
+ if (!may_record) {
+ // Note: Clearing client id will not affect the running state (e.g. field
+ // trial randomization), as the pref is only read on startup.
+ g_browser_process->local_state()->ClearPref(
+ metrics::prefs::kMetricsClientID);
+ g_browser_process->local_state()->ClearPref(
+ metrics::prefs::kMetricsReportingEnabledTimestamp);
+ }
+
g_browser_process->GetMetricsServicesManager()->UpdatePermissions(
may_record, may_upload);
}
« no previous file with comments | « no previous file | chrome/browser/metrics/metrics_reporting_state.cc » ('j') | chrome/installer/util/google_update_settings.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698