From 6b384d023e533b8bd89ce81cd5844bf50d1a1cac Mon Sep 17 00:00:00 2001 From: Shinwoo Kim Date: Mon, 14 Nov 2016 11:47:49 +0900 Subject: [PATCH 01/16] [accessibility][screen-reader] make widget accessible Change-Id: I2db8f30ae410aba654b3559e19f510f938ed023f --- src/widget_app.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/widget_app.c b/src/widget_app.c index 80d9cb8..374e437 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -1346,6 +1346,14 @@ EXPORT_API const char *widget_app_get_id(widget_context_h context) return context->id; } +static void _win_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + /* Remove data used in accessibility */ + char *plug_id; + plug_id = evas_object_data_del(obj, "___PLUGID"); + free(plug_id); +} + EXPORT_API int widget_app_get_elm_win(widget_context_h context, Evas_Object **win) { @@ -1353,6 +1361,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context, Evas_Object *ret_win; Ecore_Wl_Window *wl_win; struct wl_surface *surface; + char buffer[256]; if (!_is_widget_feature_enabled()) { _E("not supported"); /* LCOV_EXCL_LINE */ @@ -1390,6 +1399,11 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context, cxt->win = ret_win; cxt->win_id = ecore_wl_window_id_get(wl_win); + /* Set data to use in accessibility */ + snprintf(buffer, sizeof(buffer), "%s:%d", cxt->id, getpid()); + evas_object_data_set(ret_win, "___PLUGID", strdup(buffer)); + evas_object_event_callback_add(ret_win, EVAS_CALLBACK_DEL, _win_del_cb, NULL); + _D("window created: %d", cxt->win_id); return WIDGET_ERROR_NONE; -- 2.7.4 From 8f3616ab0951a76bf2080e50a6bd0ff8c77b0637 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 18 Nov 2016 10:48:05 +0900 Subject: [PATCH 02/16] Fix CMakeLists.txt To make extendible for adding source & header files. Change-Id: I79ed47c2e1078b6797be46a4a4467ce3851fb6c9 Signed-off-by: Hyunho Kang --- CMakeLists.txt | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e2669a7..2099f82 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,13 +22,6 @@ SET(CMAKE_SKIP_BUILD_RPATH TRUE) # Build appcore-widget Library # ------------------------------ SET(APPCORE_WIDGET "capi-appfw-widget-application") -SET(SRCS_widget - src/widget-i18n.c - src/widget_app.c - src/widget_app_internal.c - src/widget_error.c - ) -SET(HEADERS_widget widget_app.h widget_app_efl.h widget_app_internal.h) INCLUDE(FindPkgConfig) pkg_check_modules(pkg_widget REQUIRED @@ -49,7 +42,8 @@ FOREACH(flag ${pkg_widget_CFLAGS}) SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}") ENDFOREACH(flag) -ADD_LIBRARY(${APPCORE_WIDGET} SHARED ${SRCS_widget}) +AUX_SOURCE_DIRECTORY(src SOURCES) +ADD_LIBRARY(${APPCORE_WIDGET} SHARED ${SOURCES}) SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES SOVERSION ${VERSION_MAJOR}) SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES VERSION ${VERSION}) SET_TARGET_PROPERTIES(${APPCORE_WIDGET} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_widget}) @@ -57,6 +51,8 @@ TARGET_LINK_LIBRARIES(${APPCORE_WIDGET} ${pkg_widget_LDFLAGS} "-ldl -Wl,--no-und INSTALL(TARGETS ${APPCORE_WIDGET} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/${APPCORE_WIDGET}.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) -FOREACH(hfile ${HEADERS_widget}) - INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/${hfile} DESTINATION include/appfw) -ENDFOREACH(hfile) + +INSTALL(DIRECTORY ${CMAKE_SOURCE_DIR}/include/ DESTINATION include/appfw/ + FILES_MATCHING + PATTERN "*.h" + ) \ No newline at end of file -- 2.7.4 From d1d148d3981632531c3c0b31cc6ba1c15cfc269d Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 30 Nov 2016 17:01:54 +0900 Subject: [PATCH 03/16] Use strdup instead of g_strdup - strdup should be used beacase it was freed by free() Change-Id: I77c200e75661c27e0ac5eb26f6cc9ad190d7475c Signed-off-by: Junghoon Park --- src/widget_app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget_app.c b/src/widget_app.c index 374e437..dc45392 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -413,7 +413,7 @@ static int __instance_create(widget_class_h handle, const char *id, const char * return WIDGET_ERROR_OUT_OF_MEMORY; wc->state = WC_READY; - wc->id = g_strdup(id); + wc->id = strdup(id); wc->provider = handle; wc->win = NULL; wc->win_id = -1; -- 2.7.4 From 65326312013c0fe8f9b78f1e44f74a1ca2ccc02f Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 6 Dec 2016 09:49:25 +0900 Subject: [PATCH 04/16] Fix log format Change-Id: Ibe94d27267119a38fe614fd4f13736fb3b8f1311 Signed-off-by: Hwankyu Jhun --- src/widget_app.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widget_app.c b/src/widget_app.c index dc45392..8898766 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -662,7 +662,7 @@ static void __destroy_all(int reason, int send_update) iter = g_list_next(iter); switch (cxt->state) { case WC_PAUSED: - LOGD("destroy %s", cxt->state, cxt->id); + LOGD("destroy %d : %s", cxt->state, cxt->id); __instance_destroy(cxt->provider, cxt->id, reason, send_update); break; } -- 2.7.4 From d56a2f159c189b27361020d1cffc4a4382c9354c Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Thu, 24 Nov 2016 17:03:15 +0900 Subject: [PATCH 05/16] Set default preferred rotation to 0 Some devices set all applications preferred rotation to 90 degree widget app sould not be rotated becasue viewer will be rotated Change-Id: I1ad6204423ee7845c4ccf21614fc8eaae246bc01 Signed-off-by: Hyunho Kang --- src/widget_app.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/widget_app.c b/src/widget_app.c index 8898766..4ee4e2e 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -1362,6 +1362,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context, Ecore_Wl_Window *wl_win; struct wl_surface *surface; char buffer[256]; + int rots[3] = {0}; if (!_is_widget_feature_enabled()) { _E("not supported"); /* LCOV_EXCL_LINE */ @@ -1378,6 +1379,9 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context, goto fault; /* LCOV_EXCL_LINE */ } + elm_win_wm_rotation_preferred_rotation_set(ret_win, -1); + elm_win_wm_rotation_available_rotations_set(ret_win, rots, 1); + wl_win = elm_win_wl_window_get(ret_win); if (wl_win == NULL) { _E("failed to get wayland window"); /* LCOV_EXCL_LINE */ -- 2.7.4 From e95b5d19521b531da453f48c71d9777f335bdb28 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Mon, 12 Dec 2016 15:03:39 +0900 Subject: [PATCH 06/16] Replace tbm to screen-connector Change-Id: Icd7d1ae8c78e860fcaf816ee880c7f6ba4d06974 Signed-off-by: Hyunho Kang --- CMakeLists.txt | 1 + packaging/appcore-widget.spec | 1 + src/widget_app.c | 10 ++++------ 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2099f82..13129fc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ pkg_check_modules(pkg_widget REQUIRED capi-system-info ecore-wayland tizen-remote-surface-client + screen_connector_provider ) FOREACH(flag ${pkg_widget_CFLAGS}) SET(EXTRA_CFLAGS_widget "${EXTRA_CFLAGS_widget} ${flag}") diff --git a/packaging/appcore-widget.spec b/packaging/appcore-widget.spec index 5355ca0..8bdedaa 100644 --- a/packaging/appcore-widget.spec +++ b/packaging/appcore-widget.spec @@ -19,6 +19,7 @@ BuildRequires: pkgconfig(widget_service) BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(wayland-tbm-client) BuildRequires: pkgconfig(ecore-wayland) +BuildRequires: pkgconfig(screen_connector_provider) BuildRequires: cmake diff --git a/src/widget_app.c b/src/widget_app.c index 4ee4e2e..3b85e32 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -36,7 +36,7 @@ #include #include #include -#include +#include #include "widget_app.h" #include "widget-log.h" @@ -891,8 +891,7 @@ static int __before_loop(int argc, char **argv) _E("failed to get launch argv"); /* LCOV_EXCL_LINE */ } - aul_rsm_provider_init(); - + screen_connector_provider_init(); elm_init(argc, argv); r = aul_launch_init(__aul_handler, NULL); @@ -963,7 +962,7 @@ static void __after_loop() if (app_ops->terminate) app_ops->terminate(app_user_data); - aul_rsm_provider_fini(); + screen_connector_provider_fini(); _widget_app_free_viewer_endpoint(); _widget_core_unset_appcore_event_cb(); @@ -1393,8 +1392,7 @@ EXPORT_API int widget_app_get_elm_win(widget_context_h context, _E("failed to get surface"); /* LCOV_EXCL_LINE */ goto fault; /* LCOV_EXCL_LINE */ } - - aul_rsm_provider_remote_enable(cxt->id, surface); + screen_connector_provider_remote_enable(cxt->id, surface); ecore_wl_window_class_name_set(wl_win, cxt->id); elm_win_aux_hint_add(ret_win, "wm.policy.win.user.geometry", "1"); -- 2.7.4 From 3be5a3fd119e14a5834a1e946b1298f2a4ed5922 Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Fri, 16 Dec 2016 18:14:20 +0900 Subject: [PATCH 07/16] fix API description Change-Id: Ic83954f5ded30d25949b24e07afb708a9737c6d1 --- doc/appcore-widget_doc.h | 43 ++++++++---------- include/widget_app.h | 115 ++++++++++++++++++++++------------------------- include/widget_app_efl.h | 15 ++++--- 3 files changed, 81 insertions(+), 92 deletions(-) diff --git a/doc/appcore-widget_doc.h b/doc/appcore-widget_doc.h index 1a83d63..99b698c 100755 --- a/doc/appcore-widget_doc.h +++ b/doc/appcore-widget_doc.h @@ -14,28 +14,26 @@ * limitations under the License. */ + /** - * * @ingroup CAPI_WIDGET_FRAMEWORK * @defgroup CAPI_WIDGET_APP_MODULE Widget Application - * @brief Widget application API - * + * @brief Widget application API. * @section CAPI_WIDGET_APP_MODULE_HEADER Required Header - * \#include - * \#include + * \#include + * \#include + * * @section CAPI_WIDGET_APP_MODULE_OVERVIEW Overview * The @ref CAPI_WIDGET_APP_MODULE API provides functions for handling Tizen widget application state changes or system events. Tizen widget application can be shown in the home screen. - * This APIs support making multiple widget instances per an application. - * + * This API supports making multiple widget instances per an application. * This API provides interfaces for the following categories: - * - Starting or exiting the main event loop - * - Registering callbacks for application state change events - * - Registering callbacks for basic system events - * - Registering callbacks for instance state change events + * - Starting or exiting the main event loop. + * - Registering callbacks for application state change events. + * - Registering callbacks for basic system events. + * - Registering callbacks for instance state change events. * * @subsection CAPI_WIDGET_APP_MODULE_STATE_CHANGE_EVENT Registering Callbacks for Application State Change Events - * As for Tizen widget application states, it is very simple and somewhat similer to Tizen service application states. - * + * As for Tizen widget application states, it is very simple and somewhat similar to Tizen service application states. *

* * @@ -46,7 +44,7 @@ * * * @@ -54,24 +52,23 @@ * * * *
widget_app_create_cb()Hook to take necessary actions before the main event loop starts. * Your UI generation code should be placed here so that you do not miss any events from your application UI. - * Please make sure that you should make a class handle and return it. It will be used when the event for creating widget instance is received. + * Please make sure that you make a class handle and return it. It will be used when the event for creating widget instance is received. * You can initialize shared resources for widget instances in this callback function as well. *
widget_app_terminate_cb() Hook to take necessary actions when your application is terminating. * Your application should release all resources, especially any - * allocations and shared resources must be freed here so other running applications can fully use these shared resources. + * allocations and shared resources must be freed here so that other running applications can fully use these shared resources. *
*

- * * Please refer to the following state diagram to see the possible transitions and callbacks that are called while transition. + * * @image html widget_app_lifecycle.png "Widget Application States" * * @subsection CAPI_WIDGET_APP_MODULE_SYSTEM_EVENT Registering Callbacks for System Events - * Tizen widget applications can receive system events with widget_app_add_event_handler() api. + * Tizen widget applications can receive system events with widget_app_add_event_handler() API. * The type of system events that can be received are same as Tizen UI applications except for APP_EVENT_DEVICE_ORIENTATION_CHANGED. * See @ref CAPI_APPLICATION_MODULE. * The event for APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported in this module. - * + * @subsection CAPI_WIDGET_APP_INSTNACE_STATE_CHANGE_EVENT Registering callbacks for instance state change events - * As for Tizen widget instance states, it is somewhat similer to Tizen application states. - * + * As for Tizen widget instance states, it is somewhat similar to Tizen application states. *

* * @@ -82,7 +79,7 @@ * * * * @@ -117,13 +114,11 @@ * *
widget_instance_create_cb() Called after widget instance is created. * In this callback, you can initialize resources for this instance. - * If parameter 'content' is not NULL, You should restore the pervious status. + * If parameter 'content' is not NULL, you should restore the pervious status. *
*

- * * Please refer to the following state diagram to see the possible transitions and callbacks that are called while transition. + * * @image html widget_obj_lifecycle.png "Widget Instance States" * * @section CAPI_WIDGET_APP_MODULE_RELATED_FEATURES Related Features * This API is related with the following feature: * - http://tizen.org/feature/shell.appwidget - * - * */ diff --git a/include/widget_app.h b/include/widget_app.h index 3cd38a0..da53d6b 100755 --- a/include/widget_app.h +++ b/include/widget_app.h @@ -33,6 +33,7 @@ extern "C" { * @{ */ + /** * @brief Destroy type of widget instance. * @since_tizen 2.3.1 @@ -40,28 +41,29 @@ extern "C" { typedef enum widget_app_destroy_type { WIDGET_APP_DESTROY_TYPE_PERMANENT = 0x00, /**< User deleted this widget from the viewer */ WIDGET_APP_DESTROY_TYPE_TEMPORARY = 0x01, /**< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) */ -} widget_app_destroy_type_e; +} widget_app_destroy_type_e; /**< Delete type */ + /** - * @brief The handle for widget class. + * @brief The widget class handle. * @since_tizen 2.3.1 */ typedef struct _widget_class *widget_class_h; + /** - * @brief The handle for widget context. + * @brief The widget context handle. * @since_tizen 2.3.1 */ typedef struct _widget_context *widget_context_h; + /** * @brief Called when the widget instance starts. * @since_tizen 2.3.1 - * * @details The callback function is called after widget instance is created. * In this callback, you can initialize resources for this instance. - * - * @param[in] context The context of widget instance. + * @param[in] context The context of widget instance * @param[in] content The data set for the previous status * @param[in] w The pixel value for widget width * @param[in] h The pixel value for widget height @@ -72,37 +74,34 @@ typedef struct _widget_context *widget_context_h; */ typedef int (*widget_instance_create_cb)(widget_context_h context, bundle *content, int w, int h, void *user_data); + /** * @brief Called before the widget instance is destroyed. * @since_tizen 2.3.1 - * * @details The callback function is called before widget instance is destroyed. * In this callback, you can finalize resources for this instance. - * If reason is not #WIDGET_APP_DESTROY_TYPE_TEMPORARY, It should store the current status by using incoming bundle. - * - * @param[in] context The context of widget instance. - * @param[in] reason The reason for destruction - * @param[in,out] content The data set to save - * @param[in] user_data The user data passed from widget_app_class_create function + * If reason is not #WIDGET_APP_DESTROY_TYPE_TEMPORARY, it should store the current status by using incoming bundle. * @remark Note that the parameter 'content' is used to save the status of the widget instance. * As a input parameter, content contains the saved status of the widget instance. * You can fill the content parameter with the current status in this callback, * then the framework will save the content by receiving it as a output parameter. * Consequently, you should not use widget_app_context_set_content_info() api in this callback. * The content will be overwritten after this callback returns with the 'content' parameter. - * + * @param[in] context The context of widget instance + * @param[in] reason The reason for destruction + * @param[in,out] content The data set to save + * @param[in] user_data The user data passed from widget_app_class_create function * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure */ typedef int (*widget_instance_destroy_cb)(widget_context_h context, widget_app_destroy_type_e reason, bundle *content, void *user_data); + /** * @brief Called when the widget is invisible. * @since_tizen 2.3.1 - * * @details The callback function is called when the widget is invisible. * The paused instance may be destroyed by framework. - * * @param[in] context The context of widget instance * @param[in] user_data The user data passed from widget_app_class_create function * @return #WIDGET_ERROR_NONE on success, @@ -110,12 +109,11 @@ typedef int (*widget_instance_destroy_cb)(widget_context_h context, widget_app_d */ typedef int (*widget_instance_pause_cb)(widget_context_h context, void *user_data); + /** * @brief Called when the widget is visible. * @since_tizen 2.3.1 - * * @details The callback function is called when the widget is visible. - * * @param[in] context The context of widget instance * @param[in] user_data The user data passed from widget_app_class_create function * @return #WIDGET_ERROR_NONE on success, @@ -123,12 +121,11 @@ typedef int (*widget_instance_pause_cb)(widget_context_h context, void *user_dat */ typedef int (*widget_instance_resume_cb)(widget_context_h context, void *user_data); + /** * @brief Called before the widget size is changed. * @since_tizen 2.3.1 - * * @details The callback function is called before the widget size is changed. - * * @param[in] context The context of widget instance * @param[in] w The pixel value for widget width * @param[in] h The pixel value for widget height @@ -138,13 +135,12 @@ typedef int (*widget_instance_resume_cb)(widget_context_h context, void *user_da */ typedef int (*widget_instance_resize_cb)(widget_context_h context, int w, int h, void *user_data); + /** * @brief Called when the event for updating widget is received. * @since_tizen 2.3.1 - * * @details The callback function is called when the event for updating widget is received. - * - * @param[in] context The context of widget instance. + * @param[in] context The context of widget instance * @param[in] content The data set for updating this widget. It will be provided by requester. * Requester can use widget_service_trigger_update() * @param[in] force Although the widget is paused, if it is TRUE, the widget can be updated @@ -155,6 +151,7 @@ typedef int (*widget_instance_resize_cb)(widget_context_h context, int w, int h, */ typedef int (*widget_instance_update_cb)(widget_context_h context, bundle *content, int force, void *user_data); + /** * @brief The structure for lifecycle of a widget instance. * @since_tizen 2.3.1 @@ -168,14 +165,13 @@ typedef struct { widget_instance_update_cb update; /**< The callback function is called when the event for updating widget is received. */ } widget_instance_lifecycle_callback_s; + /** * @brief Called when the application starts. * @since_tizen 2.3.1 - * * @details The callback function is called before the main loop of the application starts. * In this callback, you can initialize resources which can be shared among widget instances. * This function should return the handle for widget class so that it will be used for making instances of widget. - * * @param[in] user_data The user data passed from the callback registration function * @return The object of widget class * @see widget_app_main() @@ -192,17 +188,18 @@ typedef struct { */ typedef widget_class_h (*widget_app_create_cb)(void *user_data); + /** * @brief Called when the application's main loop exits. * @details This callback function is called once after the main loop of the application exits. * You should release the application's resources in this function. * @since_tizen 2.3.1 - * * @param[in] user_data The user data passed from the callback registration function * @see widget_app_main() */ typedef void (*widget_app_terminate_cb)(void *user_data); + /** * @brief The structure for lifecycle of a widget application. * @since_tizen 2.3.1 @@ -212,31 +209,29 @@ typedef struct { widget_app_terminate_cb terminate; /**< This callback function is called once after the main loop of the application exits. */ } widget_app_lifecycle_callback_s; + /** * @brief Called for each widget context. * @since_tizen 2.3.1 - * * @details This function will be called in the function of widget_app_foreach_context repeatedly. - * * @param[in] context The context for widget instance * @param[in] data The data for caller - * @return true to continue with the next iteration of the loop, - * otherwise false to break out of the loop. + * @return @c true to continue with the next iteration of the loop, + * otherwise @c false to break out of the loop * @see widget_app_foreach_context() */ typedef bool (*widget_context_cb)(widget_context_h context, void *data); + /** * @brief Runs the main loop of the application until widget_app_exit() is called. * @since_tizen 2.3.1 - * * @param[in] argc The argument count * @param[in] argv The argument vector * @param[in] callback The set of callback functions to handle application events * @param[in] user_data The user data to be passed to the callback functions - * * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported @@ -245,13 +240,13 @@ typedef bool (*widget_context_cb)(widget_context_h context, void *data); */ int widget_app_main(int argc, char **argv, widget_app_lifecycle_callback_s *callback, void *user_data); + /** * @brief Exits the main loop of the application. * @details The main loop of the application stops and widget_app_terminate_cb() is invoked. * @since_tizen 2.3.1 - * * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_FAULT Unrecoverable error @@ -260,14 +255,13 @@ int widget_app_main(int argc, char **argv, widget_app_lifecycle_callback_s *call */ int widget_app_exit(void); + /** * @brief Finishes context for the widget instance. * @since_tizen 2.3.1 - * * @param[in] context The context for widget instance - * * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported @@ -275,15 +269,14 @@ int widget_app_exit(void); */ int widget_app_terminate_context(widget_context_h context); + /** * @brief Retrieves all widget contexts in this application. * @since_tizen 2.3.1 - * * @param[in] callback The iteration callback function * @param[in] data The data for the callback function - * * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_CANCELED The iteration is canceled @@ -293,17 +286,16 @@ int widget_app_terminate_context(widget_context_h context); */ int widget_app_foreach_context(widget_context_cb callback, void *data); + /** * @brief Adds the system event handler. * @since_tizen 2.3.1 - * * @param[out] event_handler The event handler * @param[in] event_type The system event type. APP_EVENT_DEVICE_ORIENTATION_CHANGED is not supported * @param[in] callback The callback function * @param[in] user_data The user data to be passed to the callback function - * * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_OUT_OF_MEMORY Out of memory @@ -319,11 +311,9 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t /** * @brief Removes registered event handler. * @since_tizen 2.3.1 - * * @param[in] event_handler The event handler - * - * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * @return #WIDGET_ERROR_NONE on success + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported @@ -332,25 +322,25 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t */ int widget_app_remove_event_handler(app_event_handler_h event_handler); + /** * @brief Gets a widget instance id. * @since_tizen 2.3.1 - * - * @param[in] context The context for widget instance - * * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. - * @return Widget ID on success, otherwise NULL + * @remark You must not free returned Widget ID + * @param[in] context The context for widget instance + * @return Widget ID on success, + * otherwise NULL * @exception #WIDGET_ERROR_NOT_SUPPORTED Not supported * @exception #WIDGET_ERROR_FAULT Unrecoverable error - * @remark You must not free returned Widget ID * @see get_last_result() */ const char *widget_app_get_id(widget_context_h context); + /** * @brief Makes a class for widget instances. * @since_tizen 2.3.1 - * * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] callback The set of lifecycle callbacks * @param[in] user_data The user data to be passed to the callback functions @@ -363,42 +353,42 @@ const char *widget_app_get_id(widget_context_h context); */ widget_class_h widget_app_class_create(widget_instance_lifecycle_callback_s callback, void *user_data); + /** * @brief Sets a tag in the context. * @since_tizen 2.3.1 - * * @param[in] context The context for widget instance * @param[in] tag The value to save - * * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error */ int widget_app_context_set_tag(widget_context_h context, void *tag); + /** * @brief Gets the tag in the context. * @since_tizen 2.3.1 - * * @param[in] context The context for widget instance * @param[out] tag The value to get * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Unrecoverable error */ int widget_app_context_get_tag(widget_context_h context, void **tag); + /** * @brief Sets the content info to the widget. * @since_tizen 2.3.1 * @param[in] context The context for widget instance * @param[in] content_info The data set to save * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successfully sent * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported @@ -407,13 +397,14 @@ int widget_app_context_get_tag(widget_context_h context, void **tag); */ int widget_app_context_set_content_info(widget_context_h context, bundle *content_info); + /** * @brief Sends the title to the widget. * @since_tizen 2.3.1 * @param[in] context The context for widget instance * @param[in] title When an accessibility mode is turned on, this string will be read * @return #WIDGET_ERROR_NONE on success, - * otherwise an error code (see WIDGET_ERROR_XXX) on failure + * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successfully sent * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid argument * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported @@ -422,6 +413,7 @@ int widget_app_context_set_content_info(widget_context_h context, bundle *conten */ int widget_app_context_set_title(widget_context_h context, const char *title); + /** * @brief Adds an additional widget class for multi-class of widget instantiation. * @since_tizen 3.0 @@ -449,4 +441,3 @@ widget_class_h widget_app_class_add(widget_class_h widget_class, const char *cla #endif #endif /* __TIZEN_APPFW_WIDGET_APP_H__ */ - diff --git a/include/widget_app_efl.h b/include/widget_app_efl.h index fd1a0c0..092f195 100644 --- a/include/widget_app_efl.h +++ b/include/widget_app_efl.h @@ -14,6 +14,7 @@ * limitations under the License. */ + #ifndef __TIZEN_APPFW_WIDGET_APP_EFL_H__ #define __TIZEN_APPFW_WIDGET_APP_EFL_H__ @@ -24,30 +25,32 @@ extern "C" { #endif + /** * @addtogroup CAPI_WIDGET_APP_MODULE * @{ */ /** - * @brief Gets a evas object for the widget + * @brief Gets an Evas object for the widget. * @since_tizen 2.3.1 - * * @param[in] context The context for widget instance - * @param[out] win Evas object for window - * - * @return 0 on success, otherwise a negative error value - * @retval #WIDGET_ERROR_NONE Successfull + * @param[out] win evas object for window + * @return 0 on success, + * otherwise a negative error value + * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter * @retval #WIDGET_ERROR_FAULT Failed to make evas object * @retval #WIDGET_ERROR_NOT_SUPPORTED Not supported */ int widget_app_get_elm_win(widget_context_h context, Evas_Object **win); + /** * @} */ + #ifdef __cplusplus } #endif -- 2.7.4 From 0642934264fd99143a235ea87f70600c74111183 Mon Sep 17 00:00:00 2001 From: Daehyeon Jung Date: Wed, 4 Jan 2017 17:50:03 +0900 Subject: [PATCH 08/16] Fix API description Change-Id: I9184102cc89cd08f654697a2ae67e2d627dfd39c --- include/widget_app.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/include/widget_app.h b/include/widget_app.h index da53d6b..4a2068e 100755 --- a/include/widget_app.h +++ b/include/widget_app.h @@ -35,13 +35,13 @@ extern "C" { /** - * @brief Destroy type of widget instance. + * @brief Enumeration for destroy type of widget instance. * @since_tizen 2.3.1 */ typedef enum widget_app_destroy_type { WIDGET_APP_DESTROY_TYPE_PERMANENT = 0x00, /**< User deleted this widget from the viewer */ WIDGET_APP_DESTROY_TYPE_TEMPORARY = 0x01, /**< Widget is deleted because of other reasons (e.g. widget process is terminated temporarily by the system) */ -} widget_app_destroy_type_e; /**< Delete type */ +} widget_app_destroy_type_e; /** @@ -60,9 +60,9 @@ typedef struct _widget_context *widget_context_h; /** * @brief Called when the widget instance starts. - * @since_tizen 2.3.1 * @details The callback function is called after widget instance is created. * In this callback, you can initialize resources for this instance. + * @since_tizen 2.3.1 * @param[in] context The context of widget instance * @param[in] content The data set for the previous status * @param[in] w The pixel value for widget width @@ -77,10 +77,10 @@ typedef int (*widget_instance_create_cb)(widget_context_h context, bundle *conte /** * @brief Called before the widget instance is destroyed. - * @since_tizen 2.3.1 * @details The callback function is called before widget instance is destroyed. * In this callback, you can finalize resources for this instance. * If reason is not #WIDGET_APP_DESTROY_TYPE_TEMPORARY, it should store the current status by using incoming bundle. + * @since_tizen 2.3.1 * @remark Note that the parameter 'content' is used to save the status of the widget instance. * As a input parameter, content contains the saved status of the widget instance. * You can fill the content parameter with the current status in this callback, @@ -99,9 +99,9 @@ typedef int (*widget_instance_destroy_cb)(widget_context_h context, widget_app_d /** * @brief Called when the widget is invisible. - * @since_tizen 2.3.1 * @details The callback function is called when the widget is invisible. * The paused instance may be destroyed by framework. + * @since_tizen 2.3.1 * @param[in] context The context of widget instance * @param[in] user_data The user data passed from widget_app_class_create function * @return #WIDGET_ERROR_NONE on success, @@ -112,8 +112,8 @@ typedef int (*widget_instance_pause_cb)(widget_context_h context, void *user_dat /** * @brief Called when the widget is visible. - * @since_tizen 2.3.1 * @details The callback function is called when the widget is visible. + * @since_tizen 2.3.1 * @param[in] context The context of widget instance * @param[in] user_data The user data passed from widget_app_class_create function * @return #WIDGET_ERROR_NONE on success, @@ -124,8 +124,8 @@ typedef int (*widget_instance_resume_cb)(widget_context_h context, void *user_da /** * @brief Called before the widget size is changed. - * @since_tizen 2.3.1 * @details The callback function is called before the widget size is changed. + * @since_tizen 2.3.1 * @param[in] context The context of widget instance * @param[in] w The pixel value for widget width * @param[in] h The pixel value for widget height @@ -138,8 +138,8 @@ typedef int (*widget_instance_resize_cb)(widget_context_h context, int w, int h, /** * @brief Called when the event for updating widget is received. - * @since_tizen 2.3.1 * @details The callback function is called when the event for updating widget is received. + * @since_tizen 2.3.1 * @param[in] context The context of widget instance * @param[in] content The data set for updating this widget. It will be provided by requester. * Requester can use widget_service_trigger_update() @@ -153,7 +153,7 @@ typedef int (*widget_instance_update_cb)(widget_context_h context, bundle *conte /** - * @brief The structure for lifecycle of a widget instance. + * @brief The structure type containing the set of callback functions for lifecycle of a widget instance. * @since_tizen 2.3.1 */ typedef struct { @@ -168,10 +168,10 @@ typedef struct { /** * @brief Called when the application starts. - * @since_tizen 2.3.1 * @details The callback function is called before the main loop of the application starts. * In this callback, you can initialize resources which can be shared among widget instances. * This function should return the handle for widget class so that it will be used for making instances of widget. + * @since_tizen 2.3.1 * @param[in] user_data The user data passed from the callback registration function * @return The object of widget class * @see widget_app_main() @@ -212,8 +212,8 @@ typedef struct { /** * @brief Called for each widget context. - * @since_tizen 2.3.1 * @details This function will be called in the function of widget_app_foreach_context repeatedly. + * @since_tizen 2.3.1 * @param[in] context The context for widget instance * @param[in] data The data for caller * @return @c true to continue with the next iteration of the loop, @@ -312,7 +312,7 @@ int widget_app_add_event_handler(app_event_handler_h *event_handler, app_event_t * @brief Removes registered event handler. * @since_tizen 2.3.1 * @param[in] event_handler The event handler - * @return #WIDGET_ERROR_NONE on success + * @return #WIDGET_ERROR_NONE on success, * otherwise an error code (see WIDGET_ERROR_XXX) on failure * @retval #WIDGET_ERROR_NONE Successful * @retval #WIDGET_ERROR_INVALID_PARAMETER Invalid parameter @@ -344,7 +344,8 @@ const char *widget_app_get_id(widget_context_h context); * @remarks The specific error code can be obtained using the get_last_result() method. Error codes are described in Exception section. * @param[in] callback The set of lifecycle callbacks * @param[in] user_data The user data to be passed to the callback functions - * @return The new widget class object. NULL on error + * @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_NOT_SUPPORTED Not supported @@ -422,7 +423,8 @@ int widget_app_context_set_title(widget_context_h context, const char *title); * @param[in] class_id The class id of provider * @param[in] callback The set of lifecycle callbacks * @param[in] user_data The user data to be passed to the callback functions - * @return The new widget class object. NULL on error + * @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_NOT_SUPPORTED Not supported -- 2.7.4 From 4782cff410a2b05bbaed7074279eb3f551897c49 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 20 Jan 2017 17:30:32 +0900 Subject: [PATCH 09/16] Fix memory leak Change-Id: I6dfa71dd1baebac7c12725badf15459b29b13204 Signed-off-by: Hwankyu Jhun --- src/widget_app.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/widget_app.c b/src/widget_app.c index 3b85e32..b3c18c5 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -973,6 +973,11 @@ static void __after_loop() package_id = NULL; } + if (appid) { + free(appid); + appid = NULL; + } + elm_shutdown(); } @@ -1148,8 +1153,13 @@ EXPORT_API int widget_app_main(int argc, char **argv, app_ops = callback; app_user_data = user_data; r = __before_loop(argc, argv); - if (r < 0) + if (r < 0) { + if (appid) { + free(appid); + appid = NULL; + } return r; + } ecore_main_loop_begin(); aul_status_update(STATUS_DYING); @@ -1538,6 +1548,7 @@ EXPORT_API int widget_app_context_set_content_info(widget_context_h context, else context->content = NULL; + free(raw); if (ret < 0) { /* LCOV_EXCL_START */ _E("failed to send content info: %s of %s (%d)", context->id, -- 2.7.4 From 262bcf3a60d0d9e00237ad7fea91a6801b93df81 Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Tue, 31 Jan 2017 09:25:30 +0900 Subject: [PATCH 10/16] Fix errata in doxygen comment Change-Id: Ib4c4879cd0c9b2a26e15fec2b678699fbcad51cf Signed-off-by: Semun Lee --- doc/appcore-widget_doc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/appcore-widget_doc.h b/doc/appcore-widget_doc.h index 99b698c..0dbc9a9 100755 --- a/doc/appcore-widget_doc.h +++ b/doc/appcore-widget_doc.h @@ -79,7 +79,7 @@ * widget_instance_create_cb() * Called after widget instance is created. * In this callback, you can initialize resources for this instance. - * If parameter 'content' is not NULL, you should restore the pervious status. + * If parameter 'content' is not NULL, you should restore the previous status. * * * -- 2.7.4 From 0c9faf0db7a4b3776c9a097e6952f8393087f01a Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Wed, 22 Feb 2017 10:33:32 +0900 Subject: [PATCH 11/16] Send FG/BG signal to resourced - resourced should know the FG/BG status to control oom score Change-Id: Ieab8aa28f9f80bbb087cef1f662c58ad8e4cb3de Signed-off-by: Junghoon Park --- src/widget_app.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/widget_app.c b/src/widget_app.c index b3c18c5..3911a6d 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -16,6 +16,7 @@ #include +#include #include #include @@ -50,6 +51,9 @@ #define STR_MAX_BUF 128 #define LOG_TAG "CAPI_WIDGET_APPLICATION" #define K_REASON "__WC_K_REASON__" +#define APP_TYPE_WIDGET "widgetapp" +#define STATUS_FOREGROUND "fg" +#define STATUS_BACKGROUND "bg" typedef enum _widget_obj_state_e { WC_READY = 0, @@ -86,6 +90,7 @@ static char *appid; static widget_class_h class_provider; static int exit_called; static char *package_id; +static bool fg_signal; static void _widget_core_set_appcore_event_cb(void); static void _widget_core_unset_appcore_event_cb(void); @@ -149,6 +154,28 @@ static widget_context_s *__find_context_by_id(const char *id) return ret->data; } +static gint __comp_by_state(gconstpointer a, gconstpointer b) +{ + widget_context_s *wc = (widget_context_s *)a; + + if (wc->state == (widget_obj_state_e)GPOINTER_TO_INT(b)) + return 0; + + return -1; +} + +static widget_context_s *__find_context_by_state(widget_obj_state_e state) +{ + GList *ret; + GList *contexts = _widget_app_get_contexts(); + + ret = g_list_find_custom(contexts, GINT_TO_POINTER((int)state), __comp_by_state); + if (ret == NULL) + return NULL; + + return ret->data; +} + static gint __comp_by_win(gconstpointer a, gconstpointer b) { int win = GPOINTER_TO_INT(b); @@ -283,6 +310,15 @@ static int __instance_resume(widget_class_h handle, const char *id, int send_upd if (send_update) { ret = __send_update_status(handle->classid, wc->id, WIDGET_INSTANCE_EVENT_RESUME, NULL); + if (!fg_signal) { + _D("Send fg signal to resourceD"); + aul_send_app_status_change_signal(getpid(), + appid, + package_id, + STATUS_FOREGROUND, + APP_TYPE_WIDGET); + fg_signal = true; + } } else { ret = 0; } @@ -318,6 +354,16 @@ static int __instance_pause(widget_class_h handle, const char *id, int send_upda if (send_update) { ret = __send_update_status(handle->classid, wc->id, WIDGET_INSTANCE_EVENT_PAUSE, NULL); + wc = __find_context_by_state(WC_RUNNING); + if (!wc && fg_signal) { + _D("Send bg signal to resourceD"); + aul_send_app_status_change_signal(getpid(), + appid, + package_id, + STATUS_BACKGROUND, + APP_TYPE_WIDGET); + fg_signal = false; + } } else { ret = 0; } -- 2.7.4 From dad8b9e077617e32e5c62fb6b6716dc04249f679 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 16 Mar 2017 11:39:08 +0900 Subject: [PATCH 12/16] Add log messages Change-Id: I9cc598c0b9252b16946aa93771290538854ddd68 Signed-off-by: Hwankyu Jhun --- src/widget_app.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/widget_app.c b/src/widget_app.c index 3911a6d..6cedfa8 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -455,8 +455,10 @@ static int __instance_create(widget_class_h handle, const char *id, const char * bundle *content_info = NULL; wc = (widget_context_s *)calloc(1, sizeof(widget_context_s)); - if (!wc) + if (!wc) { + _E("Out of memory"); return WIDGET_ERROR_OUT_OF_MEMORY; + } wc->state = WC_READY; wc->id = strdup(id); @@ -473,6 +475,7 @@ static int __instance_create(widget_class_h handle, const char *id, const char * ret = handle->ops.create(wc, content_info, w, h, handle->user_data); if (ret < 0) { + _W("Create callback resturns error(%d)", ret); /* TODO send abort */ } else { ret = __send_update_status(handle->classid, wc->id, -- 2.7.4 From 48f9d97a5d930e13ad80e318bdd2c7e6bfab0020 Mon Sep 17 00:00:00 2001 From: Hyunho Kang Date: Fri, 17 Mar 2017 22:59:28 +0900 Subject: [PATCH 13/16] Handle widget resize event Change-Id: I8a6a8cc7be128ebd8720bb2bd6a0794385a2b97a Signed-off-by: Hyunho Kang (cherry picked from commit e14b8629ef2df41c3a018aaed9f2d40a791c03ff) --- src/widget_app.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widget_app.c b/src/widget_app.c index 6cedfa8..a5a5bdb 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -634,6 +634,7 @@ static void __control(bundle *b) __instance_create(handle, id, content, w, h); } else if (strcmp(operation, "resize") == 0) { __resize_window(id, w, h); + __instance_resize(handle, id, w, h); } else if (strcmp(operation, "update") == 0) { if (id) __instance_update(handle, id, force, content); -- 2.7.4 From 6fdbff007910db7fca2b6d0cddee15c10e477491 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 17 Mar 2017 16:53:20 +0900 Subject: [PATCH 14/16] Send create aborted event to the widget viewer Requires: - https://review.tizen.org/gerrit/119553 Change-Id: Iaac8a02534fd72381a270aa00e00de59756559f0 Signed-off-by: Hwankyu Jhun (cherry picked from commit fcbfa76f54caaff86e2ff9648d420f1338854af8) --- src/widget_app.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/widget_app.c b/src/widget_app.c index a5a5bdb..5995238 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -476,7 +476,17 @@ static int __instance_create(widget_class_h handle, const char *id, const char * ret = handle->ops.create(wc, content_info, w, h, handle->user_data); if (ret < 0) { _W("Create callback resturns error(%d)", ret); - /* TODO send abort */ + ret = __send_update_status(handle->classid, wc->id, + WIDGET_INSTANCE_EVENT_CREATE_ABORTED, NULL); + _widget_app_remove_context(wc); + if (wc->id) + free(wc->id); + if (wc->content) + free(wc->content); + free(wc); + + if (_widget_app_get_contexts() == NULL && !exit_called) + widget_app_exit(); } else { ret = __send_update_status(handle->classid, wc->id, WIDGET_INSTANCE_EVENT_CREATE, NULL); -- 2.7.4 From 7bd93f1f542237e8313c30f0b2018be0cadcd654 Mon Sep 17 00:00:00 2001 From: Junghoon Park Date: Thu, 13 Apr 2017 20:46:41 +0900 Subject: [PATCH 15/16] Change main loop APIs - Use elm_run instead of ecore_main_loop_begin Change-Id: I613edea999586a27d20eee506aabfcb66bb694fa Signed-off-by: Junghoon Park --- src/widget_app.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/widget_app.c b/src/widget_app.c index 5995238..384f0cd 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -1039,6 +1039,13 @@ static void __after_loop() } elm_shutdown(); + + /* Check loader case */ + if (getenv("AUL_LOADER_INIT")) { + unsetenv("AUL_LOADER_INIT"); + elm_shutdown(); + } + } static void __on_low_memory(keynode_t *key, void *data) @@ -1221,7 +1228,7 @@ EXPORT_API int widget_app_main(int argc, char **argv, return r; } - ecore_main_loop_begin(); + elm_run(); aul_status_update(STATUS_DYING); __after_loop(); @@ -1240,7 +1247,7 @@ EXPORT_API int widget_app_exit(void) exit_called = 1; - ecore_main_loop_quit(); + elm_exit(); return WIDGET_ERROR_NONE; } -- 2.7.4 From 92bdc56b4dbe0d4a75c692a6d1a68344c0db9580 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 31 May 2017 13:25:44 +0900 Subject: [PATCH 16/16] Handle abnormal exit Whlie calling widget_app_exit(), the widget app sends the normal termination signal to the amd. If the amd doesn't get the signal when the widget app is dead, the amd will send the widget fault signal to the widget viewer. Requires: - https://review.tizen.org/gerrit/#/c/131674/ [aul-1] - https://review.tizen.org/gerrit/#/c/131685/ [amd] - https://review.tizen.org/gerrit/#/c/131692/ [widget-service] - https://review.tizen.org/gerrit/#/c/131695/ [widget-viewer] Change-Id: I60076b893ef36c8a43e43669746393b7b98b877f Signed-off-by: Hwankyu Jhun --- src/widget_app.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/widget_app.c b/src/widget_app.c index 384f0cd..8790457 100755 --- a/src/widget_app.c +++ b/src/widget_app.c @@ -1248,6 +1248,7 @@ EXPORT_API int widget_app_exit(void) exit_called = 1; elm_exit(); + aul_widget_notify_exit(); return WIDGET_ERROR_NONE; } -- 2.7.4