summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Kumar M <rpavan@codeaurora.org>2018-10-25 14:21:55 +0530
committerGerrit - the friendly Code Review server <code-review@localhost>2018-10-29 06:56:45 -0700
commit066d6220c5cadb3a9b90f2fd59fa5aa40ba479f7 (patch)
tree2c2a0e12ebc97662211f3096e58bdda65702cd46
parenta469d687be733d034b5ef1c66a85c659676bd1f3 (diff)
ipa: check return status of HAL calls
If the underlying HAL service object is invalidated, it might result in a HAL transaction failure and the ipacm process would be forced to abort. To prevent the transaction error, use the isOk check right after the HAL API is invoked to check whether the HAL transaction was successful or not. Change-Id: I4d71b35b6a31a6b705c1f61b542e1e82d1716a21 CRs-Fixed: 2340020
-rw-r--r--hal/src/IpaEventRelay.cpp53
1 files changed, 33 insertions, 20 deletions
diff --git a/hal/src/IpaEventRelay.cpp b/hal/src/IpaEventRelay.cpp
index 788b152..137092f 100644
--- a/hal/src/IpaEventRelay.cpp
+++ b/hal/src/IpaEventRelay.cpp
@@ -47,37 +47,50 @@ IpaEventRelay::IpaEventRelay(
void IpaEventRelay::onOffloadStarted() {
ALOGI("onOffloadStarted()");
- mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STARTED);
+ auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STARTED);
+ if (!ret.isOk()) {
+ ALOGE("Triggering OffloadStarted Callback failed.");
+ }
} /* onOffloadStarted */
void IpaEventRelay::onOffloadStopped(StoppedReason reason) {
ALOGI("onOffloadStopped(%d)", reason);
- switch (reason) {
- case REQUESTED:
- /*
- * No way to communicate this to Framework right now, they make an
- * assumption that offload is stopped when they remove the
- * configuration.
- */
- break;
- case ERROR:
- mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_ERROR);
- break;
- case UNSUPPORTED:
- mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_UNSUPPORTED);
- break;
- default:
- ALOGE("Unknown stopped reason(%d)", reason);
- break;
+ if( reason == StoppedReason::REQUESTED ) {
+ /*
+ * No way to communicate this to Framework right now, they make an
+ * assumption that offload is stopped when they remove the
+ * configuration.
+ */
+ }
+ else if ( reason == StoppedReason::ERROR ) {
+ auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_ERROR);
+ if (!ret.isOk()) {
+ ALOGE("Triggering OffloadStopped Callback failed.");
+ }
+ }
+ else if ( reason == StoppedReason::UNSUPPORTED ) {
+ auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_UNSUPPORTED);
+ if (!ret.isOk()) {
+ ALOGE("Triggering OffloadStopped Callback failed.");
+ }
+ }
+ else {
+ ALOGE("Unknown stopped reason(%d)", reason);
}
} /* onOffloadStopped */
void IpaEventRelay::onOffloadSupportAvailable() {
ALOGI("onOffloadSupportAvailable()");
- mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_SUPPORT_AVAILABLE);
+ auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_SUPPORT_AVAILABLE);
+ if (!ret.isOk()) {
+ ALOGE("Triggering OffloadSupportAvailable Callback failed.");
+ }
} /* onOffloadSupportAvailable */
void IpaEventRelay::onLimitReached() {
ALOGI("onLimitReached()");
- mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_LIMIT_REACHED);
+ auto ret = mFramework->onEvent(OffloadCallbackEvent::OFFLOAD_STOPPED_LIMIT_REACHED);
+ if (!ret.isOk()) {
+ ALOGE("Triggering LimitReached Callback failed.");
+ }
} /* onLimitReached */