From 4036c533b3da963ef103a923037ca944e3c283ea Mon Sep 17 00:00:00 2001 From: xshu Date: Tue, 11 Aug 2020 19:17:44 -0700 Subject: Breakdown manual connection events (cherry-picked from ebf39c906b8f2afe499f96e6f33379ba110fc194) Adding a new event type, EVENT_ADD_OR_UPDATE_NETWORK to track adding new networks and modifying credentials for existing networks. Bug: 163663606 Test: atest com.android.server.wifi Test: Manual sanity test Updated-pdd: TRUE Change-Id: If2c611b50c03463d4041d6b1bd96778b2d567469 Merged-In: If2c611b50c03463d4041d6b1bd96778b2d567469 --- service/java/com/android/server/wifi/WifiMetrics.java | 3 +++ service/java/com/android/server/wifi/WifiServiceImpl.java | 11 ++++++++++- service/proto/src/metrics.proto | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) (limited to 'service') diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 6c2b5e369..cfc06b5b5 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -824,6 +824,9 @@ public class WifiMetrics { case UserActionEvent.EVENT_MANUAL_CONNECT: eventType = "EVENT_MANUAL_CONNECT"; break; + case UserActionEvent.EVENT_ADD_OR_UPDATE_NETWORK: + eventType = "EVENT_ADD_OR_UPDATE_NETWORK"; + break; } sb.append(" eventType=").append(eventType); sb.append(" startTimeMillis=").append(mUserActionEvent.startTimeMillis); diff --git a/service/java/com/android/server/wifi/WifiServiceImpl.java b/service/java/com/android/server/wifi/WifiServiceImpl.java index a398eacaf..20aea050a 100644 --- a/service/java/com/android/server/wifi/WifiServiceImpl.java +++ b/service/java/com/android/server/wifi/WifiServiceImpl.java @@ -4120,7 +4120,12 @@ public class WifiServiceImpl extends BaseWifiService { mLog.info("connect uid=%").c(uid).flush(); mClientModeImpl.connect(config, netId, binder, callback, callbackIdentifier, uid); if (mWifiPermissionsUtil.checkNetworkSettingsPermission(uid)) { - mWifiMetrics.logUserActionEvent(UserActionEvent.EVENT_MANUAL_CONNECT, netId); + if (config == null) { + mWifiMetrics.logUserActionEvent(UserActionEvent.EVENT_MANUAL_CONNECT, netId); + } else { + mWifiMetrics.logUserActionEvent( + UserActionEvent.EVENT_ADD_OR_UPDATE_NETWORK, config.networkId); + } } } @@ -4135,6 +4140,10 @@ public class WifiServiceImpl extends BaseWifiService { throw new SecurityException(TAG + ": Permission denied"); } mLog.info("save uid=%").c(Binder.getCallingUid()).flush(); + if (mWifiPermissionsUtil.checkNetworkSettingsPermission(Binder.getCallingUid())) { + mWifiMetrics.logUserActionEvent( + UserActionEvent.EVENT_ADD_OR_UPDATE_NETWORK, config.networkId); + } mClientModeImpl.save( config, binder, callback, callbackIdentifier, Binder.getCallingUid()); } diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index 30b1690cc..c16ecfbba 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -3156,6 +3156,8 @@ message UserActionEvent { EVENT_MANUAL_CONNECT = 11; // User changes the metered setting to "detect automatically" EVENT_CONFIGURE_METERED_STATUS_AUTO = 12; + // User adds a new network or updates configurations for an existing network. + EVENT_ADD_OR_UPDATE_NETWORK = 13; } // The type of user action -- cgit v1.2.3