From 5b65450f3ce04be96bd133b8d0271705ec697eaa Mon Sep 17 00:00:00 2001 From: Changgyu Choi Date: Wed, 9 Nov 2022 17:46:59 +0900 Subject: [PATCH] Add AUL_SVC_RET_ETIMEOUT error Currently, app_control_send_launch_request() has returned REJECTED error even though timeout. After applying this patch, app receive APP_CONTROL_ERROR_TIMED_OUT when app_control_send_launch_request() occurs time out. Change-Id: I2b32627cd1c6189d97834d926009720b55e49a6c Signed-off-by: Changgyu Choi --- include/aul_svc.h | 1 + src/aul_svc.cc | 2 ++ src/launch_with_result.cc | 8 +++++++- 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/aul_svc.h b/include/aul_svc.h index 1eaff91..af8f290 100644 --- a/include/aul_svc.h +++ b/include/aul_svc.h @@ -126,6 +126,7 @@ extern "C" { * @brief Return values in appsvc. */ typedef enum _aul_svc_return_val { + AUL_SVC_RET_ETIMEOUT = -10, /**< Timeout */ AUL_SVC_RET_ENOMEM = -9, /**< Out of memory */ AUL_SVC_RET_ECANCELED = -8, /**< Operation is canceled */ AUL_SVC_RET_EREJECTED = -7, /**< application launch rejected */ diff --git a/src/aul_svc.cc b/src/aul_svc.cc index 7e2956c..df63a25 100644 --- a/src/aul_svc.cc +++ b/src/aul_svc.cc @@ -219,6 +219,8 @@ int AulErrorConvert(int res) { return AUL_SVC_RET_ENOMATCH; case AUL_R_ECANCELED: return AUL_SVC_RET_ECANCELED; + case AUL_R_ETIMEOUT: + return AUL_SVC_RET_ETIMEOUT; default: return AUL_SVC_RET_ELAUNCH; } diff --git a/src/launch_with_result.cc b/src/launch_with_result.cc index a932416..9a95d49 100644 --- a/src/launch_with_result.cc +++ b/src/launch_with_result.cc @@ -394,6 +394,9 @@ int __recv_reply_bundle(int fd, bundle** reply_b) { int ret = aul_sock_recv_reply_pkt(fd, &pkt); if (ret != 0) { _E("Failed to receive the packet. result(%d)", ret); + if (ret == -EAGAIN) + return AUL_R_ETIMEOUT; + return AUL_R_ECOMM; } @@ -406,6 +409,9 @@ int __recv_reply_bundle(int fd, bundle** reply_b) { ret = pkt_auto->cmd; if (ret < 0) { _E("The launch request is failed. result(%d)", ret); + if (ret == -EAGAIN) + return AUL_R_ETIMEOUT; + return AUL_R_ERROR; } @@ -761,7 +767,7 @@ extern "C" API int aul_send_launch_request_for_uid(const char* appid, uid, reply_cb, error_cb, user_data); } -extern "C" API int aul_send_launch_request_sync_for_uid(const char* appid, +extern "C" API int aul_send_launch_request_sync_for_uid(const char* appid, bundle* b, uid_t uid, bundle** res_b) { if (!aul_is_initialized()) { if (aul_launch_init(nullptr, nullptr) < 0) { -- 2.7.4