2 * Copyright 2012 Samsung Electronics Co., Ltd
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
8 * http://www.tizenopensource.org/license
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.
18 #include "vcui-application.h"
19 #include "vcui-app-window.h"
20 #include "vcui-app-data.h"
21 #include "vcui-document.h"
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"
34 #include <glib-2.0/glib.h>
35 #include <dbus/dbus-glib.h>
36 #include <notification.h>
41 static vcui_app_call_data_t global_ad;
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};
50 static gboolean g_avoid_multi_setup = EINA_FALSE;
51 static Eina_Bool __vcui_avoid_multi_setup_timer_cb(void *data);
53 #define CISS_AUL_CMD "org.tizen.ciss"
54 #define CISS_MODE_OPT "REQ"
55 #define __VCUI_NOTIFICATION_CALL_GROUP_ID 1001
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);
73 * This function serves as the signal handler function for the SIGSEGV Signal
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
80 static void __vcui_exit_handler(void)
82 printf("\n __vcui_app_exit_handler\n");
83 /*syslog (LOG_INFO, "[VOICE-CALL] __vcui_app_exit_handler\n");*/
87 * This function serves as the signal handler function for the SIGSEGV Signal
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
94 static void __vcui_sigsegv_handler(int signal_no)
98 CALL_UI_DEBUG("SISEGV Received, Signal Number: :%d \n", signal_no);
100 vcall_engine_force_reset();
101 __vcui_fade_out_cb_routine();
103 for (i=0; i < VCUI_SIG_NUM; i++)
105 sigaction(vcui_app_sig_to_handle[i], &(vcui_app_sigoldact[i]), NULL);
108 raise(signal_no); /*raise signal intentionally (pass the same signal)*/
112 * This function registers a user space signal handler for the signal SIGSEGV (Signal #11)
116 static void __vcui_register_sigsegv_handler()
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);
126 for (;i < VCUI_SIG_NUM; i++)
128 sigaction (vcui_app_sig_to_handle[i], &vcui_app_sigact, &(vcui_app_sigoldact[i]));
134 static int __vcui_launch_ciss(const char *number)
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);
147 static int __vcui_app_create(void *data)
149 CALL_UI_DEBUG("__vcui_app_create()..");
150 CALL_UI_KPI("__vcui_app_create start");
151 vcui_app_call_data_t *ad = data;
153 elm_theme_extension_add(NULL, CALL_THEME);
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");
163 UG_INIT_EFL(ad->win_main, UG_OPT_INDICATOR_ENABLE);
165 __vcui_hide_main_ui_set_flag();
167 ad->evas = evas_object_evas_get(ad->win_main);
168 ad->scale_factor = elm_config_scale_get();
170 __vcui_cache_flush_set(ad->evas);
174 _vcui_app_win_key_grab(ad);
176 _vcui_view_common_timer_text_init();
178 _vcui_app_win_set_noti_type(EINA_TRUE);
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);
185 #ifdef SIGNAL_HANDLER
186 __vcui_register_sigsegv_handler();
187 atexit(__vcui_exit_handler);
190 CALL_UI_KPI("__vcui_app_create done");
194 static int __vcui_app_pause(void *data)
196 CALL_UI_DEBUG("__vcui_app_pause()..");
198 vcui_app_call_data_t *ad = (vcui_app_call_data_t *) data;
202 static int __vcui_app_reset(bundle *kb, void *data)
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;
208 const char *launch_type = NULL;
209 const char *mime_type = NULL;
210 const char *tmp = NULL;
211 const char *uri_bundle = NULL;
214 #ifdef _RESET_OPEN_APP_
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);
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);
234 CALL_UI_DEBUG("bundle val is NULL");
239 if (strncmp(tmp, "tel:", 4) == 0) {
240 telnum = (char *)tmp + 4;
243 CALL_UI_DEBUG("number: [%s]", telnum);
245 vcui_call_type_t call_type;
246 vcui_call_mo_data_t call_data;
248 memset(&call_data, 0, sizeof(call_data));
249 call_type = VCUI_CALL_TYPE_MO;
251 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", telnum);
253 _vcui_engine_interface_process_mo_call(call_type, &call_data);
257 CALL_UI_DEBUG("wrong mime type!!");
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);
270 vcui_call_type_t call_type;
271 tmp = (char *)appsvc_get_data(kb, "calltype");
274 CALL_UI_DEBUG("calltype: [%s]", tmp);
275 if (!strncmp(tmp, "EMERGENCY", 9)) {
276 vcui_call_ecc_data_t call_data;
278 memset(&call_data, 0, sizeof(call_data));
279 call_type = VCUI_CALL_TYPE_ECC;
281 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", telnum);
283 _vcui_engine_interface_process_ecc_call(call_type, &call_data);
285 CALL_UI_DEBUG("wrong calltype!");
290 vcui_call_mo_data_t call_data;
292 memset(&call_data, 0, sizeof(call_data));
294 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", telnum);
296 call_type = VCUI_CALL_TYPE_MO;
298 tmp = (char *)appsvc_get_data(kb, "ctindex");
300 CALL_UI_DEBUG("ctindex: [%s]", tmp);
301 call_data.ct_index = atoi(tmp);
303 CALL_UI_DEBUG("bundle val is NULL");
304 call_data.ct_index = -1;
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)
316 _vcui_engine_interface_process_mo_call(call_type, &call_data);
322 CALL_UI_DEBUG("wrong type!");
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)) {
334 if (g_avoid_multi_setup == EINA_TRUE) {
335 CALL_UI_DEBUG("Avoid multi touch setup");
339 ecore_timer_add(3.5, __vcui_avoid_multi_setup_timer_cb, ad);
340 g_avoid_multi_setup = EINA_TRUE;
342 vcui_call_type_t call_type;
343 vcui_call_mo_data_t call_data;
345 memset(&call_data, 0, sizeof(call_data));
346 call_type = VCUI_CALL_TYPE_MO;
348 tmp = bundle_get_val(kb, "number");
350 CALL_UI_DEBUG("number: [%s]", tmp);
352 CALL_UI_DEBUG("bundle val is NULL");
356 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", tmp);
358 tmp = bundle_get_val(kb, "ctindex");
360 CALL_UI_DEBUG("ctindex: [%s]", tmp);
361 call_data.ct_index = atoi(tmp);
363 CALL_UI_DEBUG("bundle val is NULL");
364 call_data.ct_index = -1;
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)
376 _vcui_engine_interface_process_mo_call(call_type, &call_data);
378 } else if (!strncmp(launch_type, "MT", 2)) {
380 vcui_call_type_t call_type;
381 vcui_call_mt_data_t call_data;
383 memset(&call_data, 0, sizeof(call_data));
384 call_type = VCUI_CALL_TYPE_MT;
386 tmp = bundle_get_val(kb, "handle");
388 CALL_UI_DEBUG("handle: [%s]", tmp);
389 call_data.call_handle = atoi(tmp);
391 CALL_UI_DEBUG("bundle val is NULL");
396 tmp = bundle_get_val(kb, "calltype");
398 CALL_UI_DEBUG("calltype: [%s]", tmp);
399 call_data.call_type = atoi(tmp);
401 CALL_UI_DEBUG("calltype is NULL but NOT mendatory");
402 call_data.call_type = 0;
405 tmp = bundle_get_val(kb, "cliindicator");
407 CALL_UI_DEBUG("cliindicator: [%s]", tmp);
408 call_data.cli_presentation_indicator = atoi(tmp);
410 CALL_UI_DEBUG("cliindicator is NULL but NOT mendatory");
411 call_data.cli_presentation_indicator = 0;
414 tmp = bundle_get_val(kb, "number");
416 CALL_UI_DEBUG("number: [%s]", tmp);
417 vcall_engine_util_strcpy(call_data.call_num, VC_PHONE_NUMBER_LENGTH_MAX, tmp);
419 CALL_UI_DEBUG("bundle val is NULL");
420 /*return VC_NO_ERROR;*/ /*check clir mt call.*/
423 tmp = bundle_get_val(kb, "name_mode");
425 CALL_UI_DEBUG("name_mode: [%s]", tmp);
426 call_data.calling_name_mode= atoi(tmp);
428 CALL_UI_DEBUG("name_mode is NULL but NOT mendatory");
429 call_data.calling_name_mode = -1;
432 tmp = bundle_get_val(kb, "name");
434 CALL_UI_DEBUG("name: [%s]", tmp);
435 vcall_engine_util_strcpy(call_data.calling_name, VC_PHONE_NAME_LENGTH_MAX, tmp);
437 CALL_UI_DEBUG("bundle val is NULL but NOT mendatory");
440 tmp = bundle_get_val(kb, "rdnumber");
442 CALL_UI_DEBUG("rdnumber: [%s]", tmp);
443 vcall_engine_util_strcpy(call_data.redirected_number, VC_PHONE_NUMBER_LENGTH_MAX, tmp);
445 CALL_UI_DEBUG("bundle val is NULL but NOT mendatory");
448 tmp = bundle_get_val(kb, "rdsubaddress");
450 CALL_UI_DEBUG("rdnumber: [%s]", tmp);
451 vcall_engine_util_strcpy(call_data.redirected_sub_address, VC_PHONE_SUBADDRESS_LENGTH_MAX, tmp);
453 CALL_UI_DEBUG("bundle val is NULL but NOT mendatory");
456 tmp = bundle_get_val(kb, "clicause");
458 CALL_UI_DEBUG("clicause: [%s]", tmp);
459 call_data.cli_cause = atoi(tmp);
461 CALL_UI_DEBUG("bundle val is NULL");
466 tmp = bundle_get_val(kb, "fwded");
468 CALL_UI_DEBUG("fwded: [%s]", tmp);
469 call_data.bfwded = atoi(tmp);
471 CALL_UI_DEBUG("bundle val is NULL");
476 tmp = bundle_get_val(kb, "activeline");
478 CALL_UI_DEBUG("activeline: [%s]", tmp);
479 call_data.active_line = atoi(tmp);
481 CALL_UI_DEBUG("bundle val is NULL");
485 _vcui_engine_interface_process_mt_call(call_type, &call_data);
486 } else if (!strncmp(launch_type, "EMERGENCY", 9)) {
488 vcui_call_type_t call_type;
489 vcui_call_ecc_data_t call_data;
491 memset(&call_data, 0, sizeof(call_data));
492 call_type = VCUI_CALL_TYPE_ECC;
494 tmp = bundle_get_val(kb, "number");
496 CALL_UI_DEBUG("number: [%s]", tmp);
498 CALL_UI_DEBUG("bundle val is NULL");
500 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", tmp);
502 _vcui_engine_interface_process_ecc_call(call_type, &call_data);
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;
508 memset(&sat_setup_call_info, 0, sizeof(sat_setup_call_info));
509 call_type = VCUI_CALL_TYPE_SAT;
511 tmp = bundle_get_val(kb, "cmd_id");
513 CALL_UI_DEBUG("cmd_id: [%s]", tmp);
514 sat_setup_call_info.command_id = atoi(tmp);
516 CALL_UI_DEBUG("bundle val is NULL");
521 tmp = bundle_get_val(kb, "cmd_qual");
523 CALL_UI_DEBUG("cmd_qual: [%s]", tmp);
524 sat_setup_call_info.command_qualifier = atoi(tmp);
526 CALL_UI_DEBUG("bundle val is NULL");
531 tmp = bundle_get_val(kb, "disp_text");
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);
536 CALL_UI_DEBUG("bundle val is NULL");
538 return VC_NO_ERROR;*/
541 tmp = bundle_get_val(kb, "call_num");
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);
546 CALL_UI_DEBUG("bundle val is NULL");
551 tmp = bundle_get_val(kb, "dur");
553 CALL_UI_DEBUG("dur: [%s]", tmp);
554 sat_setup_call_info.duration = atoi(tmp);
556 CALL_UI_DEBUG("bundle val is NULL");
560 _vcui_engine_interface_process_sat_call(call_type, &sat_setup_call_info);
561 } else if (!strncmp(launch_type, "ECCTEST", 7)) {
563 vcui_call_type_t call_type;
564 vcui_call_ecc_data_t call_data;
566 memset(&call_data, 0, sizeof(call_data));
567 call_type = VCUI_CALL_TYPE_ECC_TEST;
569 _vcui_engine_interface_process_ecc_call(call_type, &call_data);
571 } else if (!strncmp(launch_type, "DOWNLOADCALL", 12)) {
572 vcui_call_type_t call_type;
573 vcui_call_mo_data_t call_data;
575 memset(&call_data, 0, sizeof(call_data));
576 call_type = VCUI_CALL_TYPE_DOWNLOAD_CALL;
578 tmp = bundle_get_val(kb, "number");
580 CALL_UI_DEBUG("number: [%s]", tmp);
582 CALL_UI_DEBUG("bundle val is NULL");
586 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", tmp);
588 snprintf(call_data.call_number, sizeof(call_data.call_number), "%s", "116");
591 vcall_engine_util_strcpy(call_data.call_number, sizeof(call_data.call_number), tmp);
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");
597 CALL_UI_KPI("__vcui_app_reset done");
601 CALL_UI_DEBUG("bundle data is wrong!!");
606 static int __vcui_app_resume(void *data)
608 CALL_UI_DEBUG("__vcui_app_resume()..");
610 vcui_app_call_data_t *ad = (vcui_app_call_data_t *) data;
614 static int __vcui_app_terminate(void *data)
616 CALL_UI_DEBUG("__vcui_app_terminate()..");
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();
623 __vcui_fade_out_cb_routine();
627 static void __vcui_cache_flush_set(Evas *e)
630 evas_image_cache_set(e, 4096 * 1024);
631 evas_font_cache_set(e, 512 * 1024);
633 edje_file_cache_set(0);
634 edje_collection_cache_set(0);
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) ())
640 app_data->func_new[view_id] = view_new;
643 void _vcui_response_volume(int vol_alert_type, int vol_level)
645 vcui_app_call_data_t *ad = _vcui_get_app_data();
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);
654 CALL_UI_DEBUG("ERROR");
658 void _vcui_set_volume(int key_status)
660 vcui_app_call_data_t *ad = _vcui_get_app_data();
662 if (_vcui_doc_get_count() == 0) {
663 CALL_UI_DEBUG("ignore it");
667 if ((ad->view_st[ad->view_top]->type == VIEW_INCOMING_VIEW || ad->view_st[ad->view_top]->type == VIEW_INCOMING_LOCK_VIEW)) {
669 int settings_sound_status = EINA_FALSE;
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.");
677 if (ad->bmute_ringtone == EINA_TRUE) {
678 CALL_UI_DEBUG("during mute ringtone, vol will not changed");
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);
688 ad->ringtone_val = vol_level;
691 CALL_UI_DEBUG("RINGTONE : Set Volume");
692 if (key_status == VAL_VOL_DOWN && ad->ringtone_val > RINGTONE_MIN) {
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) {
697 _vcui_engine_set_volume_level(VCUI_VOL_RING, ad->ringtone_val);
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);
708 CALL_UI_DEBUG("BT VOL : Set Volume");
709 if (key_status == VAL_VOL_DOWN && ad->bt_vol_val > BT_VOL_MIN) { /*Key Down*/
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*/
714 _vcui_engine_set_volume_level(VCUI_VOL_HEADSET, ad->bt_vol_val);
716 _vcui_view_popup_vol_bt(ad->bt_vol_val);
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);
722 CALL_UI_DEBUG("TAPI VOL : Set Volume");
723 if (key_status == VAL_VOL_DOWN && ad->voice_vol_val > VOICE_VOL_MIN) { /*Key Down*/
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*/
728 _vcui_engine_set_volume_level(VCUI_VOL_VOICE, ad->voice_vol_val);
730 _vcui_view_popup_vol_voice(ad->voice_vol_val);
735 static void __vcui_fade_out_cb_routine()
738 vcui_app_call_data_t *ad = _vcui_get_app_data();
740 if (ad->child_is == 1) {
741 /*system("killall dialer");*/
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);
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();
753 static int __vcui_lang_changed_cb(void *data)
757 _vcui_view_auto_change();
762 static int __vcui_low_mem_cb(void *data)
769 static int __vcui_low_bat_cb(void *data)
776 static void __vcui_init(vcui_app_call_data_t *ad)
778 CALL_UI_KPI("g_type_init start");
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);
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");
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;
805 ad->show_flag = WIN_HIDE;
806 ad->brecord_voice = 0;
807 ad->ringtone_val = -1;
808 ad->voice_vol_val = -1;
810 ad->call_end_type = CALL_END_TYPE_NONE;
813 char *_vcui_get_endcause_string(int end_cause, char *data)
815 char *string_id = NULL;
816 CALL_UI_DEBUG("end type : %d", end_cause);
818 case VC_ENGINE_ENDCAUSE_USER_UNAVAILABLE:
819 string_id = _("IDS_CALL_BODY_CALLED_PARTY_UNAVAILABLE");
821 case VC_ENGINE_ENDCAUSE_UNASSIGNED_NUMBER:
822 string_id = _("IDS_CALL_BODY_NUMBER_DOES_NOT_EXIST");
824 case VC_ENGINE_ENDCAUSE_USER_DOESNOT_RESPOND:
825 string_id = _("IDS_CALL_BODY_NO_ANSWER");
827 case VC_ENGINE_ENDCAUSE_CALL_DISCONNECTED:
828 string_id = _("IDS_CALL_BODY_DISCONNECTED");
830 case VC_ENGINE_ENDCAUSE_CALL_ENDED:
831 string_id = _("IDS_CALL_BODY_CALLENDED");
833 case VC_ENGINE_ENDCAUSE_CALL_SERVICE_NOT_ALLOWED:
834 string_id = _("IDS_CALL_POP_SERVICE_NOT_ALLOWED");
836 case VC_ENGINE_ENDCAUSE_CALL_BARRED:
837 string_id = _("IDS_CALL_POP_CALL_BARRED");
839 case VC_ENGINE_ENDCAUSE_NO_SERVICE:
840 string_id = _("IDS_CALL_POP_NOSERVICE");
842 case VC_ENGINE_ENDCAUSE_NW_BUSY:
843 string_id = _("IDS_CALL_POP_NETWORKBUSY");
845 case VC_ENGINE_ENDCAUSE_NW_FAILED:
846 string_id = _("IDS_CALL_POP_NETWORK_UNAVAILABLE");
848 case VC_ENGINE_ENDCAUSE_SERVICE_TEMP_UNAVAILABLE:
849 string_id = _("IDS_CALL_BODY_SERVICE_UNAVAILABLE");
851 case VC_ENGINE_ENDCAUSE_NO_ANSWER:
852 string_id = _("IDS_CALL_BODY_NO_ANSWER");
854 case VC_ENGINE_ENDCAUSE_NO_CREDIT:
855 string_id = _("IDS_CALL_POP_NOCREDITLEFT");
857 case VC_ENGINE_ENDCAUSE_REJECTED:
858 string_id = _("IDS_CALL_BODY_CALL_REJECTED");
860 case VC_ENGINE_ENDCAUSE_USER_BUSY:
861 string_id = _("IDS_CALL_POP_USER_BUSY");
863 case VC_ENGINE_ENDCAUSE_WRONG_GROUP:
864 string_id = _("IDS_CALL_POP_WRONG_GROUP");
866 case VC_ENGINE_ENDCAUSE_INVALID_NUMBER_FORMAT:
867 string_id = _("IDS_CALL_POP_CAUSE_WRONG_NUMBER");
869 case VC_ENGINE_ENDCAUSE_CALL_NOT_ALLOWED:
870 string_id = _("IDS_CALL_POP_CALLNOTCALLOWED");
872 case VC_ENGINE_ENDCAUSE_TAPI_ERROR:
873 string_id = _("IDS_CALL_POP_AEESYS_SYSTEMFAILUREERROR");
875 case VC_ENGINE_ENDCAUSE_CALL_FAILED:
876 string_id = _("IDS_CALL_POP_CALLFAILED");
878 case VC_ENGINE_ENDCAUSE_NUMBER_CHANGED:
879 string_id = _("IDS_CALL_BODY_NUMBER_CHANGED");
881 case VC_ENGINE_ENDCAUSE_IMEI_REJECTED:
882 string_id = _("IDS_CALL_POP_VERIFY_SIM_OR_INSERT_VALID_SIM");
884 case VC_ENGINE_ENDCAUSE_NO_USER_RESPONDING: /**< User not responding */
885 case VC_ENGINE_ENDCAUSE_USER_ALERTING_NO_ANSWER: /**< User Alerting No Answer */
887 string_id = _("IDS_CALL_BODY_CALLENDED");
890 vcall_engine_util_strcpy(data, VC_DATA_LENGTH_MAX, string_id);
894 void _vcui_cache_flush()
897 vcui_app_call_data_t *ad = _vcui_get_app_data();
899 evas_font_cache_flush(ad->evas);
900 evas_image_cache_flush(ad->evas);
902 edje_file_cache_flush();
903 edje_collection_cache_flush();
905 evas_render_idle_flush(ad->evas);
909 int _vcui_is_idle_lock()
912 int ret = vconf_get_int(VCONFKEY_IDLE_LOCK_STATE, &(lock_state));
914 CALL_UI_DEBUG("Cannot get vconf key");
917 if (lock_state == VCONFKEY_IDLE_LOCK)
923 unsigned long _vcui_get_diff_now(time_t start_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;
932 gboolean _vcui_is_gcf_mode(void)
934 gboolean bgcf_status = EINA_FALSE;
937 ret = vconf_get_int(VCONFKEY_ADMIN_GCF_TEST, &bgcf_status);
939 CALL_UI_DEBUG("bgcf_status = [%d]\n", bgcf_status);
941 CALL_UI_DEBUG("vconf_get_int failed..[%d]\n", ret);
947 gboolean _vcui_is_headset_conected(void)
949 int bt_connected = VCONFKEY_BT_DEVICE_NONE;
950 Eina_Bool ret = EINA_FALSE;
952 ret = vconf_get_int(VCONFKEY_BT_DEVICE, &bt_connected);
954 CALL_UI_DEBUG("bt_connected = [0x%x] ", bt_connected);
956 CALL_UI_DEBUG("vconf_get_int failed..[%d]", ret);
959 return (VCONFKEY_BT_DEVICE_HEADSET_CONNECTED == (bt_connected & VCONFKEY_BT_DEVICE_HEADSET_CONNECTED)) ? EINA_TRUE : EINA_FALSE;
962 gboolean _vcui_is_headset_switch_on(void)
964 int bt_status = VCONFKEY_BT_STATUS_OFF;
965 Eina_Bool ret = EINA_FALSE;
967 ret = vconf_get_int(VCONFKEY_BT_STATUS, &bt_status);
969 CALL_UI_DEBUG("bt_status = [0x%x] ", bt_status);
971 CALL_UI_DEBUG("vconf_get_int failed..[%d]", ret);
974 return (VCONFKEY_BT_STATUS_ON == (bt_status & VCONFKEY_BT_STATUS_ON)) ? EINA_TRUE : EINA_FALSE;
977 gboolean _vcui_is_answering_mode_on(void)
979 gboolean bAnswerMode = EINA_FALSE;
980 Eina_Bool ret = EINA_FALSE;
982 ret = vconf_get_bool(VCONFKEY_CISSAPPL_ANSWERING_KEY_BOOL, &bAnswerMode);
984 CALL_UI_DEBUG("bAnswerMode = [%d] \n", bAnswerMode);
986 CALL_UI_DEBUG("vconf_get_int failed..[%d]\n", ret);
992 gboolean _vcui_is_powerkey_mode_on(void)
994 gboolean bPowerkeyMode = EINA_FALSE;
995 Eina_Bool ret = EINA_FALSE;
997 ret = vconf_get_bool(VCONFKEY_CISSAPPL_POWER_KEY_ENDS_CALL_BOOL, &bPowerkeyMode);
999 CALL_UI_DEBUG("bPowerkeyMode = [%d] \n", bPowerkeyMode);
1001 CALL_UI_DEBUG("vconf_get_int failed..[%d]\n", ret);
1004 return bPowerkeyMode;
1007 gboolean _vcui_is_phonelock_status()
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);
1014 CALL_UI_DEBUG("get VCONFKEY_SETAPPL_STATE_POWER_ON_LOCK_BOOL failed..");
1019 void _vcui_add_calllog(int type, call_data_t *data, int boutgoing_end)
1021 CALL_UI_DEBUG("type = [0x%x] ", type);
1023 time_t current_time;
1027 contacts_svc_connect();
1029 current_time = time(NULL);
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);
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);
1041 contacts_svc_value_set_int(plog, CTS_PLOG_VAL_DURATION_INT, _vcui_get_diff_now(data->start_time));
1043 contacts_svc_insert_phonelog(plog);
1045 contacts_svc_value_free(plog);
1046 contacts_svc_disconnect();
1048 /* vconf set & quickpanel noti (for missed call) */
1049 if (type == CTS_PLOG_TYPE_VOICE_INCOMMING_UNSEEN) {
1050 char szname[255] = { 0, };
1052 notification_h noti = NULL;
1053 notification_error_e noti_err = NOTIFICATION_ERROR_NONE;
1055 if (strlen((char *)data->call_display) == 0) {
1056 snprintf(szname, sizeof(szname), "%s", data->call_num);
1058 snprintf(szname, sizeof(szname), "%s", data->call_display);
1060 CALL_UI_DEBUG("szname:[%s]", szname);
1062 noti = notification_new(NOTIFICATION_TYPE_NOTI, __VCUI_NOTIFICATION_CALL_GROUP_ID, NOTIFICATION_PRIV_ID_NONE);
1064 CALL_UI_DEBUG("Fail to notification_new\n");
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);
1073 bundle *args = bundle_create();
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);
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);
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);
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);
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");
1105 noti_err = notification_free(noti);
1106 if(noti_err != NOTIFICATION_ERROR_NONE) {
1107 CALL_UI_DEBUG("Fail to notification_set_text_domain\n");
1112 void _vcui_raise_main_win()
1114 CALL_UI_DEBUG("..");
1116 vcui_app_call_data_t *ad = _vcui_get_app_data();
1118 CALL_UI_DEBUG("App data is NULL");
1121 if (ad->win_main == NULL) {
1122 CALL_UI_DEBUG("Main Window is NULL");
1126 elm_win_activate(ad->win_main);
1127 _vcui_show_main_ui_set_flag();
1128 /*view_refresh_now();*/
1132 int _vcui_check_valid_eo(Evas_Object *eo, char *v_name)
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);
1140 if (strncmp(obj_name, v_name, strlen(obj_name)) == 0) {
1143 CALL_UI_DEBUG("different name !! ");
1148 vcui_app_call_data_t *_vcui_get_app_data()
1153 void _vcui_show_main_ui_set_flag()
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;
1163 void __vcui_hide_main_ui_set_flag()
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;
1171 Evas_Object *_vcui_load_edj(Evas_Object *parent, const char *file, const char *group)
1176 eo = elm_layout_add(parent);
1178 r = elm_layout_file_set(eo, file, group);
1180 evas_object_del(eo);
1181 CALL_UI_DEBUG("ERROR!!");
1185 evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
1191 int main(int argc, char *argv[])
1193 CALL_UI_DEBUG("voice call ui main()..");
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,
1203 memset(&global_ad, 0, sizeof(vcui_app_call_data_t));
1205 ops.data = &global_ad;
1207 CALL_UI_KPI("__vcui_init start");
1208 __vcui_init(&global_ad);
1209 CALL_UI_KPI("__vcui_init done");
1211 appcore_set_i18n(PACKAGE, LOCALEDIR);
1213 return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
1216 static Eina_Bool __vcui_avoid_multi_setup_timer_cb(void *data)
1218 CALL_UI_DEBUG("..");
1220 g_avoid_multi_setup = EINA_FALSE;
1222 return ECORE_CALLBACK_CANCEL;