Revert "Revert "Add codes for setting voice touch as auto mode""
[platform/core/appfw/app-core.git] / src / ui_base / appcore_ui_base.c
index 8a03188..8872ac4 100644 (file)
@@ -43,6 +43,8 @@
 #include <aul_svc.h>
 #include <bundle_internal.h>
 #include <ttrace.h>
+#include <voice_control_elm.h>
+#include <voice_control_elm_private.h>
 
 #include "appcore_base.h"
 #include "appcore_ui_base.h"
@@ -685,6 +687,8 @@ EXPORT_API int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **ar
        const char *bg_launch;
        bundle *b;
        char appid[PATH_MAX] = {0, };
+       int r;
+       bool is_vc_vt_automode = false;
 
        appcore_ui_plugin_init(&ops, &hint);
        aul_app_get_appid_bypid(getpid(), appid, sizeof(appid));
@@ -699,6 +703,16 @@ EXPORT_API int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **ar
        LOG(LOG_DEBUG, "LAUNCH", "[%s:Application:main:done]", appid);
        elm_init(argc, argv);
 
+       r = vc_elm_is_supported_vt_auto(&is_vc_vt_automode);
+       if (r != 0) {
+               _ERR("[VC] Fail to get vconfkey of vt_automode");
+       } else {
+               if (is_vc_vt_automode == true) {
+                       vc_elm_initialize();
+                       vc_elm_set_auto_register_mode(2, 0);
+               }
+       }
+
        if (__context.hint & APPCORE_UI_BASE_HINT_HW_ACC_CONTROL) {
                hwacc = getenv("HWACC");
 
@@ -731,6 +745,9 @@ EXPORT_API int appcore_ui_base_init(appcore_ui_base_ops ops, int argc, char **ar
 
 EXPORT_API void appcore_ui_base_fini(void)
 {
+       bool is_vc_vt_automode = false;
+       int r;
+
        appcore_base_fini();
        appcore_ui_plugin_fini();
 
@@ -744,6 +761,15 @@ EXPORT_API void appcore_ui_base_fini(void)
                ecore_event_handler_del(__context.hlower);
 
        __finish_wl();
+
+       r = vc_elm_is_supported_vt_auto(&is_vc_vt_automode);
+       if (r != 0) {
+               _ERR("[VC] Fail to get vconfkey of vt_automode");
+       } else {
+               if (is_vc_vt_automode == true)
+                       vc_elm_deinitialize();
+       }
+
        elm_shutdown();
 
        /* Check loader case */