mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Wifi: Handle invalid error values from vendor HAL
The HAL shim (default implementation) expects all vendor hal functions to return valid wifi_error values. In case the vendor hal returning a value outside this range of values, the HAL service crashes. This commit is to handle this type of error by defaulting to WIFI_ERROR_UNKNOWN. Bug: 143317834 Test: Manual Test: Pass an invalid error code, and make sure it is properly handled Change-Id: Ifaba8a7e4e866a2be154c9dcaeb521cd758010ee
This commit is contained in:
@@ -46,6 +46,8 @@ std::string legacyErrorToString(legacy_hal::wifi_error error) {
|
||||
return "BUSY";
|
||||
case legacy_hal::WIFI_ERROR_UNKNOWN:
|
||||
return "UNKNOWN";
|
||||
default:
|
||||
return "UNKNOWN ERROR";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -92,6 +94,10 @@ WifiStatus createWifiStatusFromLegacyError(legacy_hal::wifi_error error,
|
||||
|
||||
case legacy_hal::WIFI_ERROR_UNKNOWN:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN, "unknown");
|
||||
|
||||
default:
|
||||
return createWifiStatus(WifiStatusCode::ERROR_UNKNOWN,
|
||||
"unknown error");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user