diff options
author | Jong Wook Kim <jongwook@google.com> | 2018-08-08 15:03:31 -0700 |
---|---|---|
committer | Jong Wook Kim <jongwook@google.com> | 2018-08-08 15:15:19 -0700 |
commit | c3b4bcfb325898a9d753d5dae8aeaa8817999296 (patch) | |
tree | d2737ba6b9e7ccd978b4b644c58d7590208ae7a9 /service | |
parent | 78f3b4a5f2b9032fcc16df9067883f9f88b01035 (diff) |
Log when wifi is turned on/off in metrics
Generate a StaEvent whenever wifi is enabled/disabled.
Bug: 112193991
Test: frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Test: Turn wifi on/off from settings
Test: adb shell dumpsys wifi | grep -A10 StaEventList
Change-Id: I9ed97ed38e7529a6977bbf1a6004530f2af10a2e
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/ClientModeImpl.java | 2 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 8 |
2 files changed, 10 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/ClientModeImpl.java b/service/java/com/android/server/wifi/ClientModeImpl.java index f316b504d..1303d1be0 100644 --- a/service/java/com/android/server/wifi/ClientModeImpl.java +++ b/service/java/com/android/server/wifi/ClientModeImpl.java @@ -3890,6 +3890,7 @@ public class ClientModeImpl extends StateMachine { mWifiConnectivityManager.setWifiEnabled(true); // Inform metrics that Wifi is Enabled (but not yet connected) mWifiMetrics.setWifiState(WifiMetricsProto.WifiLog.WIFI_DISCONNECTED); + mWifiMetrics.logStaEvent(StaEvent.TYPE_WIFI_ENABLED); // Inform p2p service that wifi is up and ready when applicable p2pSendMessage(ClientModeImpl.CMD_ENABLE_P2P); // Inform sar manager that wifi is Enabled @@ -3907,6 +3908,7 @@ public class ClientModeImpl extends StateMachine { mWifiConnectivityManager.setWifiEnabled(false); // Inform metrics that Wifi is being disabled (Toggled, airplane enabled, etc) mWifiMetrics.setWifiState(WifiMetricsProto.WifiLog.WIFI_DISABLED); + mWifiMetrics.logStaEvent(StaEvent.TYPE_WIFI_DISABLED); // Inform sar manager that wifi is being disabled mSarManager.setClientWifiState(WifiManager.WIFI_STATE_DISABLED); diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 538a014b1..be8e3322b 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -2902,6 +2902,8 @@ public class WifiMetrics { case StaEvent.TYPE_FRAMEWORK_DISCONNECT: case StaEvent.TYPE_SCORE_BREACH: case StaEvent.TYPE_MAC_CHANGE: + case StaEvent.TYPE_WIFI_ENABLED: + case StaEvent.TYPE_WIFI_DISABLED: break; default: Log.e(TAG, "Unknown StaEvent:" + type); @@ -3097,6 +3099,12 @@ public class WifiMetrics { case StaEvent.TYPE_MAC_CHANGE: sb.append("MAC_CHANGE"); break; + case StaEvent.TYPE_WIFI_ENABLED: + sb.append("WIFI_ENABLED"); + break; + case StaEvent.TYPE_WIFI_DISABLED: + sb.append("WIFI_DISABLED"); + break; default: sb.append("UNKNOWN " + event.type + ":"); break; |