Fail Power HAL benchmarks on failed result
This cl adds ranges to benchmark tests to cover all existing power
Boost, Mode and Hint values. It also fails the benchmark when a HAL
result is fail, and skip AIDL unsupported operations.
Checking the hardware::Return status prevents the benchmark execution
crash, which was causing the json output to be clipped and unable to
be parsed and uploaded to any metric dashboard.
Also adding more error logs printing HAL result from within wrappers.
Sample output:
https://paste.googleplex.com/5185928966438912
Fix: b/160972434
Test: atest libpowermanager_benchmarks
Change-Id: I63733baaf7d04428a9a5425a25c5ffe8c72249e1
diff --git a/services/powermanager/PowerHalWrapper.cpp b/services/powermanager/PowerHalWrapper.cpp
index 95f8623..4a711ca 100644
--- a/services/powermanager/PowerHalWrapper.cpp
+++ b/services/powermanager/PowerHalWrapper.cpp
@@ -29,12 +29,20 @@
// -------------------------------------------------------------------------------------------------
inline HalResult toHalResult(const binder::Status& result) {
- return result.isOk() ? HalResult::SUCCESSFUL : HalResult::FAILED;
+ if (result.isOk()) {
+ return HalResult::SUCCESSFUL;
+ }
+ ALOGE("Power HAL request failed: %s", result.toString8().c_str());
+ return HalResult::FAILED;
}
template <typename T>
inline HalResult toHalResult(const hardware::Return<T>& result) {
- return result.isOk() ? HalResult::SUCCESSFUL : HalResult::FAILED;
+ if (result.isOk()) {
+ return HalResult::SUCCESSFUL;
+ }
+ ALOGE("Power HAL request failed: %s", result.description().c_str());
+ return HalResult::FAILED;
}
// -------------------------------------------------------------------------------------------------
@@ -117,8 +125,8 @@
bool isSupported = false;
auto isSupportedRet = mHandle->isBoostSupported(boost, &isSupported);
if (!isSupportedRet.isOk()) {
- ALOGV("Skipped setBoost %s because Power HAL is not available to check support",
- toString(boost).c_str());
+ ALOGE("Skipped setBoost %s because check support failed with: %s",
+ toString(boost).c_str(), isSupportedRet.toString8().c_str());
return HalResult::FAILED;
}
@@ -148,8 +156,8 @@
bool isSupported = false;
auto isSupportedRet = mHandle->isModeSupported(mode, &isSupported);
if (!isSupportedRet.isOk()) {
- ALOGV("Skipped setMode %s because Power HAL is not available to check support",
- toString(mode).c_str());
+ ALOGE("Skipped setMode %s because check support failed with: %s",
+ toString(mode).c_str(), isSupportedRet.toString8().c_str());
return HalResult::FAILED;
}