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 int __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);
93 static void __efl_app_finish(void)
95 vconf_ignore_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE,
96 __vc_vtauto_changed_cb);
97 if (vc_elm_initialized) {
98 vc_elm_deinitialize();
99 vc_elm_initialized = false;
104 /* Check loader case */
105 if (getenv("AUL_LOADER_INIT")) {
106 unsetenv("AUL_LOADER_INIT");
111 static void __efl_app_run(void *data)
116 static void __efl_app_exit(void *data)
121 EXPORT_API int appcore_efl_base_init(appcore_efl_base_ops ops, int argc,
122 char **argv, void *data, unsigned int hint)
124 return appcore_ui_base_init(ops.ui_base, argc, argv, data, hint);
127 EXPORT_API void appcore_efl_base_fini(void)
129 appcore_ui_base_fini();
132 EXPORT_API appcore_efl_base_ops appcore_efl_base_get_default_ops(void)
134 appcore_efl_base_ops ops;
136 ops.ui_base = appcore_ui_base_get_default_ops();
138 /* override methods */
139 ops.ui_base.base.init = __efl_app_init;
140 ops.ui_base.base.finish = __efl_app_finish;
141 ops.ui_base.base.run = __efl_app_run;
142 ops.ui_base.base.exit = __efl_app_exit;
147 EXPORT_API int appcore_efl_base_on_receive(aul_type type, bundle *b)
149 return appcore_ui_base_on_receive(type, b);
152 EXPORT_API int appcore_efl_base_on_create(void)
154 return appcore_ui_base_on_create();
157 EXPORT_API int appcore_efl_base_on_terminate(void)
159 return appcore_ui_base_on_terminate();
162 EXPORT_API int appcore_efl_base_on_pause(void)
164 return appcore_ui_base_on_pause();
167 EXPORT_API int appcore_efl_base_on_resume(void)
169 return appcore_ui_base_on_resume();
172 EXPORT_API int appcore_efl_base_on_control(bundle *b)
174 return appcore_ui_base_on_control(b);
177 EXPORT_API void appcore_efl_base_window_on_show(int type, void *event)
179 appcore_ui_base_window_on_show(type, event);
182 EXPORT_API void appcore_efl_base_window_on_hide(int type, void *event)
184 appcore_ui_base_window_on_hide(type, event);
187 EXPORT_API void appcore_efl_base_window_on_lower(int type, void *event)
189 appcore_ui_base_window_on_lower(type, event);
192 EXPORT_API void appcore_efl_base_window_on_visibility(int type, void *event)
194 appcore_ui_base_window_on_visibility(type, event);
197 EXPORT_API void appcore_efl_base_pause(void)
199 appcore_ui_base_pause();
202 EXPORT_API void appcore_efl_base_resume(void)
204 appcore_ui_base_resume();
207 EXPORT_API bool appcore_efl_base_is_resumed(void)
209 return appcore_ui_base_is_resumed();
212 EXPORT_API void appcore_efl_base_exit(void)
214 appcore_ui_base_exit();
217 EXPORT_API void appcore_efl_base_group_add(void)
219 appcore_ui_base_group_add();
222 EXPORT_API void appcore_efl_base_group_remove(void)
224 appcore_ui_base_group_remove();
227 EXPORT_API unsigned int appcore_efl_base_get_main_window(void)
229 return appcore_ui_base_get_main_window();
232 EXPORT_API unsigned int appcore_efl_base_get_main_surface(void)
234 return appcore_ui_base_get_main_surface();
237 EXPORT_API int appcore_efl_base_get_hint(void)
239 return appcore_ui_base_get_hint();
242 EXPORT_API bool appcore_efl_base_get_bg_state(void)
244 return appcore_ui_base_get_bg_state();
247 EXPORT_API void appcore_efl_base_set_bg_state(bool bg_state)
249 appcore_ui_base_set_bg_state(bg_state);