From 118916174281f6ad5521f89c92b5334e38156643 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 12 Sep 2017 14:05:29 +0900 Subject: [PATCH] Send error code to viewer - In case of sending WIDGET_INSTANCE_EVENT_CREATE_ABORTED, the error code should be sent to viewer - Require: https://review.tizen.org/gerrit/#/c/149321/ Change-Id: I2ad991dda2e4e10d78a774f75a42fefa90bc99d2 Signed-off-by: Junghoon Park Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 92c8123..e43635d 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -239,12 +239,13 @@ static int __send_lifecycle_event(const char *class_id, const char *instance_id, } static int __send_update_status(const char *class_id, const char *instance_id, - int status, bundle *extra) + int status, int err, bundle *extra) { bundle *b; int lifecycle = -1; bundle_raw *raw = NULL; int len; + char err_str[256]; b = bundle_create(); if (!b) { @@ -252,6 +253,11 @@ static int __send_update_status(const char *class_id, const char *instance_id, return -1; /* LCOV_EXCL_LINE */ } + if (err < 0) { + snprintf(err_str, sizeof(err_str), "%d", err); + bundle_add_str(b, AUL_K_WIDGET_ERROR_CODE, err_str); + } + bundle_add_str(b, AUL_K_WIDGET_ID, class_id); bundle_add_str(b, AUL_K_WIDGET_INSTANCE_ID, instance_id); bundle_add_byte(b, AUL_K_WIDGET_STATUS, &status, sizeof(int)); @@ -385,7 +391,7 @@ static void __control_resize(const char *class_id, const char *id, bundle *b) LOGD("%s is resized to %dx%d", id, w, h); __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_SIZE_CHANGED, NULL); + WIDGET_INSTANCE_EVENT_SIZE_CHANGED, 0, NULL); } static void __call_update_cb(const char *class_id, const char *id, int force, @@ -430,7 +436,7 @@ static void __call_update_cb(const char *class_id, const char *id, int force, cls->ops.update(instance_h, content, force, class_data); __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_UPDATE, NULL); + WIDGET_INSTANCE_EVENT_UPDATE, 0, NULL); LOGD("updated:%s", id); if (content) @@ -964,7 +970,7 @@ EXPORT_API int widget_base_context_set_content_info( return WIDGET_BASE_ERROR_FAULT; ret = __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info); + WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, 0, content_info); if (data->content) free(data->content); @@ -1367,14 +1373,14 @@ static void __multiwindow_instance_create( if (ret < 0) { LOGW("Create callback returns error(%d)", ret); ret = __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_CREATE_ABORTED, NULL); + WIDGET_INSTANCE_EVENT_CREATE_ABORTED, ret, NULL); if (ret < 0) LOGE("Fail to send abort status (%d) ", ret); __instance_drop(instance_h); } else { LOGD("%s is created", id); ret = __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_CREATE, NULL); + WIDGET_INSTANCE_EVENT_CREATE, 0, NULL); if (ret < 0) LOGE("Fail to send create status (%d) ", ret); @@ -1432,7 +1438,7 @@ static void __multiwindow_instance_resume( LOGD("%s is resumed", id); __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_RESUME, NULL); + WIDGET_INSTANCE_EVENT_RESUME, 0, NULL); if (!__fg_signal) { LOGD("Send fg signal to resourceD"); @@ -1467,7 +1473,7 @@ static void __multiwindow_instance_pause( LOGD("%s is paused", id); __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_PAUSE, NULL); + WIDGET_INSTANCE_EVENT_PAUSE, 0, NULL); if (__fg_signal) { LOGD("Send bg signal to resourceD"); @@ -1528,7 +1534,7 @@ static void __multiwindow_instance_terminate( } else { __is_permanent = false; __send_update_status(class_id, id, - WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, + WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, 0, content_info); } @@ -1538,7 +1544,7 @@ static void __multiwindow_instance_terminate( if (data->periodic_timer) g_source_remove(data->periodic_timer); - __send_update_status(class_id, id, event, NULL); + __send_update_status(class_id, id, event, 0, NULL); appcore_multiwindow_base_class_on_terminate(instance_h); } -- 2.7.4