diff options
author | Jong Wook Kim <jongwook@google.com> | 2018-08-08 15:03:31 -0700 |
---|---|---|
committer | Jong Wook Kim <jongwook@google.com> | 2018-10-10 14:59:56 -0700 |
commit | df19e3cc9f5a5f67b973f5d2de2c8576f9a7b2fd (patch) | |
tree | 90e2873ff691608b0ce3ed7bc078fdec55ecd158 /service | |
parent | c26d2bfdf8ff6f5049bd599349dbd46e5e053fb4 (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
Merged-In: I9ed97ed38e7529a6977bbf1a6004530f2af10a2e
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 9 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiStateMachine.java | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 15f65c980..d0b051e4e 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -29,7 +29,6 @@ import android.os.Handler; import android.os.Looper; import android.os.Message; import android.os.SystemProperties; - import android.util.Base64; import android.util.Log; import android.util.Pair; @@ -2739,6 +2738,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); @@ -2934,6 +2935,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; diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index ef5eb027f..394a8ece4 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3826,6 +3826,7 @@ public class WifiStateMachine 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(WifiStateMachine.CMD_ENABLE_P2P); // Inform sar manager that wifi is Enabled @@ -3843,6 +3844,7 @@ public class WifiStateMachine 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); |