diff options
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 4 | ||||
-rw-r--r-- | service/proto/src/metrics.proto | 3 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java | 2 |
3 files changed, 9 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index 383659e4d..621a2fbc8 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -4696,6 +4696,9 @@ public class WifiMetrics { staEvent.totalTxBytes = mFacade.getTotalTxBytes(); staEvent.totalRxBytes = mFacade.getTotalRxBytes(); staEvent.screenOn = mScreenOn; + if (mWifiDataStall != null) { + staEvent.isCellularDataAvailable = mWifiDataStall.isCellularDataAvailable(); + } mSupplicantStateChangeBitmask = 0; mLastPollRssi = -127; mLastPollFreq = -1; @@ -4911,6 +4914,7 @@ public class WifiMetrics { if (event.totalTxBytes > 0) sb.append(" totalTxBytes=").append(event.totalTxBytes); if (event.totalRxBytes > 0) sb.append(" totalRxBytes=").append(event.totalRxBytes); sb.append(" screenOn=").append(event.screenOn); + sb.append(" cellularData=").append(event.isCellularDataAvailable); if (event.supplicantStateChangesBitmask != 0) { sb.append(", ").append(supplicantStateChangesBitmaskToString( event.supplicantStateChangesBitmask)); diff --git a/service/proto/src/metrics.proto b/service/proto/src/metrics.proto index ad52af1f4..0c3346bef 100644 --- a/service/proto/src/metrics.proto +++ b/service/proto/src/metrics.proto @@ -1438,6 +1438,9 @@ message StaEvent { // Whether screen is on when the event happens optional bool screen_on = 24; + + // Whether cellular data network is available + optional bool is_cellular_data_available = 25; } // Wi-Fi Aware metrics diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java index 04730bbe3..e4e58c1df 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java @@ -2285,6 +2285,7 @@ public class WifiMetricsTest extends WifiBaseTest { } mTestLooper.dispatchAll(); wifiMetrics.setScreenState(true); + when(mWifiDataStall.isCellularDataAvailable()).thenReturn(true); for (int i = 0; i < mTestStaLogInts.length; i++) { int[] lia = mTestStaLogInts[i]; wifiMetrics.logStaEvent(lia[0], lia[1], lia[2] == 1 ? mTestWifiConfig : null); @@ -2324,6 +2325,7 @@ public class WifiMetricsTest extends WifiBaseTest { assertConfigInfoEqualsWifiConfig( evs[7] == 1 ? mTestWifiConfig : null, event.configInfo); assertEquals(true, event.screenOn); + assertEquals(true, event.isCellularDataAvailable); j++; } assertEquals(mExpectedValues.length, j); |