41c9d7dd8a07ae4f23322c1fe9cc117130ab2211
[apps/home/call.git] / ui / vcui-application.c
1 /*
2  * Copyright 2012  Samsung Electronics Co., Ltd
3  *
4  * Licensed under the Flora License, Version 1.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
7  *
8  * http://www.tizenopensource.org/license
9  *
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.
15  */
16
17
18 #include "vcui-application.h"
19 #include "vcui-app-window.h"
20 #include "vcui-app-data.h"
21 #include "vcui-document.h"
22
23 #include "vcui-view-dialing.h"
24 #include "vcui-view-incoming.h"
25 #include "vcui-view-incoming-lock.h"
26 #include "vcui-view-keypad.h"
27 #include "vcui-view-single-call.h"
28 #include "vcui-view-multi-call-split.h"
29 #include "vcui-view-multi-call-conf.h"
30 #include "vcui-view-multi-call-list.h"
31 #include "vcui-view-callend.h"
32  #include "vcui-view-popup.h"
33 #include <glib.h>
34 #include <glib-2.0/glib.h>
35 #include <dbus/dbus-glib.h>
36 #include <notification.h>
37 #ifdef SIGNAL_HANDLER
38 #include <signal.h>
39 #endif
40
41 static vcui_app_call_data_t global_ad;
42
43 #ifdef SIGNAL_HANDLER
44 #define VCUI_SIG_NUM 12
45 static struct sigaction vcui_app_sigact;
46 static struct sigaction vcui_app_sigoldact[VCUI_SIG_NUM];
47 static int vcui_app_sig_to_handle[] = {SIGABRT,SIGBUS,SIGFPE,SIGILL,SIGQUIT,SIGSEGV,SIGSYS,SIGTRAP,SIGXCPU,SIGXFSZ,SIGTERM,SIGPIPE};
48 #endif
49
50 static gboolean g_avoid_multi_setup = EINA_FALSE;
51 static Eina_Bool __vcui_avoid_multi_setup_timer_cb(void *data);
52
53 #define CISS_AUL_CMD "org.tizen.ciss"
54 #define CISS_MODE_OPT "REQ"
55 #define __VCUI_NOTIFICATION_CALL_GROUP_ID 1001
56
57 static int __vcui_launch_ciss(const char *number);
58 static void __vcui_cache_flush_set(Evas *e);
59 static void __vcui_init_view_register_function(vcui_app_call_data_t *app_data, vcui_app_call_view_id_t view_id, voice_call_view_data_t *(*view_new) ());
60 static int __vcui_app_create(void *data);
61 static int __vcui_app_pause(void *data);
62 static int __vcui_app_reset(bundle *kb, void *data);
63 static int __vcui_app_resume(void *data);
64 static int __vcui_app_terminate(void *data);
65 static void __vcui_fade_out_cb_routine(void);
66 static int __vcui_lang_changed_cb(void *data);
67 static int __vcui_low_mem_cb(void *data);
68 static int __vcui_low_bat_cb(void *data);
69 static void __vcui_init(vcui_app_call_data_t *ad);
70
71 #ifdef SIGNAL_HANDLER
72 /**
73 * This function serves as the signal handler function for the SIGSEGV Signal
74 *
75 * @return               nothing
76 * @param[in]            signal_no               Signal Number
77 * @param[in]            signal_info     Information associated with the generated signal
78 * @param[in]            signal_context  Signal Context Info
79 */
80 static void __vcui_exit_handler(void)
81 {
82         printf("\n __vcui_app_exit_handler\n");
83         /*syslog (LOG_INFO, "[VOICE-CALL] __vcui_app_exit_handler\n");*/
84 }
85
86 /**
87 * This function serves as the signal handler function for the SIGSEGV Signal
88 *
89 * @return               nothing
90 * @param[in]            signal_no               Signal Number
91 * @param[in]            signal_info     Information associated with the generated signal
92 * @param[in]            signal_context  Signal Context Info
93 */
94 static void __vcui_sigsegv_handler(int signal_no)
95 {
96         int i=0;
97
98         CALL_UI_DEBUG("SISEGV Received, Signal Number: :%d \n", signal_no);
99
100         vcall_engine_force_reset();
101         __vcui_fade_out_cb_routine();
102
103         for (i=0; i < VCUI_SIG_NUM; i++)
104         {
105                 sigaction(vcui_app_sig_to_handle[i], &(vcui_app_sigoldact[i]), NULL);
106         }
107
108         raise(signal_no); /*raise signal intentionally (pass the same signal)*/
109 }
110
111 /**
112 * This function registers a user space signal handler for the signal SIGSEGV (Signal #11)
113 *
114 * @return               nothing
115 */
116 static void __vcui_register_sigsegv_handler()
117 {
118         CALL_UI_DEBUG("..");
119
120         int i =0;
121         vcui_app_sigact.sa_flags = SA_NOCLDSTOP;
122         vcui_app_sigact.sa_handler =  (void *)__vcui_sigsegv_handler;
123         sigemptyset(&vcui_app_sigact.sa_mask);
124
125
126         for (;i < VCUI_SIG_NUM; i++)
127         {
128                 sigaction (vcui_app_sig_to_handle[i], &vcui_app_sigact, &(vcui_app_sigoldact[i]));
129         }
130
131 }
132 #endif
133
134 static int __vcui_launch_ciss(const char *number)
135 {
136    bundle *kb;
137
138    CALL_UI_DEBUG("number(%s)");
139    kb = bundle_create();
140    bundle_add(kb, "CISS_LAUNCHING_MODE", CISS_MODE_OPT);
141    bundle_add(kb, "CISS_REQ_STRING", number);
142    aul_launch_app(CISS_AUL_CMD, kb);
143    bundle_free(kb);
144    return VC_NO_ERROR;
145 }
146
147 static int __vcui_app_create(void *data)
148 {
149         CALL_UI_DEBUG("__vcui_app_create()..");
150         CALL_UI_KPI("__vcui_app_create start");
151         vcui_app_call_data_t *ad = data;
152
153         elm_theme_extension_add(NULL, CALL_THEME);
154
155         CALL_UI_KPI("_vcui_app_win_create_main start");
156         ad->win_main = (Evas_Object *)_vcui_app_win_create_main(ad, PACKAGE);
157         CALL_UI_KPI("_vcui_app_win_create_main done");
158         if (ad->win_main == NULL) {
159                 CALL_UI_DEBUG("ERROR");
160                 return VC_ERROR;
161         }
162
163         UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
164
165         __vcui_hide_main_ui_set_flag();
166
167         ad->evas = evas_object_evas_get(ad->win_main);
168         ad->scale_factor = elm_config_scale_get();
169
170         __vcui_cache_flush_set(ad->evas);
171
172         ecore_init();
173         ecore_x_init(NULL);
174         _vcui_app_win_key_grab(ad);
175
176         _vcui_view_common_timer_text_init();
177
178         _vcui_app_win_set_noti_type(EINA_TRUE);
179
180         /* add system event callback */
181         appcore_set_event_callback(APPCORE_EVENT_LANG_CHANGE, __vcui_lang_changed_cb, ad);
182         appcore_set_event_callback(APPCORE_EVENT_LOW_MEMORY, __vcui_low_mem_cb, NULL);
183         appcore_set_event_callback(APPCORE_EVENT_LOW_BATTERY, __vcui_low_bat_cb, NULL);
184
185 #ifdef SIGNAL_HANDLER
186                 __vcui_register_sigsegv_handler();
187                 atexit(__vcui_exit_handler);
188 #endif
189
190         CALL_UI_KPI("__vcui_app_create done");
191         return VC_NO_ERROR;
192 }
193
194 static int __vcui_app_pause(void *data)
195 {
196         CALL_UI_DEBUG("__vcui_app_pause()..");
197
198         vcui_app_call_data_t *ad = (vcui_app_call_data_t *) data;
199         return VC_NO_ERROR;
200 }
201
202 static int __vcui_app_reset(bundle *kb, void *data)
203 {
204         CALL_UI_DEBUG("__vcui_app_reset()..");
205         CALL_UI_KPI("__vcui_app_reset start");
206         vcui_app_call_data_t *ad = (vcui_app_call_data_t *) data;
207
208         const char *launch_type = NULL;
209         const char *mime_type = NULL;
210         const char *tmp = NULL;
211         const char *uri_bundle = NULL;
212         char *telnum = NULL;
213
214 #ifdef _RESET_OPEN_APP_
215         {
216                 launch_type = bundle_get_val(kb, "__AUL_CMD__");
217                 if (launch_type != NULL) {
218                         CALL_UI_DEBUG("launch type: [%s]", launch_type);
219                         if (!strncmp(launch_type, "OPEN_APP", 8)) {
220                                 elm_win_raise(ad->win_main);
221                                 return;
222                         }
223                 }
224         }
225 #endif
226
227         /* mime content based AUL */
228         mime_type = bundle_get_val(kb, AUL_K_MIME_TYPE);
229         if (mime_type != NULL) {
230                 CALL_UI_DEBUG("mime_type: [%s]", mime_type);
231                 if (strncmp(mime_type, "phonenum.uri",12) == 0 || strncmp(mime_type, "tel.uri",7) == 0) {
232                         tmp = bundle_get_val(kb, AUL_K_MIME_CONTENT);
233                         if (tmp == NULL) {
234                                 CALL_UI_DEBUG("bundle val is NULL");
235                                 elm_exit();
236                                 return VC_NO_ERROR;
237                         }
238
239                         if (strncmp(tmp, "tel:", 4) == 0) {
240                                 telnum = (char *)tmp + 4;
241                         }
242
243                         CALL_UI_DEBUG("number: [%s]", telnum);
244
245                         vcui_call_type_t call_type;
246                         vcui_call_mo_data_t call_data;
247
248                         memset(&call_data, 0, sizeof(call_data));
249                         call_type = VCUI_CALL_TYPE_MO;
250
251                         snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", telnum);
252
253                         _vcui_engine_interface_process_mo_call(call_type, &call_data);
254
255                         return VC_NO_ERROR;
256                 } else {
257                         CALL_UI_DEBUG("wrong mime type!!");
258                         elm_exit();
259                         return VC_NO_ERROR;
260                 }
261         }
262
263         uri_bundle = (const char *)appsvc_get_uri(kb);
264         if (uri_bundle != NULL) {
265                 CALL_UI_DEBUG("tmp: [%s]", uri_bundle);
266                 if (strncmp(uri_bundle, "tel:", 4) == 0) {
267                         telnum = (char *)uri_bundle + 4;
268                         CALL_UI_DEBUG("number: [%s]", telnum);
269
270                         vcui_call_type_t call_type;
271                         tmp = (char *)appsvc_get_data(kb, "calltype");
272                         
273                         if (tmp) {
274                                 CALL_UI_DEBUG("calltype: [%s]", tmp);
275                                 if (!strncmp(tmp, "EMERGENCY", 9)) {
276                                         vcui_call_ecc_data_t call_data;
277
278                                         memset(&call_data, 0, sizeof(call_data));
279                                         call_type = VCUI_CALL_TYPE_ECC;
280
281                                         snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", telnum);
282
283                                         _vcui_engine_interface_process_ecc_call(call_type, &call_data);
284                                 } else {
285                                         CALL_UI_DEBUG("wrong calltype!");
286                                         elm_exit();
287                                         return VC_ERROR;
288                                 }
289                         } else {
290                                 vcui_call_mo_data_t call_data;
291
292                                 memset(&call_data, 0, sizeof(call_data));
293
294                                 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", telnum);
295
296                                 call_type = VCUI_CALL_TYPE_MO;
297
298                                 tmp = (char *)appsvc_get_data(kb, "ctindex");
299                                 if (tmp) {
300                                         CALL_UI_DEBUG("ctindex: [%s]", tmp);
301                                         call_data.ct_index = atoi(tmp);
302                                 } else {
303                                         CALL_UI_DEBUG("bundle val is NULL");
304                                         call_data.ct_index = -1;
305                                 }
306
307                                 if ((_vc_core_util_check_incall_ss_string(call_data.call_number) == EINA_TRUE) && (_vcui_doc_get_count() >= 1)) {
308                                         vcall_engine_process_incall_ss(call_data.call_number);
309                                         _vcui_view_auto_change();
310                                 } else if (_vc_core_util_check_ss_string(call_data.call_number) == EINA_TRUE) {
311                                         __vcui_launch_ciss(call_data.call_number);
312                                         if (_vcui_doc_get_count() == 0)
313                                                 elm_exit();
314                                         return VC_NO_ERROR;
315                                 } else {
316                                         _vcui_engine_interface_process_mo_call(call_type, &call_data);
317                                 }
318                         }
319
320                         return VC_NO_ERROR;
321                 } else {
322                         CALL_UI_DEBUG("wrong type!");
323                         elm_exit();
324                         return VC_NO_ERROR;
325                 }
326         }
327
328         /* AUL */
329         launch_type = bundle_get_val(kb, "launch-type");
330         if (launch_type != NULL) {
331                 CALL_UI_DEBUG("launch type: [%s]", launch_type);
332                 if (!strncmp(launch_type, "MO", 2)) {
333
334                         if (g_avoid_multi_setup == EINA_TRUE) {
335                                 CALL_UI_DEBUG("Avoid multi touch setup");
336                                 return VC_NO_ERROR;
337                         }
338                         
339                         ecore_timer_add(3.5, __vcui_avoid_multi_setup_timer_cb, ad);
340                         g_avoid_multi_setup = EINA_TRUE;
341                         
342                         vcui_call_type_t call_type;
343                         vcui_call_mo_data_t call_data;
344
345                         memset(&call_data, 0, sizeof(call_data));
346                         call_type = VCUI_CALL_TYPE_MO;
347
348                         tmp = bundle_get_val(kb, "number");
349                         if (tmp) {
350                                 CALL_UI_DEBUG("number: [%s]", tmp);
351                         } else {
352                                 CALL_UI_DEBUG("bundle val is NULL");
353                                 elm_exit();
354                                 return VC_NO_ERROR;
355                         }
356                         snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", tmp);
357
358                         tmp = bundle_get_val(kb, "ctindex");
359                         if (tmp) {
360                                 CALL_UI_DEBUG("ctindex: [%s]", tmp);
361                                 call_data.ct_index = atoi(tmp);
362                         } else {
363                                 CALL_UI_DEBUG("bundle val is NULL");
364                                 call_data.ct_index = -1;
365                         }
366
367                         if ((_vc_core_util_check_incall_ss_string(call_data.call_number) == EINA_TRUE) && (_vcui_doc_get_count() >= 1)) {
368                                 vcall_engine_process_incall_ss(call_data.call_number);
369                                 _vcui_view_auto_change();
370                         } else if (_vc_core_util_check_ss_string(call_data.call_number) == EINA_TRUE) {
371                                 __vcui_launch_ciss(call_data.call_number);
372                                 if(_vcui_doc_get_count() == 0)
373                                         elm_exit();
374                                 return VC_NO_ERROR;
375                         } else {
376                                 _vcui_engine_interface_process_mo_call(call_type, &call_data);
377                         }
378                 } else if (!strncmp(launch_type, "MT", 2)) {
379
380                         vcui_call_type_t call_type;
381                         vcui_call_mt_data_t call_data;
382
383                         memset(&call_data, 0, sizeof(call_data));
384                         call_type = VCUI_CALL_TYPE_MT;
385
386                         tmp = bundle_get_val(kb, "handle");
387                         if (tmp) {
388                                 CALL_UI_DEBUG("handle: [%s]", tmp);
389                                 call_data.call_handle = atoi(tmp);
390                         } else {
391                                 CALL_UI_DEBUG("bundle val is NULL");
392                                 elm_exit();
393                                 return VC_NO_ERROR;
394                         }
395
396                         tmp = bundle_get_val(kb, "calltype");
397                         if (tmp) {
398                                 CALL_UI_DEBUG("calltype: [%s]", tmp);
399                                 call_data.call_type = atoi(tmp);
400                         } else {
401                                 CALL_UI_DEBUG("calltype is NULL but NOT mendatory");
402                                 call_data.call_type = 0;
403                         }
404
405                         tmp = bundle_get_val(kb, "cliindicator");
406                         if (tmp) {
407                                 CALL_UI_DEBUG("cliindicator: [%s]", tmp);
408                                 call_data.cli_presentation_indicator = atoi(tmp);
409                         } else {
410                                 CALL_UI_DEBUG("cliindicator is NULL but NOT mendatory");
411                                 call_data.cli_presentation_indicator = 0;
412                         }
413
414                         tmp = bundle_get_val(kb, "number");
415                         if (tmp) {
416                                 CALL_UI_DEBUG("number: [%s]", tmp);
417                                 vcall_engine_util_strcpy(call_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX, tmp);
418                         } else {
419                                 CALL_UI_DEBUG("bundle val is NULL");
420                                 /*return VC_NO_ERROR;*/ /*check clir mt call.*/
421                         }
422
423                         tmp = bundle_get_val(kb, "name_mode");
424                         if (tmp) {
425                                 CALL_UI_DEBUG("name_mode: [%s]", tmp);
426                                 call_data.calling_name_mode= atoi(tmp);
427                         } else {
428                                 CALL_UI_DEBUG("name_mode is NULL but NOT mendatory");
429                                 call_data.calling_name_mode = -1;
430                         }
431
432                         tmp = bundle_get_val(kb, "name");
433                         if (tmp) {
434                                 CALL_UI_DEBUG("name: [%s]", tmp);
435                                 vcall_engine_util_strcpy(call_data.calling_name, VC_PHONE_NAME_LENGTH_MAX, tmp);
436                         } else {
437                                 CALL_UI_DEBUG("bundle val is NULL but NOT mendatory");
438                         }
439
440                         tmp = bundle_get_val(kb, "rdnumber");
441                         if (tmp) {
442                                 CALL_UI_DEBUG("rdnumber: [%s]", tmp);
443                                 vcall_engine_util_strcpy(call_data.redirected_number, VC_PHONE_NUMBER_LENGTH_MAX, tmp);
444                         } else {
445                                 CALL_UI_DEBUG("bundle val is NULL but NOT mendatory");
446                         }
447
448                         tmp = bundle_get_val(kb, "rdsubaddress");
449                         if (tmp) {
450                                 CALL_UI_DEBUG("rdnumber: [%s]", tmp);
451                                 vcall_engine_util_strcpy(call_data.redirected_sub_address, VC_PHONE_SUBADDRESS_LENGTH_MAX, tmp);
452                         } else {
453                                 CALL_UI_DEBUG("bundle val is NULL but NOT mendatory");
454                         }
455
456                         tmp = bundle_get_val(kb, "clicause");
457                         if (tmp) {
458                                 CALL_UI_DEBUG("clicause: [%s]", tmp);
459                                 call_data.cli_cause = atoi(tmp);
460                         } else {
461                                 CALL_UI_DEBUG("bundle val is NULL");
462                                 elm_exit();
463                                 return VC_NO_ERROR;
464                         }
465
466                         tmp = bundle_get_val(kb, "fwded");
467                         if (tmp) {
468                                 CALL_UI_DEBUG("fwded: [%s]", tmp);
469                                 call_data.bfwded = atoi(tmp);
470                         } else {
471                                 CALL_UI_DEBUG("bundle val is NULL");
472                                 elm_exit();
473                                 return VC_NO_ERROR;
474                         }
475
476                         tmp = bundle_get_val(kb, "activeline");
477                         if (tmp) {
478                                 CALL_UI_DEBUG("activeline: [%s]", tmp);
479                                 call_data.active_line = atoi(tmp);
480                         } else {
481                                 CALL_UI_DEBUG("bundle val is NULL");
482                                 elm_exit();
483                                 return VC_NO_ERROR;
484                         }
485                         _vcui_engine_interface_process_mt_call(call_type, &call_data);
486                         } else if (!strncmp(launch_type, "EMERGENCY", 9)) {
487
488                         vcui_call_type_t call_type;
489                         vcui_call_ecc_data_t call_data;
490
491                         memset(&call_data, 0, sizeof(call_data));
492                         call_type = VCUI_CALL_TYPE_ECC;
493
494                         tmp = bundle_get_val(kb, "number");
495                         if (tmp) {
496                                 CALL_UI_DEBUG("number: [%s]", tmp);
497                         } else {
498                                 CALL_UI_DEBUG("bundle val is NULL");
499                         }
500                         snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", tmp);
501
502                         _vcui_engine_interface_process_ecc_call(call_type, &call_data);
503
504                 } else if (!strncmp(launch_type, "SATSETUPCALL", 12)) {
505                         vcui_call_type_t call_type;
506                         vcui_call_sat_data_t sat_setup_call_info;
507
508                         memset(&sat_setup_call_info, 0, sizeof(sat_setup_call_info));
509                         call_type = VCUI_CALL_TYPE_SAT;
510
511                         tmp = bundle_get_val(kb, "cmd_id");
512                         if (tmp) {
513                                 CALL_UI_DEBUG("cmd_id: [%s]", tmp);
514                                 sat_setup_call_info.command_id = atoi(tmp);
515                         } else {
516                                 CALL_UI_DEBUG("bundle val is NULL");
517                                 elm_exit();
518                                 return VC_NO_ERROR;
519                         }
520
521                         tmp = bundle_get_val(kb, "cmd_qual");
522                         if (tmp) {
523                                 CALL_UI_DEBUG("cmd_qual: [%s]", tmp);
524                                 sat_setup_call_info.command_qualifier = atoi(tmp);
525                         } else {
526                                 CALL_UI_DEBUG("bundle val is NULL");
527                                 elm_exit();
528                                 return VC_NO_ERROR;
529                         }
530
531                         tmp = bundle_get_val(kb, "disp_text");
532                         if (tmp) {
533                                 CALL_UI_DEBUG("disp_text: [%s]", tmp);
534                                 vcall_engine_util_strcpy(sat_setup_call_info.disp_text, sizeof(sat_setup_call_info.disp_text), tmp);
535                         } else {
536                                 CALL_UI_DEBUG("bundle val is NULL");
537                                 /*elm_exit();
538                                 return VC_NO_ERROR;*/
539                         }
540
541                         tmp = bundle_get_val(kb, "call_num");
542                         if (tmp) {
543                                 CALL_UI_DEBUG("call_num: [%s]", tmp);
544                                 vcall_engine_util_strcpy(sat_setup_call_info.call_num, sizeof(sat_setup_call_info.call_num), tmp);
545                         } else {
546                                 CALL_UI_DEBUG("bundle val is NULL");
547                                 elm_exit();
548                                 return VC_NO_ERROR;
549                         }
550
551                         tmp = bundle_get_val(kb, "dur");
552                         if (tmp) {
553                                 CALL_UI_DEBUG("dur: [%s]", tmp);
554                                 sat_setup_call_info.duration = atoi(tmp);
555                         } else {
556                                 CALL_UI_DEBUG("bundle val is NULL");
557                                 elm_exit();
558                                 return VC_NO_ERROR;
559                         }
560                         _vcui_engine_interface_process_sat_call(call_type, &sat_setup_call_info);
561                         } else if (!strncmp(launch_type, "ECCTEST", 7)) {
562
563                         vcui_call_type_t call_type;
564                         vcui_call_ecc_data_t call_data;
565
566                         memset(&call_data, 0, sizeof(call_data));
567                         call_type = VCUI_CALL_TYPE_ECC_TEST;
568
569                         _vcui_engine_interface_process_ecc_call(call_type, &call_data);
570
571                 } else if (!strncmp(launch_type, "DOWNLOADCALL", 12)) {
572                         vcui_call_type_t call_type;
573                         vcui_call_mo_data_t call_data;
574
575                         memset(&call_data, 0, sizeof(call_data));
576                         call_type = VCUI_CALL_TYPE_DOWNLOAD_CALL;
577
578                         tmp = bundle_get_val(kb, "number");
579                         if (tmp) {
580                                 CALL_UI_DEBUG("number: [%s]", tmp);
581                         } else {
582                                 CALL_UI_DEBUG("bundle val is NULL");
583                         }
584
585                         if(tmp != NULL) {
586                                 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", tmp);
587                         } else {
588                                 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", "116");
589                         }
590
591                         vcall_engine_util_strcpy(call_data.call_number, sizeof(call_data.call_number), tmp);
592
593                         _vcui_engine_interface_process_mo_call(call_type, &call_data);
594                 } else {        /*if ear jack is needed, add it*/
595                         CALL_UI_DEBUG("unknown launch type");
596                 }
597                 CALL_UI_KPI("__vcui_app_reset done");
598                 return VC_NO_ERROR;
599         }
600
601         CALL_UI_DEBUG("bundle data is wrong!!");
602         elm_exit();
603         return VC_NO_ERROR;
604 }
605
606 static int __vcui_app_resume(void *data)
607 {
608         CALL_UI_DEBUG("__vcui_app_resume()..");
609
610         vcui_app_call_data_t *ad = (vcui_app_call_data_t *) data;
611         return VC_NO_ERROR;
612 }
613
614 static int __vcui_app_terminate(void *data)
615 {
616         CALL_UI_DEBUG("__vcui_app_terminate()..");
617
618         if (_vcui_doc_get_count() >= 1) {
619                 CALL_UI_DEBUG("WARNING!! call exists. abnormal terminate!!");
620                 _vcui_engine_end_all_call();
621                 vcall_engine_set_to_default();
622         }
623         __vcui_fade_out_cb_routine();
624         return VC_NO_ERROR;
625 }
626
627 static void __vcui_cache_flush_set(Evas *e)
628 {
629 #ifdef _CACHE_FLUSH_
630         evas_image_cache_set(e, 4096 * 1024);
631         evas_font_cache_set(e, 512 * 1024);
632
633         edje_file_cache_set(0);
634         edje_collection_cache_set(0);
635 #endif
636 }
637
638 static void __vcui_init_view_register_function(vcui_app_call_data_t *app_data, vcui_app_call_view_id_t view_id, voice_call_view_data_t *(*view_new) ())
639 {
640         app_data->func_new[view_id] = view_new;
641 }
642
643 void _vcui_response_volume(int vol_alert_type, int vol_level)
644 {
645         vcui_app_call_data_t *ad = _vcui_get_app_data();
646
647         if (vol_alert_type == VCUI_VOL_VOICE) {
648                 ad->voice_vol_val = vol_level;
649                 _vcui_set_volume(ad->vol_key_status);
650         } else if (vol_alert_type == VCUI_VOL_HEADSET) {
651                 ad->bt_vol_val = vol_level;
652                 _vcui_set_volume(ad->vol_key_status);
653         } else {
654                 CALL_UI_DEBUG("ERROR");
655         }
656 }
657
658 void _vcui_set_volume(int key_status)
659 {
660         vcui_app_call_data_t *ad = _vcui_get_app_data();
661
662         if (_vcui_doc_get_count() == 0) {
663                 CALL_UI_DEBUG("ignore it");
664                 return;
665         }
666
667         if ((ad->view_st[ad->view_top]->type == VIEW_INCOMING_VIEW || ad->view_st[ad->view_top]->type == VIEW_INCOMING_LOCK_VIEW)) {
668                 int err_code = 0;
669                 int settings_sound_status = EINA_FALSE;
670
671                 err_code = vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &settings_sound_status);
672                 if (settings_sound_status == EINA_FALSE) {
673                         CALL_UI_DEBUG("ringtone vol is ignored in sound off status.");
674                         return;
675                 }
676
677                 if (ad->bmute_ringtone == EINA_TRUE) {
678                         CALL_UI_DEBUG("during mute ringtone, vol will not changed");
679                         return;
680                 }
681
682                 if (ad->ringtone_val < RINGTONE_MIN) {
683                         int vol_level = _vcui_engine_get_volume_level(VCUI_VOL_RING);
684                         if ((vol_level < RINGTONE_MIN) || (vol_level > RINGTONE_MAX)) {
685                                 CALL_UI_DEBUG("ERROR : ringtone vol:[%d]", vol_level);
686                                 return;
687                         }
688                         ad->ringtone_val = vol_level;
689                 }
690
691                 CALL_UI_DEBUG("RINGTONE : Set Volume");
692                 if (key_status == VAL_VOL_DOWN && ad->ringtone_val > RINGTONE_MIN) {
693                         ad->ringtone_val--;
694                         _vcui_engine_set_volume_level(VCUI_VOL_RING, ad->ringtone_val);
695                 } else if (key_status == VAL_VOL_UP && ad->ringtone_val < RINGTONE_MAX) {
696                         ad->ringtone_val++;
697                         _vcui_engine_set_volume_level(VCUI_VOL_RING, ad->ringtone_val);
698                 }
699                 _vcui_view_popup_vol_ringtone(ad->ringtone_val);
700         } else if (ad->headset_status == EINA_TRUE) {
701                 if (ad->bt_vol_val < BT_VOL_MIN) {
702                         CALL_UI_DEBUG("BT VOL : Get Volume");
703                         ad->vol_key_status = key_status;
704                         _vcui_engine_get_volume_level(VCUI_VOL_HEADSET);
705                         return;
706                 }
707
708                 CALL_UI_DEBUG("BT VOL : Set Volume");
709                 if (key_status == VAL_VOL_DOWN && ad->bt_vol_val > BT_VOL_MIN) {        /*Key Down*/
710                         ad->bt_vol_val--;
711                         _vcui_engine_set_volume_level(VCUI_VOL_HEADSET, ad->bt_vol_val);
712                 } else if (key_status == VAL_VOL_UP && ad->bt_vol_val < BT_VOL_MAX) {   /*Key Up*/
713                         ad->bt_vol_val++;
714                         _vcui_engine_set_volume_level(VCUI_VOL_HEADSET, ad->bt_vol_val);
715                 }
716                 _vcui_view_popup_vol_bt(ad->bt_vol_val);
717         } else {
718                 CALL_UI_DEBUG("TAPI VOL : Get Volume");
719                 ad->vol_key_status = key_status;
720                 ad->voice_vol_val = _vcui_engine_get_volume_level(VCUI_VOL_VOICE);
721
722                 CALL_UI_DEBUG("TAPI VOL : Set Volume");
723                 if (key_status == VAL_VOL_DOWN && ad->voice_vol_val > VOICE_VOL_MIN) {  /*Key Down*/
724                         ad->voice_vol_val--;
725                         _vcui_engine_set_volume_level(VCUI_VOL_VOICE, ad->voice_vol_val);
726                 } else if (key_status == VAL_VOL_UP && ad->voice_vol_val < VOICE_VOL_MAX) {     /*Key Up*/
727                         ad->voice_vol_val++;
728                         _vcui_engine_set_volume_level(VCUI_VOL_VOICE, ad->voice_vol_val);
729                 }
730                 _vcui_view_popup_vol_voice(ad->voice_vol_val);
731         }
732
733 }
734
735 static void __vcui_fade_out_cb_routine()
736 {
737         CALL_UI_DEBUG("..");
738         vcui_app_call_data_t *ad = _vcui_get_app_data();
739
740         if (ad->child_is == 1) {
741                 /*system("killall dialer");*/
742         }
743         if (ad->disp && ad->win) {
744                 utilx_ungrab_key(ad->disp, ad->win, KEY_VOLUMEUP);
745                 utilx_ungrab_key(ad->disp, ad->win, KEY_VOLUMEDOWN);
746         }
747         _vcui_doc_remove_all_data();
748         _voicecall_dvc_proximity_sensor_deinit();
749         _voicecall_dvc_control_lcd_state(VC_LCD_ON_UNLOCK);
750         _vcui_view_common_timer_destroy();
751 }
752
753 static int __vcui_lang_changed_cb(void *data)
754 {
755         CALL_UI_DEBUG("..");
756
757         _vcui_view_auto_change();
758  
759         return VC_NO_ERROR;
760 }
761
762 static int __vcui_low_mem_cb(void *data)
763 {
764         CALL_UI_DEBUG("..");
765
766         return VC_NO_ERROR;
767 }
768
769 static int __vcui_low_bat_cb(void *data)
770 {
771         CALL_UI_DEBUG("..");
772
773         return VC_NO_ERROR;
774 }
775
776 static void __vcui_init(vcui_app_call_data_t *ad)
777 {
778         CALL_UI_KPI("g_type_init start");
779         g_type_init();
780         CALL_UI_KPI("g_type_init done");
781         _vcui_doc_recent_init();
782         _vcui_doc_caller_list_init();
783         _vcui_view_common_init();
784         _vcui_engine_init(ad);
785
786         CALL_UI_KPI("__vcui_init_view_register_function for all views start");
787         __vcui_init_view_register_function(ad, VIEW_DIALLING_VIEW, _vcui_view_dialing_new);
788         __vcui_init_view_register_function(ad, VIEW_INCOMING_VIEW, _vcui_view_incoming_new);
789         __vcui_init_view_register_function(ad, VIEW_INCOMING_LOCK_VIEW, _vcui_view_incoming_lock_new);
790         __vcui_init_view_register_function(ad, VIEW_INCALL_ONECALL_VIEW, _vc_ui_view_single_call_new);
791         __vcui_init_view_register_function(ad, VIEW_INCALL_MULTICALL_SPLIT_VIEW, _vcui_view_multi_call_split_new);
792         __vcui_init_view_register_function(ad, VIEW_INCALL_MULTICALL_CONF_VIEW, _vcui_view_multi_call_conf_new);
793         __vcui_init_view_register_function(ad, VIEW_INCALL_MULTICALL_LIST_VIEW, _vcui_view_multi_call_list_new);
794         __vcui_init_view_register_function(ad, VIEW_INCALL_KEYPAD_VIEW, _vcui_view_keypad_new);
795         __vcui_init_view_register_function(ad, VIEW_ENDCALL_VIEW, _vcui_view_callend_new);
796         CALL_UI_KPI("__vcui_init_view_register_function for all views done");
797
798         ad->view_top = -1;
799         ad->view_before_top = -1;
800         ad->view_before_reject_view = -1;
801         ad->headset_status = (int)_vcui_is_headset_conected();
802         ad->speaker_status = EINA_FALSE;
803         ad->mute_status = EINA_FALSE;
804         ad->child_is = -1;
805         ad->show_flag = WIN_HIDE;
806         ad->brecord_voice = 0;
807         ad->ringtone_val = -1;
808         ad->voice_vol_val = -1;
809         ad->bt_vol_val = -1;
810         ad->call_end_type = CALL_END_TYPE_NONE;
811 }
812
813 char *_vcui_get_endcause_string(int end_cause, char *data)
814 {
815         char *string_id = NULL;
816         CALL_UI_DEBUG("end type : %d", end_cause);
817         switch (end_cause) {
818         case VC_ENGINE_ENDCAUSE_USER_UNAVAILABLE:
819                 string_id = _("IDS_CALL_BODY_CALLED_PARTY_UNAVAILABLE");
820                 break;
821         case VC_ENGINE_ENDCAUSE_UNASSIGNED_NUMBER:
822                 string_id = _("IDS_CALL_BODY_NUMBER_DOES_NOT_EXIST");
823                 break;
824         case VC_ENGINE_ENDCAUSE_USER_DOESNOT_RESPOND:
825                 string_id = _("IDS_CALL_BODY_NO_ANSWER");
826                 break;
827         case VC_ENGINE_ENDCAUSE_CALL_DISCONNECTED:
828                 string_id = _("IDS_CALL_BODY_DISCONNECTED");
829                 break;
830         case VC_ENGINE_ENDCAUSE_CALL_ENDED:
831                 string_id = _("IDS_CALL_BODY_CALLENDED");
832                 break;
833         case VC_ENGINE_ENDCAUSE_CALL_SERVICE_NOT_ALLOWED:
834                 string_id = _("IDS_CALL_POP_SERVICE_NOT_ALLOWED");
835                 break;
836         case VC_ENGINE_ENDCAUSE_CALL_BARRED:
837                 string_id = _("IDS_CALL_POP_CALL_BARRED");
838                 break;
839         case VC_ENGINE_ENDCAUSE_NO_SERVICE:
840                 string_id = _("IDS_CALL_POP_NOSERVICE");
841                 break;
842         case VC_ENGINE_ENDCAUSE_NW_BUSY:
843                 string_id = _("IDS_CALL_POP_NETWORKBUSY");
844                 break;
845         case VC_ENGINE_ENDCAUSE_NW_FAILED:
846                 string_id = _("IDS_CALL_POP_NETWORK_UNAVAILABLE");
847                 break;
848         case VC_ENGINE_ENDCAUSE_SERVICE_TEMP_UNAVAILABLE:
849                 string_id = _("IDS_CALL_BODY_SERVICE_UNAVAILABLE");
850                 break;
851         case VC_ENGINE_ENDCAUSE_NO_ANSWER:
852                 string_id = _("IDS_CALL_BODY_NO_ANSWER");
853                 break;
854         case VC_ENGINE_ENDCAUSE_NO_CREDIT:
855                 string_id = _("IDS_CALL_POP_NOCREDITLEFT");
856                 break;
857         case VC_ENGINE_ENDCAUSE_REJECTED:
858                 string_id = _("IDS_CALL_BODY_CALL_REJECTED");
859                 break;
860         case VC_ENGINE_ENDCAUSE_USER_BUSY:
861                 string_id = _("IDS_CALL_POP_USER_BUSY");
862                 break;
863         case VC_ENGINE_ENDCAUSE_WRONG_GROUP:
864                 string_id = _("IDS_CALL_POP_WRONG_GROUP");
865                 break;
866         case VC_ENGINE_ENDCAUSE_INVALID_NUMBER_FORMAT:
867                 string_id = _("IDS_CALL_POP_CAUSE_WRONG_NUMBER");
868                 break;
869         case VC_ENGINE_ENDCAUSE_CALL_NOT_ALLOWED:
870                 string_id = _("IDS_CALL_POP_CALLNOTCALLOWED");
871                 break;
872         case VC_ENGINE_ENDCAUSE_TAPI_ERROR:
873                 string_id = _("IDS_CALL_POP_AEESYS_SYSTEMFAILUREERROR");
874                 break;
875         case VC_ENGINE_ENDCAUSE_CALL_FAILED:
876                 string_id = _("IDS_CALL_POP_CALLFAILED");
877                 break;
878         case VC_ENGINE_ENDCAUSE_NUMBER_CHANGED:
879                 string_id = _("IDS_CALL_BODY_NUMBER_CHANGED");
880                 break;
881         case VC_ENGINE_ENDCAUSE_IMEI_REJECTED:
882                 string_id = _("IDS_CALL_POP_VERIFY_SIM_OR_INSERT_VALID_SIM");
883                 break;
884         case VC_ENGINE_ENDCAUSE_NO_USER_RESPONDING:     /**< User not responding */
885         case VC_ENGINE_ENDCAUSE_USER_ALERTING_NO_ANSWER:        /**< User Alerting No Answer */
886         default:
887                 string_id = _("IDS_CALL_BODY_CALLENDED");
888                 break;
889         }
890         vcall_engine_util_strcpy(data, VC_DATA_LENGTH_MAX, string_id);
891         return data;
892 }
893
894 void _vcui_cache_flush()
895 {
896 #ifdef _CACHE_FLUSH_
897         vcui_app_call_data_t *ad = _vcui_get_app_data();
898
899         evas_font_cache_flush(ad->evas);
900         evas_image_cache_flush(ad->evas);
901
902         edje_file_cache_flush();
903         edje_collection_cache_flush();
904
905         evas_render_idle_flush(ad->evas);
906 #endif
907 }
908
909 int _vcui_is_idle_lock()
910 {
911         int lock_state;
912         int ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &(lock_state));
913         if (ret == -1) {
914                 CALL_UI_DEBUG("Cannot get vconf key");
915         }
916
917         if (lock_state == VCONFKEY_IDLE_LOCK)
918                 return CALL_LOCK;
919         else
920                 return CALL_UNLOCK;
921 }
922
923 unsigned long _vcui_get_diff_now(time_t start_time)
924 {
925         time_t curr_time;
926         unsigned long call_duration_in_sec = 0;
927         curr_time = time(&curr_time);
928         call_duration_in_sec = curr_time - start_time;
929         return call_duration_in_sec;
930 }
931
932 gboolean _vcui_is_gcf_mode(void)
933 {
934         gboolean bgcf_status = EINA_FALSE;
935         int ret = -1;
936
937         ret = vconf_get_int(VCONFKEY_ADMIN_GCF_TEST, &bgcf_status);
938         if (0 == ret) {
939                 CALL_UI_DEBUG("bgcf_status = [%d]\n", bgcf_status);
940         } else {
941                 CALL_UI_DEBUG("vconf_get_int failed..[%d]\n", ret);
942         }
943
944         return bgcf_status;
945 }
946
947 gboolean _vcui_is_headset_conected(void)
948 {
949         int bt_connected = VCONFKEY_BT_DEVICE_NONE;
950         Eina_Bool ret = EINA_FALSE;
951
952         ret = vconf_get_int(VCONFKEY_BT_DEVICE, &bt_connected);
953         if (0 == ret) {
954                 CALL_UI_DEBUG("bt_connected = [0x%x] ", bt_connected);
955         } else {
956                 CALL_UI_DEBUG("vconf_get_int failed..[%d]", ret);
957         }
958
959         return (VCONFKEY_BT_DEVICE_HEADSET_CONNECTED == (bt_connected & VCONFKEY_BT_DEVICE_HEADSET_CONNECTED)) ? EINA_TRUE : EINA_FALSE;
960 }
961
962 gboolean _vcui_is_headset_switch_on(void)
963 {
964         int bt_status = VCONFKEY_BT_STATUS_OFF;
965         Eina_Bool ret = EINA_FALSE;
966
967         ret = vconf_get_int(VCONFKEY_BT_STATUS, &bt_status);
968         if (0 == ret) {
969                 CALL_UI_DEBUG("bt_status = [0x%x] ", bt_status);
970         } else {
971                 CALL_UI_DEBUG("vconf_get_int failed..[%d]", ret);
972         }
973
974         return (VCONFKEY_BT_STATUS_ON == (bt_status & VCONFKEY_BT_STATUS_ON)) ? EINA_TRUE : EINA_FALSE;
975 }
976
977 gboolean _vcui_is_answering_mode_on(void)
978 {
979         gboolean bAnswerMode = EINA_FALSE;
980         Eina_Bool ret = EINA_FALSE;
981
982         ret = vconf_get_bool(VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL, &bAnswerMode);
983         if (0 == ret) {
984                 CALL_UI_DEBUG("bAnswerMode = [%d] \n", bAnswerMode);
985         } else {
986                 CALL_UI_DEBUG("vconf_get_int failed..[%d]\n", ret);
987         }
988
989         return bAnswerMode;
990 }
991
992 gboolean _vcui_is_powerkey_mode_on(void)
993 {
994         gboolean bPowerkeyMode = EINA_FALSE;
995         Eina_Bool ret = EINA_FALSE;
996
997         ret = vconf_get_bool(VCONFKEY_CISSAPPL_POWER_KEY_ENDS_CALL_BOOL, &bPowerkeyMode);
998         if (0 == ret) {
999                 CALL_UI_DEBUG("bPowerkeyMode = [%d] \n", bPowerkeyMode);
1000         } else {
1001                 CALL_UI_DEBUG("vconf_get_int failed..[%d]\n", ret);
1002         }
1003
1004         return bPowerkeyMode;
1005 }
1006
1007 gboolean _vcui_is_phonelock_status()
1008 {
1009         gboolean b_phonelock = EINA_FALSE;
1010         if (!vconf_get_bool(VCONFKEY_SETAPPL_STATE_POWER_ON_LOCK_BOOL, &b_phonelock)) {
1011                 CALL_UI_DEBUG("b_phonelock:[%d]", b_phonelock);
1012                 return b_phonelock;
1013         } else {
1014                 CALL_UI_DEBUG("get VCONFKEY_SETAPPL_STATE_POWER_ON_LOCK_BOOL failed..");
1015                 return EINA_FALSE;
1016         }
1017 }
1018
1019 void _vcui_add_calllog(int type, call_data_t *data, int boutgoing_end)
1020 {
1021         CALL_UI_DEBUG("type = [0x%x] ", type);
1022         CTSvalue *plog;
1023         time_t current_time;
1024
1025         if (data == NULL)
1026                 return;
1027         contacts_svc_connect();
1028
1029         current_time = time(NULL);
1030
1031         plog = contacts_svc_value_new(CTS_VALUE_PHONELOG);
1032         contacts_svc_value_set_str(plog, CTS_PLOG_VAL_NUMBER_STR, data->call_num);
1033         contacts_svc_value_set_int(plog, CTS_PLOG_VAL_LOG_TIME_INT, (int)current_time);
1034         contacts_svc_value_set_int(plog, CTS_PLOG_VAL_LOG_TYPE_INT, type);
1035         contacts_svc_value_set_int(plog, CTS_PLOG_VAL_RELATED_ID_INT, data->contact_id);
1036
1037         if ((type == CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN) || (type == CTS_PLOG_TYPE_VOICE_REJECT) ||
1038                 (type == CTS_PLOG_TYPE_VOICE_BLOCKED) || (boutgoing_end == EINA_TRUE)) {
1039                 contacts_svc_value_set_int(plog, CTS_PLOG_VAL_DURATION_INT, 0);
1040         } else {
1041                 contacts_svc_value_set_int(plog, CTS_PLOG_VAL_DURATION_INT, _vcui_get_diff_now(data->start_time));
1042         }
1043         contacts_svc_insert_phonelog(plog);
1044
1045         contacts_svc_value_free(plog);
1046         contacts_svc_disconnect();
1047
1048         /* vconf set & quickpanel noti (for missed call) */
1049         if (type == CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN) {
1050                 char szname[255] = { 0, };
1051                 int ret;
1052                 notification_h noti = NULL;
1053                 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1054
1055                 if (strlen((char *)data->call_display) == 0) {
1056                         snprintf(szname, sizeof(szname), "%s", data->call_num);
1057                 } else {
1058                         snprintf(szname, sizeof(szname), "%s", data->call_display);
1059                 }
1060                 CALL_UI_DEBUG("szname:[%s]", szname);
1061
1062                 noti = notification_new(NOTIFICATION_TYPE_NOTI, __VCUI_NOTIFICATION_CALL_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1063                 if(noti == NULL) {
1064                         CALL_UI_DEBUG("Fail to notification_new\n");
1065                         return;
1066                 }
1067
1068                 noti_err = notification_set_application(noti, DIALER_PKG);
1069                 if(noti_err != NOTIFICATION_ERROR_NONE) {
1070                         CALL_UI_DEBUG("Fail to notification_set_application : %d\n", noti_err);
1071                 }
1072
1073                 bundle *args  = bundle_create();
1074
1075                 bundle_add(args, "logs", "missed_call");
1076                 noti_err = notification_set_args(noti, args, NULL);
1077                 if(noti_err != NOTIFICATION_ERROR_NONE) {
1078                         CALL_UI_DEBUG("Fail to notification_set_args : %d\n", noti_err);
1079                 }
1080                 bundle_free(args);
1081
1082                 noti_err = notification_set_time(noti, current_time);
1083                 if(noti_err != NOTIFICATION_ERROR_NONE) {
1084                         CALL_UI_DEBUG("Fail to notification_set_icon : %d\n", noti_err);
1085                 }
1086
1087                 noti_err = notification_set_text(noti, NOTIFICATION_TEXT_TYPE_TITLE, szname, szname, NOTIFICATION_VARIABLE_TYPE_NONE);
1088                 if(noti_err != NOTIFICATION_ERROR_NONE) {
1089                         CALL_UI_DEBUG("Fail to notification_set_title : %d\n", noti_err);
1090                 }
1091
1092                 CALL_UI_DEBUG("data->call_file_path(%s)",data->call_file_path);
1093                 if (strlen(data->call_file_path) > 0) {
1094                         noti_err = notification_set_image(noti, NOTIFICATION_IMAGE_TYPE_THUMBNAIL, data->call_file_path);
1095                         if(noti_err != NOTIFICATION_ERROR_NONE) {
1096                                 CALL_UI_DEBUG("Fail to notification_set_title : %d\n", noti_err);
1097                         }
1098                 }
1099                 
1100                 noti_err = notification_insert(noti, NULL);
1101                 if(noti_err != NOTIFICATION_ERROR_NONE) {
1102                         CALL_UI_DEBUG("Fail to notification_set_text_domain\n");
1103                 }
1104
1105                 noti_err = notification_free(noti);
1106                 if(noti_err != NOTIFICATION_ERROR_NONE) {
1107                         CALL_UI_DEBUG("Fail to notification_set_text_domain\n");
1108                 }
1109         }
1110 }
1111
1112 void _vcui_raise_main_win()
1113 {
1114         CALL_UI_DEBUG("..");
1115
1116         vcui_app_call_data_t *ad = _vcui_get_app_data();
1117         if (ad == NULL) {
1118                 CALL_UI_DEBUG("App data is NULL");
1119                 return;
1120         }
1121         if (ad->win_main == NULL) {
1122                 CALL_UI_DEBUG("Main Window is NULL");
1123                 return;
1124         }
1125
1126         elm_win_activate(ad->win_main);
1127         _vcui_show_main_ui_set_flag();
1128         /*view_refresh_now();*/
1129
1130 }
1131
1132 int _vcui_check_valid_eo(Evas_Object *eo, char *v_name)
1133 {
1134         /*CALL_UI_DEBUG("eo addr:[%p], v_name:[%s]", eo, v_name);*/
1135         const char *obj_name = evas_object_name_get(eo);
1136         if (obj_name == NULL) {
1137                 CALL_UI_DEBUG("obj_name is NULL!!. eo addr:[%p], v_name:[%s]", eo, v_name);
1138                 return VC_ERROR;
1139         }
1140         if (strncmp(obj_name, v_name, strlen(obj_name)) == 0) {
1141                 return VC_NO_ERROR;
1142         } else {
1143                 CALL_UI_DEBUG("different name !! ");
1144                 return VC_ERROR;
1145         }
1146 }
1147
1148 vcui_app_call_data_t *_vcui_get_app_data()
1149 {
1150         return &global_ad;
1151 }
1152
1153 void _vcui_show_main_ui_set_flag()
1154 {
1155         vcui_app_call_data_t *ad = _vcui_get_app_data();
1156         if (ad->show_flag == WIN_HIDE) {
1157                 CALL_UI_DEBUG("show_flag : WIN_SHOW");
1158                 evas_object_show(ad->win_main);
1159                 ad->show_flag = WIN_SHOW;
1160         }
1161 }
1162
1163 void __vcui_hide_main_ui_set_flag()
1164 {
1165         vcui_app_call_data_t *ad = _vcui_get_app_data();
1166         CALL_UI_DEBUG("show_flag: WIN_HIDE");
1167         evas_object_hide(ad->win_main);
1168         ad->show_flag = WIN_HIDE;
1169 }
1170
1171 Evas_Object *_vcui_load_edj(Evas_Object *parent, const char *file, const char *group)
1172 {
1173         Evas_Object *eo;
1174         int r;
1175
1176         eo = elm_layout_add(parent);
1177         if (eo) {
1178                 r = elm_layout_file_set(eo, file, group);
1179                 if (!r) {
1180                         evas_object_del(eo);
1181                         CALL_UI_DEBUG("ERROR!!");
1182                         return NULL;
1183                 }
1184
1185                 evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1186         }
1187
1188         return eo;
1189 }
1190
1191 int main(int argc, char *argv[])
1192 {
1193         CALL_UI_DEBUG("voice call ui main()..");
1194
1195         struct appcore_ops ops = {
1196                 .create = __vcui_app_create,
1197                 .terminate = __vcui_app_terminate,
1198                 .pause = __vcui_app_pause,
1199                 .resume = __vcui_app_resume,
1200                 .reset = __vcui_app_reset,
1201         };
1202
1203         memset(&global_ad, 0, sizeof(vcui_app_call_data_t));
1204
1205         ops.data = &global_ad;
1206
1207         CALL_UI_KPI("__vcui_init start");
1208         __vcui_init(&global_ad);
1209         CALL_UI_KPI("__vcui_init done");
1210
1211         appcore_set_i18n(PACKAGE, LOCALEDIR);
1212
1213         return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
1214 }
1215
1216 static Eina_Bool __vcui_avoid_multi_setup_timer_cb(void *data)
1217 {
1218         CALL_UI_DEBUG("..");
1219
1220         g_avoid_multi_setup = EINA_FALSE;
1221         
1222         return ECORE_CALLBACK_CANCEL;
1223 }
1224