From d991f02b6d603d98d9bed4478b31d21efc562877 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 28 Jun 2017 20:41:33 +0900 Subject: [PATCH 01/16] Use common normal exit notify API - aul_notify_exit https://review.tizen.org/gerrit/#/c/136199/ (amd) https://review.tizen.org/gerrit/#/c/136200/ (aul-1) https://review.tizen.org/gerrit/#/c/136201/ (appcore-widget) https://review.tizen.org/gerrit/#/c/136209/ (widget-service) Change-Id: I92863ca2c88e8ac552012a5b5c4ae4f190833029 Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 6f19ce9..8e74db9 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -644,7 +644,7 @@ static void __multiwindow_exit(void *data) EXPORT_API int widget_base_exit(void) { appcore_multiwindow_base_exit(); - aul_widget_notify_exit(); + aul_notify_exit(); return 0; } -- 2.7.4 From c2233b1e963b14080d8725edbde500649eb7ad52 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 19 Jul 2017 15:09:56 +0900 Subject: [PATCH 02/16] Implement periodic update - update-callabck should be invoked periodically when the value of 'update-period' is bigger then 0 - Paused widget's update-callback should be deferred until it is resumed - Require https://review.tizen.org/gerrit/#/c/139466/ Change-Id: Id30e4de0576f3cb8b35743fff0ac37989356df6d Signed-off-by: Junghoon Park Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 117 ++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 96 insertions(+), 21 deletions(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 8e74db9..d479c52 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -84,8 +84,12 @@ typedef struct _widget_base_context { typedef struct _widget_base_instance_data { bundle *args; + char *id; char *content; void *tag; + double period; + guint periodic_timer; + bool pending_update; void *user_data; } widget_base_instance_data; @@ -94,6 +98,32 @@ static char *__appid; static char *__package_id; static bool __fg_signal; static char *__viewer_endpoint; +static void __call_update_cb(const char *class_id, const char *id, int force, + const char *content_raw); + +static gboolean __timeout_cb(gpointer user_data) +{ + widget_base_instance_data *data = + (widget_base_instance_data *)user_data; + appcore_multiwindow_base_instance_h cxt; + const char *class_id; + + cxt = appcore_multiwindow_base_instance_find(data->id); + if (appcore_multiwindow_base_instance_is_resumed(cxt)) { + LOGD("Periodic update!"); + class_id = appcore_multiwindow_base_instance_get_class_id(cxt); + __call_update_cb(class_id, data->id, 0, NULL); + } else { + data->pending_update = true; + if (data->periodic_timer) { + LOGD("Remove timer!"); + g_source_remove(data->periodic_timer); + data->periodic_timer = 0; + } + } + + return G_SOURCE_CONTINUE; +} static bool __is_widget_feature_enabled(void) { @@ -151,6 +181,7 @@ static void __instance_drop(appcore_multiwindow_base_instance_h instance_h) data = appcore_multiwindow_base_instance_get_extra(instance_h); appcore_multiwindow_base_instance_drop(instance_h); free(data->content); + free(data->id); free(data); __check_empty_instance(); } @@ -260,6 +291,9 @@ static void __control_create(const char *class_id, const char *id, bundle *b) { widget_base_instance_data *data; char *content = NULL; + double *period = NULL; + size_t size; + int ret; data = (widget_base_instance_data *) calloc(1, sizeof(widget_base_instance_data)); @@ -268,7 +302,14 @@ static void __control_create(const char *class_id, const char *id, bundle *b) return; } + data->id = strdup(id); data->args = b; + ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period, &size); + if (ret == BUNDLE_ERROR_NONE) { + data->period = *period; + data->periodic_timer = g_timeout_add_seconds(data->period, + __timeout_cb, data); + } /* call stub create */ appcore_multiwindow_base_instance_run(class_id, id, data); @@ -353,20 +394,18 @@ static void __control_resize(const char *class_id, const char *id, bundle *b) WIDGET_INSTANCE_EVENT_SIZE_CHANGED, NULL); } -static void __update_cb(const char *class_id, const char *id, - appcore_multiwindow_base_instance_h instance_h, void *data) +static void __call_update_cb(const char *class_id, const char *id, int force, + const char *content_raw) { void *class_data; + widget_base_class *cls; const appcore_multiwindow_base_class *raw_cls; + appcore_multiwindow_base_instance_h instance_h; bundle *content = NULL; - char *content_raw = NULL; - char *force_str = NULL; - int force; - bundle *b = data; - widget_base_class *cls; - if (!b) { - LOGE("bundle is NULL"); + instance_h = appcore_multiwindow_base_instance_find(id); + if (!instance_h) { + LOGE("context not found: %s", id); return; } @@ -388,15 +427,6 @@ static void __update_cb(const char *class_id, const char *id, return; } - bundle_get_str(b, WIDGET_K_FORCE, &force_str); - - if (force_str && strcmp(force_str, "true") == 0) - force = 1; - else - force = 0; - - bundle_get_str(b, WIDGET_K_CONTENT_INFO, &content_raw); - if (content_raw) { content = bundle_decode((const bundle_raw *)content_raw, strlen(content_raw)); @@ -413,13 +443,37 @@ static void __update_cb(const char *class_id, const char *id, bundle_free(content); } +static void __update_process(const char *class_id, const char *id, + appcore_multiwindow_base_instance_h instance_h, void *data) +{ + char *content_raw = NULL; + char *force_str = NULL; + int force; + bundle *b = data; + + if (!b) { + LOGE("bundle is NULL"); + return; + } + + bundle_get_str(b, WIDGET_K_FORCE, &force_str); + + if (force_str && strcmp(force_str, "true") == 0) + force = 1; + else + force = 0; + + bundle_get_str(b, WIDGET_K_CONTENT_INFO, &content_raw); + __call_update_cb(class_id, id, force, content_raw); +} + static void __control_update(const char *class_id, const char *id, bundle *b) { appcore_multiwindow_base_instance_h instance_h; if (!id) { appcore_multiwindow_base_instance_foreach(class_id, - __update_cb, b); + __update_process, b); return; } @@ -429,7 +483,7 @@ static void __control_update(const char *class_id, const char *id, bundle *b) return; } - __update_cb(class_id, id, instance_h, b); + __update_process(class_id, id, instance_h, b); } static void __control_destroy(const char *class_id, const char *id, bundle *b) @@ -451,6 +505,7 @@ static void __control_destroy(const char *class_id, const char *id, bundle *b) /* call stub terminate */ appcore_multiwindow_base_instance_exit(instance_h); free(data->content); + free(data->id); free(data); __check_empty_instance(); } @@ -1122,9 +1177,10 @@ static void __free_class(gpointer data) EXPORT_API void widget_base_fini(void) { - appcore_multiwindow_base_fini(); g_list_free_full(__context.classes, __free_class); __context.classes = NULL; + + appcore_multiwindow_base_fini(); } EXPORT_API int widget_base_context_window_bind( @@ -1264,6 +1320,7 @@ static void __multiwindow_instance_resume( const char *id; const char *class_id; widget_base_class *cls; + widget_base_instance_data *data; appcore_multiwindow_base_class_on_resume(instance_h); id = appcore_multiwindow_base_instance_get_id(instance_h); @@ -1274,6 +1331,21 @@ static void __multiwindow_instance_resume( return; } + data = (widget_base_instance_data *) + appcore_multiwindow_base_instance_get_extra(instance_h); + + if (data->pending_update) { + LOGD("pending update!"); + data->pending_update = false; + __control_update(class_id, data->id, data->args); + if (data->period > 0) { + LOGD("Restart timer!"); + data->periodic_timer = g_timeout_add_seconds( + data->period, + __timeout_cb, data); + } + } + if (cls->ops.resume) cls->ops.resume(instance_h, class_data); @@ -1380,6 +1452,9 @@ static void __multiwindow_instance_terminate( if (content_info) bundle_free(content_info); + if (data->periodic_timer) + g_source_remove(data->periodic_timer); + __send_update_status(class_id, id, event, NULL); appcore_multiwindow_base_class_on_terminate(instance_h); } -- 2.7.4 From cc471d913591dde16c9d4e88df5d31aa29b3d63f Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 20 Jul 2017 14:23:36 +0900 Subject: [PATCH 03/16] Implement widget operation for 'period' - This patch is associated with widget_service_change_period() - This operation is responsible for changing current update-period Change-Id: I32abe9b865941040d223d467984dac8e72e9d748 Signed-off-by: Junghoon Park Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index d479c52..c10cd8d 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -510,6 +510,48 @@ static void __control_destroy(const char *class_id, const char *id, bundle *b) __check_empty_instance(); } +static void __control_change_period(const char *class_id, const char *id, + bundle *b) +{ + appcore_multiwindow_base_instance_h instance_h; + widget_base_instance_data *data; + double *period = NULL; + size_t size; + int ret; + + instance_h = appcore_multiwindow_base_instance_find(id); + if (!instance_h) { + LOGE("context not found: %s", id); + return; + } + + data = (widget_base_instance_data *) + appcore_multiwindow_base_instance_get_extra(instance_h); + + if (!data) { + LOGE("could not find instance data: %s", id); + return; + } + + if (data->periodic_timer) { + LOGD("Remove timer!"); + g_source_remove(data->periodic_timer); + data->periodic_timer = 0; + } + + ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period, &size); + if (ret == BUNDLE_ERROR_NONE) + data->period = *period; + + if (data->period > 0) { + LOGD("Restart timer!"); + data->periodic_timer = g_timeout_add_seconds(data->period, + __timeout_cb, data); + } + + return; +} + static int __multiwindow_create(void *data) { char pkgid[256] = {0, }; @@ -601,6 +643,8 @@ static int __multiwindow_control(bundle *b, void *data) __control_pause(class_id, id, b); else if (strcmp(operation, "terminate") == 0) __control_destroy(class_id, id, b); + else if (strcmp(operation, "period") == 0) + __control_change_period(class_id, id, b); return 0; } -- 2.7.4 From b92069e837cbd5ebc51c7b8f4c50fdf94fcedde3 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 4 Aug 2017 19:53:49 +0900 Subject: [PATCH 04/16] Add an exception handling about permanent deletion Change-Id: Iea0e8dc778532174c618f07273f793cbee74d35b Signed-off-by: Hwankyu Jhun Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index c10cd8d..0cf602c 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -98,6 +98,7 @@ static char *__appid; static char *__package_id; static bool __fg_signal; static char *__viewer_endpoint; +static bool __is_permanent; static void __call_update_cb(const char *class_id, const char *id, int force, const char *content_raw); @@ -743,7 +744,8 @@ static void __multiwindow_exit(void *data) EXPORT_API int widget_base_exit(void) { appcore_multiwindow_base_exit(); - aul_notify_exit(); + if (appcore_multiwindow_base_instance_get_cnt() != 0 && __is_permanent) + aul_notify_exit(); return 0; } @@ -1485,9 +1487,11 @@ static void __multiwindow_instance_terminate( LOGD("%s is destroyed %d", id, reason); if (reason == WIDGET_BASE_DESTROY_TYPE_PERMANENT) { + __is_permanent = true; event = WIDGET_INSTANCE_EVENT_DESTROY; aul_widget_instance_del(class_id, id); } else { + __is_permanent = false; __send_update_status(class_id, id, WIDGET_INSTANCE_EVENT_EXTRA_UPDATED, content_info); -- 2.7.4 From a2f7f05a70c5fc2b331786824221c44037fbf88e Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 11 Aug 2017 10:54:53 +0900 Subject: [PATCH 05/16] Add a fallback about updating instance Change-Id: Icc45d5f4fddbadd8deeb81bdd024a47543b2a09c Signed-off-by: Hwankyu Jhun Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 0cf602c..34c94f5 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -90,6 +90,7 @@ typedef struct _widget_base_instance_data { double period; guint periodic_timer; bool pending_update; + char *pending_content; void *user_data; } widget_base_instance_data; @@ -181,6 +182,7 @@ static void __instance_drop(appcore_multiwindow_base_instance_h instance_h) data = appcore_multiwindow_base_instance_get_extra(instance_h); appcore_multiwindow_base_instance_drop(instance_h); + free(data->pending_content); free(data->content); free(data->id); free(data); @@ -444,6 +446,29 @@ static void __call_update_cb(const char *class_id, const char *id, int force, bundle_free(content); } +static void __update_pending_content( + appcore_multiwindow_base_instance_h instance_h, + const char *content_raw) +{ + widget_base_instance_data *data; + + data = (widget_base_instance_data *) + appcore_multiwindow_base_instance_get_extra(instance_h); + + if (data->pending_content) { + free(data->pending_content); + data->pending_content = NULL; + } + + if (content_raw) { + data->pending_content = strdup(content_raw); + if (data->pending_content == NULL) + LOGW("Out of memory"); + } + + data->pending_update = true; +} + static void __update_process(const char *class_id, const char *id, appcore_multiwindow_base_instance_h instance_h, void *data) { @@ -465,7 +490,10 @@ static void __update_process(const char *class_id, const char *id, force = 0; bundle_get_str(b, WIDGET_K_CONTENT_INFO, &content_raw); - __call_update_cb(class_id, id, force, content_raw); + if (!appcore_multiwindow_base_instance_is_resumed(instance_h) && !force) + __update_pending_content(instance_h, content_raw); + else + __call_update_cb(class_id, id, force, content_raw); } static void __control_update(const char *class_id, const char *id, bundle *b) @@ -505,6 +533,7 @@ static void __control_destroy(const char *class_id, const char *id, bundle *b) /* call stub terminate */ appcore_multiwindow_base_instance_exit(instance_h); + free(data->pending_content); free(data->content); free(data->id); free(data); @@ -1383,7 +1412,7 @@ static void __multiwindow_instance_resume( if (data->pending_update) { LOGD("pending update!"); data->pending_update = false; - __control_update(class_id, data->id, data->args); + __call_update_cb(class_id, data->id, 0, data->pending_content); if (data->period > 0) { LOGD("Restart timer!"); data->periodic_timer = g_timeout_add_seconds( -- 2.7.4 From cde56de54ed8022fc4ef199f49d66208e368e101 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Wed, 16 Aug 2017 13:44:32 +0900 Subject: [PATCH 06/16] Do not check period when instance create fail Change-Id: I6870e0ff6bd93f92f100ad8a0baf6f9d84285dce Signed-off-by: Hyunho Kang --- src/base/widget_base.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 34c94f5..92c8123 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -294,9 +294,6 @@ static void __control_create(const char *class_id, const char *id, bundle *b) { widget_base_instance_data *data; char *content = NULL; - double *period = NULL; - size_t size; - int ret; data = (widget_base_instance_data *) calloc(1, sizeof(widget_base_instance_data)); @@ -307,12 +304,6 @@ static void __control_create(const char *class_id, const char *id, bundle *b) data->id = strdup(id); data->args = b; - ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period, &size); - if (ret == BUNDLE_ERROR_NONE) { - data->period = *period; - data->periodic_timer = g_timeout_add_seconds(data->period, - __timeout_cb, data); - } /* call stub create */ appcore_multiwindow_base_instance_run(class_id, id, data); @@ -1330,6 +1321,8 @@ static void __multiwindow_instance_create( int h = 0; int ret = -1; widget_base_class *cls; + double *period = NULL; + size_t size; appcore_multiwindow_base_class_on_create(instance_h); instance_data = appcore_multiwindow_base_instance_get_extra(instance_h); @@ -1375,13 +1368,26 @@ static void __multiwindow_instance_create( LOGW("Create callback returns error(%d)", ret); ret = __send_update_status(class_id, id, WIDGET_INSTANCE_EVENT_CREATE_ABORTED, 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); + if (ret < 0) + LOGE("Fail to send create status (%d) ", ret); aul_widget_instance_add(class_id, id); + + ret = bundle_get_byte(b, WIDGET_K_PERIOD, (void **)&period, + &size); + if (ret == BUNDLE_ERROR_NONE) { + instance_data->period = *period; + instance_data->periodic_timer = g_timeout_add_seconds( + instance_data->period, + __timeout_cb, instance_data); + } } if (content_info) -- 2.7.4 From 948b351ba2463236fdb977c145d7abe55e63213f Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Wed, 30 Aug 2017 13:53:59 +0900 Subject: [PATCH 07/16] Fix wrong description Change-Id: Ic1a7a27fb1442e32d0ffbee03c23d014d842e957 --- include/widget_app.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/widget_app.h b/include/widget_app.h index cf1b275..9e309d2 100755 --- a/include/widget_app.h +++ b/include/widget_app.h @@ -353,7 +353,7 @@ const char *widget_app_get_id(widget_context_h context); * @return The new widget class object, * NULL on error * @exception #WIDGET_ERROR_NONE Successfully added - * @exception #WIDGET_ERROR_INVALID_PARAMETER Not supported + * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported * @exception #WIDGET_ERROR_OUT_OF_MEMORY Out of memory * @see get_last_result() @@ -432,7 +432,7 @@ int widget_app_context_set_title(widget_context_h context, const char *title); * @return The new widget class object, * NULL on error * @exception #WIDGET_ERROR_NONE Successfully added - * @exception #WIDGET_ERROR_INVALID_PARAMETER Not supported + * @exception #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported * @exception #WIDGET_ERROR_OUT_OF_MEMORY Out of memory * @see get_last_result() -- 2.7.4 From 118916174281f6ad5521f89c92b5334e38156643 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 12 Sep 2017 14:05:29 +0900 Subject: [PATCH 08/16] 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 From c226780592898b9967ff95bb0a77a7fce1e00913 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Fri, 22 Sep 2017 11:50:42 +0900 Subject: [PATCH 09/16] Release version 1.2.1 Changes: - Add get class exception handling logic - Fix base fini sequence Change-Id: Id6456311015174fca4a487619ce743741de93410 Signed-off-by: Junghoon Park --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index bf74f68..d4499dc 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.2.0 +Version: 1.2.1 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From c9d27c59f01297409fe3ddd40374c14a03e837ab Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 25 Sep 2017 11:25:02 +0900 Subject: [PATCH 10/16] Release version 1.2.2 Changes: - Use common normal exit notify API - Implement periodic update - Implement widget operation for 'period' - Add an exception handling about permanent deletion - Add a fallback about updating instance - Do not check period when instance create fail - Fix wrong description - Send error code to viewer - Merge branch 'devel/tizen' into tizen Change-Id: Ic7ff8988835d1afc13296fc4e2d62f1867d113c2 Signed-off-by: Hwankyu Jhun --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index d4499dc..281a334 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.2.1 +Version: 1.2.2 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 9d143f53708c28c91fe9a308306164b1c961cf19 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 26 Sep 2017 17:52:55 +0900 Subject: [PATCH 11/16] Fix static analysis issue - Fix 'resource leak' - Fix 'Uninitialized scalar variable' - Fix 'Dereference null return value' Change-Id: I70231bcc28287b8da2a999f8e0931670af6e464d Signed-off-by: Junghoon Park --- src/base/widget_base.c | 1 + src/efl_base/widget_app.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index e43635d..1843061 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -1600,6 +1600,7 @@ EXPORT_API widget_base_class widget_base_class_get_default(void) cls.ops.destroy = __class_on_destroy; cls.ops.pause = __class_on_pause; cls.ops.resume = __class_on_resume; + cls.id = NULL; return cls; } diff --git a/src/efl_base/widget_app.c b/src/efl_base/widget_app.c index 640dca2..6197b31 100644 --- a/src/efl_base/widget_app.c +++ b/src/efl_base/widget_app.c @@ -51,6 +51,8 @@ struct app_class_cb_info { void *user_data; }; +static GList *__class_data_list; + static int __class_resize(widget_base_instance_h instance_h, int w, int h, void *class_data) { @@ -62,6 +64,13 @@ static int __class_resize(widget_base_instance_h instance_h, int w, int h, widget_base_class_on_resize(instance_h, w, h); data = (struct instance_data *) widget_base_context_get_user_data(instance_h); + + if (!data) { + _E("widget_base_context_get_user_data() returns null"); + + return -1; + } + if (data->win) evas_object_resize(data->win, w, h); else @@ -253,6 +262,11 @@ EXPORT_API int widget_app_main(int argc, char **argv, cb_info.user_data = user_data; r = widget_base_init(ops, argc, argv, &cb_info); + if (__class_data_list) { + g_list_free_full(__class_data_list, free); + __class_data_list = NULL; + } + widget_base_fini(); return r; @@ -428,6 +442,7 @@ EXPORT_API widget_class_h widget_app_class_add(widget_class_h widget_class, return NULL; } + __class_data_list = g_list_append(__class_data_list, callback_data); set_last_result(WIDGET_ERROR_NONE); return wc; -- 2.7.4 From a6af77b734bb246dfbaecece1151363b14555d17 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 28 Sep 2017 09:49:37 +0900 Subject: [PATCH 12/16] Add lcov for widget restart logic - widget restart positive logic should be checked with manual tc Change-Id: Ia8b78b2f86806d07d07eddca60ed24d62d0a470f Signed-off-by: Hyunho Kang --- src/efl_base/widget_app_internal.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/efl_base/widget_app_internal.c b/src/efl_base/widget_app_internal.c index 43de979..cbd7e4c 100644 --- a/src/efl_base/widget_app_internal.c +++ b/src/efl_base/widget_app_internal.c @@ -43,12 +43,14 @@ #define LOG_TAG "CAPI_WIDGET_APPLICATION" static char *__class_id; +/* LCOV_EXCL_START */ static void __inst_cb(const char *class_id, const char *id, appcore_multiwindow_base_instance_h cxt, void *data) { if (!__class_id) __class_id = strdup(class_id); } +/* LCOV_EXCL_STOP */ EXPORT_API int widget_app_restart(void) { -- 2.7.4 From 2da6a06230b1c591dded99c41712b62eb568b732 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 28 Sep 2017 19:39:25 +0900 Subject: [PATCH 13/16] Release version 1.2.3 Changes: - Add lcov for widget restart logic - Fix static analysis issue Change-Id: I0a0418f8d242b92ee935dcfbef69e3828ebbd2a9 Signed-off-by: Junghoon Park --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 281a334..a93c404 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.2.2 +Version: 1.2.3 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 67ec244a5728d5e3fbf47ea9a012b80cd59f7e4b Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 29 Sep 2017 11:09:45 +0900 Subject: [PATCH 14/16] Add missing requirement Change-Id: Iff39d0dc4db7f73274baa43adad54051dcab860a Signed-off-by: Hyunho Kang --- appcore-widget-base.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appcore-widget-base.pc.in b/appcore-widget-base.pc.in index 78de159..f2d3717 100644 --- a/appcore-widget-base.pc.in +++ b/appcore-widget-base.pc.in @@ -8,6 +8,6 @@ includedir=@INCLUDEDIR@ Name: appcore-widget-base Description: widget base library Version: @VERSION@ -Requires: aul dlog capi-appfw-app-common widget_service +Requires: aul dlog capi-appfw-app-common widget_service appcore-multiwindow Libs: -L${libdir} -lappcore-widget-base Cflags: -I${includedir} -I${includedir}/appfw -- 2.7.4 From c6a564124cc41fa41b9d79b40e082f98443ccb20 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 29 Sep 2017 11:57:56 +0900 Subject: [PATCH 15/16] Release version 1.2.4 Changes: - Add missing requirement Change-Id: Ia8552bf2ffb0e94707ad707ff8ce636d2b4cda38 Signed-off-by: Hyunho Kang --- packaging/appcore-widget.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index a93c404..4eeb935 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -1,6 +1,6 @@ Name: appcore-widget Summary: Widget Application -Version: 1.2.3 +Version: 1.2.4 Release: 1 Group: Application Framework/Libraries License: Apache-2.0 -- 2.7.4 From 45f807bf3a812120e606026546f5f282fb17ac39 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Tue, 10 Oct 2017 22:14:17 +0900 Subject: [PATCH 16/16] Fix crash issue - Wrong sequence of finishing classes Change-Id: Icc9b23762f1a274ee1e8c7b1612280d934fb4599 Signed-off-by: Junghoon Park --- src/base/widget_base.c | 3 +-- src/efl_base/widget_app.c | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/base/widget_base.c b/src/base/widget_base.c index 1843061..f37fa3f 100644 --- a/src/base/widget_base.c +++ b/src/base/widget_base.c @@ -1249,10 +1249,9 @@ static void __free_class(gpointer data) EXPORT_API void widget_base_fini(void) { + appcore_multiwindow_base_fini(); g_list_free_full(__context.classes, __free_class); __context.classes = NULL; - - appcore_multiwindow_base_fini(); } EXPORT_API int widget_base_context_window_bind( diff --git a/src/efl_base/widget_app.c b/src/efl_base/widget_app.c index 6197b31..83073b3 100644 --- a/src/efl_base/widget_app.c +++ b/src/efl_base/widget_app.c @@ -262,13 +262,13 @@ EXPORT_API int widget_app_main(int argc, char **argv, cb_info.user_data = user_data; r = widget_base_init(ops, argc, argv, &cb_info); + widget_base_fini(); + if (__class_data_list) { g_list_free_full(__class_data_list, free); __class_data_list = NULL; } - widget_base_fini(); - return r; } -- 2.7.4