From: saerome kim Date: Fri, 28 Jun 2019 11:27:06 +0000 (+0900) Subject: Changed the app to transmit the event to the bundle in the suspend state. X-Git-Tag: accepted/tizen/unified/20190702.234158^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9e1c906cbe576cbc7f17639bde6c39035b9cf9c2;p=platform%2Fcore%2Fconnectivity%2Fua-manager.git Changed the app to transmit the event to the bundle in the suspend state. Change-Id: I048f27cf42d9aff88cdacd0f10aef31bac15b614 Signed-off-by: saerome kim --- diff --git a/ua-daemon/src/ua-manager-event-sender.c b/ua-daemon/src/ua-manager-event-sender.c index 5f40dc5..3408437 100644 --- a/ua-daemon/src/ua-manager-event-sender.c +++ b/ua-daemon/src/ua-manager-event-sender.c @@ -25,10 +25,34 @@ GSList *apps; /* List of apps to launch - uam_app_info_t*/ -# define APP_CONTROL_DATA_PUSH_LAUNCH_TYPE "http://tizen.org/appcontrol/data/push/launch_type" -# define EXTRA_DATA_FROM_REGISTRATION_CHANGE "registration_change" +#define UA_EVENT "UA_EVENT" -static void __uam_app_launcher(uam_app_info_t *app_info) +#define CASE_TO_STR(x) case x: return #x; + +const char* __uam_event_str(int event) +{ + switch (event) { + /* CHECK: List all enum values here */ + CASE_TO_STR(UAM_EVENT_SENSOR_STATE_READY) + CASE_TO_STR(UAM_EVENT_SENSOR_STATE_NOT_READY) + CASE_TO_STR(UAM_EVENT_USER_ADDED) + CASE_TO_STR(UAM_EVENT_USER_REMOVED) + CASE_TO_STR(UAM_EVENT_DEVICE_ADDED) + CASE_TO_STR(UAM_EVENT_DEVICE_REMOVED) + CASE_TO_STR(UAM_EVENT_PRESENCE_DETECTED) + CASE_TO_STR(UAM_EVENT_USER_PRESENCE_DETECTED) + CASE_TO_STR(UAM_EVENT_ABSENCE_DETECTED) + CASE_TO_STR(UAM_EVENT_USER_ABSENCE_DETECTED) + CASE_TO_STR(UAM_EVENT_DETECTION_STARTED) + CASE_TO_STR(UAM_EVENT_DETECTION_STOPPED) + CASE_TO_STR(UAM_EVENT_DEVICE_FOUND) + CASE_TO_STR(UAM_EVENT_SCAN_COMPLETED) + default : + return "Unknown Event"; + } +} + +static void __uam_app_launcher(uam_app_info_t *app_info, int event) { FUNC_ENTRY; int r = 0; @@ -42,7 +66,7 @@ static void __uam_app_launcher(uam_app_info_t *app_info) bundle *bund = NULL; bund = bundle_create(); - bundle_add(bund, APP_CONTROL_DATA_PUSH_LAUNCH_TYPE, EXTRA_DATA_FROM_REGISTRATION_CHANGE); + bundle_add(bund, UA_EVENT, __uam_event_str(event)); int result; result = aul_svc_set_background_launch(bund, TRUE); @@ -58,7 +82,7 @@ static void __uam_app_launcher(uam_app_info_t *app_info) FUNC_EXIT; } -static void __uam_resume_app(const char *dest) +static void __uam_resume_app(const char *dest, int event) { FUNC_ENTRY; GSList *l; @@ -72,7 +96,7 @@ static void __uam_resume_app(const char *dest) UAM_INFO("app_id: [%s] ", (const char*)app_info->app_id); UAM_INFO("uid: [%d] ", app_info->uid); - __uam_app_launcher(app_info); + __uam_app_launcher(app_info, event); } } else { for (l = apps; NULL != l; l = g_slist_next(l)) { @@ -83,7 +107,7 @@ static void __uam_resume_app(const char *dest) UAM_INFO("app_id: [%s] ", (const char*)app_info->app_id); UAM_INFO("uid: [%d] ", app_info->uid); if (!g_strcmp0(app_info->sender, dest)) { - __uam_app_launcher(app_info); + __uam_app_launcher(app_info, event); break; } } @@ -155,7 +179,7 @@ int _uam_manager_send_event( dest, _uam_manager_event_to_str(event), signal); /* Check if application requires resume before sending event */ - __uam_resume_app(dest); + __uam_resume_app(dest, event); if (!g_dbus_connection_emit_signal(conn, dest, UAM_EVENT_PATH, UAM_EVENT_INTERFACE, signal, param, &error)) {