diff options
author | Roshan Pius <rpius@google.com> | 2018-03-15 10:45:03 -0700 |
---|---|---|
committer | Roshan Pius <rpius@google.com> | 2018-03-15 10:49:35 -0700 |
commit | 26e5eb3545a8d67c66e546f4ce413c0611573cfb (patch) | |
tree | 5c1afb5600a37f9f83e451701fba27ef42aa64ce /service | |
parent | 6ef9e33f9bd16064df5f5696731f36f8fab286ae (diff) |
SelfRecovery/WifiDiagnostics: Use a generic reason code for crash
These higher layer modules don't really need to know the exact daemon
that crashed. So, use a generic reason code for all native failures.
Bug: 70937289
Test: Unit tests
Change-Id: I8e88f69dd9017726e9f28cb7f14b7fdc4a9ec45c
Diffstat (limited to 'service')
3 files changed, 7 insertions, 11 deletions
diff --git a/service/java/com/android/server/wifi/SelfRecovery.java b/service/java/com/android/server/wifi/SelfRecovery.java index f6c97400b..d3985f5fd 100644 --- a/service/java/com/android/server/wifi/SelfRecovery.java +++ b/service/java/com/android/server/wifi/SelfRecovery.java @@ -37,14 +37,12 @@ public class SelfRecovery { * Reason codes for the various recovery triggers. */ public static final int REASON_LAST_RESORT_WATCHDOG = 0; - public static final int REASON_HAL_CRASH = 1; - public static final int REASON_WIFICOND_CRASH = 2; + public static final int REASON_WIFINATIVE_FAILURE = 1; public static final long MAX_RESTARTS_IN_TIME_WINDOW = 2; // 2 restarts per hour public static final long MAX_RESTARTS_TIME_WINDOW_MILLIS = 60 * 60 * 1000; // 1 hour protected static final String[] REASON_STRINGS = { "Last Resort Watchdog", // REASON_LAST_RESORT_WATCHDOG - "Hal Crash", // REASON_HAL_CRASH - "Wificond Crash" // REASON_WIFICOND_CRASH + "WifiNative Failure" // REASON_WIFINATIVE_FAILURE }; private final WifiController mWifiController; @@ -67,13 +65,12 @@ public class SelfRecovery { * @param reason One of the above |REASON_*| codes. */ public void trigger(int reason) { - if (!(reason == REASON_LAST_RESORT_WATCHDOG || reason == REASON_HAL_CRASH - || reason == REASON_WIFICOND_CRASH)) { + if (!(reason == REASON_LAST_RESORT_WATCHDOG || reason == REASON_WIFINATIVE_FAILURE)) { Log.e(TAG, "Invalid trigger reason. Ignoring..."); return; } Log.e(TAG, "Triggering recovery for reason: " + REASON_STRINGS[reason]); - if (reason == REASON_WIFICOND_CRASH || reason == REASON_HAL_CRASH) { + if (reason == REASON_WIFINATIVE_FAILURE) { trimPastRestartTimes(); // Ensure there haven't been too many restarts within MAX_RESTARTS_TIME_WINDOW if (mPastRestartTimes.size() >= MAX_RESTARTS_IN_TIME_WINDOW) { diff --git a/service/java/com/android/server/wifi/WifiDiagnostics.java b/service/java/com/android/server/wifi/WifiDiagnostics.java index a74708790..23e6ebe93 100644 --- a/service/java/com/android/server/wifi/WifiDiagnostics.java +++ b/service/java/com/android/server/wifi/WifiDiagnostics.java @@ -77,8 +77,7 @@ class WifiDiagnostics extends BaseWifiDiagnostics { public static final int REPORT_REASON_UNEXPECTED_DISCONNECT = 5; public static final int REPORT_REASON_SCAN_FAILURE = 6; public static final int REPORT_REASON_USER_ACTION = 7; - public static final int REPORT_REASON_WIFICOND_CRASH = 8; - public static final int REPORT_REASON_HAL_CRASH = 9; + public static final int REPORT_REASON_WIFINATIVE_FAILURE = 8; /** number of bug reports to hold */ public static final int MAX_BUG_REPORTS = 4; diff --git a/service/java/com/android/server/wifi/WifiStateMachine.java b/service/java/com/android/server/wifi/WifiStateMachine.java index e690ef926..f8df4de7f 100644 --- a/service/java/com/android/server/wifi/WifiStateMachine.java +++ b/service/java/com/android/server/wifi/WifiStateMachine.java @@ -3777,8 +3777,8 @@ public class WifiStateMachine extends StateMachine { case CMD_WIFINATIVE_FAILURE: Log.e(TAG, "One of the native daemons died unexpectedly. Triggering recovery"); mWifiDiagnostics.captureBugReportData( - WifiDiagnostics.REPORT_REASON_WIFICOND_CRASH); - mWifiInjector.getSelfRecovery().trigger(SelfRecovery.REASON_WIFICOND_CRASH); + WifiDiagnostics.REPORT_REASON_WIFINATIVE_FAILURE); + mWifiInjector.getSelfRecovery().trigger(SelfRecovery.REASON_WIFINATIVE_FAILURE); break; default: return NOT_HANDLED; |