2 * Copyright (c) 2017 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
22 #include <Elementary.h>
24 #include <voice_control_elm.h>
25 #include <voice_control_elm_private.h>
27 #include "appcore_efl_base_private.h"
28 #include "appcore_efl_base.h"
30 static bool vc_elm_initialized;
32 static void __vc_vtauto_changed_cb(keynode_t *key, void *data)
37 name = vconf_keynode_get_name(key);
38 if (!name || strcmp(name, VCONFKEY_VC_VOICE_TOUCH_AUTOMODE) != 0)
41 vt_automode = vconf_keynode_get_bool(key);
43 if (!vc_elm_initialized) {
45 vc_elm_initialized = true;
47 vc_elm_set_auto_register_mode(2, 0);
49 vc_elm_deinitialize();
50 vc_elm_initialized = false;
54 static void __efl_app_init(int argc, char **argv, void *data)
62 hint = appcore_efl_base_get_hint();
63 if (hint & APPCORE_EFL_BASE_HINT_HW_ACC_CONTROL) {
64 hwacc = getenv("HWACC");
66 _DBG("elm_config_accel_preference_set is not called");
67 } else if (strcmp(hwacc, "USE") == 0) {
68 elm_config_accel_preference_set("hw");
69 _DBG("elm_config_accel_preference_set : hw");
70 } else if (strcmp(hwacc, "NOT_USE") == 0) {
71 elm_config_accel_preference_set("none");
72 _DBG("elm_config_accel_preference_set : none");
74 _DBG("elm_config_accel_preference_set is not called");
78 /* VC voice touch setting */
79 vconf_notify_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE,
80 __vc_vtauto_changed_cb, NULL);
81 vconf_get_bool(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, &vt_automode);
83 if (!vc_elm_initialized) {
85 vc_elm_initialized = true;
87 vc_elm_set_auto_register_mode(2, 0);
91 static void __efl_app_finish(void)
93 vconf_ignore_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE,
94 __vc_vtauto_changed_cb);
95 if (vc_elm_initialized) {
96 vc_elm_deinitialize();
97 vc_elm_initialized = false;
102 /* Check loader case */
103 if (getenv("AUL_LOADER_INIT")) {
104 unsetenv("AUL_LOADER_INIT");
109 static void __efl_app_run(void *data)
114 static void __efl_app_exit(void *data)
119 EXPORT_API int appcore_efl_base_init(appcore_efl_base_ops ops, int argc,
120 char **argv, void *data, unsigned int hint)
122 return appcore_ui_base_init(ops.ui_base, argc, argv, data, hint);
125 EXPORT_API void appcore_efl_base_fini(void)
127 appcore_ui_base_fini();
130 EXPORT_API appcore_efl_base_ops appcore_efl_base_get_default_ops(void)
132 appcore_efl_base_ops ops;
134 ops.ui_base = appcore_ui_base_get_default_ops();
136 /* override methods */
137 ops.ui_base.base.init = __efl_app_init;
138 ops.ui_base.base.finish = __efl_app_finish;
139 ops.ui_base.base.run = __efl_app_run;
140 ops.ui_base.base.exit = __efl_app_exit;
145 EXPORT_API int appcore_efl_base_on_receive(aul_type type, bundle *b)
147 return appcore_ui_base_on_receive(type, b);
150 EXPORT_API int appcore_efl_base_on_create(void)
152 return appcore_ui_base_on_create();
155 EXPORT_API int appcore_efl_base_on_terminate(void)
157 return appcore_ui_base_on_terminate();
160 EXPORT_API int appcore_efl_base_on_pause(void)
162 return appcore_ui_base_on_pause();
165 EXPORT_API int appcore_efl_base_on_resume(void)
167 return appcore_ui_base_on_resume();
170 EXPORT_API int appcore_efl_base_on_control(bundle *b)
172 return appcore_ui_base_on_control(b);
175 EXPORT_API void appcore_efl_base_window_on_show(int type, void *event)
177 appcore_ui_base_window_on_show(type, event);
180 EXPORT_API void appcore_efl_base_window_on_hide(int type, void *event)
182 appcore_ui_base_window_on_hide(type, event);
185 EXPORT_API void appcore_efl_base_window_on_lower(int type, void *event)
187 appcore_ui_base_window_on_lower(type, event);
190 EXPORT_API void appcore_efl_base_window_on_visibility(int type, void *event)
192 appcore_ui_base_window_on_visibility(type, event);
195 EXPORT_API void appcore_efl_base_pause(void)
197 appcore_ui_base_pause();
200 EXPORT_API void appcore_efl_base_resume(void)
202 appcore_ui_base_resume();
205 EXPORT_API bool appcore_efl_base_is_resumed(void)
207 return appcore_ui_base_is_resumed();
210 EXPORT_API void appcore_efl_base_exit(void)
212 appcore_ui_base_exit();
215 EXPORT_API void appcore_efl_base_group_add(void)
217 appcore_ui_base_group_add();
220 EXPORT_API void appcore_efl_base_group_remove(void)
222 appcore_ui_base_group_remove();
225 EXPORT_API unsigned int appcore_efl_base_get_main_window(void)
227 return appcore_ui_base_get_main_window();
230 EXPORT_API unsigned int appcore_efl_base_get_main_surface(void)
232 return appcore_ui_base_get_main_surface();
235 EXPORT_API int appcore_efl_base_get_hint(void)
237 return appcore_ui_base_get_hint();
240 EXPORT_API bool appcore_efl_base_get_bg_state(void)
242 return appcore_ui_base_get_bg_state();
245 EXPORT_API void appcore_efl_base_set_bg_state(bool bg_state)
247 appcore_ui_base_set_bg_state(bg_state);