问题描述
我有一个运行HAL的服务,并带有注册的Java服务回调。 HAL调用Java回调实例的函数并对其自身进行回调。但是,Java服务从HAL发出的此调用请求中抛出了一个错误。之后,HAL因运输错误而崩溃。
我试图围绕对回调实例的HAL调用的调用进行try / catch关闭,但是,我仍然无法捕获异常。
这是我的HAL代码:
void ApplicationControl::onGetAppIcon(
const string &appId,ApplicationControlStub::getAppIconReply_t getAppIconReply) {
if (mAndroidServiceCallback) {
LOG(INFO) << __FUNCTION__ << "::Getting icon of app id: " << appId;
try {
//This call throws an exception in the mAndroidServiceCallback instance. We should handle it
mAndroidServiceCallback->getAppIcon(appId,getAppIconReply);
} catch (runtime_error &e) {
LOG(ERROR) << __FUNCTION__
<< "::A runtime error happened while getting app icon: "
<< e.what();
} catch (exception &e) {
LOG(ERROR) << __FUNCTION__
<< "::An error happened while getting app icon: "
<< e.what();
} catch (...) {
LOG(ERROR) << __FUNCTION__
<< "::An UNKNOWN error happened while getting app icon";
}
} else {
LOG(ERROR) << __FUNCTION__ << "::Android callback is not registered!";
}
}
我的失败:
2020-09-17 13:50:09.647 6172-6197/com.xxx.bmt.rseapplicationcontrol E/android_os_HwBinder: Uncaught exception!
2020-09-17 13:50:09.648 6134-6134/? A/HidlStatus: Status.cpp:163] Failed HIDL return status not checked: Status(EX_TRANSACTION_FAILED): 'UNKNOWN_ERROR: '
2020-09-17 13:50:09.650 6134-6134/? A/libc: Fatal signal 6 (SIGABRT),code -1 (SI_QUEUE) in tid 6134 (applicationcont),pid 6134 (applicationcont)
2020-09-17 13:50:09.696 6249-6249/? I/crash_dump64: obtaining output fd from tombstoned,type: kDebuggerdTombstone
2020-09-17 13:50:09.699 433-433/? I//system/bin/tombstoned: received crash request for pid 6134
2020-09-17 13:50:09.700 6249-6249/? I/crash_dump64: performing dump of process 6134 (target tid = 6134)
2020-09-17 13:50:09.702 6249-6249/? A/DEBUG: *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2020-09-17 13:50:09.702 6249-6249/? A/DEBUG: Build fingerprint: 'xxx/xxx_rse22_ext/xxx_rse22:10/QQ3A.200605.002/eng.moaaz.20200908.173748:userdebug/test-keys'
2020-09-17 13:50:09.702 6249-6249/? A/DEBUG: Revision: '0'
2020-09-17 13:50:09.702 6249-6249/? A/DEBUG: ABI: 'arm64'
2020-09-17 13:50:09.703 6249-6249/? A/DEBUG: Timestamp: 2020-09-17 11:50:09+0000
2020-09-17 13:50:09.703 6249-6249/? A/DEBUG: pid: 6134,tid: 6134,name: applicationcont >>> /vendor/bin/hw/[email protected] <<<
2020-09-17 13:50:09.703 6249-6249/? A/DEBUG: uid: 1000
2020-09-17 13:50:09.703 6249-6249/? A/DEBUG: signal 6 (SIGABRT),code -1 (SI_QUEUE),fault addr --------
2020-09-17 13:50:09.703 6249-6249/? A/DEBUG: Abort message: 'Failed HIDL return status not checked: Status(EX_TRANSACTION_FAILED): 'UNKNOWN_ERROR: ''
我希望能够检查HIDL呼叫并根据这些呼叫的结果采取行动。 谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)