Fix error log
[platform/core/appfw/appcore-widget.git] / src / base / widget_base.c
index efa1394..678b6f9 100644 (file)
@@ -31,8 +31,6 @@
 #include <aul_app_com.h>
 #include <Ecore_Wl2.h>
 #include <system_info.h>
-#include <vconf.h>
-#include <vconf-internal-keys.h>
 #include <screen_connector_provider.h>
 #include <appcore_multiwindow_base.h>
 
@@ -154,27 +152,6 @@ static bool __is_widget_feature_enabled(void)
        return feature;
 }
 
-/* LCOV_EXCL_START */
-static void __on_poweroff(keynode_t *key, void *data)
-{
-       int val;
-
-       val = vconf_keynode_get_int(key);
-       switch (val) {
-       case VCONFKEY_SYSMAN_POWER_OFF_DIRECT:
-       case VCONFKEY_SYSMAN_POWER_OFF_RESTART:
-               LOGI("power off changed: %d", val);
-               widget_base_exit();
-               break;
-       case VCONFKEY_SYSMAN_POWER_OFF_NONE:
-       case VCONFKEY_SYSMAN_POWER_OFF_POPUP:
-       default:
-               /* DO NOTHING */
-               break;
-       }
-}
-/* LCOV_EXCL_STOP */
-
 static void __check_empty_instance(void)
 {
        int cnt = appcore_multiwindow_base_instance_get_cnt();
@@ -325,11 +302,12 @@ static void __control_create(const char *class_id, const char *id, bundle *b)
 
        /* call stub create */
        appcore_multiwindow_base_instance_run(class_id, id, data);
-       data->args = NULL;
-       bundle_get_str(b, WIDGET_K_CONTENT_INFO, &content);
-       if (content)
-               data->content = strdup(content);
-
+       if (appcore_multiwindow_base_instance_find(id)) {
+               data->args = NULL;
+               bundle_get_str(b, WIDGET_K_CONTENT_INFO, &content);
+               if (content)
+                       data->content = strdup(content);
+       }
 }
 
 static void __control_resume(const char *class_id, const char *id, bundle *b)
@@ -547,6 +525,8 @@ static void __control_destroy(const char *class_id, const char *id, bundle *b)
        free(data->id);
        free(data);
        __check_empty_instance();
+       aul_widget_write_log(LOG_TAG,
+               "[%s:%d] instance_id(%s)", __FUNCTION__, __LINE__, id);
 }
 
 static void __control_change_period(const char *class_id, const char *id,
@@ -607,10 +587,6 @@ static int __multiwindow_create(void *data)
        }
 
        screen_connector_provider_init();
-       vconf_notify_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS,
-                       __on_poweroff, NULL);
-
-
        if (__context.ops.create)
                ret = __context.ops.create(data);
 
@@ -622,9 +598,6 @@ static int __multiwindow_terminate(void *data)
 {
        if (__context.ops.terminate)
                __context.ops.terminate(data);
-
-       vconf_ignore_key_changed(VCONFKEY_SYSMAN_POWER_OFF_STATUS,
-                       __on_poweroff);
        screen_connector_provider_fini();
 
        if (__viewer_endpoint) {
@@ -668,6 +641,7 @@ static int __multiwindow_control(bundle *b, void *data)
                return 0;
        }
 
+       LOGI("app control operation(%s)", operation);
        if (strcmp(operation, "create") == 0)
                __control_create(class_id, id, b);
        else if (strcmp(operation, "resize") == 0)
@@ -787,14 +761,17 @@ static void __multiwindow_trim_memory(void *data)
 
 EXPORT_API int widget_base_exit(void)
 {
-       int ret;
+       int ret = 0;
+       int cnt;
 
        appcore_multiwindow_base_exit();
-       if (appcore_multiwindow_base_instance_get_cnt() == 0 && __is_permanent) {
+       cnt = appcore_multiwindow_base_instance_get_cnt();
+       if (cnt == 0 && __is_permanent)
                ret = aul_notify_exit();
-               aul_widget_write_log(LOG_TAG, "[%s:%d] permanent exit : %d",
-                       __FUNCTION__, __LINE__, ret);
-       }
+
+       aul_widget_write_log(LOG_TAG,
+               "[%s:%d] exit : ret(%d), cnt(%d), permanent(%d)",
+                       __FUNCTION__, __LINE__, ret, cnt, __is_permanent);
 
        return 0;
 }
@@ -1415,13 +1392,12 @@ static void __multiwindow_instance_create(
                __instance_drop(instance_h);
        } else {
                LOGD("%s is created", id);
+               aul_widget_instance_add(class_id, id);
                ret = __send_update_status(class_id, id,
                        WIDGET_INSTANCE_EVENT_CREATE, 0, 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 && *period > 0) {
@@ -1647,7 +1623,7 @@ EXPORT_API widget_base_class *widget_base_class_add(widget_base_class cls,
        }
 
        if (!class_id) {
-               LOGE("class is is NULL");
+               LOGE("class id is NULL");
                set_last_result(WIDGET_ERROR_INVALID_PARAMETER);
                return NULL;
        }