From 70bab53b782a0efd56762e50fc41edc4daa54269 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 19 Apr 2017 08:33:48 +0900 Subject: [PATCH] Add a new API to unregister app status event Adds: - aul_ignore_app_status() Change-Id: I5944ae8874625ba9cef568ad090e491558101c17 Signed-off-by: Hwankyu Jhun --- include/aul.h | 5 +++++ src/status.c | 12 ++++++++++++ tool/aul_test.c | 4 ++++ 3 files changed, 21 insertions(+) diff --git a/include/aul.h b/include/aul.h index 6f0e66d..1b4e183 100644 --- a/include/aul.h +++ b/include/aul.h @@ -3045,6 +3045,11 @@ int aul_resume_app_by_instance_id(const char *appid, const char *instance_id); int aul_resume_app_by_instance_id_for_uid(const char *appid, const char *instance_id, uid_t uid); +/** + * This API is only for Appfw internally. + */ +int aul_ignore_app_status(status_listen_h handle); + #ifdef __cplusplus } #endif diff --git a/src/status.c b/src/status.c index 7c08016..39dac09 100644 --- a/src/status.c +++ b/src/status.c @@ -359,3 +359,15 @@ API int aul_listen_app_status(const char *appid, app_status_cb callback, return aul_listen_app_status_for_uid(appid, callback, data, handle, getuid()); } + +API int aul_ignore_app_status(status_listen_h handle) +{ + if (handle == NULL) + return AUL_R_EINVAL; + + if (handle->conn) + aul_app_com_leave(handle->conn); + free(handle); + + return AUL_R_OK; +} diff --git a/tool/aul_test.c b/tool/aul_test.c index b308dbc..3320a5b 100644 --- a/tool/aul_test.c +++ b/tool/aul_test.c @@ -933,6 +933,10 @@ int main(int argc, char **argv) exit(EXIT_FAILURE); } g_main_loop_run(mainloop); + g_main_loop_unref(mainloop); + + if (listen_handle) + aul_ignore_app_status(listen_handle); return 0; } -- 2.7.4