diff options
author | bolian@chromium.org <bolian@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 13:43:06 +0000 |
---|---|---|
committer | bolian@chromium.org <bolian@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-05-07 13:43:06 +0000 |
commit | 3b4afba3f924c6f0a4d9622e362c0e96e18f245e (patch) | |
tree | f55eb275dfcf117d6798c185da95041313b5b770 /net | |
parent | 2025798e133f9adc49b65d017dbb5cb2c5cc74c9 (diff) | |
download | chromium_src-3b4afba3f924c6f0a4d9622e362c0e96e18f245e.zip chromium_src-3b4afba3f924c6f0a4d9622e362c0e96e18f245e.tar.gz chromium_src-3b4afba3f924c6f0a4d9622e362c0e96e18f245e.tar.bz2 |
Record Mobile Operator ID in UMA report. This is Android only for now. See the linked bug for more background info.
Adding this field has been approved by privacy team (see #5 in the linked bug).
This CL depends on
https://codereview.chromium.org/238793007/
BUG=355604
Review URL: https://codereview.chromium.org/246553003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@268731 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r-- | net/base/network_change_notifier.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/net/base/network_change_notifier.cc b/net/base/network_change_notifier.cc index 638964a..11f9d36 100644 --- a/net/base/network_change_notifier.cc +++ b/net/base/network_change_notifier.cc @@ -14,6 +14,12 @@ #include "net/url_request/url_request.h" #include "url/gurl.h" +#if defined(OS_ANDROID) +#include "base/metrics/sparse_histogram.h" +#include "base/strings/string_number_conversions.h" +#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_); |