diff options
author | Isaac Chiou <isaacchiou@google.com> | 2019-04-12 12:03:45 +0800 |
---|---|---|
committer | Isaac Chiou <isaacchiou@google.com> | 2019-04-22 10:11:01 +0800 |
commit | e1ebbceea0832f2b6e4e30e84ec4ea1ff84762e4 (patch) | |
tree | 65eec426f18d1aa06d48f28ea6c278aa859c2d32 /service | |
parent | be70cc2e5eb921f4c49ad2ca118211335df8a5dd (diff) |
WifiDiagnostics: Collect logs when detecting fatal firmware alert
When detecting fatal firmware alert, flushing HAL ring buffer to files
Bug: 114766171
Test: Manual test
Test: ./frameworks/opt/net/wifi/tests/wifitests/runtests.sh
Change-Id: I687efca90c25d8d9de224b6b2e426294cae1f0f1
Diffstat (limited to 'service')
-rw-r--r-- | service/java/com/android/server/wifi/WifiDiagnostics.java | 13 | ||||
-rw-r--r-- | service/java/com/android/server/wifi/WifiLoggerHal.java | 6 |
2 files changed, 16 insertions, 3 deletions
diff --git a/service/java/com/android/server/wifi/WifiDiagnostics.java b/service/java/com/android/server/wifi/WifiDiagnostics.java index b288ccb24..52a787adb 100644 --- a/service/java/com/android/server/wifi/WifiDiagnostics.java +++ b/service/java/com/android/server/wifi/WifiDiagnostics.java @@ -34,10 +34,13 @@ import java.io.InputStreamReader; import java.io.PrintWriter; import java.nio.charset.Charset; import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Collections; import java.util.Comparator; import java.util.HashMap; +import java.util.List; +import java.util.stream.Collectors; import java.util.zip.Deflater; /** @@ -81,6 +84,7 @@ class WifiDiagnostics extends BaseWifiDiagnostics { public static final int REPORT_REASON_USER_ACTION = 7; public static final int REPORT_REASON_WIFINATIVE_FAILURE = 8; public static final int REPORT_REASON_REACHABILITY_LOST = 9; + public static final int REPORT_REASON_FATAL_FW_ALERT = 10; /** number of bug reports to hold */ public static final int MAX_BUG_REPORTS = 4; @@ -116,6 +120,7 @@ class WifiDiagnostics extends BaseWifiDiagnostics { private final Runtime mJavaRuntime; private final WifiMetrics mWifiMetrics; private int mMaxRingBufferSizeBytes; + private final List<Integer> mFatalFirmwareAlertErrorCodeList; private WifiInjector mWifiInjector; private Clock mClock; @@ -127,10 +132,14 @@ class WifiDiagnostics extends BaseWifiDiagnostics { R.integer.config_wifi_logger_ring_buffer_default_size_limit_kb) * 1024; RING_BUFFER_BYTE_LIMIT_LARGE = context.getResources().getInteger( R.integer.config_wifi_logger_ring_buffer_verbose_size_limit_kb) * 1024; + int[] fatalFirmwareAlertErrorCodeArray = context.getResources().getIntArray( + R.array.config_wifi_fatal_firmware_alert_error_code_list); mBuildProperties = buildProperties; mIsLoggingEventHandlerRegistered = false; mMaxRingBufferSizeBytes = RING_BUFFER_BYTE_LIMIT_SMALL; + mFatalFirmwareAlertErrorCodeList = Arrays.stream(fatalFirmwareAlertErrorCodeArray) + .boxed().collect(Collectors.toList()); mLog = wifiInjector.makeLog(TAG); mLastMileLogger = lastMileLogger; mJavaRuntime = wifiInjector.getJavaRuntime(); @@ -232,6 +241,10 @@ class WifiDiagnostics extends BaseWifiDiagnostics { BugReport report = captureBugreport(errorCode, isVerboseLoggingEnabled()); report.alertData = alertData; mLastAlerts.addLast(report); + /* Flush HAL ring buffer when detecting data stall */ + if (mFatalFirmwareAlertErrorCodeList.contains(errorCode)) { + flushDump(REPORT_REASON_FATAL_FW_ALERT); + } } @Override diff --git a/service/java/com/android/server/wifi/WifiLoggerHal.java b/service/java/com/android/server/wifi/WifiLoggerHal.java index 0294e9bf7..5e2635f13 100644 --- a/service/java/com/android/server/wifi/WifiLoggerHal.java +++ b/service/java/com/android/server/wifi/WifiLoggerHal.java @@ -48,7 +48,7 @@ public class WifiLoggerHal { public static final byte RX_PKT_FATE_DRV_DROP_OTHER = 10; /** These aren't formally part of the HAL. But they probably should be, eventually. */ - public static final byte WIFI_ALERT_REASON_RESERVED = 0; - public static final byte WIFI_ALERT_REASON_MIN = 0; - public static final byte WIFI_ALERT_REASON_MAX = 64; + public static final int WIFI_ALERT_REASON_RESERVED = 0; + public static final int WIFI_ALERT_REASON_MIN = 0; + public static final int WIFI_ALERT_REASON_MAX = 1024; } |