audiohal: Do not extract value from Result unless it is Ok
The 2-parameter version of processResult used to call the 3-param
version, and for that it was extracting the value from Result.
Now HIDL framework checks that it shouldn't be done if the transaction
wasn't OK.
Change the code so the 2-param version now only extracts the result
value if the transaction has been successful.
Bug: 35758741
Change-Id: I42cb5f5220e3a952b1c304840ccb3952c1707cd0
Test: make
diff --git a/media/libaudiohal/ConversionHelperHidl.h b/media/libaudiohal/ConversionHelperHidl.h
index 23fb360..a991baf 100644
--- a/media/libaudiohal/ConversionHelperHidl.h
+++ b/media/libaudiohal/ConversionHelperHidl.h
@@ -56,17 +56,19 @@
}
status_t processReturn(const char* funcName, const Return<hardware::audio::V2_0::Result>& ret) {
- return processReturn(funcName, ret, ret);
+ if (!ret.isOk()) {
+ emitError(funcName, ret.description().c_str());
+ }
+ return ret.isOk() ? analyzeResult(ret) : FAILED_TRANSACTION;
}
template<typename T>
status_t processReturn(
const char* funcName, const Return<T>& ret, hardware::audio::V2_0::Result retval) {
- const status_t st = ret.isOk() ? analyzeResult(retval) : FAILED_TRANSACTION;
if (!ret.isOk()) {
emitError(funcName, ret.description().c_str());
}
- return st;
+ return ret.isOk() ? analyzeResult(retval) : FAILED_TRANSACTION;
}
private: