diff options
-rw-r--r-- | service/java/com/android/server/wifi/WifiMetrics.java | 45 | ||||
-rw-r--r-- | tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java | 22 |
2 files changed, 67 insertions, 0 deletions
diff --git a/service/java/com/android/server/wifi/WifiMetrics.java b/service/java/com/android/server/wifi/WifiMetrics.java index bea806484..92a6fd645 100644 --- a/service/java/com/android/server/wifi/WifiMetrics.java +++ b/service/java/com/android/server/wifi/WifiMetrics.java @@ -986,6 +986,43 @@ public class WifiMetrics { } } + /** + * Increment number of times the HAL crashed. + */ + public void incrementNumHalCrashes() { + synchronized (mLock) { + mWifiLogProto.numHalCrashes++; + } + } + + /** + * Increment number of times the Wificond crashed. + */ + public void incrementNumWificondCrashes() { + synchronized (mLock) { + mWifiLogProto.numWificondCrashes++; + } + } + + /** + * Increment number of times the wifi on failed due to an error in HAL. + */ + public void incrementNumWifiOnFailureDueToHal() { + synchronized (mLock) { + mWifiLogProto.numWifiOnFailureDueToHal++; + } + } + + /** + * Increment number of times the wifi on failed due to an error in wificond. + */ + public void incrementNumWifiOnFailureDueToWificond() { + synchronized (mLock) { + mWifiLogProto.numWifiOnFailureDueToWificond++; + } + } + + public static final String PROTO_DUMP_ARG = "wifiMetricsProto"; public static final String CLEAN_DUMP_ARG = "clean"; @@ -1175,6 +1212,14 @@ public class WifiMetrics { pw.println(" FAILED_NO_CHANNEL: " + mSoftApManagerReturnCodeCounts.get( WifiMetricsProto.SoftApReturnCodeCount.SOFT_AP_FAILED_NO_CHANNEL)); pw.print("\n"); + pw.println("mWifiLogProto.numHalCrashes=" + + mWifiLogProto.numHalCrashes); + pw.println("mWifiLogProto.numWificondCrashes=" + + mWifiLogProto.numWificondCrashes); + pw.println("mWifiLogProto.numWifiOnFailureDueToHal=" + + mWifiLogProto.numWifiOnFailureDueToHal); + pw.println("mWifiLogProto.numWifiOnFailureDueToWificond=" + + mWifiLogProto.numWifiOnFailureDueToWificond); pw.println("StaEventList:"); for (StaEvent event : mStaEventList) { pw.println(staEventToString(event)); diff --git a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java index 4d9c906ea..1c09cac38 100644 --- a/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java +++ b/tests/wifitests/src/com/android/server/wifi/WifiMetricsTest.java @@ -231,6 +231,10 @@ public class WifiMetricsTest { private static final int NUM_SOFTAP_START_SUCCESS = 3; private static final int NUM_SOFTAP_FAILED_GENERAL_ERROR = 2; private static final int NUM_SOFTAP_FAILED_NO_CHANNEL = 1; + private static final int NUM_HAL_CRASHES = 11; + private static final int NUM_WIFICOND_CRASHES = 12; + private static final int NUM_WIFI_ON_FAILURE_DUE_TO_HAL = 13; + private static final int NUM_WIFI_ON_FAILURE_DUE_TO_WIFICOND = 14; private ScanDetail buildMockScanDetail(boolean hidden, NetworkDetail.HSRelease hSRelease, String capabilities) { @@ -403,6 +407,18 @@ public class WifiMetricsTest { mWifiMetrics.incrementSoftApStartResult(false, WifiManager.SAP_START_FAILURE_NO_CHANNEL); } + for (int i = 0; i < NUM_HAL_CRASHES; i++) { + mWifiMetrics.incrementNumHalCrashes(); + } + for (int i = 0; i < NUM_WIFICOND_CRASHES; i++) { + mWifiMetrics.incrementNumWificondCrashes(); + } + for (int i = 0; i < NUM_WIFI_ON_FAILURE_DUE_TO_HAL; i++) { + mWifiMetrics.incrementNumWifiOnFailureDueToHal(); + } + for (int i = 0; i < NUM_WIFI_ON_FAILURE_DUE_TO_WIFICOND; i++) { + mWifiMetrics.incrementNumWifiOnFailureDueToWificond(); + } } /** @@ -539,6 +555,12 @@ public class WifiMetricsTest { mDeserializedWifiMetrics.softApReturnCode[2].startResult); assertEquals(NUM_SOFTAP_FAILED_NO_CHANNEL, mDeserializedWifiMetrics.softApReturnCode[2].count); + assertEquals(NUM_HAL_CRASHES, mDeserializedWifiMetrics.numHalCrashes); + assertEquals(NUM_WIFICOND_CRASHES, mDeserializedWifiMetrics.numWificondCrashes); + assertEquals(NUM_WIFI_ON_FAILURE_DUE_TO_HAL, + mDeserializedWifiMetrics.numWifiOnFailureDueToHal); + assertEquals(NUM_WIFI_ON_FAILURE_DUE_TO_WIFICOND, + mDeserializedWifiMetrics.numWifiOnFailureDueToWificond); } /** |