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

Unified Diff: net/base/network_change_notifier.cc

Issue 246553003: Record Mobile Operator ID in UMA report. This is Android only for now. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@operator_id
Patch Set: log non-mobile code as well. Created 6 years, 7 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
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier.cc
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc
index 638964a25d29ad12016b9d20ad64cf82df7ef222..7632d182b0074c1c0f6f53e838dd5de35113c615 100644
--- a/net/base/network_change_notifier.cc
+++ b/net/base/network_change_notifier.cc
@@ -5,6 +5,8 @@
#include "net/base/network_change_notifier.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/sparse_histogram.h"
bengr 2014/05/05 21:57:58 Move these to the #if defined(OS_ANDROID) below.
bolian 2014/05/05 22:18:21 Done.
+#include "base/strings/string_number_conversions.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "build/build_config.h"
@@ -14,6 +16,10 @@
#include "net/url_request/url_request.h"
#include "url/gurl.h"
+#if defined(OS_ANDROID)
+#include "net/android/network_library.h"
+#endif
+
#if defined(OS_WIN)
#include "net/base/network_change_notifier_win.h"
#elif defined(OS_LINUX) && !defined(OS_CHROMEOS)
@@ -228,6 +234,24 @@ class HistogramWatcher
} else {
UMA_HISTOGRAM_MEDIUM_TIMES("NCN.OfflineChange", state_duration);
}
+
+#if defined(OS_ANDROID)
+ // On a connection type change to 2/3/4G, log the network operator MCC/MNC.
+ // Log zero in other cases.
+ unsigned mcc_mnc = 0;
+ if (type == NetworkChangeNotifier::CONNECTION_2G ||
+ type == NetworkChangeNotifier::CONNECTION_3G ||
+ type == NetworkChangeNotifier::CONNECTION_4G) {
+ // Log zero if not perfectly converted.
+ if (!base::StringToUint(
+ net::android::GetTelephonyNetworkOperator(), &mcc_mnc)) {
+ mcc_mnc = 0;
+ }
+ }
+ UMA_HISTOGRAM_SPARSE_SLOWLY(
+ "NCN.NetworkOperatorMCCMNC_ConnectionChange", mcc_mnc);
+#endif
+
UMA_HISTOGRAM_MEDIUM_TIMES(
"NCN.IPAddressChangeToConnectionTypeChange",
now - last_ip_address_change_);
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | tools/metrics/histograms/histograms.xml » ('J')

Powered by Google App Engine
This is Rietveld 408576698