Implement the update requested event 49/101349/4 accepted/tizen/3.0/common/20161213.164029 accepted/tizen/3.0/ivi/20161213.025731 accepted/tizen/3.0/mobile/20161213.025414 accepted/tizen/3.0/tv/20161213.025435 accepted/tizen/3.0/wearable/20161213.025622 submit/tizen_3.0/20161212.043612 submit/tizen_3.0/20161212.123626
authorHwankyu Jhun <h.jhun@samsung.com>
Thu, 1 Dec 2016 02:46:10 +0000 (11:46 +0900)
committerHwanKyu Jhun <h.jhun@samsung.com>
Tue, 6 Dec 2016 08:13:33 +0000 (00:13 -0800)
Change-Id: Ib264210abbc6e0852e596a2e4a4ae9ea23ee4423
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
src/app_main.c

index 8037e32..9862ba8 100755 (executable)
@@ -42,7 +42,7 @@
 
 #define LOG_TAG "CAPI_APPFW_APPLICATION"
 
-#define UI_APP_EVENT_MAX 6
+#define UI_APP_EVENT_MAX 7
 
 typedef enum {
        APP_STATE_NOT_RUNNING, /* The application has been launched or was running but was terminated */
@@ -491,6 +491,24 @@ static int _ui_app_appcore_suspended_state_changed(void *event_info, void *data)
 }
 /* LCOV_EXCL_STOP */
 
+static int _ui_app_appcore_update_requested(void *event_info, void *data)
+{
+       Eina_List *l;
+       app_event_handler_h handler;
+       struct app_event_info event;
+
+       LOGI("_ui_app_appcore_update_requested");
+
+       event.type = APP_EVENT_UPDATE_REQUESTED;
+       event.value = event_info;
+
+       EINA_LIST_FOREACH(handler_list[APP_EVENT_UPDATE_REQUESTED], l, handler) {
+               handler->cb(&event, handler->data);
+       }
+
+       return APP_ERROR_NONE;
+}
+
 static void _ui_app_appcore_set_event_cb(app_event_type_e event_type)
 {
        switch (event_type) {
@@ -513,6 +531,9 @@ static void _ui_app_appcore_set_event_cb(app_event_type_e event_type)
                LOGI("[__SUSPEND__]");
                appcore_set_event_callback(APPCORE_EVENT_SUSPENDED_STATE_CHANGE, _ui_app_appcore_suspended_state_changed, NULL);
                break;
+       case APP_EVENT_UPDATE_REQUESTED:
+               appcore_set_event_callback(APPCORE_EVENT_UPDATE_REQUESTED, _ui_app_appcore_update_requested, NULL);
+               break;
        default:
                break;
        }
@@ -540,6 +561,9 @@ static void _ui_app_appcore_unset_event_cb(app_event_type_e event_type)
                LOGI("[__SUSPEND__]");
                appcore_set_event_callback(APPCORE_EVENT_SUSPENDED_STATE_CHANGE, NULL, NULL);
                break;
+       case APP_EVENT_UPDATE_REQUESTED:
+               appcore_set_event_callback(APPCORE_EVENT_UPDATE_REQUESTED, NULL, NULL);
+               break;
        default:
                break;
        }
@@ -557,6 +581,8 @@ static void _ui_app_set_appcore_event_cb(void)
                _ui_app_appcore_set_event_cb(APP_EVENT_DEVICE_ORIENTATION_CHANGED);
        if (eina_list_count(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED]) > 0)
                _ui_app_appcore_set_event_cb(APP_EVENT_SUSPENDED_STATE_CHANGED);
+       if (eina_list_count(handler_list[APP_EVENT_UPDATE_REQUESTED]) > 0)
+               _ui_app_appcore_set_event_cb(APP_EVENT_UPDATE_REQUESTED);
 }
 
 static void _ui_app_unset_appcore_event_cb(void)
@@ -571,6 +597,8 @@ static void _ui_app_unset_appcore_event_cb(void)
                _ui_app_appcore_unset_event_cb(APP_EVENT_DEVICE_ORIENTATION_CHANGED);
        if (eina_list_count(handler_list[APP_EVENT_SUSPENDED_STATE_CHANGED]) > 0)
                _ui_app_appcore_unset_event_cb(APP_EVENT_SUSPENDED_STATE_CHANGED);
+       if (eina_list_count(handler_list[APP_EVENT_UPDATE_REQUESTED]) > 0)
+               _ui_app_appcore_unset_event_cb(APP_EVENT_UPDATE_REQUESTED);
 }
 
 static int _ui_app_appcore_create(void *data)