TizenRefApp-5965 [Call UI] Bind new Call Manager with application 65/63565/2
authorIgor Olshevskyi <i.olshevskyi@samsung.com>
Fri, 18 Mar 2016 11:57:20 +0000 (13:57 +0200)
committerIgor Olshevskyi <i.olshevskyi@samsung.com>
Thu, 24 Mar 2016 13:39:24 +0000 (15:39 +0200)
Change-Id: I47b5fdaf4c68300192a853caa4172ef20b60a585

30 files changed:
inc/callui-common-def.h [new file with mode: 0644]
inc/callui-common.h
inc/callui-manager.h
inc/callui-state-provider.h
inc/callui-view-circle.h
inc/callui-view-elements.h
inc/callui-view-incoming-call.h
inc/callui-view-manager.h
inc/callui-view-quickpanel.h
inc/callui.h
src/callui-common.c
src/callui-keypad.c
src/callui-lock-manager.c
src/callui-manager.c
src/callui-proximity-lock-manager.c
src/callui-state-provider.c
src/callui-view-callend.c
src/callui-view-circle.c
src/callui-view-dialing.c
src/callui-view-elements.c
src/callui-view-incoming-call-noti.c
src/callui-view-incoming-call.c
src/callui-view-lock-screen.c
src/callui-view-manager.c
src/callui-view-multi-call-conf.c
src/callui-view-multi-call-list.c
src/callui-view-multi-call-split.c
src/callui-view-quickpanel.c
src/callui-view-single-call.c
src/callui.c

diff --git a/inc/callui-common-def.h b/inc/callui-common-def.h
new file mode 100644 (file)
index 0000000..e21524c
--- /dev/null
@@ -0,0 +1,126 @@
+/*
+ * Copyright (c) 2009-2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+
+#ifndef __CALLUI_COMMON_DEFINES_H__
+#define __CALLUI_COMMON_DEFINES_H__
+
+#ifndef CALLUI_EXPORT_API
+#define CALLUI_EXPORT_API __attribute__ ((visibility("default")))
+#endif
+
+#define MSG_PKG                "org.tizen.message"
+
+#define PACKAGE                "org.tizen.call-ui"
+
+#define EDJ_NAME       _callui_common_get_call_edj_path()
+#define CALL_THEME     _callui_common_get_call_theme_path()
+
+#ifndef _EDJ
+#define _EDJ(obj) elm_layout_edje_get(obj)
+#endif
+
+#define CALLUI_TEXT_DOMAIN "call-ui"
+
+#undef _
+#define _(s) dgettext(CALLUI_TEXT_DOMAIN, s)
+
+#define GRP_MAIN_LY "main_ly"
+#define GRP_KEYPAD "keypad"
+#define GRP_MULTICALL "multicall-list"
+#define GRP_REJECT_MSG "reject_with_msg"
+#define GRP_QUICKPANEL "quickpanel"
+#define GRP_SEPARATOR_LAYOUT "separator-layout"
+#define GRP_SEPARATOR_LAYOUT_1BUTTON "separator-layout-1button"
+#define GRP_SEPARATOR_LAYOUT_2BUTTON "separator-layout-2button"
+#define GRP_BUTTON_LAYOUT "button-layout"
+#define APP_CONTROL_OPERATION_DURING_CALL "http://tizen.org/appcontrol/oparation/during_call"
+#define APP_CONTROL_OPERATION_MESSAGE_REJECT "http://tizen.org/appcontrol/operation/message_reject"
+#define APP_CONTROL_OPERATION_END_CALL "http://tizen.org/appcontrol/operation/end_call"
+#define GRP_CALLER_INFO "caller-info"
+#define GRP_MANAGE_CALLS "manage-calls"
+#define GRP_LOCK_ACCEPT "lock_accept"
+#define GRP_LOCK_REJECT "lock_reject"
+#define GRP_LOCK_REJECT_WITH_MSG "lock_reject_with_msg"
+#define GRP_DIMMING_LAYOUT "dimming_ly"
+#define GRP_ENDCALL_MAIN_LAYOUT "main_end_call"
+#define GRP_ENDCALL_CALL_BACK_BTN "call_back"
+#define GRP_ENDCALL_MSG_BTN "message_button"
+#define GRP_ENDCALL_CREATE_CONT_BTN "create_contact_button"
+
+#define         CALLUI_DISPLAY_NAME_LENGTH_MAX                 (255+1)                 /**< Voiecall Display Name Max Length  */
+#define         CALLUI_IMAGE_PATH_LENGTH_MAX                   (255+1)                 /**< Max File length for image */
+#define         CALLUI_RINGTONE_PATH_LENGTH_MAX                (255+1)                 /**< Max File length for Ringtone */
+#define         CALLUI_VIB_PATH_LENGTH_MAX                             (255+1)                 /**< Max File length for Vibration */
+#define         CALLUI_DATA_LENGTH_MAX                                 (255+1)                 /**< Max data length for misc */
+#define         CALLUI_PHONE_NUMBER_LENGTH_MAX                 (82+1)                  /**< Maximum length of a phone number  */
+#define         CALLUI_FORMATTED_NUMBER_LENGTH_MAX             (164+1)                 /**< Maximum length of a phone number  */
+#define         CALLUI_PHONE_DISP_NUMBER_LENGTH_MAX    (82+10+1)               /**< Maximum length of a display phone number  */
+#define         CALLUI_PHONE_NAME_LENGTH_MAX                   (80+1)                  /**< Maximum length of a calling name  */
+#define         CALLUI_PHONE_SUBADDRESS_LENGTH_MAX             (40+1)                  /**< Maximum length of a SUB address  */
+#define         CALLUI_PHONE_USSD_LENGTH_MAX                   (182+1)                 /**< Maximum length of a phone number  */
+#define         CALLUI_MAX_CALL_GROUP_MEMBER                   5                               /**< Maximum number of members in a group */
+#define         CALLUI_MAX_CALL_MEMBER                                 8                               /**< This is the maximum number of members possible */
+#define         CALLUI_INVALID_CALL_ID                                 0                               /**< This is the invalid entry for call ID */
+
+#define NO_HANDLE 0
+
+#define CALLUI_KEY_BACK "XF86Back"
+#define CALLUI_KEY_MEDIA "XF86AudioMedia"
+#define CALLUI_KEY_SELECT "XF86Phone"
+#define CALLUI_KEY_POWER "XF86PowerOff"
+#define CALLUI_KEY_HOME "XF86Home"
+#define CALLUI_KEY_VOLUMEUP "XF86AudioRaiseVolume"
+#define CALLUI_KEY_VOLUMEDOWN "XF86AudioLowerVolume"
+
+#define CALLUI_REJ_MSG_MAX_LENGTH (210+1)
+#define CALLUI_REJ_MSG_MAX_COUNT 6
+
+#define CALLUI_SAFE_C_CAST(type, value) ((type)(ptrdiff_t)value)
+
+#undef FREE
+#define FREE(ptr) \
+       do {\
+               free(ptr);\
+               ptr = NULL;\
+       } while (0)
+
+#undef G_FREE
+#define G_FREE(ptr) \
+       do {\
+               g_free(ptr);\
+               ptr = NULL;\
+       } while (0)
+
+#undef DELETE_EVAS_OBJECT
+#define DELETE_EVAS_OBJECT(x) \
+       do { \
+               if (x != NULL) { \
+                       evas_object_del(x); \
+                       x = NULL; \
+               } \
+       } while (0)
+
+#undef DELETE_ECORE_TIMER
+#define DELETE_ECORE_TIMER(x) \
+       do { \
+               if (x != NULL) { \
+                       ecore_timer_del(x); \
+                       x = NULL; \
+               } \
+       } while (0)
+
+#endif /* __CALLUI_COMMON_DEFINES_H__ */
index 242d1ed..35d050a 100644 (file)
 #include "callui-view-manager.h"
 #include "callui.h"
 #include "callui-common-types.h"
-
-#define CALLUI_KEY_BACK "XF86Back"
-#define CALLUI_KEY_MEDIA "XF86AudioMedia"
-#define CALLUI_KEY_SELECT "XF86Phone"
-#define CALLUI_KEY_POWER "XF86PowerOff"
-#define CALLUI_KEY_HOME "XF86Home"
-#define CALLUI_KEY_VOLUMEUP "XF86AudioRaiseVolume"
-#define CALLUI_KEY_VOLUMEDOWN "XF86AudioLowerVolume"
-
-#define CALLUI_REJ_MSG_MAX_LENGTH (210+1)
-#define CALLUI_REJ_MSG_MAX_COUNT 6
-
-#define CALLUI_SAFE_C_CAST(type, value) ((type)(ptrdiff_t)value)
-
-#undef FREE
-#define FREE(ptr) \
-       do {\
-               free(ptr);\
-               ptr = NULL;\
-       } while (0)
-
-#undef G_FREE
-#define G_FREE(ptr) \
-       do {\
-               g_free(ptr);\
-               ptr = NULL;\
-       } while (0)
-
-#undef DELETE_EVAS_OBJECT
-#define DELETE_EVAS_OBJECT(x) \
-       do { \
-               if (x != NULL) { \
-                       evas_object_del(x); \
-                       x = NULL; \
-               } \
-       } while (0)
-
+#include "callui-common-def.h"
 
 typedef enum {
        LOCK_TYPE_UNLOCK = 1,
@@ -74,72 +38,42 @@ typedef enum {
 } callui_lcd_timeout_t;
 
 typedef enum {
-   LCD_ON,
-   LCD_ON_LOCK,
-   LCD_ON_UNLOCK,
-   LCD_UNLOCK,
-   LCD_OFF_SLEEP_LOCK,
-   LCD_OFF_SLEEP_UNLOCK,
-   LCD_OFF
+       LCD_ON,
+       LCD_ON_LOCK,
+       LCD_ON_UNLOCK,
+       LCD_UNLOCK,
+       LCD_OFF_SLEEP_LOCK,
+       LCD_OFF_SLEEP_UNLOCK,
+       LCD_OFF
 } callui_lcd_control_t;
 
-/**
- * @brief Set call duration
- *
- * @param[in] time_dur       Time duration
- *
- */
-void _callui_common_set_call_duration(char *time_dur);
-
-/**
- * @brief Update begin timer
- *
- * @param[in] starttime       Start time
- *
- */
-void _callui_common_update_call_duration(long starttime);
-
-/**
- * @brief Create duration timer
- *
- */
-void _callui_common_create_duration_timer();
-
-/**
- * @brief Delete duration timer
- *
- */
-void _callui_common_delete_duration_timer();
+typedef void (*set_call_duration_time)(struct tm *cur_time, Evas_Object *obj, const char *part);
 
 /**
  * @brief create ending timer
+ *
  * @param[in] appdata        App data
+ *
  */
 void _callui_common_create_ending_timer(void *appdata);
 
 /**
  * @brief Delete ending timer
- * @param[in] appdata        App data
- */
-void _callui_common_delete_ending_timer(void *appdata);
-
-/**
- * @brief Get sim name
  *
  * @param[in] appdata        App data
  *
- * @return sim name
- *
  */
-char * _callui_common_get_sim_name(void *appdata);
+void _callui_common_delete_ending_timer(void *appdata);
 
 /**
  * @brief State if headset is conected
  *
+ * @param[in] appdata        App data
+ *
  * @return state
  *
  */
-Eina_Bool _callui_common_is_headset_conected(void);
+Eina_Bool _callui_common_is_headset_conected(void *appdata);
 
 /**
  * @brief Get idle lock type
@@ -158,13 +92,6 @@ callui_idle_lock_type_t _callui_common_get_idle_lock_type(void);
 int _callui_common_unlock_swipe_lock(void);
 
 /**
- * @brief Get uptime
- * @return uptime
- *
- */
-long _callui_common_get_uptime(void);
-
-/**
  * @brief Set notification type
  *
  * @param[in] person_id      Person id
@@ -174,15 +101,6 @@ long _callui_common_get_uptime(void);
 void _callui_common_win_set_noti_type(void *appdata, int bwin_noti);
 
 /**
- * @brief Get contact info
- *
- * @param[in] person_id      Person id
- * @param[out] ct_info       Contacts data
- *
- */
-void _callui_common_get_contact_info(int person_id, call_contact_data_t *ct_info);
-
-/**
  * @brief Launch contacts application
  *
  * @param[in] appdata        App data
@@ -213,7 +131,7 @@ void _callui_common_launch_dialer(void *appdata);
  * @param[in] number         Phone number
  *
  */
-void _callui_common_launch_msg_composer(void *appdata, char *number);
+void _callui_common_launch_msg_composer(void *appdata, const char *number);
 
 /**
  * @brief Reset main layout text fields
@@ -236,10 +154,12 @@ void _callui_common_dvc_set_lcd_timeout(callui_lcd_timeout_t state);
 /**
  * @brief state is volume mode on
  *
+ * @param[in] data                     Application data
+ *
  * @return state
  *
  */
-gboolean _callui_common_is_extra_volume_available(void);
+bool _callui_common_is_extra_volume_available(void *data);
 
 /**
  * @brief state is aswering mode on
@@ -337,4 +257,30 @@ bool _callui_is_on_handsfree_mode();
  */
 bool _callui_is_on_background();
 
+/**
+ * @brief Set call duration time into text part of Evas object
+ * @param[in] cur_time         source time data
+ * @param[in] func                     Evas Object updater function
+ * @param[in] obj                      Evas object to set call duration
+ * @param[in] part                     Evas object text part name
+ */
+void _callui_common_set_call_duration_time(struct tm *cur_time,
+               Evas_Object *obj,
+               const char *part);
+
+/**
+ * @brief Update call duration data in EvasObjcet text part if it is needed
+ * @remark if updaet is needed @cur_time data will be replaced by @comp_time data
+ * @param[in] cur_time         current time data
+ * @param[in] comp_time                time data to compare
+ * @param[in] func                     Evas Object part updater function
+ * @param[in] obj                      Evas object to set call duration
+ * @param[in] part                     Evas object text part name
+ */
+void _callui_common_try_update_call_duration_time(struct tm *cur_time,
+               struct tm *comp_time,
+               set_call_duration_time func,
+               Evas_Object *obj,
+               const char *part);
+
 #endif //__CALLUI_COMMON_H_
index e09e44f..9d3b4ba 100644 (file)
@@ -68,6 +68,8 @@ callui_result_e _callui_manager_join_call(callui_manager_h cm_handler);
 
 callui_result_e _callui_manager_reject_call(callui_manager_h cm_handler);
 
+callui_result_e _callui_manager_stop_alert(callui_manager_h cm_handler);
+
 callui_result_e _callui_manager_split_call(callui_manager_h cm_handler, unsigned int call_id);
 
 callui_result_e _callui_manager_answer_call(callui_manager_h cm_handler, callui_call_answer_type_e ans_type);
index a019b4d..d90b8a6 100644 (file)
@@ -68,6 +68,7 @@ struct _callui_conf_call_data_t {
 typedef struct _callui_conf_call_data_t callui_conf_call_data_t;
 
 struct _callui_call_state_data_t {
+       callui_call_data_type_e type;
        unsigned int call_id;
        char call_num[CALLUI_PHONE_NUMBER_LENGTH_MAX];
        char call_disp_num[CALLUI_PHONE_DISP_NUMBER_LENGTH_MAX];
@@ -85,9 +86,6 @@ typedef void (*callui_call_state_event_cb)(void *user_data,
                unsigned int call_id,
                callui_sim_slot_type_e sim_type);
 
-typedef void (*callui_last_call_end_event_cb)(void *user_data,
-               const callui_call_state_data_t *last_call_data);
-
 const callui_call_state_data_t *_callui_stp_get_call_data(callui_state_provider_h stp,
                callui_call_data_type_e call_data_type);
 
@@ -96,6 +94,10 @@ Eina_List *_callui_stp_get_conference_call_list(callui_state_provider_h stp);
 struct tm *_callui_stp_get_call_duration(callui_state_provider_h stp,
                callui_call_data_type_e call_data_type);
 
+const callui_call_state_data_t *_callui_stp_get_last_ended_call_data(callui_state_provider_h stp);
+
+bool _callui_stp_is_any_calls_available(callui_state_provider_h stp);
+
 callui_result_e _callui_stp_add_call_state_event_cb(callui_state_provider_h stp,
                callui_call_state_event_cb cb_func,
                void *cb_data);
@@ -104,12 +106,4 @@ callui_result_e _callui_stp_remove_call_state_event_cb(callui_state_provider_h s
                callui_call_state_event_cb cb_func,
                void *cb_data);
 
-callui_result_e _callui_stp_add_last_call_end_event_cb(callui_state_provider_h stp,
-               callui_last_call_end_event_cb cb_func,
-               void *cb_data);
-
-callui_result_e _callui_stp_remove_last_call_end_event_cb(callui_state_provider_h stp,
-               callui_last_call_end_event_cb cb_func,
-               void *cb_data);
-
 #endif /* __CALLUI_CALL_STATE_PROVIDER_H__ */
index 47e231e..733b924 100755 (executable)
@@ -23,6 +23,7 @@
 
 #include "callui-view-incoming-call.h"
 #include "callui.h"
+#include "callui-common-types.h"
 
 /**
  * @brief Create reject layout
@@ -34,7 +35,7 @@
  * @return CALLUI_RESULT_OK on success or error code otherwise
  *
  */
-int _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent);
+callui_result_e _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent);
 
 /**
  * @brief Create accept layout
@@ -46,6 +47,6 @@ int _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_
  * @return CALLUI_RESULT_OK on success or error code otherwise
  *
  */
-int _callui_view_circle_create_accept_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent);
+callui_result_e _callui_view_circle_create_accept_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent);
 
 #endif
index 7c8218f..e5ea9af 100644 (file)
@@ -269,7 +269,7 @@ Evas_Object *_callui_show_caller_info_status(void *data, const char *status);
  * @return layout
  *
  */
-Evas_Object *_callui_show_caller_id(Evas_Object *contents, char *path);
+Evas_Object *_callui_show_caller_id(Evas_Object *contents, const char *path);
 
 /**
  * @brief Create more popup
@@ -296,12 +296,6 @@ void _callui_load_second_call_popup(callui_app_data_t *ad);
 void _callui_load_bluetooth_popup(callui_app_data_t *ad);
 
 /**
- * @brief Create extra volume notification popup
- *
- */
-void _callui_create_extravolume_notify_popup(void);
-
-/**
  * @brief Create toast message
  *
  * @param[in]    string       The messages to be posted
@@ -330,42 +324,6 @@ void _callui_spk_btn_cb(void *data, Evas_Object *obj, void *event_info);
 void _callui_mute_btn_cb(void *data, Evas_Object *obj, void *event_info);
 
 /**
- * @brief Update speaker button depending on the state
- *
- * @param[in]    data         Application data
- * @param[in]    is_on        Button state
- *
- */
-void _callui_update_speaker_btn(callui_app_data_t *ad, Eina_Bool is_on);
-
-/**
- * @brief Update headset button depending on the state
- *
- * @param[in]    data         Application data
- * @param[in]    is_on        Button state
- *
- */
-void _callui_update_headset_btn(callui_app_data_t *ad, Eina_Bool is_on);
-
-/**
- * @brief Update mute button depending on the state
- *
- * @param[in]    data         Application data
- * @param[in]    is_on        Button state
- *
- */
-void _callui_update_mute_btn(callui_app_data_t *ad, Eina_Bool is_on);
-
-/**
- * @brief Update extra volume button depending on the state
- *
- * @param[in]    data         Application data
- * @param[in]    is_on        Button state
- *
- */
-void _callui_update_extra_vol_btn(callui_app_data_t *ad, Eina_Bool is_on);
-
-/**
  * @brief Create and set background layout
  *
  * @param[in]    app_data              Application data pointer
@@ -373,6 +331,6 @@ void _callui_update_extra_vol_btn(callui_app_data_t *ad, Eina_Bool is_on);
  * @param[in]    part          Part name in parent to be set reject message button
  *
  */
-int _callui_create_reject_msg_button(void *app_data, Evas_Object *parent, char *part);
+int _callui_create_reject_msg_button(void *app_data, Evas_Object *parent, const char *part);
 
 #endif //__CALLUI_VIEW_ELEMENTS_H_
index 7fde3dd..5806580 100644 (file)
@@ -20,6 +20,8 @@
 
 #include <Elementary.h>
 
+#include "callui-common-types.h"
+
 typedef struct _callui_view_incoming_call *callui_view_incoming_call_h;
 
 /**
@@ -37,7 +39,7 @@ callui_view_incoming_call_h _callui_view_incoming_call_new();
  *
  * @return CALLUI_RESULT_OK on success or error code otherwise
  */
-int _callui_view_incoming_call_set_accept_layout(callui_view_incoming_call_h vd, Evas_Object *layout);
+callui_result_e _callui_view_incoming_call_set_accept_layout(callui_view_incoming_call_h vd, Evas_Object *layout);
 
 /**
  * @brief Gets accept layout from Incoming call view
@@ -56,7 +58,7 @@ Evas_Object *_callui_view_incoming_call_get_accept_layout(callui_view_incoming_c
  *
  * @return CALLUI_RESULT_OK on success or error code otherwise
  */
-int _callui_view_incoming_call_set_reject_layout(callui_view_incoming_call_h vd, Evas_Object *layout);
+callui_result_e _callui_view_incoming_call_set_reject_layout(callui_view_incoming_call_h vd, Evas_Object *layout);
 
 /**
  * @brief Gets reject layout from Incoming call view
index 4bcbb24..2c791aa 100644 (file)
 #define __CALLUI_VIEW_MANAGER_H__
 
 #include <Elementary.h>
+#include <Ecore.h>
+#include <time.h>
+
+#include "callui-common-types.h"
 
 typedef enum {
        VIEW_TYPE_UNDEFINED = -1,
@@ -36,9 +40,9 @@ typedef enum {
 
 struct _view_data;
 
-typedef int (*create_cb)       (struct _view_data *view_data, void *appdata);
-typedef int (*update_cb)       (struct _view_data *view_data);
-typedef int (*destroy_cb)      (struct _view_data *view_data);
+typedef callui_result_e (*create_cb) (struct _view_data *view_data, void *appdata);
+typedef callui_result_e (*update_cb) (struct _view_data *view_data);
+typedef callui_result_e (*destroy_cb) (struct _view_data *view_data);
 
 typedef struct appdata callui_app_data_t;
 
@@ -46,8 +50,13 @@ struct _view_data {
        create_cb onCreate;
        update_cb onUpdate;
        destroy_cb onDestroy;
+
        callui_app_data_t *ad;
+
        Evas_Object *contents;
+
+       Ecore_Timer *call_duration_timer;
+       struct tm *call_duration_tm;
 };
 typedef struct _view_data call_view_data_base_t;
 
@@ -75,7 +84,7 @@ void _callui_vm_destroy(callui_vm_h vm);
  *
  * @return result CALLUI_RESULT_OK on success
  */
-int _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type);
+callui_result_e _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type);
 
 /**
  * @brief Auto change view
@@ -84,7 +93,7 @@ int _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type);
  *
  * @return result CALLUI_RESULT_OK on success
  */
-int _callui_vm_auto_change_view(callui_vm_h vm);
+callui_result_e _callui_vm_auto_change_view(callui_vm_h vm);
 
 /**
  * @brief Get top view type
index 43c7861..39750e8 100644 (file)
 
 typedef struct _callui_qp_mc *callui_qp_mc_h;
 
+typedef struct appdata callui_app_data_t;
+
 callui_qp_mc_h _callui_qp_mc_create(callui_app_data_t *ad);
 
 void _callui_qp_mc_destroy(callui_qp_mc_h qp);
 
-void _callui_qp_mc_update_mute_status(callui_qp_mc_h qp, Eina_Bool is_disable);
-
-void _callui_qp_mc_update_speaker_status(callui_qp_mc_h qp, Eina_Bool is_disable);
-
-void _callui_qp_mc_update_calltime_status(callui_qp_mc_h qp, char *call_timer);
-
-void _callui_qp_mc_update(callui_qp_mc_h qp);
-
 #endif /*__UI_VIEW_QUICKPANEL_H_*/
index d7df07b..eb7d3ae 100755 (executable)
 #ifndef __CALLUI_H_
 #define __CALLUI_H_
 
-#include <efl_extension.h>
-#include <call-manager.h>
-#include <call-manager-extension.h>
+#include <Elementary.h>
 
 #include "callui-view-manager.h"
 #include "callui-lock-manager.h"
-#include "callui-debug.h"
 #include "callui-keypad.h"
-
-#define ACTIVE_NOTIFICATION_AVAILABLE 1
-
-#ifndef CALLUI_EXPORT_API
-#define CALLUI_EXPORT_API __attribute__ ((visibility("default")))
-#endif
-
-#define MSG_PKG                "org.tizen.message"
-
-#define PACKAGE                "org.tizen.call-ui"
-
-#define EDJ_NAME       _callui_common_get_call_edj_path()
-#define CALL_THEME     _callui_common_get_call_theme_path()
-
-#ifndef _EDJ
-#define _EDJ(obj) elm_layout_edje_get(obj)
-#endif
-
-#define CALLUI_TEXT_DOMAIN "call-ui"
-
-#undef _
-#define _(s) dgettext(CALLUI_TEXT_DOMAIN, s)
-
-#define GRP_MAIN_LY "main_ly"
-#define GRP_KEYPAD "keypad"
-#define GRP_MULTICALL "multicall-list"
-#define GRP_REJECT_MSG "reject_with_msg"
-#define GRP_QUICKPANEL "quickpanel"
-#define GRP_SEPARATOR_LAYOUT "separator-layout"
-#define GRP_SEPARATOR_LAYOUT_1BUTTON "separator-layout-1button"
-#define GRP_SEPARATOR_LAYOUT_2BUTTON "separator-layout-2button"
-#define GRP_BUTTON_LAYOUT "button-layout"
-#define APP_CONTROL_OPERATION_DURING_CALL "http://tizen.org/appcontrol/oparation/during_call"
-#define APP_CONTROL_OPERATION_MESSAGE_REJECT "http://tizen.org/appcontrol/operation/message_reject"
-#define APP_CONTROL_OPERATION_END_CALL "http://tizen.org/appcontrol/operation/end_call"
-#define GRP_CALLER_INFO "caller-info"
-#define GRP_MANAGE_CALLS "manage-calls"
-#define GRP_LOCK_ACCEPT "lock_accept"
-#define GRP_LOCK_REJECT "lock_reject"
-#define GRP_LOCK_REJECT_WITH_MSG "lock_reject_with_msg"
-#define GRP_DIMMING_LAYOUT "dimming_ly"
-#define GRP_ENDCALL_MAIN_LAYOUT "main_end_call"
-#define GRP_ENDCALL_CALL_BACK_BTN "call_back"
-#define GRP_ENDCALL_MSG_BTN "message_button"
-#define GRP_ENDCALL_CREATE_CONT_BTN "create_contact_button"
-
-#define         CALLUI_DISPLAY_NAME_LENGTH_MAX                 (255+1)                 /**< Voiecall Display Name Max Length  */
-#define         CALLUI_IMAGE_PATH_LENGTH_MAX                   (255+1)                 /**< Max File length for image */
-#define         CALLUI_RINGTONE_PATH_LENGTH_MAX                (255+1)                 /**< Max File length for Ringtone */
-#define         CALLUI_VIB_PATH_LENGTH_MAX                             (255+1)                 /**< Max File length for Vibration */
-#define         CALLUI_DATA_LENGTH_MAX                                 (255+1)                 /**< Max data length for misc */
-#define         CALLUI_PHONE_NUMBER_LENGTH_MAX                 (82+1)                  /**< Maximum length of a phone number  */
-#define         CALLUI_FORMATTED_NUMBER_LENGTH_MAX             (164+1)                 /**< Maximum length of a phone number  */
-#define         CALLUI_PHONE_DISP_NUMBER_LENGTH_MAX    (82+10+1)               /**< Maximum length of a display phone number  */
-#define         CALLUI_PHONE_NAME_LENGTH_MAX                   (80+1)                  /**< Maximum length of a calling name  */
-#define         CALLUI_PHONE_SUBADDRESS_LENGTH_MAX             (40+1)                  /**< Maximum length of a SUB address  */
-#define         CALLUI_PHONE_USSD_LENGTH_MAX                   (182+1)                 /**< Maximum length of a phone number  */
-#define         CALLUI_MAX_CALL_GROUP_MEMBER                   5                               /**< Maximum number of members in a group */
-#define         CALLUI_MAX_CALL_MEMBER                                 8                               /**< This is the maximum number of members possible */
-#define         CALLUI_INVALID_CALL_ID                                 0                               /**< This is the invalid entry for call ID */
-
-#define NO_HANDLE 0
-
-//typedef struct appdata callui_app_data_t;
-typedef struct _call_contact_data_t {
-       gint person_id;                 /**< Contact index of the Caller */
-       char call_disp_name[CALLUI_DISPLAY_NAME_LENGTH_MAX];                    /**< Caller display name */
-       char caller_id_path[CALLUI_IMAGE_PATH_LENGTH_MAX];                              /**< Caller image path */
-} call_contact_data_t;
-
-typedef struct _call_data_t {
-       unsigned int call_id;
-       cm_call_direction_e call_direction;
-       char call_num[CALLUI_PHONE_NUMBER_LENGTH_MAX];
-       char call_disp_num[CALLUI_PHONE_DISP_NUMBER_LENGTH_MAX];                /**< Caller display number */
-       long start_time;
-       cm_call_type_e call_type;                                       /**< Specifies type of call (voice, data, emergency) */
-       cm_call_state_e call_state;                                     /**< Current Call state */
-       int member_count;                                               /**< Whether Call is in Conference or not and indicate the number of members in that conference*/
-       gboolean is_emergency;                                          /**< is emergency*/
-       cm_call_domain_e call_domain;                           /**< Current Call domain */
-       call_contact_data_t call_ct_info;       /**< Contact information */
-}call_data_t;
-
-typedef struct _callui_qp_mc *callui_qp_mc_h;
+#include "callui-manager.h"
+#include "callui-view-quickpanel.h"
 
 struct appdata {
        Evas_Object *win;
        Evas_Object *win_conformant;
        Evas_Object *nf;
-
-       /* Main Layout contents Start */
        Evas_Object *main_ly;
-       /* Main Layout contents End */
+
        callui_qp_mc_h qp_minicontrol;
 
        Evas_Object *ctxpopup;
        Evas_Object *second_call_popup;
        Evas_Object *bt_popup;
 
-       callui_vm_h view_manager_handle;
+       callui_vm_h view_manager;
 
        bool multi_call_list_end_clicked;
 
@@ -137,41 +49,23 @@ struct appdata {
        int root_w;     /**<Width of a root window */
        int root_h;     /**<Height of a root window */
 
-       Eina_Bool speaker_status;
-       Eina_Bool extra_volume_status;
-       Eina_Bool extra_volume_status_force_stop;
-       Eina_Bool headset_status;
-       Eina_Bool earphone_status;
-       Eina_Bool mute_status;
-       Eina_Bool b_earset_key_longpress;
-
-       cm_client_h cm_handle;          /**<Call manager client handle */
-       cm_multi_sim_slot_type_e sim_slot;
-
-       /*call list*/
-       call_data_t *incom;
-       call_data_t *active;
-       call_data_t *held;
-
-       bool incoming_noti;
-
        bool waiting_dialing;
 
        /*Call duration*/
        Ecore_Timer *blink_timer;
        Ecore_Timer *ending_timer;
-       Ecore_Timer *duration_timer;
+
        int blink_cnt;
-       int current_sec;
-       int current_min;
-       int current_hour;
 
        Ecore_Event_Handler *downkey_handler;
        Ecore_Event_Handler *upkey_handler;
        Ecore_Timer *earset_key_longpress_timer;
 
-
        callui_keypad_h keypad;
+
+       callui_manager_h call_manager;
+       callui_state_provider_h state_provider;
+       callui_sound_manager_h sound_manager;
 };
 
 callui_app_data_t *_callui_get_app_data();
index c8cf17e..83d9edb 100755 (executable)
@@ -35,6 +35,7 @@
 #include <Ecore_Wayland.h>
 
 #include "callui-common.h"
+#include "callui-debug.h"
 #include "callui-view-elements.h"
 #include "callui.h"
 #include "callui-view-dialing.h"
@@ -46,6 +47,8 @@
 #include "callui-view-multi-call-conf.h"
 #include "callui-view-quickpanel.h"
 #include "callui-view-caller-info-defines.h"
+#include "callui-sound-manager.h"
+#include "callui-state-provider.h"
 
 #define CONTACT_PKG                    "org.tizen.contacts"
 #define PHONE_PKG                      "org.tizen.phone"
@@ -73,66 +76,6 @@ struct dbus_byte {
        int size;
 };
 
-static Eina_Bool __callui_common_duration_timer_cb(void *data)
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-       CALLUI_RETURN_VALUE_IF_FAIL(ad, ECORE_CALLBACK_CANCEL);
-
-       if ((ad->active) && (ad->incom == NULL) && (ad->active->call_state != CM_CALL_STATE_DIALING)) {
-               if (ad->held) {
-                       _callui_common_update_call_duration(ad->held->start_time);
-               } else {
-                       _callui_common_update_call_duration(ad->active->start_time);
-               }
-       }
-       return ECORE_CALLBACK_RENEW;
-}
-
-void _callui_common_set_call_duration(char *time_dur)
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-       CALLUI_RETURN_IF_FAIL(ad);
-       Evas_Object *layout = NULL;
-       layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content");
-       CALLUI_RETURN_IF_FAIL(layout);
-       if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_MULTICALL_SPLIT) {
-               Evas_Object *one_hold_layout = elm_object_part_content_get(layout, PART_SWALLOW_CALL_INFO);
-               Evas_Object *active_layout = elm_object_part_content_get(one_hold_layout, PART_SWALLOW_ACTIVE_INFO);
-               elm_object_part_text_set(active_layout, PART_TEXT_STATUS, time_dur);
-       } else {
-               edje_object_part_text_set(_EDJ(layout), "call_txt_status", _(time_dur));
-       }
-
-       if (ad->qp_minicontrol) {
-               _callui_qp_mc_update_calltime_status(ad->qp_minicontrol, time_dur);
-       }
-}
-
-void _callui_common_update_call_duration(long starttime)
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-       long curr_time = 0;
-       struct tm loctime;
-       long call_time;
-
-       curr_time = _callui_common_get_uptime();
-       call_time = curr_time - starttime;
-       gmtime_r((const time_t *)&call_time, &loctime);
-
-       ad->current_sec = loctime.tm_sec;
-       ad->current_min = loctime.tm_min;
-       ad->current_hour = loctime.tm_hour;
-
-       char dur[TIME_BUF_LEN];
-       if (ad->current_hour > 0) {
-               snprintf(dur, TIME_BUF_LEN, "%02d:%02d:%02d", ad->current_hour, ad->current_min, ad->current_sec);
-       } else {
-               snprintf(dur, TIME_BUF_LEN, "%02d:%02d", ad->current_min, ad->current_sec);
-       }
-
-       _callui_common_set_call_duration(dur);
-}
-
 Eina_Bool _callui_common_is_earjack_connected(void)
 {
        int result = EINA_FALSE;
@@ -151,33 +94,6 @@ Eina_Bool _callui_common_is_earjack_connected(void)
        return result;
 }
 
-void _callui_common_create_duration_timer()
-{
-       dbg("_callui_common_create_duration_timer..");
-       callui_app_data_t *ad = _callui_get_app_data();
-
-       if (ad->duration_timer) {
-               ecore_timer_del(ad->duration_timer);
-               ad->duration_timer = NULL;
-       }
-       CALLUI_RETURN_IF_FAIL(ad->active);
-
-       _callui_common_update_call_duration(ad->active->start_time);
-       ad->duration_timer = ecore_timer_add(1.0, __callui_common_duration_timer_cb, NULL);
-       if (ad->duration_timer == NULL) {
-               err("ecore_timer_add returned NULL");
-       }
-}
-
-void _callui_common_delete_duration_timer()
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-       if (ad->duration_timer) {
-               ecore_timer_del(ad->duration_timer);
-               ad->duration_timer = NULL;
-       }
-}
-
 static Eina_Bool __callui_common_ending_timer_expired_cb(void *data)
 {
        dbg("__callui_common_ending_timer_expired_cb");
@@ -205,10 +121,7 @@ static Eina_Bool __callui_common_ending_timer_blink_cb(void *data)
        ad->blink_cnt++;
        if (ad->blink_cnt == 5) {
                /* Run a timer of 2secs for destroying the end selection menu */
-               if (ad->ending_timer) {
-                       ecore_timer_del(ad->ending_timer);
-                       ad->ending_timer = NULL;
-               }
+               DELETE_ECORE_TIMER(ad->ending_timer);
                ad->ending_timer = ecore_timer_add(2, __callui_common_ending_timer_expired_cb, ad);
 
                ad->blink_timer = NULL;
@@ -223,10 +136,7 @@ void _callui_common_create_ending_timer(void *appdata)
        callui_app_data_t *ad = (callui_app_data_t *)appdata;
 
        ad->blink_cnt = 0;
-       if (ad->blink_timer) {
-               ecore_timer_del(ad->blink_timer);
-               ad->blink_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(ad->blink_timer);
        ad->blink_timer = ecore_timer_add(0.5, __callui_common_ending_timer_blink_cb, ad);
 }
 
@@ -235,35 +145,10 @@ void _callui_common_delete_ending_timer(void *appdata)
        CALLUI_RETURN_IF_FAIL(appdata);
        callui_app_data_t *ad = (callui_app_data_t *)appdata;
 
-       if (ad->ending_timer) {
-               ecore_timer_del(ad->ending_timer);
-               ad->ending_timer = NULL;
-       }
-
-       if (ad->blink_timer) {
-               ecore_timer_del(ad->blink_timer);
-               ad->blink_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(ad->ending_timer);
+       DELETE_ECORE_TIMER(ad->blink_timer);
 }
 
-char *_callui_common_get_sim_name(void *appdata)
-{
-       CALLUI_RETURN_VALUE_IF_FAIL(appdata, NULL);
-       callui_app_data_t *ad = (callui_app_data_t *)appdata;
-
-       char *sim_name = NULL;
-       if (ad->sim_slot == CM_SIM_SLOT_1_E) {
-               sim_name = vconf_get_str(VCONFKEY_SETAPPL_SIM1_NAME);
-       } else if (ad->sim_slot == CM_SIM_SLOT_2_E) {
-               sim_name = vconf_get_str(VCONFKEY_SETAPPL_SIM2_NAME);
-       } else {
-               err("Invalid option for sim slot reached !!!");
-       }
-       info("sim name is :  %s ", sim_name);
-       return sim_name;
-}
-
-
 static bool __callui_common_bt_device_connected_profile(bt_profile_e profile, void *user_data)
 {
        dbg("..");
@@ -286,10 +171,12 @@ static bool __callui_common_bt_adapter_bonded_device_cb(bt_device_info_s *device
 }
 
 
-Eina_Bool _callui_common_is_headset_conected(void)
+Eina_Bool _callui_common_is_headset_conected(void *appdata)
 {
+       CALLUI_RETURN_VALUE_IF_FAIL(appdata, EINA_FALSE);
+
+       callui_app_data_t *ad = (callui_app_data_t *)appdata;
        g_is_headset_connected = false;
-       callui_app_data_t *ad  = _callui_get_app_data();
        bt_adapter_foreach_bonded_device(__callui_common_bt_adapter_bonded_device_cb, ad);
 
        return g_is_headset_connected;
@@ -333,16 +220,6 @@ int _callui_common_unlock_swipe_lock(void)
        return 0;
 }
 
-long _callui_common_get_uptime(void)
-{
-       struct sysinfo info;
-
-       if (sysinfo(&info) == 0) {
-               return info.uptime;
-       }
-       return 0;
-}
-
 void _callui_common_win_set_noti_type(void *appdata, int bwin_noti)
 {
        dbg("_callui_common_win_set_noti_type START");
@@ -365,64 +242,6 @@ void _callui_common_win_set_noti_type(void *appdata, int bwin_noti)
        return;
 }
 
-void _callui_common_get_contact_info(int person_id, call_contact_data_t *ct_info)
-{
-       dbg("_callui_common_get_contact_info");
-       contacts_error_e err = CONTACTS_ERROR_NONE;
-       contacts_record_h person_record = NULL;
-
-       if (person_id == -1) {
-               err("Invalid contact index!!!");
-               return;
-       }
-
-       if (ct_info == NULL) {
-               err("Empty contact info!!!");
-               return;
-       }
-
-       err = contacts_connect();
-       if (CONTACTS_ERROR_NONE != err) {
-               err("contacts_connect is error : %d", err);
-               return;
-       }
-
-       ct_info->person_id = person_id;
-       err = contacts_db_get_record(_contacts_person._uri, person_id, &person_record);
-       if (CONTACTS_ERROR_NONE != err) {
-               err("contacts_db_get_record error %d", err);
-       } else {
-               char *name = NULL;
-               char *img_path = NULL;
-
-               /* Get display name */
-               err = contacts_record_get_str(person_record, _contacts_person.display_name, &name);
-               if (CONTACTS_ERROR_NONE != err) {
-                       err("contacts_record_get_str(display name) error %d", err);
-               } else {
-                       g_strlcpy(ct_info->call_disp_name, name, CALLUI_DISPLAY_NAME_LENGTH_MAX);
-                       free(name);
-               }
-
-               /* Get caller id path */
-               err = contacts_record_get_str(person_record, _contacts_person.image_thumbnail_path, &img_path);
-               if (CONTACTS_ERROR_NONE != err) {
-                       err("contacts_record_get_str(caller id path) error %d", err);
-               } else {
-                       g_strlcpy(ct_info->caller_id_path, img_path, CALLUI_IMAGE_PATH_LENGTH_MAX);
-                       free(img_path);
-               }
-               contacts_record_destroy(person_record, TRUE);
-       }
-
-       dbg("contact index:[%d]", ct_info->person_id);
-       dbg("display name:[%s]", ct_info->call_disp_name);
-       dbg("img path:[%s]", ct_info->caller_id_path);
-
-       contacts_disconnect();
-       return;
-}
-
 void _callui_common_launch_contacts(void *appdata)
 {
        dbg("..");
@@ -521,7 +340,7 @@ void _callui_common_launch_dialer(void *appdata)
        return;
 }
 
-void _callui_common_launch_msg_composer(void *appdata, char *number)
+void _callui_common_launch_msg_composer(void *appdata, const char *number)
 {
        dbg("..");
 
@@ -815,21 +634,23 @@ void _callui_common_reset_main_ly_text_fields(Evas_Object *contents)
        }
 }
 
-gboolean _callui_common_is_extra_volume_available(void)
+bool _callui_common_is_extra_volume_available(void *data)
 {
-       callui_app_data_t *ad = _callui_get_app_data();
-       CALLUI_RETURN_VALUE_IF_FAIL(ad, EINA_TRUE);
-       cm_audio_state_type_e snd_path = CM_AUDIO_STATE_NONE_E;
+       CALLUI_RETURN_VALUE_IF_FAIL(data, true);
+
+       callui_app_data_t *ad = (callui_app_data_t*)data;
+
+       callui_audio_state_type_e audio_state =
+                       _callui_sdm_get_audio_state(ad->sound_manager);
 
-       cm_get_audio_state(ad->cm_handle, &snd_path);
-       dbg("sound path : %d", snd_path);
+       dbg("sound path : %d", audio_state);
 
-       if ((snd_path == CM_AUDIO_STATE_BT_E)
-               || ((snd_path == CM_AUDIO_STATE_EARJACK_E)
+       if ((audio_state == CALLUI_AUDIO_STATE_BT)
+               || ((audio_state == CALLUI_AUDIO_STATE_EARJACK)
                                && (_callui_common_is_earjack_connected() == EINA_TRUE))) {
-               return EINA_FALSE;
+               return false;
        } else {
-               return EINA_TRUE;
+               return true;
        }
 }
 
@@ -872,7 +693,7 @@ static void __callui_common_lock_state_cb (system_settings_key_e key, void *user
        }
 }
 
-void _callui_common_set_lock_state_changed_cb()
+void _callui_common_set_lock_state_changed_cb(void *user_data)
 {
        system_settings_set_changed_cb(SYSTEM_SETTINGS_KEY_LOCK_STATE, __callui_common_lock_state_cb, NULL);
 }
@@ -1031,9 +852,10 @@ int _callui_common_send_reject_msg(void *appdata, char *reject_msg)
 
        int res = CALLUI_RESULT_FAIL;
        callui_app_data_t *ad = (callui_app_data_t *)appdata;
-       call_data_t *call_data = ad->incom;
 
-       CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
+       const callui_call_state_data_t *incom = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+
+       CALLUI_RETURN_VALUE_IF_FAIL(incom, CALLUI_RESULT_FAIL);
 
        if (strlen(reject_msg) == 0) {
                err("Is not reject with message case");
@@ -1061,7 +883,8 @@ int _callui_common_send_reject_msg(void *appdata, char *reject_msg)
        /* Set message type to SMS reject*/
        msg_set_int_value(msgInfo, MSG_MESSAGE_TYPE_INT, MSG_TYPE_SMS_REJECT);
 
-       int slot_id = ad->sim_slot;
+       // TODO: Need functionality
+       int slot_id = 1;
        dbg("msg_sms_send_message() Sim slot [%d]", slot_id);
        if (slot_id != -1) {
                slot_id++;
@@ -1079,7 +902,7 @@ int _callui_common_send_reject_msg(void *appdata, char *reject_msg)
                msg_struct_list_s *addr_list;
                msg_get_list_handle(msgInfo, MSG_MESSAGE_ADDR_LIST_STRUCT, (void **)&addr_list);
                msg_struct_t addr_info = addr_list->msg_struct_info[0];
-               char *call_number = call_data->call_num;
+               const char *call_number = incom->call_num;
 
                /* Set message address */
                msg_set_int_value(addr_info, MSG_ADDRESS_INFO_RECIPIENT_TYPE_INT, MSG_RECIPIENTS_TYPE_TO);
@@ -1110,7 +933,10 @@ int _callui_common_send_reject_msg(void *appdata, char *reject_msg)
 bool _callui_is_on_handsfree_mode()
 {
        callui_app_data_t *ad = _callui_get_app_data();
-       return (ad->speaker_status || ad->headset_status || ad->earphone_status);
+       //return (ad->speaker_status || ad->headset_status || ad->earphone_status);
+
+       callui_audio_state_type_e type = _callui_sdm_get_audio_state(ad->sound_manager);
+       return (type != CALLUI_AUDIO_STATE_RECEIVER && type != CALLUI_AUDIO_STATE_NONE);
 }
 
 bool _callui_is_on_background()
@@ -1118,3 +944,41 @@ bool _callui_is_on_background()
        callui_app_data_t *ad = _callui_get_app_data();
        return ad->on_background;
 }
+
+void _callui_common_set_call_duration_time(struct tm *cur_time,
+               Evas_Object *obj,
+               const char *part)
+{
+       CALLUI_RETURN_IF_FAIL(cur_time);
+       CALLUI_RETURN_IF_FAIL(obj);
+       CALLUI_RETURN_IF_FAIL(part);
+
+       char dur[TIME_BUF_LEN];
+       if (cur_time->tm_hour > 0) {
+               snprintf(dur, TIME_BUF_LEN, "%02d:%02d:%02d", cur_time->tm_hour, cur_time->tm_min, cur_time->tm_sec);
+       } else {
+               snprintf(dur, TIME_BUF_LEN, "%02d:%02d", cur_time->tm_min, cur_time->tm_sec);
+       }
+       elm_object_part_text_set(obj, part, _(dur));
+}
+
+void _callui_common_try_update_call_duration_time(
+               struct tm *cur_time,
+               struct tm *comp_time,
+               set_call_duration_time func,
+               Evas_Object *obj,
+               const char *part)
+{
+       CALLUI_RETURN_IF_FAIL(cur_time);
+       CALLUI_RETURN_IF_FAIL(comp_time);
+       CALLUI_RETURN_IF_FAIL(func);
+       CALLUI_RETURN_IF_FAIL(obj);
+       CALLUI_RETURN_IF_FAIL(part);
+
+       int sec_diff = comp_time->tm_sec - cur_time->tm_sec;
+
+       if (sec_diff != 0) {
+               memcpy(cur_time, comp_time, sizeof(struct tm));
+               func(cur_time, obj, part);
+       }
+}
index cb92a1b..6650537 100755 (executable)
  *
  */
 
+#include <linux/limits.h>
+#include <efl_extension.h>
+
 #include "callui.h"
+#include "callui-debug.h"
 #include "callui-keypad.h"
 #include "callui-common.h"
 #include "callui-view-elements.h"
 #include "callui-view-layout.h"
 #include "callui-view-caller-info-defines.h"
+#include "callui-sound-manager.h"
 
 #define VC_KEYPAD_ENTRY_FONT "<font='Samsung Sans Num47:style=Light'>%s</>"
 #define VC_KEYAD_ENTRY_STYLE "DEFAULT='align=center color=#ffffffff font_size=76'"
@@ -86,18 +91,14 @@ int __callui_keypad_init(callui_keypad_h keypad, Evas_Object *parent, callui_app
        res = __create_entry(keypad);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
-       elm_object_part_content_set(keypad->ad->main_ly,
-                       PART_SWALLOW_KEYPAD_LAYOUT_AREA,
-                       keypad->main_layout);
+       evas_object_hide(keypad->main_layout);
 
        return res;
 }
 
 void __callui_keypad_deinit(callui_keypad_h keypad)
 {
-       if (keypad->anim_timer) {
-               ecore_timer_del(keypad->anim_timer);
-       }
+       DELETE_ECORE_TIMER(keypad->anim_timer);
 
        if (keypad->main_layout) {
                evas_object_del(keypad->btns_layout);
@@ -204,7 +205,7 @@ static int __create_gesture_layer(callui_keypad_h keypad)
        Evas_Object *sweep_area = _callui_edje_object_part_get(keypad->btns_layout, "sweep_area");
 
        keypad->gesture_layer = elm_gesture_layer_add(keypad->btns_layout);
-       if (FALSE == elm_gesture_layer_attach(keypad->gesture_layer, sweep_area)) {
+       if (!elm_gesture_layer_attach(keypad->gesture_layer, sweep_area)) {
                err("elm_gesture_layer_attach failed !!");
                DELETE_EVAS_OBJECT(keypad->gesture_layer);
                return CALLUI_RESULT_ALLOCATION_FAIL;
@@ -245,10 +246,12 @@ static void __on_hide_completed(void *data, Evas_Object *obj, const char *emissi
 
        eext_object_event_callback_del(keypad->parent, EEXT_CALLBACK_BACK,      __back_button_click_cb);
 
-       if (keypad->anim_timer) {
-               ecore_timer_del(keypad->anim_timer);
-               keypad->anim_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(keypad->anim_timer);
+
+       keypad->main_layout = elm_object_part_content_unset(keypad->ad->main_ly,
+                       PART_SWALLOW_KEYPAD_LAYOUT_AREA);
+
+       evas_object_hide(keypad->main_layout);
 
        if (keypad->cb_func) {
                keypad->cb_func(keypad->cb_data, keypad->is_keypad_show);
@@ -265,7 +268,6 @@ static void __on_key_down_click_event(void *data, Evas_Object *obj, const char *
 
        char *entry_dest = NULL;
        char *keypad_source = NULL;
-       char *entry_str = NULL;
        char *disp_str = NULL;
 
        if (strcmp(source, "star") == 0) {
@@ -276,7 +278,11 @@ static void __on_key_down_click_event(void *data, Evas_Object *obj, const char *
                keypad_source = (char *)source;
        }
 
-       cm_start_dtmf(ad->cm_handle, keypad_source[0]);
+       callui_result_e res = _callui_sdm_start_dtmf(ad->sound_manager, keypad_source[0]);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_sdm_start_dtmf() failed. res[%d]", res);
+               return;
+       }
 
        const char *text = elm_entry_entry_get(keypad->entry);
        disp_str = elm_entry_markup_to_utf8(text);
@@ -305,11 +311,11 @@ static void __on_key_down_click_event(void *data, Evas_Object *obj, const char *
 
        free(disp_str);
 
-       entry_str = g_strdup_printf(VC_KEYPAD_ENTRY_FONT, entry_dest);
-       if (entry_str) {
-               elm_object_text_set(keypad->entry, entry_str);
-               g_free(entry_str);
-       }
+       char tmp[NAME_MAX] = { 0 };
+       snprintf(tmp, NAME_MAX, VC_KEYPAD_ENTRY_FONT, entry_dest);
+
+       elm_object_text_set(keypad->entry, tmp);
+
        elm_entry_cursor_end_set(keypad->entry);
 
        if (entry_dest) {
@@ -324,7 +330,10 @@ static void __on_key_up_click_event(void *data, Evas_Object *obj, const char *em
 
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       cm_stop_dtmf(ad->cm_handle);
+       callui_result_e res = _callui_sdm_stop_dtmf(ad->sound_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_sdm_stop_dtmf() failed. res[%d]", res);
+       }
 }
 
 static Evas_Object *__create_single_line_scrolled_entry(Evas_Object *content)
@@ -398,6 +407,9 @@ void _callui_keypad_show(callui_keypad_h keypad)
        CALLUI_RETURN_IF_FAIL(keypad);
        callui_app_data_t *ad = keypad->ad;
 
+       elm_object_part_content_set(keypad->ad->main_ly, PART_SWALLOW_KEYPAD_LAYOUT_AREA, keypad->main_layout);
+       evas_object_show(keypad->main_layout);
+
        elm_object_signal_emit(keypad->btns_layout, "SHOW", "KEYPADBTN");
 
        elm_object_signal_emit(keypad->btns_layout, "init", "down_arrow");
@@ -456,8 +468,6 @@ void _callui_keypad_hide_immediately(callui_keypad_h keypad)
 void _callui_keypad_show_status_change_callback_set(callui_keypad_h keypad, show_state_change_cd cb_func, void *cb_data)
 {
        CALLUI_RETURN_IF_FAIL(keypad);
-       CALLUI_RETURN_IF_FAIL(cb_func);
-       CALLUI_RETURN_IF_FAIL(cb_data);
 
        keypad->cb_func = cb_func;
        keypad->cb_data = cb_data;
index 077fcc2..eef722b 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include "callui-lock-manager.h"
+#include "callui-debug.h"
 #include "callui-proximity-lock-manager.h"
 #include "callui-view-lock-screen.h"
 #include "callui-common.h"
index fb08836..9207213 100644 (file)
@@ -19,6 +19,7 @@
 #include <call-manager-extension.h>
 
 #include "callui-manager.h"
+#include "callui-debug.h"
 #include "callui-common.h"
 #include "callui-sound-manager-priv.h"
 #include "callui-state-provider-priv.h"
@@ -152,7 +153,6 @@ callui_result_e _callui_manager_dial_voice_call(callui_manager_h cm_handler, con
 callui_result_e _callui_manager_end_call(callui_manager_h cm_handler, unsigned int call_id, callui_call_release_type_e release_type)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(cm_handler, CALLUI_RESULT_INVALID_PARAM);
-       CALLUI_RETURN_VALUE_IF_FAIL(call_id <= 0, CALLUI_RESULT_INVALID_PARAM);
 
        return _callui_utils_convert_cm_res(
                        cm_end_call(cm_handler->cm_handler, call_id, __convert_app_release_type(release_type)));
@@ -198,10 +198,17 @@ callui_result_e _callui_manager_reject_call(callui_manager_h cm_handler)
                        cm_reject_call(cm_handler->cm_handler));
 }
 
+callui_result_e _callui_manager_stop_alert(callui_manager_h cm_handler)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(cm_handler, CALLUI_RESULT_INVALID_PARAM);
+
+       return _callui_utils_convert_cm_res(
+                       cm_stop_alert(cm_handler->cm_handler));
+}
+
 callui_result_e _callui_manager_split_call(callui_manager_h cm_handler, unsigned int call_id)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(cm_handler, CALLUI_RESULT_INVALID_PARAM);
-       CALLUI_RETURN_VALUE_IF_FAIL(call_id <= 0, CALLUI_RESULT_INVALID_PARAM);
 
        return _callui_utils_convert_cm_res(
                        cm_split_call(cm_handler->cm_handler, call_id));
index ac268d5..80f6731 100644 (file)
@@ -18,6 +18,7 @@
 #include <sensor.h>
 
 #include "callui-proximity-lock-manager.h"
+#include "callui-debug.h"
 #include "callui-common.h"
 
 #define SENSOR_INTERVAL 100
index b78cafa..a6437d6 100644 (file)
@@ -36,6 +36,8 @@ struct __callui_state_provider {
 
        callui_call_state_data_t *st_data_list[CALLUI_CALL_DATA_TYPE_MAX];
 
+       callui_call_state_data_t *last_ended_call_data;
+
        _callui_listeners_coll_t call_state_lc;
        _callui_listeners_coll_t last_call_end_lc;
 };
@@ -48,16 +50,20 @@ static void __get_contact_info_from_contact_srv(callui_contact_data_t *ct_info);
 static callui_result_e __convert_cm_call_event_type(cm_call_event_e cm_call_event, callui_call_event_type_e *call_event_type);
 static callui_sim_slot_type_e __convert_cm_sim_type(cm_multi_sim_slot_type_e cm_sim_type);
 static void __free_call_event_data(callui_state_provider_h stp);
-static callui_call_state_data_t *__call_data_create(cm_call_data_t* cm_call_data);
-static callui_result_e __call_data_init(callui_call_state_data_t *callui_call_data, cm_call_data_t* cm_call_data);
-static callui_result_e __update_stp_call_data(callui_call_state_data_t **stp_call_data, cm_call_data_t* cm_call_data);
+static callui_call_state_data_t *__call_data_create(callui_call_data_type_e call_type,
+               cm_call_data_t* cm_call_data);
+static callui_result_e __call_data_init(callui_call_state_data_t *callui_call_data,
+               callui_call_data_type_e call_type,
+               cm_call_data_t* cm_call_data);
+static callui_result_e __update_stp_call_data(callui_state_provider_h stp,
+               callui_call_data_type_e call_type,
+               cm_call_data_t* cm_call_data);
 static callui_result_e __update_stp_all_call_data(callui_state_provider_h stp,
                cm_call_data_t *cm_incom,
                cm_call_data_t *cm_active,
                cm_call_data_t *cm_held);
 static void __call_event_cb(cm_call_event_e call_event, cm_call_event_data_t *call_state_data, void *user_data);
 static void __call_state_event_handler_func(_callui_listener_t *listener, va_list args);
-static void __last_call_end_handler_func(_callui_listener_t *listener, va_list args);
 static void __list_free_cb(gpointer data);
 static callui_result_e __conf_call_data_init(callui_conf_call_data_t *conf_call_data, cm_conf_call_data_t *cm_conf_data);
 static callui_conf_call_data_t * __conf_call_data_create(cm_conf_call_data_t *cm_conf_data);
@@ -171,12 +177,12 @@ static void __free_call_event_data(callui_state_provider_h stp)
        }
 }
 
-static callui_call_state_data_t *__call_data_create(cm_call_data_t* cm_call_data)
+static callui_call_state_data_t *__call_data_create(callui_call_data_type_e call_type, cm_call_data_t* cm_call_data)
 {
        callui_call_state_data_t *call_data = calloc(1, sizeof(callui_call_state_data_t));
        CALLUI_RETURN_NULL_IF_FAIL(call_data);
 
-       int res = __call_data_init(call_data, cm_call_data);
+       int res = __call_data_init(call_data, call_type, cm_call_data);
        if (res != CALLUI_RESULT_OK) {
                err("Init call data failed. res[%d]", res);
                FREE(call_data);
@@ -185,8 +191,11 @@ static callui_call_state_data_t *__call_data_create(cm_call_data_t* cm_call_data
 }
 
 static callui_result_e __call_data_init(callui_call_state_data_t *callui_call_data,
+               callui_call_data_type_e call_type,
                cm_call_data_t* cm_call_data)
 {
+       callui_call_data->type = call_type;
+
        callui_call_data->call_id = CALLUI_NO_HANDLE;
        int res = cm_call_data_get_call_id(cm_call_data, &callui_call_data->call_id);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CM_ERROR_NONE, _callui_utils_convert_cm_res(res));
@@ -230,23 +239,27 @@ static callui_result_e __call_data_init(callui_call_state_data_t *callui_call_da
 
        if (strlen(callui_call_data->call_ct_info.caller_id_path) <= 0) {
                snprintf(callui_call_data->call_ct_info.caller_id_path,
+
+
                                CALLUI_IMAGE_PATH_LENGTH_MAX, "%s", CALLUI_DEFAULT_PERSON_ID_TXT);
        }
 
        return CALLUI_RESULT_OK;
 }
 
-static callui_result_e __update_stp_call_data(callui_call_state_data_t **stp_call_data, cm_call_data_t* cm_call_data)
+static callui_result_e __update_stp_call_data(callui_state_provider_h stp,
+               callui_call_data_type_e call_type,
+               cm_call_data_t* cm_call_data)
 {
        if (!cm_call_data) {
-               FREE(*stp_call_data);
+               FREE(stp->st_data_list[call_type]);
                return CALLUI_RESULT_OK;
        }
-       callui_call_state_data_t *tmp_call_data = __call_data_create(cm_call_data);
+       callui_call_state_data_t *tmp_call_data = __call_data_create(call_type, cm_call_data);
        CALLUI_RETURN_VALUE_IF_FAIL(tmp_call_data, CALLUI_RESULT_FAIL);
 
-       free(*stp_call_data);
-       *stp_call_data = tmp_call_data;
+       free(stp->st_data_list[call_type]);
+       stp->st_data_list[call_type] = tmp_call_data;
 
        return CALLUI_RESULT_OK;
 }
@@ -257,15 +270,15 @@ static callui_result_e __update_stp_all_call_data(callui_state_provider_h stp,
                cm_call_data_t *cm_held)
 {
        dbg("Update incoming call data");
-       int res = __update_stp_call_data(&(stp->st_data_list[CALLUI_CALL_DATA_TYPE_INCOMING]), cm_incom);
+       int res = __update_stp_call_data(stp, CALLUI_CALL_DATA_TYPE_INCOMING, cm_incom);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        dbg("Update active call data");
-       res = __update_stp_call_data(&(stp->st_data_list[CALLUI_CALL_DATA_TYPE_ACTIVE]), cm_active);
+       res = __update_stp_call_data(stp, CALLUI_CALL_DATA_TYPE_ACTIVE, cm_active);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        dbg("Update held call data");
-       res = __update_stp_call_data(&(stp->st_data_list[CALLUI_CALL_DATA_TYPE_HELD]), cm_held);
+       res = __update_stp_call_data(stp, CALLUI_CALL_DATA_TYPE_HELD, cm_held);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return res;
@@ -282,7 +295,6 @@ static void __call_event_cb(cm_call_event_e call_event, cm_call_event_data_t *ca
        dbg("Call event changed on [%d]", event_type);
 
        callui_state_provider_h stp = (callui_state_provider_h)user_data;
-       bool is_need_notify_call_event = true;
 
        unsigned int call_id = 0;
        int res = cm_call_event_data_get_call_id(call_state_data, &call_id);
@@ -304,29 +316,22 @@ static void __call_event_cb(cm_call_event_e call_event, cm_call_event_data_t *ca
        res = cm_call_event_data_get_held_call(call_state_data, &cm_held);
        CALLUI_RETURN_IF_FAIL(res == CM_ERROR_NONE);
 
+       FREE(stp->last_ended_call_data);
+
        switch (event_type) {
        case CALLUI_CALL_EVENT_TYPE_END:
-       {
-               callui_call_state_data_t *temp = NULL;
                if (cm_incom == NULL && cm_active == NULL && cm_held == NULL) {
                        if (stp->st_data_list[CALLUI_CALL_DATA_TYPE_ACTIVE]) {
-                               temp = stp->st_data_list[CALLUI_CALL_DATA_TYPE_ACTIVE];
+                               stp->last_ended_call_data = stp->st_data_list[CALLUI_CALL_DATA_TYPE_ACTIVE];
+                               stp->st_data_list[CALLUI_CALL_DATA_TYPE_ACTIVE] = NULL;
                        } else if (stp->st_data_list[CALLUI_CALL_DATA_TYPE_HELD]) {
-                               temp = stp->st_data_list[CALLUI_CALL_DATA_TYPE_HELD];
-                       } else {
-                               return;
+                               stp->last_ended_call_data = stp->st_data_list[CALLUI_CALL_DATA_TYPE_HELD];
+                               stp->st_data_list[CALLUI_CALL_DATA_TYPE_HELD] = NULL;
+                       } else if (stp->st_data_list[CALLUI_CALL_DATA_TYPE_INCOMING]) {
+                               stp->last_ended_call_data = stp->st_data_list[CALLUI_CALL_DATA_TYPE_INCOMING];
+                               stp->st_data_list[CALLUI_CALL_DATA_TYPE_INCOMING] = NULL;
                        }
-                       _callui_listeners_coll_call_listeners(&stp->last_call_end_lc, temp);
-
-                       __update_stp_all_call_data(stp, cm_incom, cm_active, cm_held);
-
-                       is_need_notify_call_event = false;
-
-               } else {
-                       res = __update_stp_all_call_data(stp, cm_incom, cm_active, cm_held);
                }
-       }
-               break;
        case CALLUI_CALL_EVENT_TYPE_ACTIVE:
        case CALLUI_CALL_EVENT_TYPE_INCOMING:
        case CALLUI_CALL_EVENT_TYPE_DIALING:
@@ -341,7 +346,7 @@ static void __call_event_cb(cm_call_event_e call_event, cm_call_event_data_t *ca
                return;
        }
 
-       if (is_need_notify_call_event && res == CALLUI_RESULT_OK) {
+       if (res == CALLUI_RESULT_OK) {
                _callui_listeners_coll_call_listeners(&stp->call_state_lc, event_type, call_id, sim_slot_type);
        }
 }
@@ -384,6 +389,8 @@ static void __callui_stp_deinit(callui_state_provider_h stp)
        _callui_listeners_coll_deinit(&stp->last_call_end_lc);
 
        __free_call_event_data(stp);
+
+       FREE(stp->last_ended_call_data);
 }
 
 callui_state_provider_h _callui_stp_create(cm_client_h cm_client)
@@ -430,12 +437,6 @@ static void __call_state_event_handler_func(_callui_listener_t *listener, va_lis
        ((callui_call_state_event_cb)(listener->cb_func))(listener->cb_data, call_event_type, id, sim_slot);
 }
 
-static void __last_call_end_handler_func(_callui_listener_t *listener, va_list args)
-{
-       callui_call_state_data_t *last_call_data = va_arg(args, callui_call_state_data_t *);
-       ((callui_last_call_end_event_cb)(listener->cb_func))(listener->cb_data, last_call_data);
-}
-
 callui_result_e _callui_stp_add_call_state_event_cb(callui_state_provider_h stp,
                callui_call_state_event_cb cb_func,
                void *cb_data)
@@ -457,27 +458,6 @@ callui_result_e _callui_stp_remove_call_state_event_cb(callui_state_provider_h s
        return _callui_listeners_coll_remove_listener(&stp->call_state_lc, (void *)cb_func, cb_data);
 }
 
-callui_result_e _callui_stp_add_last_call_end_event_cb(callui_state_provider_h stp,
-               callui_last_call_end_event_cb cb_func,
-               void *cb_data)
-{
-       CALLUI_RETURN_VALUE_IF_FAIL(stp, CALLUI_RESULT_INVALID_PARAM);
-       CALLUI_RETURN_VALUE_IF_FAIL(cb_func, CALLUI_RESULT_INVALID_PARAM);
-
-       return _callui_listeners_coll_add_listener(&stp->last_call_end_lc,
-                       __last_call_end_handler_func, cb_func, cb_data);
-}
-
-callui_result_e _callui_stp_remove_last_call_end_event_cb(callui_state_provider_h stp,
-               callui_last_call_end_event_cb cb_func,
-               void *cb_data)
-{
-       CALLUI_RETURN_VALUE_IF_FAIL(stp, CALLUI_RESULT_INVALID_PARAM);
-       CALLUI_RETURN_VALUE_IF_FAIL(cb_func, CALLUI_RESULT_INVALID_PARAM);
-
-       return _callui_listeners_coll_remove_listener(&stp->last_call_end_lc, (void *)cb_func, cb_data);
-}
-
 static void __list_free_cb(gpointer data)
 {
        cm_conf_call_data_t *call_data = (cm_conf_call_data_t *)data;
@@ -542,12 +522,12 @@ Eina_List *_callui_stp_get_conference_call_list(callui_state_provider_h stp)
        CALLUI_RETURN_NULL_IF_FAIL(res == CM_ERROR_NONE);
 
        if (call_list) {
-               int list_len = g_slist_length(call_list);
                res = CALLUI_RESULT_OK;
 
-               int idx = 0;
-               for (; idx < list_len; idx++) {
-                       callui_conf_call_data_t *conf_call_data = __conf_call_data_create(g_slist_nth_data(call_list, idx));
+               GSList *l = call_list;
+               for (; l != NULL; l = g_slist_next(l)) {
+                       callui_conf_call_data_t *conf_call_data =
+                                       __conf_call_data_create((cm_conf_call_data_t*)l->data);
                        if(conf_call_data == NULL) {
                                err("Create conference call data failed.");
                                res = CALLUI_RESULT_ALLOCATION_FAIL;
@@ -597,3 +577,19 @@ struct tm*_callui_stp_get_call_duration(callui_state_provider_h stp,
 
        return time;
 }
+
+const callui_call_state_data_t *_callui_stp_get_last_ended_call_data(callui_state_provider_h stp)
+{
+       CALLUI_RETURN_NULL_IF_FAIL(stp);
+
+       return stp->last_ended_call_data;
+}
+
+bool _callui_stp_is_any_calls_available(callui_state_provider_h stp)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(stp, false);
+
+       return (stp->st_data_list[CALLUI_CALL_DATA_TYPE_INCOMING] ||
+                       stp->st_data_list[CALLUI_CALL_DATA_TYPE_ACTIVE] ||
+                       stp->st_data_list[CALLUI_CALL_DATA_TYPE_HELD]);
+}
index 9e508b8..af2eec1 100644 (file)
  */
 
 #include <app_control.h>
+#include <efl_extension.h>
 
 #include "callui-view-callend.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-view-elements.h"
 #include "callui-common.h"
+#include "callui-manager.h"
+#include "callui-state-provider.h"
 
 #define APP_CONTROL_MIME_CONTACT "application/vnd.tizen.contact"
 #define CONTACT_NUMBER_BUF_LEN 32
@@ -34,11 +38,11 @@ struct _callui_view_callend {
 };
 typedef struct _callui_view_callend _callui_view_callend_t;
 
-static int __callui_view_callend_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_callend_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_callend_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_callend_h vd);
-static int __update_displayed_data(callui_view_callend_h vd);
+static callui_result_e __create_main_content(callui_view_callend_h vd);
+static callui_result_e __update_displayed_data(callui_view_callend_h vd);
 
 static void __call_back_btn_click_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
 
@@ -62,7 +66,7 @@ callui_view_callend_h _callui_view_callend_new()
        return callend_view;
 }
 
-static int __callui_view_callend_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_callend_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -74,14 +78,13 @@ static int __callui_view_callend_oncreate(call_view_data_base_t *view_data, void
 
        _callui_common_win_set_noti_type(vd->base_view.ad, EINA_TRUE);
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return __update_displayed_data(vd);
 }
 
-
-static int __callui_view_callend_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_callend_ondestroy(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
@@ -97,7 +100,7 @@ static int __callui_view_callend_ondestroy(call_view_data_base_t *view_data)
        return CALLUI_RESULT_OK;
 }
 
-static int __create_main_content(callui_view_callend_h vd)
+static callui_result_e __create_main_content(callui_view_callend_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
@@ -108,20 +111,15 @@ static int __create_main_content(callui_view_callend_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static int __update_displayed_data(callui_view_callend_h vd)
+static callui_result_e __update_displayed_data(callui_view_callend_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
-       call_data_t *call_data = NULL;
-       if (ad->active) {
-               call_data = ad->active;
-       } else {
-               call_data = ad->held;
-       }
+       const callui_call_state_data_t *call_data = _callui_stp_get_last_ended_call_data(ad->state_provider);
        CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
 
-       char *file_path = call_data->call_ct_info.caller_id_path;
-       char *call_name = call_data->call_ct_info.call_disp_name;
+       const char *file_path = call_data->call_ct_info.caller_id_path;
+       const char *call_name = call_data->call_ct_info.call_disp_name;
 
        if (call_data->call_disp_num[0] != '\0') {
                strncpy(vd->call_number, call_data->call_disp_num, sizeof(vd->call_number));
@@ -181,14 +179,10 @@ static void __call_back_btn_click_cb(void *data, Evas *evas, Evas_Object *obj, v
 
        _callui_common_delete_ending_timer(vd->base_view.ad);
 
-       vd->base_view.ad->speaker_status = EINA_FALSE;
-       vd->base_view.ad->mute_status = EINA_FALSE;
-       vd->base_view.ad->extra_volume_status = EINA_FALSE;
-
-       cm_dial_call(vd->base_view.ad->cm_handle,
-                       vd->call_number,
-                       CM_CALL_TYPE_VOICE,
-                       vd->base_view.ad->sim_slot);
+       callui_result_e res = _callui_manager_dial_voice_call(vd->base_view.ad->call_manager, vd->call_number, CALLUI_SIM_SLOT_DEFAULT);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_dial_voice_call() failed. res[%d]", res);
+       }
 }
 
 static char *__vcui_endcall_get_item_text(void *data, Evas_Object *obj, const char *part)
index 35ec9b9..d36f329 100755 (executable)
  */
 
 #include "callui-view-circle.h"
+#include "callui-debug.h"
 #include "callui-view-elements.h"
 #include "callui-view-layout.h"
 #include "callui-common.h"
+#include "callui-state-provider.h"
 
 #define CALLUI_CIRCLE_LAYOUT_DATA "VIEW_DATA"
 
@@ -60,13 +62,15 @@ static void __callui_view_circle_handle_accept(callui_app_data_t *ad)
                _callui_common_unlock_swipe_lock();
        }
 
-       if (ad->active == NULL) {
-               dbg("No Call Or Held call - Accept");
+       const callui_call_state_data_t *call_data =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
 
-               int ret = cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_NORMAL);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_answer_call() is failed");
-                       return;
+       if (!call_data) {
+               dbg("No Call Or Held call - Accept");
+               callui_result_e res = _callui_manager_answer_call(ad->call_manager,
+                                               CALLUI_CALL_ANSWER_TYPE_NORMAL);
+               if (res != CALLUI_RESULT_OK) {
+                       err("_callui_manager_answer_call() failed. res[%d]", res);
                }
        } else {
                dbg("Show popup - 2nd MT call - test volume popup");
@@ -76,10 +80,9 @@ static void __callui_view_circle_handle_accept(callui_app_data_t *ad)
 
 static void __callui_view_circle_handle_reject(callui_app_data_t *ad)
 {
-       dbg("..");
-       int ret = cm_reject_call(ad->cm_handle);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_reject_call() is failed");
+       callui_result_e res = _callui_manager_reject_call(ad->call_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_reject_call() failed. res[%d]", res);
        }
 }
 
@@ -122,11 +125,11 @@ static void __callui_view_circle_mouse_down_cb(void *data, Evas *evas, Evas_Obje
 
        if (-1 == accept_touch_num && -1 == reject_touch_num) {
                __callui_view_circle_accept_down(vd, ad, ev->canvas.x, ev->canvas.y);
-               if (TRUE == baccept_clicked) {
+               if (baccept_clicked) {
                        accept_touch_num = 0;
                } else {
                        __callui_view_circle_reject_down(vd, ad, ev->canvas.x, ev->canvas.y);
-                       if (TRUE == breject_clicked)
+                       if (breject_clicked)
                                reject_touch_num = 0;
                }
        }
@@ -144,11 +147,11 @@ static void __callui_view_circle_multi_down_cb(void *data, Evas *evas, Evas_Obje
        dbg("ev->device = %d, accept_touch_num = %d", ev->device, accept_touch_num);
        if (-1 == accept_touch_num && -1 == reject_touch_num) {
                __callui_view_circle_accept_down(vd, ad, ev->canvas.x, ev->canvas.y);
-               if (TRUE == baccept_clicked) {
+               if (baccept_clicked) {
                        accept_touch_num = ev->device;
                } else {
                        __callui_view_circle_reject_down(vd, ad, ev->canvas.x, ev->canvas.y);
-                       if (TRUE == breject_clicked)
+                       if (breject_clicked)
                                reject_touch_num = ev->device;
                }
        }
@@ -340,7 +343,7 @@ static void __callui_view_circle_reject_up(callui_view_incoming_call_h vd, callu
        }
 }
 
-int _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent)
+callui_result_e _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(ad, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(vd, CALLUI_RESULT_INVALID_PARAM);
@@ -349,7 +352,7 @@ int _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_
        Evas_Object *lock_reject = _callui_view_incoming_call_get_reject_layout(vd);
        Evas_Object *inner_circle = NULL;
        Evas_Object *outer_circle = NULL;
-       int res = CALLUI_RESULT_FAIL;
+       callui_result_e res = CALLUI_RESULT_FAIL;
        int x = 0;
        int y = 0;
        int width = 0;
@@ -397,7 +400,7 @@ int _callui_view_circle_create_reject_layout(callui_app_data_t *ad, callui_view_
        return CALLUI_RESULT_OK;
 }
 
-int _callui_view_circle_create_accept_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent)
+callui_result_e _callui_view_circle_create_accept_layout(callui_app_data_t *ad, callui_view_incoming_call_h vd, Evas_Object *parent)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(ad, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(vd, CALLUI_RESULT_INVALID_PARAM);
@@ -406,7 +409,7 @@ int _callui_view_circle_create_accept_layout(callui_app_data_t *ad, callui_view_
        Evas_Object *lock_accept = _callui_view_incoming_call_get_accept_layout(vd);
        Evas_Object *inner_circle = NULL;
        Evas_Object *outer_circle = NULL;
-       int res = CALLUI_RESULT_FAIL;
+       callui_result_e res = CALLUI_RESULT_FAIL;
        int x = 0;
        int y = 0;
        int width = 0;
index b866bdb..5b71f26 100644 (file)
 #include <Elementary.h>
 
 #include "callui-view-dialing.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-view-elements.h"
 #include "callui-keypad.h"
 #include "callui-common.h"
 #include "callui-view-caller-info-defines.h"
+#include "callui-state-provider.h"
 
 struct _callui_view_dialing {
        call_view_data_base_t base_view;
@@ -31,14 +33,14 @@ struct _callui_view_dialing {
 };
 typedef struct _callui_view_dialing _callui_view_dialing_t;
 
-static int __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_dialing_onupdate(call_view_data_base_t *view_data);
-static int __callui_view_dialing_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_dialing_onupdate(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_dialing_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_dialing_h vd);
+static callui_result_e __create_main_content(callui_view_dialing_h vd);
 
 static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
-static int __update_displayed_data(callui_view_dialing_h vd);
+static callui_result_e __update_displayed_data(callui_view_dialing_h vd);
 static void __keypad_show_state_change_cd(void *data, Eina_Bool visibility);
 
 callui_view_dialing_h _callui_dialing_view_dialing_new()
@@ -53,7 +55,7 @@ callui_view_dialing_h _callui_dialing_view_dialing_new()
        return dialing_view;
 }
 
-static int __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -63,7 +65,7 @@ static int __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void
 
        vd->base_view.ad = ad;
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, CALLUI_RESULT_FAIL);
 
        _callui_lock_manager_start(ad->lock_handle);
@@ -71,7 +73,7 @@ static int __callui_view_dialing_oncreate(call_view_data_base_t *view_data, void
        return __update_displayed_data(vd);
 }
 
-static int __create_main_content(callui_view_dialing_h vd)
+static callui_result_e __create_main_content(callui_view_dialing_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
@@ -96,14 +98,14 @@ static int __create_main_content(callui_view_dialing_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static int __callui_view_dialing_onupdate(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_dialing_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        return __update_displayed_data((callui_view_dialing_h)view_data);
 }
 
-static int __callui_view_dialing_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_dialing_ondestroy(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
@@ -127,23 +129,28 @@ static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_in
        callui_view_dialing_h vd = (callui_view_dialing_h)data;
        callui_app_data_t *ad = vd->base_view.ad;
 
-       if (ad->active) {
-               int ret = cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_end_call() is failed");
+       const callui_call_state_data_t *call_state =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+
+       if (call_state) {
+               callui_result_e res = _callui_manager_end_call(ad->call_manager,
+                               call_state->call_id, CALLUI_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+               if (res != CALLUI_RESULT_OK) {
+                       err("_callui_manager_end_call() failed. res[%d]", res);
                }
        }
 }
 
-static int __update_displayed_data(callui_view_dialing_h vd)
+static callui_result_e __update_displayed_data(callui_view_dialing_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
-       call_data_t *now_call_data = ad->active;
+       const callui_call_state_data_t *now_call_data = _callui_stp_get_call_data(ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
        CALLUI_RETURN_VALUE_IF_FAIL(now_call_data, CALLUI_RESULT_FAIL);
 
-       char *file_path = now_call_data->call_ct_info.caller_id_path;
-       char *call_name = now_call_data->call_ct_info.call_disp_name;
-       char *disp_number = NULL;
+       const char *file_path = now_call_data->call_ct_info.caller_id_path;
+       const char *call_name = now_call_data->call_ct_info.call_disp_name;
+       const char *disp_number = NULL;
 
        if (strlen(now_call_data->call_disp_num) > 0) {
                disp_number = now_call_data->call_disp_num;
index ac726e5..84d4e60 100755 (executable)
 #include <bluetooth.h>
 #include <app_control.h>
 #include <notification.h>
+#include <efl_extension.h>
 
 #include "callui-view-elements.h"
+#include "callui-debug.h"
 #include "callui-view-manager.h"
 #include "callui-view-dialing.h"
 #include "callui-view-single-call.h"
@@ -34,6 +36,9 @@
 #include "callui-view-quickpanel.h"
 #include "callui-view-caller-info-defines.h"
 #include "callui-proximity-lock-manager.h"
+#include "callui-manager.h"
+#include "callui-sound-manager.h"
+#include "callui-state-provider.h"
 
 #define        POPUP_LIST_W            300
 #define        POPUP_LIST_ITEM_H       120
@@ -114,12 +119,14 @@ static Evas_Object *__callui_create_button_style(void *data, Evas_Object **p_but
        Evas_Object *sw = NULL;
        callui_app_data_t *ad = (callui_app_data_t *)data;
        CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL);
+
        layout = elm_object_part_content_get(ad->main_ly, "elm.swallow.content");
        CALLUI_RETURN_VALUE_IF_FAIL(layout, NULL);
+
        btn_ly = elm_object_part_content_get(layout, "btn_region");
        CALLUI_RETURN_VALUE_IF_FAIL(btn_ly, NULL);
 
-       sw = edje_object_part_swallow_get(_EDJ(btn_ly), part_name);
+       sw = elm_object_part_content_get(btn_ly, part_name);
        if (sw) {
                dbg("Object Already Exists, so Update Only");
                *p_button = sw;
@@ -133,127 +140,68 @@ static Evas_Object *__callui_create_button_style(void *data, Evas_Object **p_but
 
 void _callui_spk_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(data != NULL);
+       CALLUI_RETURN_IF_FAIL(data);
+
        callui_app_data_t *ad = (callui_app_data_t *)data;
-       int ret = -1;
+       callui_result_e res = CALLUI_RESULT_FAIL;
 
-       if (ad->speaker_status == EINA_TRUE) {
-               ret = cm_speaker_off(ad->cm_handle);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_speaker_off() is failed. ret[%d]", ret);
-                       return;
-               }
-       } else {
-               ret = cm_speaker_on(ad->cm_handle);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_speaker_on() is failed. ret[%d]", ret);
-                       return;
-               }
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+       bool speaker_status = false;
+       if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
+               speaker_status = true;
        }
-       _callui_update_speaker_btn(ad, !ad->speaker_status);
 
-       return;
+       res = _callui_sdm_set_speaker_state(ad->sound_manager, !speaker_status);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_sdm_set_speaker_state() failed. res[%d]", res);
+               return;
+       }
 }
 
 static void __callui_contacts_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
+       CALLUI_RETURN_IF_FAIL(data);
+
        callui_app_data_t *ad = (callui_app_data_t *)data;
+
        __callui_unload_more_option(ad);
        _callui_common_launch_contacts(ad);
 }
 
-void _callui_update_speaker_btn(callui_app_data_t *ad, Eina_Bool is_on)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(ad);
-
-       ad->speaker_status = is_on;
-
-       /* Update Buttons */
-       _callui_create_top_first_button(ad);
-       _callui_qp_mc_update_speaker_status(ad->qp_minicontrol, EINA_FALSE);
-
-       return;
-}
-
-void _callui_update_headset_btn(callui_app_data_t *ad, Eina_Bool is_on)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(ad);
-       ad->headset_status = is_on;
-
-       _callui_create_top_third_button(ad);
-
-       return;
-}
-
-void _callui_update_mute_btn(callui_app_data_t *ad, Eina_Bool is_on)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(ad != NULL);
-
-       ad->mute_status = is_on;
-       _callui_create_bottom_second_button(ad);
-       _callui_qp_mc_update_mute_status(ad->qp_minicontrol, EINA_FALSE);
-
-       return;
-}
-
-void _callui_update_extra_vol_btn(callui_app_data_t *ad, Eina_Bool is_on)
-{
-       dbg("..");
-       CALLUI_RETURN_IF_FAIL(ad != NULL);
-
-       ad->extra_volume_status = is_on;
-       _callui_create_bottom_third_button(ad);
-
-       return;
-}
-
 void _callui_mute_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
-       callui_app_data_t *ad = (callui_app_data_t *)data;
-       CALLUI_RETURN_IF_FAIL(ad != NULL);
-       int ret = -1;
-       gboolean is_mute_on = FALSE;
+       CALLUI_RETURN_IF_FAIL(data);
 
-       if (ad->mute_status == EINA_FALSE) {
-               is_mute_on = TRUE;
-       } else {
-               is_mute_on = FALSE;
-       }
+       callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       ret = cm_set_mute_state(ad->cm_handle, is_mute_on);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_set_mute_state() get failed with err[%d]", ret);
+       callui_result_e res = _callui_sdm_set_mute_state(ad->sound_manager,
+                       !_callui_sdm_get_mute_state(ad->sound_manager));
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_sdm_set_mute_state() failed. res[%d]", res);
                return;
        }
-
-       _callui_update_mute_btn(ad, is_mute_on);
-       return;
 }
 
 static void __callui_headset_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
-       callui_app_data_t *ad = _callui_get_app_data();
-       CALLUI_RETURN_IF_FAIL(ad != NULL);
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_app_data_t *ad = (callui_app_data_t *)data;
        Eina_Bool bupdate_btn = EINA_FALSE;
 
-       if (ad->headset_status == EINA_TRUE) {
-               ad->headset_status = EINA_FALSE;
-               ad->speaker_status = EINA_FALSE;
-               cm_bluetooth_off(ad->cm_handle);
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+
+       switch (audio_state) {
+       case CALLUI_AUDIO_STATE_BT:
+               _callui_sdm_set_bluetooth_state(ad->sound_manager, false);
                bupdate_btn = EINA_TRUE;
-       } else {
-               /* Check If SCO path exists, open if exists*/
-               if (EINA_TRUE == _callui_common_is_headset_conected()) {
-                       ad->headset_status = EINA_TRUE;
-                       ad->speaker_status = EINA_FALSE;
-                       cm_bluetooth_on(ad->cm_handle);
+               break;
+       case CALLUI_AUDIO_STATE_NONE:
+               err("Invalid audio state");
+               return;
+       default:
+               if (_callui_common_is_headset_conected(ad)) {
+                       _callui_sdm_set_bluetooth_state(ad->sound_manager, true);
                        bupdate_btn = EINA_TRUE;
                } else {
                        bt_adapter_state_e bt_state = BT_ADAPTER_DISABLED;
@@ -266,21 +214,13 @@ static void __callui_headset_btn_cb(void *data, Evas_Object *obj, void *event_in
                                        _callui_common_launch_bt_app(ad);
                                }
                        } else {
-                               err("fail to get vconf key: %d", ret_code);
+                               err("Fail to get vconf key: %d", ret_code);
                        }
                        bupdate_btn = EINA_FALSE;
                }
        }
 
        if (bupdate_btn) {
-               if (ad->extra_volume_status == EINA_TRUE) {
-                       int ret = -1;
-                       ret = cm_set_extra_vol(ad->cm_handle, EINA_FALSE);
-                       if (ret != CM_ERROR_NONE) {
-                               err("Fail cm_set_extra_vol");
-                       }
-                       ad->extra_volume_status = EINA_FALSE;
-               }
                /* Update Headset/Speaker buttons */
                _callui_create_top_first_button(ad);
                _callui_create_top_third_button(ad);
@@ -290,16 +230,15 @@ static void __callui_headset_btn_cb(void *data, Evas_Object *obj, void *event_in
 
 static void __callui_addcall_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
-       callui_app_data_t *ad = (callui_app_data_t *)data;
-       CALLUI_RETURN_IF_FAIL(ad != NULL);
+       CALLUI_RETURN_IF_FAIL(data);
 
-       _callui_common_launch_dialer(ad);
+       _callui_common_launch_dialer(data);
 }
 
 static void __callui_keypad_btn_cb(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
+       CALLUI_RETURN_IF_FAIL(data);
+
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
        if (_callui_keypad_get_show_status(ad->keypad)) {
@@ -309,6 +248,26 @@ static void __callui_keypad_btn_cb(void *data, Evas_Object *obj, void *event_inf
        }
 }
 
+static void __top_first_audio_st_changed_cb(void *user_data, callui_audio_state_type_e state)
+{
+       CALLUI_RETURN_IF_FAIL(user_data);
+
+       Evas_Object *btn = (Evas_Object *)user_data;
+       if (state == CALLUI_AUDIO_STATE_SPEAKER) {
+               elm_object_style_set(btn, "style_call_sixbtn_speaker_on");
+       } else {
+               elm_object_style_set(btn, "style_call_sixbtn_speaker");
+       }
+}
+
+static void __top_first_button_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_app_data_t *ad = (callui_app_data_t *)data;
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __top_first_audio_st_changed_cb, obj);
+}
+
 /* Speaker Button ENABLED */
 Evas_Object *_callui_create_top_first_button(callui_app_data_t *ad)
 {
@@ -316,15 +275,24 @@ Evas_Object *_callui_create_top_first_button(callui_app_data_t *ad)
        CALLUI_RETURN_VALUE_IF_FAIL(ad != NULL, NULL);
        __callui_create_button_style(ad, &btn, PART_TOP_FIRST_BTN);
 
-       evas_object_smart_callback_del(btn, "clicked", _callui_spk_btn_cb);
-       elm_object_text_set(btn, _("IDS_CALL_BUTTON_SPEAKER"));
-       evas_object_smart_callback_add(btn, "clicked", _callui_spk_btn_cb, ad);
-       if (ad->speaker_status == EINA_FALSE) {
-               elm_object_style_set(btn, "style_call_sixbtn_speaker");
-       } else {
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+       if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
                elm_object_style_set(btn, "style_call_sixbtn_speaker_on");
+       } else {
+               elm_object_style_set(btn, "style_call_sixbtn_speaker");
        }
 
+       elm_object_text_set(btn, _("IDS_CALL_BUTTON_SPEAKER"));
+
+       evas_object_smart_callback_del_full(btn, "clicked", _callui_spk_btn_cb, ad);
+       evas_object_smart_callback_add(btn, "clicked", _callui_spk_btn_cb, ad);
+
+       evas_object_event_callback_del_full(btn, EVAS_CALLBACK_DEL, __top_first_button_del_cb, ad);
+       evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __top_first_button_del_cb, ad);
+
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __top_first_audio_st_changed_cb, btn);
+       _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __top_first_audio_st_changed_cb, btn);
+
        elm_object_disabled_set(btn, EINA_FALSE);
 
        return btn;
@@ -337,9 +305,11 @@ Evas_Object *_callui_create_top_first_button_disabled(callui_app_data_t *ad)
        CALLUI_RETURN_VALUE_IF_FAIL(ad != NULL, NULL);
 
        __callui_create_button_style(ad, &btn, PART_TOP_FIRST_BTN);
+
        elm_object_style_set(btn, "style_call_sixbtn_disabled_speaker");
 
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_SPEAKER"));
+
        elm_object_disabled_set(btn, EINA_TRUE);
 
        return btn;
@@ -352,11 +322,14 @@ Evas_Object *_callui_create_top_second_button(callui_app_data_t *ad)
        CALLUI_RETURN_VALUE_IF_FAIL(ad != NULL, NULL);
 
        __callui_create_button_style(ad, &btn, PART_TOP_SECOND_BTN);
+
        elm_object_style_set(btn, "style_call_sixbtn_keypad");
 
-       evas_object_smart_callback_del(btn, "clicked", __callui_keypad_btn_cb);
+       elm_object_text_set(btn, _("IDS_CALL_SK3_KEYPAD"));
+
+       evas_object_smart_callback_del_full(btn, "clicked", __callui_keypad_btn_cb, ad);
        evas_object_smart_callback_add(btn, "clicked", __callui_keypad_btn_cb, ad);
-       elm_object_text_set(btn, _("IDS_CALL_SK3_KEYPAD")); /* ToDo: Handle Keypad/Hide layout and text changes */
+
        elm_object_disabled_set(btn, EINA_FALSE);
 
        return btn;
@@ -369,14 +342,36 @@ Evas_Object *_callui_create_top_second_button_disabled(callui_app_data_t *ad)
        Evas_Object *btn = NULL;
 
        __callui_create_button_style(ad, &btn, PART_TOP_SECOND_BTN);
+
        elm_object_style_set(btn, "style_call_sixbtn_disabled_keypad");
 
        elm_object_text_set(btn, _("IDS_CALL_SK3_KEYPAD"));
+
        elm_object_disabled_set(btn, EINA_TRUE);
 
        return btn;
 }
 
+static void __top_third_audio_st_changed_cb(void *user_data, callui_audio_state_type_e state)
+{
+       CALLUI_RETURN_IF_FAIL(user_data);
+
+       Evas_Object *btn = (Evas_Object *)user_data;
+       if (state == CALLUI_AUDIO_STATE_BT) {
+               elm_object_style_set(btn, "style_call_sixbtn_headset_on");
+       } else {
+               elm_object_style_set(btn, "style_call_sixbtn_headset");
+       }
+}
+
+static void __top_third_button_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_app_data_t *ad = (callui_app_data_t *)data;
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __top_third_audio_st_changed_cb, obj);
+}
+
 /* HeadSet Button ENABLED */
 Evas_Object *_callui_create_top_third_button(callui_app_data_t *ad)
 {
@@ -385,14 +380,24 @@ Evas_Object *_callui_create_top_third_button(callui_app_data_t *ad)
 
        __callui_create_button_style(ad, &btn, PART_TOP_THIRD_BTN);
 
-       if (ad->headset_status == EINA_FALSE) {
-               elm_object_style_set(btn, "style_call_sixbtn_headset");
-       } else {
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+       if (audio_state == CALLUI_AUDIO_STATE_BT) {
                elm_object_style_set(btn, "style_call_sixbtn_headset_on");
+       } else {
+               elm_object_style_set(btn, "style_call_sixbtn_headset");
        }
+
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_BLUETOOTH_ABB"));
+
        evas_object_smart_callback_del(btn, "clicked", __callui_headset_btn_cb);
        evas_object_smart_callback_add(btn, "clicked", __callui_headset_btn_cb, ad);
+
+       evas_object_event_callback_del_full(btn, EVAS_CALLBACK_DEL, __top_third_button_del_cb, ad);
+       evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __top_third_button_del_cb, ad);
+
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __top_third_audio_st_changed_cb, btn);
+       _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __top_third_audio_st_changed_cb, btn);
+
        elm_object_disabled_set(btn, EINA_FALSE);
 
        return btn;
@@ -407,6 +412,7 @@ Evas_Object *_callui_create_top_third_button_disabled(callui_app_data_t *ad)
        __callui_create_button_style(ad, &btn, PART_TOP_THIRD_BTN);
 
        elm_object_style_set(btn, "style_call_sixbtn_disabled_headset");
+
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_BLUETOOTH_ABB"));
 
        elm_object_disabled_set(btn, EINA_TRUE);
@@ -421,9 +427,12 @@ Evas_Object *_callui_create_bottom_first_button(callui_app_data_t *ad)
        Evas_Object *btn = NULL;
 
        __callui_create_button_style(ad, &btn, PART_BOTTOM_FIRST_BTN);
-       evas_object_smart_callback_del(btn, "clicked", __callui_addcall_btn_cb);
+
        elm_object_style_set(btn, "style_call_sixbtn_add");
+
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_ADD_CALL"));
+
+       evas_object_smart_callback_del_full(btn, "clicked", __callui_addcall_btn_cb, ad);
        evas_object_smart_callback_add(btn, "clicked", __callui_addcall_btn_cb, ad);
 
        elm_object_disabled_set(btn, EINA_FALSE);
@@ -440,6 +449,7 @@ Evas_Object *_callui_create_bottom_first_button_disabled(callui_app_data_t *ad)
        __callui_create_button_style(ad, &btn, PART_BOTTOM_FIRST_BTN);
 
        elm_object_style_set(btn, "style_call_sixbtn_disabled_add");
+
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_ADD_CALL"));
 
        elm_object_disabled_set(btn, EINA_TRUE);
@@ -447,6 +457,26 @@ Evas_Object *_callui_create_bottom_first_button_disabled(callui_app_data_t *ad)
        return btn;
 }
 
+static void __bootom_second_mute_st_changed_cb(void *user_data, bool is_enable)
+{
+       CALLUI_RETURN_IF_FAIL(user_data);
+
+       Evas_Object *btn = (Evas_Object *)user_data;
+       if (is_enable) {
+               elm_object_style_set(btn, "style_call_sixbtn_mute_on");
+       } else {
+               elm_object_style_set(btn, "style_call_sixbtn_mute");
+       }
+}
+
+static void __bootom_second_button_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_app_data_t *ad = (callui_app_data_t *)data;
+       _callui_sdm_remove_mute_state_changed_cb(ad->sound_manager, __bootom_second_mute_st_changed_cb, obj);
+}
+
 /* Mute Button ENABLED */
 Evas_Object *_callui_create_bottom_second_button(callui_app_data_t *ad)
 {
@@ -454,17 +484,26 @@ Evas_Object *_callui_create_bottom_second_button(callui_app_data_t *ad)
        CALLUI_RETURN_VALUE_IF_FAIL(ad != NULL, NULL);
 
        __callui_create_button_style(ad, &btn, PART_BOTTOM_SECOND_BTN);
-       elm_object_text_set(btn, _("IDS_CALL_BUTTON_MUTE_ABB"));
-       if (ad->mute_status == EINA_FALSE) {
-               elm_object_style_set(btn, "style_call_sixbtn_mute");
-       } else {
+
+       if (_callui_sdm_get_mute_state(ad->sound_manager)) {
                elm_object_style_set(btn, "style_call_sixbtn_mute_on");
+       } else {
+               elm_object_style_set(btn, "style_call_sixbtn_mute");
        }
-       elm_object_disabled_set(btn, EINA_FALSE);
 
-       evas_object_smart_callback_del(btn, "clicked", _callui_mute_btn_cb);
+       elm_object_text_set(btn, _("IDS_CALL_BUTTON_MUTE_ABB"));
+
+       evas_object_smart_callback_del_full(btn, "clicked", _callui_mute_btn_cb, ad);
        evas_object_smart_callback_add(btn, "clicked", _callui_mute_btn_cb, ad);
 
+       evas_object_event_callback_del_full(btn, EVAS_CALLBACK_DEL, __bootom_second_button_del_cb, ad);
+       evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __bootom_second_button_del_cb, ad);
+
+       _callui_sdm_remove_mute_state_changed_cb(ad->sound_manager, __bootom_second_mute_st_changed_cb, btn);
+       _callui_sdm_add_mute_state_changed_cb(ad->sound_manager, __bootom_second_mute_st_changed_cb, btn);
+
+       elm_object_disabled_set(btn, EINA_FALSE);
+
        return btn;
 }
 
@@ -475,7 +514,9 @@ Evas_Object *_callui_create_bottom_second_button_disabled(callui_app_data_t *ad)
        Evas_Object *btn = NULL;
 
        __callui_create_button_style(ad, &btn, PART_BOTTOM_SECOND_BTN);
+
        elm_object_style_set(btn, "style_call_sixbtn_disabled_mute");
+
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_MUTE_ABB"));
 
        elm_object_disabled_set(btn, EINA_TRUE);
@@ -488,12 +529,17 @@ Evas_Object *_callui_create_bottom_third_button(callui_app_data_t *ad)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(ad != NULL, NULL);
        Evas_Object *btn = NULL;
+
        __callui_create_button_style(ad, &btn, PART_BOTTOM_THIRD_BTN);
+
+       elm_object_style_set(btn, "style_call_sixbtn_contacts");
+
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_CONTACTS"));
-       evas_object_smart_callback_del(btn, "clicked", __callui_contacts_btn_cb);
+
+       evas_object_smart_callback_del_full(btn, "clicked", __callui_contacts_btn_cb, ad);
        evas_object_smart_callback_add(btn, "clicked", __callui_contacts_btn_cb, ad);
+
        elm_object_disabled_set(btn, EINA_FALSE);
-       elm_object_style_set(btn, "style_call_sixbtn_contacts");
 
        return btn;
 }
@@ -503,20 +549,15 @@ Evas_Object *_callui_create_bottom_third_button_disabled(callui_app_data_t *ad)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(ad != NULL, NULL);
        Evas_Object *btn = NULL;
-#if 1
+
        __callui_create_button_style(ad, &btn, PART_BOTTOM_THIRD_BTN);
+
        elm_object_style_set(btn, "style_call_sixbtn_disabled_contacts");
 
        elm_object_text_set(btn, _("IDS_CALL_BUTTON_CONTACTS"));
-       elm_object_disabled_set(btn, EINA_TRUE);
-
-#else
-       __callui_create_button_style(data, &btn, PART_BOTTOM_THIRD_BTN);
-       elm_object_style_set(btn, "style_call_sixbtn_disabled_contacts");
 
        elm_object_disabled_set(btn, EINA_TRUE);
 
-#endif
        return btn;
 }
 
@@ -618,7 +659,7 @@ Evas_Object *_callui_show_caller_info_status(void *data, const char *status)
        return layout;
 }
 
-Evas_Object *_callui_show_caller_id(Evas_Object *contents, char *path)
+Evas_Object *_callui_show_caller_id(Evas_Object *contents, const char *path)
 {
        dbg("..");
        Evas_Object *layout = _callui_create_thumbnail(contents, path, THUMBNAIL_138);
@@ -638,11 +679,10 @@ static void __callui_hold_btn_cb(void *data, Evas_Object *obj, void *event_info)
 
        __callui_unload_more_option(ad);
 
-/*     if (_vcui_keypad_get_show_status() == EINA_TRUE) {
-                       _vcui_keypad_hide(vd);
+       callui_result_e res = _callui_manager_hold_call(ad->call_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_hold_call() failed. res[%d]", res);
        }
-       */
-       cm_hold_call(ad->cm_handle);
 }
 
 static void __callui_unhold_btn_cb(void *data, Evas_Object *obj, void *event_info)
@@ -652,12 +692,14 @@ static void __callui_unhold_btn_cb(void *data, Evas_Object *obj, void *event_inf
 
        __callui_unload_more_option(ad);
 
-       cm_unhold_call(ad->cm_handle);
+       callui_result_e res = _callui_manager_unhold_call(ad->call_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_unhold_call() failed. res[%d]", res);
+       }
 }
 
-static void __callui_move_more_option(Evas_Object *ctxpopup)
+static void __callui_move_more_option(callui_app_data_t *ad, Evas_Object *ctxpopup)
 {
-       callui_app_data_t *ad = _callui_get_app_data();
        Evas_Coord w = 0, h = 0;
        int pos = -1;
 
@@ -724,8 +766,10 @@ void _callui_load_more_option(void *data)
                eext_object_event_callback_add(ctxpopup, EEXT_CALLBACK_MORE, eext_ctxpopup_back_cb, NULL);
 
                /* Hold/Resume */
-               if (_callui_vm_get_cur_view_type(ad->view_manager_handle) != VIEW_TYPE_MULTICALL_SPLIT) {
-                       if (ad->active != NULL) {
+               if (_callui_vm_get_cur_view_type(ad->view_manager) != VIEW_TYPE_MULTICALL_SPLIT) {
+                       const callui_call_state_data_t *call_data =
+                                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+                       if (call_data) {
                                elm_ctxpopup_item_append(ctxpopup, _("IDS_CALL_BUTTON_HOLD"), NULL, __callui_hold_btn_cb, ad);
                        } else {
                                elm_ctxpopup_item_append(ctxpopup, _("IDS_CALL_BUTTON_RESUME_ABB"), NULL, __callui_unhold_btn_cb, ad);
@@ -736,7 +780,7 @@ void _callui_load_more_option(void *data)
                                                                                        ELM_CTXPOPUP_DIRECTION_UNKNOWN,
                                                                                        ELM_CTXPOPUP_DIRECTION_UNKNOWN);
 
-               __callui_move_more_option(ctxpopup);
+               __callui_move_more_option(ad, ctxpopup);
 
                evas_object_show(ctxpopup);
                ad->ctxpopup = ctxpopup;
@@ -786,18 +830,17 @@ static char *__callui_gl_second_call_option_label_get(void *data, Evas_Object *o
 static void __callui_gl_second_call_option_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
 {
        second_call_popup_data_t *item_data = (second_call_popup_data_t *)data;
-       g_free(item_data);
+       free(item_data);
 }
 
 static void __callui_gl_second_call_option_sel(void *data, Evas_Object *obj, void *event_info)
 {
-       dbg("..");
+       CALLUI_RETURN_IF_FAIL(data);
+       CALLUI_RETURN_IF_FAIL(event_info);
+
        Elm_Object_Item *item = (Elm_Object_Item *) event_info;
-       call_data_t *hold_call_data = NULL;
-       call_data_t *unhold_call_data = NULL;
        second_call_popup_data_t *item_data = NULL;
        callui_app_data_t *ad = (callui_app_data_t *)data;
-       CALLUI_RETURN_IF_FAIL(ad);
 
        __callui_unload_second_call_popup(ad);
 
@@ -806,30 +849,37 @@ static void __callui_gl_second_call_option_sel(void *data, Evas_Object *obj, voi
                CALLUI_RETURN_IF_FAIL(item_data);
                dbg("index: %d", item_data->index);
 
-               hold_call_data = ad->held;
-               unhold_call_data = ad->active;
+               const callui_call_state_data_t *hold_call_data =
+                               _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+               const callui_call_state_data_t *unhold_call_data =
+                               _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+
                if ((unhold_call_data) && (hold_call_data == NULL)) {
                        dbg("1 active call OR 1 active conference call");
                        if (item_data->index == 0) {
-                               cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_HOLD_ACTIVE_AND_ACCEPT);
+                               _callui_manager_answer_call(ad->call_manager,
+                                               CALLUI_CALL_ANSWER_TYPE_HOLD_ACTIVE_AND_ACCEPT);
                        } else if (item_data->index == 1) {
-                               cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT);
+                               _callui_manager_answer_call(ad->call_manager,
+                                               CALLUI_CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT);
                        } else {
                                err("Wrong index.. Should never get here");
                        }
                } else if (((unhold_call_data) && (hold_call_data))) {
                        dbg("1 active call + 1 held call OR 1 active conf call + 1 held call OR 1 active call + 1 held conf call");
                        if (item_data->index == 0) {
-                               cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT);
+                               _callui_manager_answer_call(ad->call_manager,
+                                               CALLUI_CALL_ANSWER_TYPE_RELEASE_ACTIVE_AND_ACCEPT);
                        } else if (item_data->index == 1) {
-                               cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_RELEASE_HOLD_AND_ACCEPT);
+                               _callui_manager_answer_call(ad->call_manager,
+                                               CALLUI_CALL_ANSWER_TYPE_RELEASE_HOLD_AND_ACCEPT);
                        } else if (item_data->index == 2) {
-                               cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_RELEASE_ALL_AND_ACCEPT);
+                               _callui_manager_answer_call(ad->call_manager,
+                                               CALLUI_CALL_ANSWER_TYPE_RELEASE_ALL_AND_ACCEPT);
                        } else {
                                err("Wrong index.. Should never get here");
                        }
                }
-
        }
 }
 
@@ -839,7 +889,7 @@ static void __callui_second_call_cancel_btn_response_cb(void *data, Evas_Object
 
        callui_app_data_t *ad = (callui_app_data_t*) data;
        __callui_unload_second_call_popup(ad);
-       _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_INCOMING_CALL);
+       _callui_vm_change_view(ad->view_manager, VIEW_TYPE_INCOMING_CALL);
 
        return;
 }
@@ -849,20 +899,20 @@ void _callui_load_second_call_popup(callui_app_data_t *ad)
        dbg("..");
        CALLUI_RETURN_IF_FAIL(ad);
        Evas_Object *box = NULL;
-       call_data_t *hold_call_data = NULL;
-       call_data_t *unhold_call_data = NULL;
-       char *hold_call_number = NULL;
-       char *hold_call_name = NULL;
-       char *unhold_call_number = NULL;
-       char *unhold_call_name = NULL;
+
+       const char *hold_call_number = NULL;
+       const char *hold_call_name = NULL;
+       const char *unhold_call_number = NULL;
+       const char *unhold_call_name = NULL;
+
        const char *temp_str = NULL;
        second_call_popup_data_t *item_data = NULL;
        Elm_Genlist_Item_Class *itc = NULL;
        Evas_Object *genlist = NULL;
        CALLUI_RETURN_IF_FAIL(ad);
 
-       hold_call_data = ad->held;
-       unhold_call_data = ad->active;
+       const callui_call_state_data_t *hold_call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       const callui_call_state_data_t *unhold_call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
        if (unhold_call_data == NULL) {
                err("active call data is null");
                return;
@@ -908,7 +958,7 @@ void _callui_load_second_call_popup(callui_app_data_t *ad)
                        unhold_call_name = unhold_call_number;
        }
 
-       if ((unhold_call_data) && (unhold_call_data->member_count == 1) && (hold_call_data == NULL)) {
+       if ((unhold_call_data) && (unhold_call_data->conf_member_count == 1) && (hold_call_data == NULL)) {
                dbg("1 active call");
                /* First option */
                item_data = (second_call_popup_data_t *) calloc(1, sizeof(second_call_popup_data_t));
@@ -933,7 +983,9 @@ void _callui_load_second_call_popup(callui_app_data_t *ad)
                temp_str = _("IDS_CALL_OPT_END_CALL_WITH_PS");
                snprintf(item_data->option_msg, 512, temp_str, unhold_call_name);
                elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
-       } else if ((unhold_call_data) && (unhold_call_data->member_count > 1) && (hold_call_data == NULL)) {
+       } else if ((unhold_call_data)
+                       && (unhold_call_data->conf_member_count > 1)
+                       && (hold_call_data == NULL)) {
                dbg("1 active conference call");
                /* First option */
                item_data = (second_call_popup_data_t *) calloc(1, sizeof(second_call_popup_data_t));
@@ -956,7 +1008,9 @@ void _callui_load_second_call_popup(callui_app_data_t *ad)
                memset(item_data->option_msg, 0x00, 512);
                strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_CONFERENCE_CALL"), 512-1);
                elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
-       } else if ((unhold_call_data) && (hold_call_data) && (unhold_call_data->member_count == 1) && (hold_call_data->member_count == 1)) {
+       } else if ((unhold_call_data)
+                       && (hold_call_data) && (unhold_call_data->conf_member_count == 1)
+                       && (hold_call_data->conf_member_count == 1)) {
                dbg("1 active call + 1 held call");
                /* First option */
                item_data = (second_call_popup_data_t *) calloc(1, sizeof(second_call_popup_data_t));
@@ -992,7 +1046,9 @@ void _callui_load_second_call_popup(callui_app_data_t *ad)
                memset(item_data->option_msg, 0x00, 512);
                strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), 512-1);
                elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
-       } else if ((unhold_call_data) && (hold_call_data) && (unhold_call_data->member_count > 1) && (hold_call_data->member_count == 1)) {
+       } else if ((unhold_call_data) && (hold_call_data)
+                       && (unhold_call_data->conf_member_count > 1)
+                       && (hold_call_data->conf_member_count == 1)) {
                dbg("1 active conf call + 1 held call");
                /* First option */
                item_data = (second_call_popup_data_t *) calloc(1, sizeof(second_call_popup_data_t));
@@ -1027,7 +1083,9 @@ void _callui_load_second_call_popup(callui_app_data_t *ad)
                memset(item_data->option_msg, 0x00, 512);
                strncpy(item_data->option_msg, _("IDS_CALL_OPT_END_ALL_CURRENT_CALLS"), 512-1);
                elm_genlist_item_append(genlist, itc, (void *)item_data, NULL, ELM_GENLIST_ITEM_NONE, __callui_gl_second_call_option_sel, ad);
-       } else if ((unhold_call_data) && (hold_call_data) && (unhold_call_data->member_count == 1) && (hold_call_data->member_count > 1)) {
+       } else if ((unhold_call_data) && (hold_call_data)
+                       && (unhold_call_data->conf_member_count == 1)
+                       && (hold_call_data->conf_member_count > 1)) {
                dbg("1 active call + 1 held conf call");
                /* First option */
                item_data = (second_call_popup_data_t *) calloc(1, sizeof(second_call_popup_data_t));
@@ -1149,34 +1207,6 @@ void _callui_load_bluetooth_popup(callui_app_data_t *ad)
        return;
 }
 
-void _callui_create_extravolume_notify_popup()
-{
-       callui_app_data_t *ad = _callui_get_app_data();
-       CALLUI_RETURN_IF_FAIL(ad != NULL);
-       char *text = NULL;
-       cm_audio_state_type_e snd_path = CM_AUDIO_STATE_NONE_E;
-
-       cm_get_audio_state(ad->cm_handle, &snd_path);
-       dbg("sound path : %d", snd_path);
-       switch (snd_path) {
-       case CM_AUDIO_STATE_BT_E:
-               {
-                       text = _("IDS_CALL_POP_EXTRA_VOLUME_CANNOT_BE_TURNED_ON_WHILE_BLUETOOTH_HEADSET_CONNECTED");
-               }
-               break;
-       case CM_AUDIO_STATE_EARJACK_E:
-               {
-                       text = _("IDS_CALL_POP_EXTRA_VOLUME_CANNOT_BE_TURNED_ON_WHILE_EARPHONES_CONNECTED");
-               }
-               break;
-       default:
-               text = _("IDS_CALL_POP_EXTRA_VOLUME_CANNOT_BE_TURNED_ON_WHILE_EARPHONES_OR_BLUETOOTH_HEADSET_CONNECTED");
-               break;
-       }
-       _callui_create_toast_message(text);
-
-}
-
 void _callui_create_toast_message(char *string)
 {
        dbg("$$$$$$ Noti-String : %s", string);
@@ -1193,20 +1223,19 @@ static void __callui_create_new_msg_btn_click_cb(void *data, Evas_Object *obj, v
 
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       CALLUI_RETURN_IF_FAIL(ad->incom);
 
-       call_data_t *call_data = ad->incom;
-       char *tel_number = call_data->call_num;
+       const callui_call_state_data_t *incom = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+       CALLUI_RETURN_IF_FAIL(incom);
 
-       _callui_common_launch_msg_composer(ad, tel_number);
+       _callui_common_launch_msg_composer(ad, incom->call_num);
 
-       int ret = cm_reject_call(ad->cm_handle);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_reject_call() is failed");
+       callui_result_e res = _callui_manager_reject_call(ad->call_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_reject_call() failed. res[%d]", res);
        }
 }
 
-int _callui_create_reject_msg_button(void *app_data, Evas_Object *parent, char *part)
+int _callui_create_reject_msg_button(void *app_data, Evas_Object *parent, const char *part)
 {
        Evas_Object *msg_button = elm_button_add(parent);
        CALLUI_RETURN_VALUE_IF_FAIL(msg_button, CALLUI_RESULT_ALLOCATION_FAIL);
index a04a58d..7974fad 100644 (file)
 #include <vconf.h>
 #include <app_control.h>
 #include <Elementary.h>
+#include <efl_extension.h>
 
 #include "callui-view-incoming-call-noti.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-view-manager.h"
 #include "callui-view-layout.h"
 #include "callui-view-elements.h"
 #include "callui-common.h"
 
+#include "callui-manager.h"
+#include "callui-state-provider.h"
+
 #define CALLUI_DURING_ICON     "call_button_icon_03.png"
 #define CALLUI_REJECT_ICON     "call_button_icon_04.png"
 #define CALLUI_END_ICON                "call_button_icon_01.png"
@@ -44,12 +49,12 @@ struct _callui_view_incoming_call_noti {
 
 typedef struct _callui_view_incoming_call_noti _callui_view_incoming_call_noti_t;
 
-static int __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_incoming_call_noti_onupdate(call_view_data_base_t *view_data);
-static int __callui_view_incoming_call_noti_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_incoming_call_noti_onupdate(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_incoming_call_noti_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_incoming_call_noti_h vd);
-static int __update_displayed_data(callui_view_incoming_call_noti_h vd);
+static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd);
+static callui_result_e __update_displayed_data(callui_view_incoming_call_noti_h vd);
 
 static void __reject_msg_genlist_item_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __reject_msg_layout_back_click_cb(void *data, Evas_Object *obj, void *event_info);
@@ -68,8 +73,8 @@ static void __create_reject_msg_content(callui_view_incoming_call_noti_h vd);
 
 static void __launch_btn_click_cb(void *data, Evas *evas, Evas_Object *obj, void *event_info);
 
-static int __create_main_content(callui_view_incoming_call_noti_h vd);
-static int __create_custom_button(char *icon_name, char *part, Evas_Object_Event_Cb func, void *data, void *data_bt_cb);
+static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd);
+static callui_result_e __create_custom_button(char *icon_name, char *part, Evas_Object_Event_Cb func, void *data, void *data_bt_cb);
 
 callui_view_incoming_call_noti_h _callui_view_incoming_call_noti_new()
 {
@@ -83,7 +88,7 @@ callui_view_incoming_call_noti_h _callui_view_incoming_call_noti_new()
        return incoming_call_noti;
 }
 
-static int __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -101,20 +106,20 @@ static int __callui_view_incoming_call_noti_oncreate(call_view_data_base_t *view
                dbg("KEY_SELECT key grab failed");
        }
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return __update_displayed_data(vd);
 }
 
-static int __callui_view_incoming_call_noti_onupdate(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_incoming_call_noti_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        return __update_displayed_data((callui_view_incoming_call_noti_h)view_data);
 }
 
-static int __callui_view_incoming_call_noti_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_incoming_call_noti_ondestroy(call_view_data_base_t *view_data)
 {
        callui_view_incoming_call_noti_h vd = (callui_view_incoming_call_noti_h)view_data;
        callui_app_data_t *ad = vd->base_view.ad;
@@ -123,16 +128,12 @@ static int __callui_view_incoming_call_noti_ondestroy(call_view_data_base_t *vie
 #ifdef _DBUS_DVC_LSD_TIMEOUT_
        /* Set LCD timeout for call state */
        /* LCD is alwasy on during incoming call screen */
-       if (ad->speaker_status == EINA_TRUE) {
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->call_sdm);
+       if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
                _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_SET);
        }
 #endif
 
-       if (ad->second_call_popup) {
-               evas_object_del(ad->second_call_popup);
-               ad->second_call_popup = NULL;
-       }
-
        DELETE_EVAS_OBJECT(vd->base_view.contents);
 
        _callui_common_win_set_noti_type(ad, EINA_FALSE);
@@ -168,9 +169,9 @@ static void __reject_msg_genlist_item_click_cb(void *data, Evas_Object *obj, voi
                        free(ret_str);
                }
 
-               int ret = cm_reject_call(ad->cm_handle);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_reject_call() is failed");
+               callui_result_e res = _callui_manager_reject_call(ad->call_manager);
+               if (res != CALLUI_RESULT_OK) {
+                       err("cm_reject_call() is failed. res[%d]", res);
                } else {
                        _callui_common_send_reject_msg(ad, vd->reject_msg);
                }
@@ -376,14 +377,14 @@ static void __launch_btn_click_cb(void *data, Evas *evas, Evas_Object *obj, void
        app_control_destroy(app_control);
 }
 
-static int __create_main_content(callui_view_incoming_call_noti_h vd)
+static callui_result_e __create_main_content(callui_view_incoming_call_noti_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
        vd->base_view.contents = _callui_load_edj(ad->main_ly, EDJ_NAME,  "main_active_noti_call");
        elm_object_part_content_set(ad->main_ly, "elm.swallow.content", vd->base_view.contents);
 
-       int res = __create_custom_button(CALLUI_DURING_ICON, "swallow.call_button",
+       callui_result_e res = __create_custom_button(CALLUI_DURING_ICON, "swallow.call_button",
                        __launch_btn_click_cb, vd, (void *)APP_CONTROL_OPERATION_DURING_CALL);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
@@ -404,7 +405,7 @@ static int __create_main_content(callui_view_incoming_call_noti_h vd)
        return res;
 }
 
-static int __create_custom_button(char *icon_name, char *part, Evas_Object_Event_Cb func, void * data, void * data_bt_cb)
+static callui_result_e __create_custom_button(char *icon_name, char *part, Evas_Object_Event_Cb func, void * data, void * data_bt_cb)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(data, CALLUI_RESULT_INVALID_PARAM);
 
@@ -427,23 +428,23 @@ static int __create_custom_button(char *icon_name, char *part, Evas_Object_Event
        return CALLUI_RESULT_OK;
 }
 
-static int __update_displayed_data(callui_view_incoming_call_noti_h vd)
+static callui_result_e __update_displayed_data(callui_view_incoming_call_noti_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
-       CALLUI_RETURN_VALUE_IF_FAIL(ad->incom, CALLUI_RESULT_FAIL);
-       call_data_t *call_data = ad->incom;
+       const callui_call_state_data_t *call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+       CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
 
        elm_object_signal_emit(vd->base_view.contents, "small_main_ly", "main_active_noti_call");
 
-       char *call_name = call_data->call_ct_info.call_disp_name;
-       char *call_number = NULL;
+       const char *call_name = call_data->call_ct_info.call_disp_name;
+       const char *call_number = NULL;
        if (call_data->call_disp_num[0] != '\0') {
                call_number = call_data->call_disp_num;
        } else {
                call_number = call_data->call_num;
        }
-       char *file_path = call_data->call_ct_info.caller_id_path;
+       const char *file_path = call_data->call_ct_info.caller_id_path;
 
        if (!(call_name && call_name[0] != '\0') && !(call_number && call_number[0] != '\0')) {
                elm_object_signal_emit(vd->base_view.contents, "big_buttons", "main_active_noti_call");
index 63be03d..13e9f58 100644 (file)
 #include <Elementary.h>
 
 #include "callui-view-incoming-call.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-view-layout.h"
 #include "callui-view-elements.h"
 #include "callui-view-manager.h"
 #include "callui-view-circle.h"
 #include "callui-common.h"
+#include "callui-state-provider.h"
 
 #define CALLUI_REJ_MSG_GENLIST_DATA "reject_msg_genlist_data"
 #define CALLUI_REJ_MSG_LIST_OPEN_STATUS_KEY "list_open_status_key"
@@ -58,12 +60,12 @@ struct _callui_view_incoming_call {
 };
 typedef struct _callui_view_incoming_call _callui_view_incoming_call_t;
 
-static int __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_incoming_call_onupdate(call_view_data_base_t *view_data);
-static int __callui_view_incoming_call_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_incoming_call_onupdate(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_incoming_call_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_incoming_call_h vd);
-static int __update_displayed_data(callui_view_incoming_call_h vd);
+static callui_result_e __create_main_content(callui_view_incoming_call_h vd);
+static callui_result_e __update_displayed_data(callui_view_incoming_call_h vd);
 
 static char *__callui_view_incoming_call_reject_msg_gl_label_get_msg(void *data, Evas_Object *obj, const char *part);
 static void __reject_msg_gl_sel_msg(void *data, Evas_Object *obj, void *event_info);
@@ -86,7 +88,7 @@ static void __reject_msg_bg_mouse_move_cb(void *data, Evas *evas, Evas_Object *o
 
 static void __reject_msg_list_height_update(callui_view_incoming_call_h vd);
 static void __reject_msg_create_genlist(callui_view_incoming_call_h vd);
-static Eina_Bool __reject_msg_check_tel_num(char *call_num);
+static Eina_Bool __reject_msg_check_tel_num(const char *call_num);
 static Evas_Object *__create_reject_msg_layout(callui_view_incoming_call_h vd);
 
 callui_view_incoming_call_h _callui_view_incoming_call_new()
@@ -101,7 +103,7 @@ callui_view_incoming_call_h _callui_view_incoming_call_new()
        return incoming_lock_view;
 }
 
-static int __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -111,33 +113,33 @@ static int __callui_view_incoming_call_oncreate(call_view_data_base_t *view_data
 
        vd->base_view.ad = ad;
 
-       evas_object_pointer_mode_set(ad->win, EVAS_OBJECT_POINTER_MODE_NOGRAB);
-
        if (_callui_lock_manager_is_started(ad->lock_handle)) {
                _callui_lock_manager_force_stop(ad->lock_handle);
        }
 
+       evas_object_resize(ad->win, ad->root_w,  ad->root_h);
+       _callui_common_win_set_noti_type(ad, EINA_TRUE);
+
+       evas_object_pointer_mode_set(ad->win, EVAS_OBJECT_POINTER_MODE_NOGRAB);
+
        if (elm_win_keygrab_set(ad->win, CALLUI_KEY_SELECT, 0, 0, 0, ELM_WIN_KEYGRAB_TOPMOST)) {
                dbg("KEY_SELECT key grab failed");
        }
-       _callui_common_win_set_noti_type(ad, EINA_TRUE);
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return __update_displayed_data(vd);
 }
 
-static int __callui_view_incoming_call_onupdate(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_incoming_call_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
-       callui_view_incoming_call_h vd = (callui_view_incoming_call_h)view_data;
-
-       return __update_displayed_data(vd);
+       return __update_displayed_data((callui_view_incoming_call_h)view_data);
 }
 
-static int __callui_view_incoming_call_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_incoming_call_ondestroy(call_view_data_base_t *view_data)
 {
        callui_view_incoming_call_h vd = (callui_view_incoming_call_h)view_data;
        callui_app_data_t *ad = vd->base_view.ad;
@@ -146,7 +148,8 @@ static int __callui_view_incoming_call_ondestroy(call_view_data_base_t *view_dat
 #ifdef _DBUS_DVC_LSD_TIMEOUT_
        /* Set LCD timeout for call state */
        /* LCD is alwasy on during incoming call screen */
-       if (ad->speaker_status == EINA_TRUE) {
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->call_sdm);
+       if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
                _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_SET);
        }
 #endif
@@ -208,9 +211,9 @@ static void __reject_msg_gl_sel_msg(void *data, Evas_Object *obj, void *event_in
                        free(ret_str);
                }
 
-               int ret = cm_reject_call(ad->cm_handle);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_reject_call() is failed");
+               callui_result_e res = _callui_manager_reject_call(ad->call_manager);
+               if (res != CALLUI_RESULT_OK) {
+                       err("cm_reject_call() is failed. res[%d]", res);
                } else {
                        _callui_common_send_reject_msg(ad, vd->reject_msg);
                }
@@ -293,7 +296,7 @@ Evas_Object *_callui_view_incoming_call_get_accept_layout(callui_view_incoming_c
        return vd->lock_accept;
 }
 
-int _callui_view_incoming_call_set_accept_layout(callui_view_incoming_call_h vd, Evas_Object *layout)
+callui_result_e _callui_view_incoming_call_set_accept_layout(callui_view_incoming_call_h vd, Evas_Object *layout)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(vd, CALLUI_RESULT_INVALID_PARAM);
 
@@ -307,7 +310,7 @@ Evas_Object *_callui_view_incoming_call_get_reject_layout(callui_view_incoming_c
        return vd->lock_reject;
 }
 
-int _callui_view_incoming_call_set_reject_layout(callui_view_incoming_call_h vd, Evas_Object *layout)
+callui_result_e _callui_view_incoming_call_set_reject_layout(callui_view_incoming_call_h vd, Evas_Object *layout)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(vd, CALLUI_RESULT_INVALID_PARAM);
 
@@ -552,7 +555,7 @@ static void __reject_msg_create_gesture_layer(callui_view_incoming_call_h vd)
        }
 
        vd->reject_msg_glayer = elm_gesture_layer_add(vd->reject_msg_layout);
-       if (FALSE == elm_gesture_layer_attach(vd->reject_msg_glayer, reject_msg_bg)) {
+       if (!elm_gesture_layer_attach(vd->reject_msg_glayer, reject_msg_bg)) {
                dbg("elm_gesture_layer_attach failed !!");
                evas_object_del(vd->reject_msg_glayer);
                vd->reject_msg_glayer = NULL;
@@ -665,21 +668,21 @@ static void __reject_msg_create_genlist(callui_view_incoming_call_h vd)
        elm_object_tree_focus_allow_set(vd->reject_msg_genlist, EINA_FALSE);
 }
 
-static int __update_displayed_data(callui_view_incoming_call_h vd)
+static callui_result_e __update_displayed_data(callui_view_incoming_call_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
-       CALLUI_RETURN_VALUE_IF_FAIL(ad->incom, CALLUI_RESULT_FAIL);
+       const callui_call_state_data_t *call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+       CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
 
-       call_data_t *call_data = ad->incom;
-       char *file_path = call_data->call_ct_info.caller_id_path;
+       const char *file_path = call_data->call_ct_info.caller_id_path;
 
        if (strcmp(file_path, "default") != 0) {
                _callui_show_caller_id(vd->caller_info, file_path);
        }
 
-       char *call_name = call_data->call_ct_info.call_disp_name;
-       char *call_number = NULL;
+       const char *call_name = call_data->call_ct_info.call_disp_name;
+       const char *call_number = NULL;
        if (call_data->call_disp_num[0] != '\0') {
                call_number = call_data->call_disp_num;
        } else {
@@ -706,7 +709,7 @@ static int __update_displayed_data(callui_view_incoming_call_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static Eina_Bool __reject_msg_check_tel_num(char *call_num)
+static Eina_Bool __reject_msg_check_tel_num(const char *call_num)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(call_num, EINA_FALSE);
 
@@ -752,7 +755,7 @@ static Evas_Object *__create_reject_msg_layout(callui_view_incoming_call_h vd)
        return vd->reject_msg_layout;
 }
 
-static int __create_main_content(callui_view_incoming_call_h vd)
+static callui_result_e __create_main_content(callui_view_incoming_call_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
@@ -766,7 +769,7 @@ static int __create_main_content(callui_view_incoming_call_h vd)
 
        _callui_show_caller_info_status(ad, _("IDS_CALL_BODY_INCOMING_CALL"));
 
-       int res = _callui_view_circle_create_accept_layout(ad, vd, vd->base_view.contents);
+       callui_result_e res = _callui_view_circle_create_accept_layout(ad, vd, vd->base_view.contents);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
        res = _callui_view_circle_create_reject_layout(ad, vd, vd->base_view.contents);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
index 3ef3d51..df71e28 100755 (executable)
@@ -15,8 +15,9 @@
  *
  */
 
-#include "callui.h"
 #include "callui-view-lock-screen.h"
+#include "callui-debug.h"
+#include "callui.h"
 #include "callui-view-dialing.h"
 #include "callui-view-single-call.h"
 #include "callui-view-multi-call-conf.h"
@@ -26,6 +27,7 @@
 #include "callui-view-manager.h"
 #include "callui-view-elements.h"
 #include "callui-common.h"
+#include "callui-sound-manager.h"
 
 typedef struct _lock_sccreen_data {
        Evas_Object *layout;
@@ -98,7 +100,9 @@ static void __callui_lock_screen_show_layout(lock_screen_data_t *lock_screen_pri
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_screen_priv);
        callui_app_data_t *ad = _callui_get_app_data();
-       if (ad->speaker_status == EINA_TRUE) {
+
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+       if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
                dbg("Speaker ON. Do not display lockscreen.");
                return;
        }
@@ -111,7 +115,7 @@ static void __callui_lock_screen_show_layout(lock_screen_data_t *lock_screen_pri
        evas_object_show(lock_screen_priv->layout);
 
 #ifdef _DBUS_DVC_LSD_TIMEOUT_
-       if (_callui_vm_get_cur_view_type(ad->view_manager_handle) != VIEW_TYPE_DIALLING) {
+       if (_callui_vm_get_cur_view_type(ad->view_manager) != VIEW_TYPE_DIALLING) {
                dbg("lcd show");
                _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_LOCKSCREEN_SET);
        }
@@ -132,7 +136,7 @@ static void __callui_lock_screen_hide_layout(lock_screen_data_t *lock_screen_pri
        lock_screen_priv->is_locked = false;
 
 #ifdef _DBUS_DVC_LSD_TIMEOUT_
-       if (_callui_vm_get_cur_view_type(ad->view_manager_handle) != VIEW_TYPE_DIALLING) {
+       if (_callui_vm_get_cur_view_type(ad->view_manager) != VIEW_TYPE_DIALLING) {
                dbg("lcd hide");
                _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_SET);
        }
@@ -159,7 +163,7 @@ static Eina_Bool __lock_timeout_cb(void *data)
 
        priv->no_lock_timer = NULL;
 
-       callui_view_type_e type = _callui_vm_get_cur_view_type(ad->view_manager_handle);
+       callui_view_type_e type = _callui_vm_get_cur_view_type(ad->view_manager);
        if (type >= VIEW_TYPE_MULTICALL_LIST) {
                return ECORE_CALLBACK_CANCEL;
        } else if (type == VIEW_TYPE_INCOMING_CALL || type == VIEW_TYPE_INCOMING_CALL_NOTI) {
@@ -184,11 +188,9 @@ static void __callui_lock_screen_user_action_cb(void *data, Evas *evas, Evas_Obj
 {
        dbg("__callui_lock_screen_user_action_cb");
        lock_screen_data_t *priv = (lock_screen_data_t *)data;
-       if (priv->no_lock_timer) {
-               ecore_timer_del(priv->no_lock_timer);
-               priv->no_lock_timer = NULL;
-               priv->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, priv);
-       }
+       DELETE_ECORE_TIMER(priv->no_lock_timer);
+       priv->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, priv);
+
        return;
 }
 
@@ -234,10 +236,7 @@ static void __callui_lock_screen_start_timer(lock_screen_data_t *lock_screen_pri
        dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_screen_priv);
 
-       if (lock_screen_priv->no_lock_timer) {
-               ecore_timer_del(lock_screen_priv->no_lock_timer);
-               lock_screen_priv->no_lock_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(lock_screen_priv->no_lock_timer);
 
        lock_screen_priv->no_lock_timer = ecore_timer_add(3.0, __lock_timeout_cb, lock_screen_priv);
        return;
@@ -245,13 +244,9 @@ static void __callui_lock_screen_start_timer(lock_screen_data_t *lock_screen_pri
 
 static void __callui_lock_screen_stop_timer(lock_screen_data_t *lock_screen_priv)
 {
-       dbg("..");
        CALLUI_RETURN_IF_FAIL(lock_screen_priv);
 
-       if (lock_screen_priv->no_lock_timer) {
-               ecore_timer_del(lock_screen_priv->no_lock_timer);
-               lock_screen_priv->no_lock_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(lock_screen_priv->no_lock_timer);
        return;
 }
 
@@ -262,10 +257,7 @@ static void __callui_lock_screen_delete_layout(void *lock_h)
        lock_screen_data_t *lock_screen_handle = (lock_screen_data_t *)lock_h;
        evas_object_del(lock_screen_handle->layout);
        evas_object_del(lock_screen_handle->hit_rect);
-       if (lock_screen_handle->no_lock_timer) {
-               ecore_timer_del(lock_screen_handle->no_lock_timer);
-               lock_screen_handle->no_lock_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(lock_screen_handle->no_lock_timer);
        free(lock_screen_handle);
 
        return;
index cb12c3c..14a0611 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include "callui-view-manager.h"
+#include "callui-debug.h"
 #include "callui-view-dialing.h"
 #include "callui-view-single-call.h"
 #include "callui-view-callend.h"
@@ -26,6 +27,7 @@
 #include "callui-view-multi-call-list.h"
 #include "callui-view-quickpanel.h"
 #include "callui-common.h"
+#include "callui-state-provider.h"
 
 typedef call_view_data_base_t *(*new_view_data_cb) ();
 
@@ -36,10 +38,20 @@ struct _callui_vm {
 };
 typedef struct _callui_vm callui_vm_t;
 
-static int __callui_vm_destroy_cur_view(callui_vm_h vm);
-static int __callui_vm_create_update_view(callui_vm_h vm, callui_view_type_e type);
+static callui_result_e __callui_vm_init(callui_vm_h vm, callui_app_data_t *ad);
+static void __callui_vm_deinit(callui_vm_h vm);
 
-static call_view_data_base_t *_allocate_view(callui_view_type_e view_type)
+static callui_result_e __destroy_cur_view(callui_vm_h vm);
+static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e type);
+static call_view_data_base_t *__allocate_view(callui_view_type_e view_type);
+static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type);
+static callui_result_e __auto_change_view(callui_vm_h vm);
+static void __call_state_event_cb(void *user_data,
+               callui_call_event_type_e call_event_type,
+               unsigned int call_id,
+               callui_sim_slot_type_e sim_type);
+
+static call_view_data_base_t *__allocate_view(callui_view_type_e view_type)
 {
        switch (view_type)
        {
@@ -65,17 +77,116 @@ static call_view_data_base_t *_allocate_view(callui_view_type_e view_type)
        return NULL;
 }
 
-callui_vm_h _callui_vm_create(callui_app_data_t *ad)
+static void _lock_manager_unlock_cb(void *data)
 {
-       CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL);
+       callui_app_data_t *ad = data;
+       _callui_vm_change_view(ad->view_manager, VIEW_TYPE_ENDCALL);
+}
 
-       callui_vm_h vm = calloc(1, sizeof(callui_vm_t));
+static callui_result_e __auto_change_view(callui_vm_h vm)
+{
+       callui_app_data_t *ad = vm->ad;
 
-       CALLUI_RETURN_VALUE_IF_FAIL(vm, NULL);
+       const callui_call_state_data_t *active =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       const callui_call_state_data_t *held =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       const callui_call_state_data_t *incom =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+
+       if (ad->multi_call_list_end_clicked) {
+               ad->multi_call_list_end_clicked = false;
+
+               if (active && active->conf_member_count > 1) {
+                       return _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_LIST);
+               }
+       }
+
+       callui_result_e res = CALLUI_RESULT_FAIL;
+       if (incom) {
+               callui_view_type_e type = VIEW_TYPE_INCOMING_CALL;
+               callui_view_type_e cur_type = _callui_vm_get_cur_view_type(ad->view_manager);
+               if (_callui_common_get_idle_lock_type() == LOCK_TYPE_UNLOCK &&
+                               active == NULL &&
+                               held == NULL &&
+                               (cur_type == VIEW_TYPE_UNDEFINED || cur_type == VIEW_TYPE_ENDCALL)) {
+                       type = VIEW_TYPE_INCOMING_CALL_NOTI;
+               }
+               res =_callui_vm_change_view(ad->view_manager, type);
+       } else if (active) {
+               if (active->is_dialing) {
+                       res = _callui_vm_change_view(vm, VIEW_TYPE_DIALLING);
+               } else if (held) {
+                       res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_SPLIT);
+               } else if (active->conf_member_count > 1) {
+                       res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_CONF);
+               } else {
+                       res = _callui_vm_change_view(vm, VIEW_TYPE_SINGLECALL);
+               }
+       } else if (held) {
+               if (held->conf_member_count > 1) {
+                       res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_CONF);
+               } else {
+                       res = _callui_vm_change_view(vm, VIEW_TYPE_SINGLECALL);
+               }
+       } else {
+               const callui_call_state_data_t *last_call_data = _callui_stp_get_last_ended_call_data(ad->state_provider);
+               if (last_call_data && last_call_data->type != CALLUI_CALL_DATA_TYPE_INCOMING) {
+                       if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
+                               _callui_lock_manager_set_callback_on_unlock(ad->lock_handle, _lock_manager_unlock_cb, ad);
+                       } else {
+                               _callui_lock_manager_stop(ad->lock_handle);
+                               _callui_vm_change_view(vm, VIEW_TYPE_ENDCALL);
+                       }
+               } else {
+                       _callui_common_exit_app();
+               }
+       }
+       return res;
+}
 
+static void __call_state_event_cb(void *user_data,
+               callui_call_event_type_e call_event_type,
+               unsigned int call_id,
+               callui_sim_slot_type_e sim_type)
+{
+       CALLUI_RETURN_IF_FAIL(user_data);
+
+       __auto_change_view(user_data);
+}
+
+static callui_result_e __callui_vm_init(callui_vm_h vm, callui_app_data_t *ad)
+{
        vm->cur_view_type = VIEW_TYPE_UNDEFINED;
        vm->ad = ad;
 
+       callui_result_e res = _callui_stp_add_call_state_event_cb(ad->state_provider,
+                       __call_state_event_cb, vm);
+       CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
+
+       return res;
+}
+
+static void __callui_vm_deinit(callui_vm_h vm)
+{
+       callui_app_data_t *ad = vm->ad;
+
+       _callui_stp_remove_call_state_event_cb(ad->state_provider, __call_state_event_cb, vm);
+
+       __destroy_cur_view(vm);
+}
+
+callui_vm_h _callui_vm_create(callui_app_data_t *ad)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(ad, NULL);
+
+       callui_vm_h vm = calloc(1, sizeof(callui_vm_t));
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, NULL);
+
+       callui_result_e res = __callui_vm_init(vm, ad);
+       if (res != CALLUI_RESULT_OK) {
+               FREE(vm);
+       }
        return vm;
 }
 
@@ -83,7 +194,7 @@ void _callui_vm_destroy(callui_vm_h vm)
 {
        CALLUI_RETURN_IF_FAIL(vm);
 
-       __callui_vm_destroy_cur_view(vm);
+       __callui_vm_deinit(vm);
 
        free(vm);
 }
@@ -97,9 +208,9 @@ callui_view_type_e _callui_vm_get_cur_view_type(callui_vm_h vm)
        return vm->cur_view_type;
 }
 
-static int __callui_vm_destroy_cur_view(callui_vm_h vm)
+static callui_result_e __destroy_cur_view(callui_vm_h vm)
 {
-       int res = CALLUI_RESULT_FAIL;
+       callui_result_e res = CALLUI_RESULT_FAIL;
 
        call_view_data_base_t *view = vm->cur_view;
 
@@ -116,15 +227,15 @@ static int __callui_vm_destroy_cur_view(callui_vm_h vm)
        return res;
 }
 
-static int __callui_vm_create_update_view(callui_vm_h vm, callui_view_type_e type)
+static callui_result_e __create_update_view(callui_vm_h vm, callui_view_type_e type)
 {
        call_view_data_base_t *view = vm->cur_view;
-       int res;
+       callui_result_e res;
 
        if (!view) {
                dbg("Try create new view [%d]", type);
 
-               view = _allocate_view(type);
+               view = __allocate_view(type);
                CALLUI_RETURN_VALUE_IF_FAIL(view, CALLUI_RESULT_FAIL);
 
                if (!view->onCreate) {
@@ -150,7 +261,7 @@ static int __callui_vm_create_update_view(callui_vm_h vm, callui_view_type_e typ
        return CALLUI_RESULT_OK;
 }
 
-int _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type)
+static callui_result_e __change_view(callui_vm_h vm, callui_view_type_e type)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
 
@@ -161,83 +272,46 @@ int _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type)
 
        info("Change view: [%d] -> [%d]", vm->cur_view_type, type);
 
-       int res;
+       callui_result_e res;
        callui_view_type_e last_view_type = vm->cur_view_type;
 
        if ((last_view_type != VIEW_TYPE_UNDEFINED) && (last_view_type != type)) {
                dbg("destroy [%d]", last_view_type);
-               res = __callui_vm_destroy_cur_view(vm);
+               res = __destroy_cur_view(vm);
                CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
        }
 
-       res = __callui_vm_create_update_view(vm, type);
+       res = __create_update_view(vm, type);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        vm->cur_view_type = type;
 
-       if (type == VIEW_TYPE_DIALLING || type == VIEW_TYPE_INCOMING_CALL) {
+       if (type == VIEW_TYPE_DIALLING
+                       || type == VIEW_TYPE_INCOMING_CALL
+                       || type == VIEW_TYPE_INCOMING_CALL_NOTI) {
                elm_win_activate(vm->ad->win);
        }
 
-       if (type == VIEW_TYPE_INCOMING_CALL_NOTI) {
-               vm->ad->incoming_noti = true;
-       }
-
-       if (type != VIEW_TYPE_ENDCALL) {
-               // TODO: temp solution. Need to be replaced in future
-               _callui_qp_mc_update(vm->ad->qp_minicontrol);
-       }
-
        evas_object_show(vm->ad->win);
-       return CALLUI_RESULT_OK;
+
+       return res;
 }
 
-int _callui_vm_auto_change_view(callui_vm_h vm)
+callui_result_e _callui_vm_change_view(callui_vm_h vm, callui_view_type_e type)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
 
-       callui_app_data_t *ad = vm->ad;
-
-       if (ad->multi_call_list_end_clicked) {
-               ad->multi_call_list_end_clicked = false;
-               if (ad->active && ad->active->member_count > 1) {
-                       return _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_LIST);
-               }
+       if ((type <= VIEW_TYPE_UNDEFINED) || (type >= VIEW_TYPE_MAX)) {
+               err("Invalid view type [%d]", type);
+               return CALLUI_RESULT_INVALID_PARAM;
        }
 
-       int res;
-       if (ad->incom) {
+       return __change_view(vm, type);
+}
 
-               callui_view_type_e type = VIEW_TYPE_INCOMING_CALL;
+callui_result_e _callui_vm_auto_change_view(callui_vm_h vm)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(vm, CALLUI_RESULT_INVALID_PARAM);
 
-#ifdef ACTIVE_NOTIFICATION_AVAILABLE
-               if (_callui_common_get_idle_lock_type() == LOCK_TYPE_UNLOCK &&
-                               ad->active == NULL &&
-                               ad->held == NULL &&
-                               ad->incoming_noti == false) {
-                       type = VIEW_TYPE_INCOMING_CALL_NOTI;
-               }
-#endif
-               res =_callui_vm_change_view(ad->view_manager_handle, type);
-       } else if (ad->active) {
-               if (CM_CALL_STATE_DIALING == ad->active->call_state) {
-                       res = _callui_vm_change_view(vm, VIEW_TYPE_DIALLING);
-               } else if (ad->held) {
-                       res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_SPLIT);
-               } else if (ad->active->member_count > 1) {
-                       res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_CONF);
-               } else {
-                       res = _callui_vm_change_view(vm, VIEW_TYPE_SINGLECALL);
-               }
-       } else if (ad->held) {
-               if (ad->held->member_count > 1) {
-                       res = _callui_vm_change_view(vm, VIEW_TYPE_MULTICALL_CONF);
-               } else {
-                       res = _callui_vm_change_view(vm, VIEW_TYPE_SINGLECALL);
-               }
-       } else {
-               err("No call exist");
-               res = CALLUI_RESULT_FAIL;
-       }
-       return res;
+       return __auto_change_view(vm);
 }
index 23cf115..d4a48b8 100755 (executable)
  */
 
 #include <Elementary.h>
+#include <efl_extension.h>
 
 #include "callui-view-multi-call-conf.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-common.h"
 #include "callui-view-elements.h"
 #include "callui-view-layout.h"
 #include "callui-keypad.h"
+#include "callui-state-provider.h"
 
 #define CALLUI_BUF_MEMBER_SIZE 512
 #define CALLUI_BUF_STATUS_SIZE 129
@@ -37,17 +40,18 @@ struct _callui_view_mc_conf {
 
 typedef struct _callui_view_mc_conf _callui_view_mc_conf_t;
 
-static int __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_multi_call_conf_onupdate(call_view_data_base_t *view_data);
-static int __callui_view_multi_call_conf_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_multi_call_conf_onupdate(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_multi_call_conf_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_mc_conf_h vd);
-static int __update_displayed_data(callui_view_mc_conf_h vd);
+static callui_result_e __create_main_content(callui_view_mc_conf_h vd);
+static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd);
 
 static void __manage_calls_btn_clicked_cb(void *data, Evas_Object *o, const char *emission, const char *source);
 static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __more_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __keypad_show_state_change_cd(void *data, Eina_Bool visibility);
+static Eina_Bool __call_duration_timer_cb(void* data);
 
 callui_view_mc_conf_h _callui_view_multi_call_conf_new()
 {
@@ -61,7 +65,7 @@ callui_view_mc_conf_h _callui_view_multi_call_conf_new()
        return mc_list_conf;
 }
 
-static int __create_main_content(callui_view_mc_conf_h vd)
+static callui_result_e __create_main_content(callui_view_mc_conf_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
@@ -98,7 +102,7 @@ static int __create_main_content(callui_view_mc_conf_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static int __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -106,51 +110,84 @@ static int __callui_view_multi_call_conf_oncreate(call_view_data_base_t *view_da
        callui_view_mc_conf_h vd = (callui_view_mc_conf_h)view_data;
        view_data->ad = (callui_app_data_t *)appdata;
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return __update_displayed_data(vd);
 }
 
-static int __callui_view_multi_call_conf_onupdate(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_multi_call_conf_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
-       callui_view_mc_conf_h vd = (callui_view_mc_conf_h)view_data;
+       return __update_displayed_data((callui_view_mc_conf_h)view_data);
+}
 
-       return __update_displayed_data(vd);
+static Eina_Bool __call_duration_timer_cb(void* data)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(data, ECORE_CALLBACK_CANCEL);
+
+       callui_view_mc_conf_h vd = data;
+
+       struct tm *new_tm = _callui_stp_get_call_duration(vd->base_view.ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!new_tm) {
+               vd->base_view.call_duration_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       _callui_common_try_update_call_duration_time(vd->base_view.call_duration_tm,
+                       new_tm,
+                       _callui_common_set_call_duration_time,
+                       vd->base_view.contents,
+                       "call_txt_status");
+
+       free(new_tm);
+
+       return ECORE_CALLBACK_RENEW;
 }
 
-static int __update_displayed_data(callui_view_mc_conf_h vd)
+static callui_result_e __update_displayed_data(callui_view_mc_conf_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
        char buf[CALLUI_BUF_MEMBER_SIZE] = { 0 };
        char status_txt[CALLUI_BUF_STATUS_SIZE] = { 0 };
-       call_data_t *call_data = NULL;
-       Eina_Bool is_held;
-
-       if (ad->active) {
-               call_data = ad->active;
-               is_held = EINA_FALSE;
-       } else if (ad->held) {
-               call_data = ad->held;
+
+       Eina_Bool is_held = EINA_FALSE;
+
+       const callui_call_state_data_t *call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!call_data) {
+               call_data = _callui_stp_get_call_data(ad->state_provider,
+                               CALLUI_CALL_DATA_TYPE_HELD);
                is_held = EINA_TRUE;
        }
        CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
 
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       FREE(vd->base_view.call_duration_tm);
+
        if (is_held) {
                snprintf(status_txt, sizeof(status_txt), _("IDS_CALL_BODY_ON_HOLD_ABB"));
                _callui_show_caller_info_status(ad, status_txt);
                elm_object_signal_emit(vd->caller_info, "set-hold-state", "call-screen");
+
        } else {
                elm_object_signal_emit(vd->caller_info, "set-unhold-state", "call-screen");
+
+               vd->base_view.call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+               CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_tm, CALLUI_RESULT_ALLOCATION_FAIL);
+
+               _callui_common_set_call_duration_time(vd->base_view.call_duration_tm, vd->base_view.contents, "call_txt_status");
+
+               vd->base_view.call_duration_timer = ecore_timer_add(0.1, __call_duration_timer_cb, vd);
+               CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_timer, CALLUI_RESULT_ALLOCATION_FAIL);
        }
 
        elm_object_signal_emit(vd->caller_info, "set_conference_mode", "");
        _callui_show_caller_info_name(ad, _("IDS_CALL_BODY_CONFERENCE"));
        char *status = _("IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB");
-       snprintf(buf, CALLUI_BUF_MEMBER_SIZE, status, call_data->member_count);
+       snprintf(buf, CALLUI_BUF_MEMBER_SIZE, status, call_data->conf_member_count);
        _callui_show_caller_info_number(ad, buf);
 
        if (is_held) {
@@ -187,13 +224,16 @@ static int __update_displayed_data(callui_view_mc_conf_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static int __callui_view_multi_call_conf_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_multi_call_conf_ondestroy(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        callui_view_mc_conf_h vd = (callui_view_mc_conf_h)view_data;
        callui_app_data_t *ad = vd->base_view.ad;
 
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       free(vd->base_view.call_duration_tm);
+
        if (ad->ctxpopup) {
                elm_ctxpopup_dismiss(ad->ctxpopup);
                ad->ctxpopup = NULL;
@@ -216,7 +256,7 @@ static void __manage_calls_btn_clicked_cb(void *data, Evas_Object *o, const char
        callui_view_mc_conf_h vd = (callui_view_mc_conf_h)data;
        callui_app_data_t *ad = vd->base_view.ad;
 
-       _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_MULTICALL_LIST);
+       _callui_vm_change_view(ad->view_manager, VIEW_TYPE_MULTICALL_LIST);
        return;
 }
 
@@ -226,9 +266,10 @@ static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_in
        callui_view_mc_conf_h vd = (callui_view_mc_conf_h)data;
        callui_app_data_t *ad = vd->base_view.ad;
 
-       int ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_CALLS);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_end_call() is failed");
+       callui_result_e res = _callui_manager_end_call(ad->call_manager,
+                       0, CALLUI_CALL_RELEASE_TYPE_ALL_CALLS);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_end_call() failed. res[%d]", res);
        }
 }
 
index e3d087c..aa04410 100755 (executable)
  */
 
 #include <Elementary.h>
+#include <efl_extension.h>
 
 #include "callui-view-multi-call-list.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-common.h"
 #include "callui-view-elements.h"
 #include "callui-view-layout.h"
+#include "callui-state-provider.h"
 
 #define CALLUI_APP_DATA_NAME "multi_call_app_data"
 
@@ -29,22 +32,22 @@ struct _callui_view_mc_list {
        call_view_data_base_t base_view;
 
        Evas_Object *call_genlist;
-       GSList *call_list;
        Elm_Genlist_Item_Class *call_genlist_itc;
+       Eina_List *conf_call_list;
 };
 typedef struct _callui_view_mc_list _callui_view_mc_list_t;
 
-static int __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_multi_call_list_onupdate(call_view_data_base_t *view_data);
-static int __callui_view_multi_call_list_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_multi_call_list_onupdate(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_multi_call_list_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_mc_list_h vd);
-static int __update_displayed_data(callui_view_mc_list_h vd);
+static callui_result_e __create_main_content(callui_view_mc_list_h vd);
+static callui_result_e __update_displayed_data(callui_view_mc_list_h vd);
 
 static void __caller_genlist_init_item_class(callui_view_mc_list_h vd);
 static void __caller_genlist_deinit_item_class(callui_view_mc_list_h vd);
 
-static int __caller_genlist_add(callui_view_mc_list_h vd);
+static callui_result_e __caller_genlist_add(callui_view_mc_list_h vd);
 static void __caller_genlist_clear(callui_view_mc_list_h vd);
 static void __caller_genlist_fill(callui_view_mc_list_h vd);
 
@@ -55,7 +58,7 @@ static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_in
 static void __split_call_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 
 static void __back_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
-static void __list_free_cb(gpointer data);
+static Eina_Bool __call_duration_timer_cb(void* data);
 
 callui_view_mc_list_h _callui_view_multi_call_list_new()
 {
@@ -69,7 +72,7 @@ callui_view_mc_list_h _callui_view_multi_call_list_new()
        return mc_list_view;
 }
 
-static int __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -77,33 +80,75 @@ static int __callui_view_multi_call_list_oncreate(call_view_data_base_t *view_da
        callui_view_mc_list_h vd = (callui_view_mc_list_h)view_data;
        view_data->ad = (callui_app_data_t *)appdata;
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return __update_displayed_data(vd);
 }
 
-static int __callui_view_multi_call_list_onupdate(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_multi_call_list_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
-       callui_view_mc_list_h vd = (callui_view_mc_list_h)view_data;
+       return __update_displayed_data((callui_view_mc_list_h)view_data);
+}
 
-       return __update_displayed_data(vd);
+static void __clear_conference_call_list(Eina_List **conf_list)
+{
+       Eina_List *l;
+       callui_conf_call_data_t *data;
+
+       EINA_LIST_FOREACH(*conf_list, l, data) {
+               free(data);
+       }
+       *conf_list = eina_list_free(*conf_list);
 }
 
-static int __update_displayed_data(callui_view_mc_list_h vd)
+static Eina_Bool __call_duration_timer_cb(void* data)
 {
-       callui_app_data_t *ad = vd->base_view.ad;
+       CALLUI_RETURN_VALUE_IF_FAIL(data, ECORE_CALLBACK_CANCEL);
+
+       callui_view_mc_list_h vd = data;
 
-       g_slist_free_full(vd->call_list, __list_free_cb);
+       struct tm *new_tm = _callui_stp_get_call_duration(vd->base_view.ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!new_tm) {
+               vd->base_view.call_duration_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       _callui_common_try_update_call_duration_time(vd->base_view.call_duration_tm,
+                       new_tm,
+                       _callui_common_set_call_duration_time,
+                       vd->base_view.contents,
+                       "call_txt_status");
+
+       free(new_tm);
+
+       return ECORE_CALLBACK_RENEW;
+}
 
-       int res = cm_get_conference_call_list(ad->cm_handle, &vd->call_list);
-       CALLUI_RETURN_VALUE_IF_FAIL(res == CM_ERROR_NONE, CALLUI_RESULT_FAIL);
-       CALLUI_RETURN_VALUE_IF_FAIL(vd->call_list, CALLUI_RESULT_FAIL);
+static callui_result_e __update_displayed_data(callui_view_mc_list_h vd)
+{
+       callui_app_data_t *ad = vd->base_view.ad;
 
        __caller_genlist_clear(vd);
 
+       __clear_conference_call_list(&vd->conf_call_list);
+
+       vd->conf_call_list = _callui_stp_get_conference_call_list(ad->state_provider);
+       CALLUI_RETURN_VALUE_IF_FAIL(vd->conf_call_list, CALLUI_RESULT_FAIL);
+
+       FREE(vd->base_view.call_duration_tm);
+       vd->base_view.call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_tm, CALLUI_RESULT_ALLOCATION_FAIL);
+
+       _callui_common_set_call_duration_time(vd->base_view.call_duration_tm, vd->base_view.contents, "call_txt_status");
+
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       vd->base_view.call_duration_timer = ecore_timer_add(0.1, __call_duration_timer_cb, vd);
+       CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_timer, CALLUI_RESULT_ALLOCATION_FAIL);
+
        __caller_genlist_init_item_class(vd);
        __caller_genlist_fill(vd);
        __caller_genlist_deinit_item_class(vd);
@@ -116,13 +161,16 @@ static int __update_displayed_data(callui_view_mc_list_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static int __callui_view_multi_call_list_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_multi_call_list_ondestroy(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        callui_view_mc_list_h vd = (callui_view_mc_list_h)view_data;
 
-       g_slist_free_full(vd->call_list, __list_free_cb);
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       free(vd->base_view.call_duration_tm);
+
+       __clear_conference_call_list(&vd->conf_call_list);
 
        DELETE_EVAS_OBJECT(vd->base_view.contents);
 
@@ -131,7 +179,7 @@ static int __callui_view_multi_call_list_ondestroy(call_view_data_base_t *view_d
        return CALLUI_RESULT_OK;
 }
 
-static int __create_main_content(callui_view_mc_list_h vd)
+static callui_result_e __create_main_content(callui_view_mc_list_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
@@ -150,7 +198,7 @@ static int __create_main_content(callui_view_mc_list_h vd)
        evas_object_smart_callback_add(back_btn, "clicked", __back_btn_click_cb, ad);
        evas_object_show(back_btn);
 
-       int res = __caller_genlist_add(vd);
+       callui_result_e res = __caller_genlist_add(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        return CALLUI_RESULT_OK;
@@ -162,15 +210,15 @@ static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_in
        callui_app_data_t *ad = (callui_app_data_t *)evas_object_data_get(obj, CALLUI_APP_DATA_NAME);
        CALLUI_RETURN_IF_FAIL(ad);
 
-       cm_conf_call_data_t *call_data = (cm_conf_call_data_t *)data;
-
-       unsigned int call_id = 0;
-       cm_conf_call_data_get_call_id(call_data, &call_id);
+       callui_conf_call_data_t *call_data = (callui_conf_call_data_t *)data;
 
-       int ret = cm_end_call(ad->cm_handle, call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_end_call() get failed with err[%d]", ret);
+       callui_result_e res = _callui_manager_end_call(ad->call_manager,
+                       call_data->call_id,
+                       CALLUI_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_end_call() failed. res[%d]", res);
        }
+
        ad->multi_call_list_end_clicked = true;
 }
 
@@ -180,14 +228,11 @@ static void __split_call_btn_click_cb(void *data, Evas_Object *obj, void *event_
        callui_app_data_t *ad = (callui_app_data_t *)evas_object_data_get(obj, CALLUI_APP_DATA_NAME);
        CALLUI_RETURN_IF_FAIL(ad);
 
-       cm_conf_call_data_t *call_data = (cm_conf_call_data_t *)data;
-
-       unsigned int call_id = 0;
-       cm_conf_call_data_get_call_id(call_data, &call_id);
+       callui_conf_call_data_t *call_data = (callui_conf_call_data_t *)data;
 
-       int ret = cm_split_call(ad->cm_handle, call_id);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_split_call() get failed with err[%d]", ret);
+       callui_result_e res = _callui_manager_split_call(ad->call_manager, call_data->call_id);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_split_call() failed. res[%d]", res);
        }
 }
 
@@ -197,7 +242,7 @@ static Evas_Object *__caller_genlist_content_cb(void *data, Evas_Object *obj, co
        callui_app_data_t *ad = (callui_app_data_t *)evas_object_data_get(obj, CALLUI_APP_DATA_NAME);
        CALLUI_RETURN_NULL_IF_FAIL(ad);
 
-       cm_conf_call_data_t *call_data = (cm_conf_call_data_t *)data;
+       callui_conf_call_data_t *call_data = (callui_conf_call_data_t *)data;
 
        Evas_Object *img = NULL;
        if ((strcmp(part, "elm.swallow.end") == 0)) {
@@ -208,7 +253,13 @@ static Evas_Object *__caller_genlist_content_cb(void *data, Evas_Object *obj, co
                evas_object_smart_callback_add(img, "clicked", __end_call_btn_click_cb, call_data);
                evas_object_data_set(img, CALLUI_APP_DATA_NAME, ad);
        } else if (strcmp(part, "elm.swallow.icon") == 0) {
-               if (ad->held || ad->active->member_count < 3) {
+
+               const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider,
+                               CALLUI_CALL_DATA_TYPE_ACTIVE);
+               const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider,
+                               CALLUI_CALL_DATA_TYPE_HELD);
+
+               if (held || (active && active->conf_member_count < 3)) {
                        return NULL;
                }
                img = elm_image_add(obj);
@@ -218,16 +269,9 @@ static Evas_Object *__caller_genlist_content_cb(void *data, Evas_Object *obj, co
                evas_object_smart_callback_add(img, "clicked", __split_call_btn_click_cb, call_data);
                evas_object_data_set(img, CALLUI_APP_DATA_NAME, ad);
        } else if ((strcmp(part, "elm.swallow.icon.0") == 0)) {
-               call_contact_data_t ct_info = {0,};
                char *file_path = "default";
-               int person_id = -1;
-
-               int res = cm_conf_call_data_get_person_id(call_data, &person_id);
-               if (res == CM_ERROR_NONE && person_id != -1) {
-                       _callui_common_get_contact_info(person_id, &ct_info);
-                       if (strlen(ct_info.caller_id_path) > 0) {
-                               file_path = ct_info.caller_id_path;
-                       }
+               if (strlen(call_data->call_ct_info.caller_id_path) > 0) {
+                       file_path = call_data->call_ct_info.caller_id_path;
                }
                img = _callui_create_thumbnail_with_size(obj, file_path, THUMBNAIL_98, true);
        }
@@ -236,21 +280,15 @@ static Evas_Object *__caller_genlist_content_cb(void *data, Evas_Object *obj, co
 
 static char *__caller_genlist_txt_cb(void *data, Evas_Object *obj, const char *part)
 {
-       cm_conf_call_data_t *call_data = (cm_conf_call_data_t *)data;
-       int person_id = -1;
-       char *call_number = NULL;
+       callui_conf_call_data_t *call_data = (callui_conf_call_data_t *)data;
+
        dbg("__caller_genlist_txt_cb %s ", part);
        if (strcmp(part, "elm.text") == 0) {
-               cm_conf_call_data_get_person_id(call_data, &person_id);
-               if (person_id != -1) {
-                       call_contact_data_t ct_info = { 0 };
-                       _callui_common_get_contact_info(person_id, &ct_info);
-                       if (strlen(ct_info.call_disp_name) > 0) {
-                               return strdup(ct_info.call_disp_name);
-                       }
+               if (strlen(call_data->call_ct_info.call_disp_name) > 0) {
+                       return strdup(call_data->call_ct_info.call_disp_name);
+               } else {
+                       return strdup(call_data->call_num);
                }
-               cm_conf_call_data_get_call_number(call_data, &call_number);
-               return strdup(call_number);
        } else {
                return NULL;
        }
@@ -273,7 +311,7 @@ static void __caller_genlist_deinit_item_class(callui_view_mc_list_h vd)
        vd->call_genlist_itc = NULL;
 }
 
-static int __caller_genlist_add(callui_view_mc_list_h vd)
+static callui_result_e __caller_genlist_add(callui_view_mc_list_h vd)
 {
        Evas_Object *genlist = elm_genlist_add(vd->base_view.contents);
        CALLUI_RETURN_VALUE_IF_FAIL(genlist, CALLUI_RESULT_ALLOCATION_FAIL);
@@ -296,16 +334,20 @@ static void __caller_genlist_clear(callui_view_mc_list_h vd)
 
 static void __caller_genlist_fill(callui_view_mc_list_h vd)
 {
-       CALLUI_RETURN_IF_FAIL(vd->call_list);
-
-       int list_len = g_slist_length(vd->call_list);
-       Elm_Object_Item *item = NULL;
-       cm_conf_call_data_t *call_data = NULL;
-       int idx = 0;
-
-       for (; idx < list_len; idx++) {
-               call_data = (cm_conf_call_data_t *)g_slist_nth_data(vd->call_list, idx);
-               item = elm_genlist_item_append(vd->call_genlist, vd->call_genlist_itc, (void *)call_data, NULL, ELM_GENLIST_ITEM_NONE, NULL, NULL);
+       CALLUI_RETURN_IF_FAIL(vd->conf_call_list);
+
+       Elm_Object_Item *item;
+       Eina_List *l;
+       callui_conf_call_data_t *data;
+
+       EINA_LIST_FOREACH(vd->conf_call_list, l, data) {
+               item = elm_genlist_item_append(vd->call_genlist,
+                               vd->call_genlist_itc,
+                               (void *)data,
+                               NULL,
+                               ELM_GENLIST_ITEM_NONE,
+                               NULL,
+                               NULL);
                elm_genlist_item_select_mode_set(item, ELM_OBJECT_SELECT_MODE_DISPLAY_ONLY);
        }
 }
@@ -313,11 +355,5 @@ static void __caller_genlist_fill(callui_view_mc_list_h vd)
 static void __back_btn_click_cb(void *data, Evas_Object *obj, void *event_info)
 {
        callui_app_data_t *ad = (callui_app_data_t *)data;
-       _callui_vm_auto_change_view(ad->view_manager_handle);
-}
-
-static void __list_free_cb(gpointer data)
-{
-       cm_conf_call_data_t *call_data = (cm_conf_call_data_t *)data;
-       cm_conf_call_data_free(call_data);
+       _callui_vm_auto_change_view(ad->view_manager);
 }
index dc8f076..b44c9cc 100755 (executable)
 #include <Elementary.h>
 
 #include "callui-view-multi-call-split.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-keypad.h"
 #include "callui-common.h"
 #include "callui-view-caller-info-defines.h"
 #include "callui-view-elements.h"
+#include "callui-state-provider.h"
 
 #define BUF_SIZE 256
 
@@ -36,28 +38,29 @@ struct _callui_view_mc_split {
 };
 typedef struct _callui_view_mc_split _callui_view_mc_split_t;
 
-static int _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_data);
-static int _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_data);
+static callui_result_e _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(callui_view_mc_split_h vd);
-static int __update_displayed_data(callui_view_mc_split_h vd);
+static callui_result_e __create_main_content(callui_view_mc_split_h vd);
+static callui_result_e __update_displayed_data(callui_view_mc_split_h vd);
 
 static Evas_Object *__create_merge_swap_btn(Evas_Object *parent, const char *name, const char *text);
 
-static void __update_hold_active_layout(Evas_Object *layout, call_data_t *call_data);
-static void __fill_one_contact_layout(Evas_Object *parent, call_data_t *call_data);
-static void __fill_conference_layout(Evas_Object *parent, call_data_t *call_data);
+static void __update_hold_active_layout(Evas_Object *layout, const callui_call_state_data_t *call_data);
+static void __fill_one_contact_layout(Evas_Object *parent, const callui_call_state_data_t *call_data);
+static void __fill_conference_layout(Evas_Object *parent, const callui_call_state_data_t *call_data);
 static void __set_hold_info(Evas_Object *parent, Evas_Object *content);
 static void __set_active_info(Evas_Object *parent, Evas_Object *content, callui_app_data_t *ad);
 
-static int __create_merge_swap_btns(Evas_Object *parent, callui_app_data_t *ad);
+static callui_result_e __create_merge_swap_btns(Evas_Object *parent, callui_app_data_t *ad);
 
 static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __mng_callers_btn_click_cb(void *data, Evas_Object *obj, const char *emission, const char *src);
 static void __merge_btn_click_cb(void *data, Evas_Object *obj, const char *emission, const char *src);
 static void __swap_btn_click_cb(void *data, Evas_Object *obj, const char *emission, const char *src);
 static void __keypad_show_state_change_cd(void *data, Eina_Bool visibility);
+static Eina_Bool __call_duration_timer_cb(void* data);
 
 callui_view_mc_split_h _callui_view_multi_call_split_new()
 {
@@ -71,7 +74,7 @@ callui_view_mc_split_h _callui_view_multi_call_split_new()
        return mc_split_view;
 }
 
-static int _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -81,7 +84,7 @@ static int _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_da
 
        vd->base_view.ad = ad;
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        _callui_lock_manager_start(ad->lock_handle);
@@ -89,7 +92,7 @@ static int _callui_view_multi_call_split_oncreate(call_view_data_base_t *view_da
        return __update_displayed_data(vd);
 }
 
-static int _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_data)
+static callui_result_e _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
@@ -101,13 +104,17 @@ static int _callui_view_multi_call_split_onupdate(call_view_data_base_t *view_da
        return  __update_displayed_data(vd);
 }
 
-static int _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        callui_view_mc_split_h vd = (callui_view_mc_split_h)view_data;
        callui_app_data_t *ad = vd->base_view.ad;
 
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+
+       free(vd->base_view.call_duration_tm);
+
        DELETE_EVAS_OBJECT(vd->base_view.contents);
 
        _callui_keypad_hide_immediately(ad->keypad);
@@ -119,7 +126,7 @@ static int _callui_view_multi_call_split_ondestroy(call_view_data_base_t *view_d
 }
 
 
-static int __create_main_content(callui_view_mc_split_h vd)
+static callui_result_e __create_main_content(callui_view_mc_split_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
@@ -137,7 +144,7 @@ static int __create_main_content(callui_view_mc_split_h vd)
        vd->active_layout = _callui_load_edj(vd->caller_info, EDJ_NAME, GROUP_ACTIVE_HOLD_INFO);
        CALLUI_RETURN_VALUE_IF_FAIL(vd->active_layout, CALLUI_RESULT_ALLOCATION_FAIL);
 
-       int res = __create_merge_swap_btns(vd->caller_info, ad);
+       callui_result_e res = __create_merge_swap_btns(vd->caller_info, ad);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        Evas_Object *btn_region = _callui_load_edj(vd->base_view.contents, EDJ_NAME, GRP_BUTTON_LAYOUT);
@@ -163,16 +170,16 @@ static Evas_Object *__create_merge_swap_btn(Evas_Object *parent, const char *nam
        return layout;
 }
 
-static void __update_hold_active_layout(Evas_Object *layout, call_data_t *call_data)
+static void __update_hold_active_layout(Evas_Object *layout, const callui_call_state_data_t *call_data)
 {
-       if (call_data->member_count == 1) {
+       if (call_data->conf_member_count == 1) {
                __fill_one_contact_layout(layout, call_data);
        } else {
                __fill_conference_layout(layout, call_data);
        }
 }
 
-static void __fill_one_contact_layout(Evas_Object *parent, call_data_t *call_data)
+static void __fill_one_contact_layout(Evas_Object *parent, const callui_call_state_data_t *call_data)
 {
        const char *pic_path = call_data->call_ct_info.caller_id_path;
        const char *main_text = call_data->call_ct_info.call_disp_name;
@@ -190,7 +197,7 @@ static void __fill_one_contact_layout(Evas_Object *parent, call_data_t *call_dat
        }
 }
 
-static void __fill_conference_layout(Evas_Object *parent, call_data_t *call_data)
+static void __fill_conference_layout(Evas_Object *parent, const callui_call_state_data_t *call_data)
 {
        Evas_Object *thumbnail = _callui_create_thumbnail(parent, NULL, CONFERENCE_THUMBNAIL_138);
        elm_object_part_content_set(parent, PART_SWALLOW_CALLER_ID, thumbnail);
@@ -199,7 +206,7 @@ static void __fill_conference_layout(Evas_Object *parent, call_data_t *call_data
 
        char buffer[BUF_SIZE] = { 0 };
        const char *fmt = _("IDS_CALL_BODY_WITH_PD_PEOPLE_M_CONFERENCE_CALL_ABB");
-       snprintf(buffer, BUF_SIZE, fmt, call_data->member_count);
+       snprintf(buffer, BUF_SIZE, fmt, call_data->conf_member_count);
        elm_object_part_text_set(parent, PART_TEXT_SUB, buffer);
 }
 
@@ -217,13 +224,17 @@ static void __set_active_info(Evas_Object *parent, Evas_Object *content, callui_
 
        elm_object_part_content_set(parent, PART_SWALLOW_ACTIVE_INFO, content);
        elm_object_signal_emit(content, SIGNAL_SET_TRANSPARENT_BACKGROUND, "");
-       if (ad->active->member_count > 1) {
+
+       const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+
+       if (active && active->conf_member_count > 1) {
                elm_object_signal_emit(content, SIGNAL_SHOW_ARROW, "");
                elm_object_signal_callback_add(content, "mouse,up,*", "arrow", __mng_callers_btn_click_cb, ad);
        }
 }
 
-static int __create_merge_swap_btns(Evas_Object *parent, callui_app_data_t *ad)
+static callui_result_e __create_merge_swap_btns(Evas_Object *parent, callui_app_data_t *ad)
 {
        Evas_Object *merge = __create_merge_swap_btn(parent, GROUP_MERGE_BTN, _("IDS_CALL_BODY_MERGE_T_CALL"));
        CALLUI_RETURN_VALUE_IF_FAIL(merge, CALLUI_RESULT_ALLOCATION_FAIL);
@@ -245,22 +256,63 @@ static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_in
        callui_view_mc_split_h vd = (callui_view_mc_split_h)data;
        callui_app_data_t *ad = vd->base_view.ad;
 
-       int ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_end_call() is failed");
+       callui_result_e res = _callui_manager_end_call(ad->call_manager,
+                       0, CALLUI_CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_end_call() failed. res[%d]", res);
+       }
+}
+
+static Eina_Bool __call_duration_timer_cb(void* data)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(data, ECORE_CALLBACK_CANCEL);
+
+       callui_view_mc_split_h vd = data;
+
+       struct tm *new_tm = _callui_stp_get_call_duration(vd->base_view.ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!new_tm) {
+               vd->base_view.call_duration_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
        }
+
+       _callui_common_try_update_call_duration_time(vd->base_view.call_duration_tm,
+                       new_tm,
+                       _callui_common_set_call_duration_time,
+                       vd->active_layout,
+                       PART_TEXT_STATUS);
+
+       free(new_tm);
+
+       return ECORE_CALLBACK_RENEW;
 }
 
-static int __update_displayed_data(callui_view_mc_split_h vd)
+static callui_result_e __update_displayed_data(callui_view_mc_split_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
 
-       __update_hold_active_layout(vd->hold_layout, ad->held);
+       const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       CALLUI_RETURN_VALUE_IF_FAIL(active, CALLUI_RESULT_FAIL);
+       const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       CALLUI_RETURN_VALUE_IF_FAIL(held, CALLUI_RESULT_FAIL);
+
+       __update_hold_active_layout(vd->hold_layout, held);
        __set_hold_info(vd->caller_info, vd->hold_layout);
 
-       __update_hold_active_layout(vd->active_layout, ad->active);
+       __update_hold_active_layout(vd->active_layout, active);
        __set_active_info(vd->caller_info, vd->active_layout, ad);
 
+       FREE(vd->base_view.call_duration_tm);
+       vd->base_view.call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_tm, CALLUI_RESULT_ALLOCATION_FAIL);
+
+       _callui_common_set_call_duration_time(vd->base_view.call_duration_tm, vd->active_layout, PART_TEXT_STATUS);
+
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       vd->base_view.call_duration_timer = ecore_timer_add(0.1, __call_duration_timer_cb, vd);
+       CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_timer, CALLUI_RESULT_ALLOCATION_FAIL);
+
+
        CALLUI_RETURN_VALUE_IF_FAIL(
                        _callui_create_top_first_button(ad), CALLUI_RESULT_FAIL);
        CALLUI_RETURN_VALUE_IF_FAIL(
@@ -286,16 +338,16 @@ static void __mng_callers_btn_click_cb(void *data, Evas_Object *obj, const char
 {
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_MULTICALL_LIST);
+       _callui_vm_change_view(ad->view_manager, VIEW_TYPE_MULTICALL_LIST);
 }
 
 static void __merge_btn_click_cb(void *data, Evas_Object *obj, const char *emission, const char *src)
 {
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       int ret = cm_join_call(ad->cm_handle);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_join_call() is failed");
+       callui_result_e res = _callui_manager_join_call(ad->call_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_join_call() failed. res[%d]", res);
        }
 }
 
@@ -303,9 +355,9 @@ static void __swap_btn_click_cb(void *data, Evas_Object *obj, const char *emissi
 {
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       int ret = cm_swap_call(ad->cm_handle);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_swap_call() is failed");
+       callui_result_e res = _callui_manager_swap_call(ad->call_manager);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_swap_call() failed. res[%d]", res);
        }
 }
 
index 563a9da..b78d820 100755 (executable)
 #include <app_control.h>
 #include <bundle.h>
 
+#include "callui-view-quickpanel.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-view-elements.h"
-#include "callui-view-quickpanel.h"
 #include "callui-view-layout.h"
 #include "callui-common.h"
+#include "callui-sound-manager.h"
+#include "callui-state-provider.h"
 
 #define TXT_TIMER_BUF_LEN 26
 #define CALL_NUMBER_ONE 1
 #define QP_WIN_H 172
+#define TIME_BUF_LEN 16
 
 struct _callui_qp_mc {
        Evas_Object *win_quickpanel;
@@ -37,11 +41,18 @@ struct _callui_qp_mc {
        bool is_activated;
        int rotate_angle;
        callui_app_data_t *ad;
+
+       Ecore_Timer *call_duration_timer;
+       struct tm *call_duration_tm;
+
        //Ecore_Event_Handler *client_msg_handler;
 };
 typedef struct _callui_qp_mc callui_qp_mc_t;
 
-static int  __callui_qp_mc_activate(callui_qp_mc_h qp);
+static callui_result_e __callui_qp_mc_init(callui_qp_mc_h qp, callui_app_data_t *ad);
+static void __callui_qp_mc_deinit(callui_qp_mc_h qp);
+
+static callui_result_e  __callui_qp_mc_activate(callui_qp_mc_h qp);
 static void __callui_qp_mc_deactivate(callui_qp_mc_h qp);
 static void __callui_qp_mc_refresh(callui_qp_mc_h qp);
 static void __callui_qp_mc_hide(callui_qp_mc_h qp);
@@ -57,31 +68,85 @@ static Evas_Object *__callui_qp_mc_create_resume_btn(callui_qp_mc_h qp);
 static Evas_Object *__callui_qp_mc_create_call_btn(callui_qp_mc_h qp);
 static Evas_Object *__callui_qp_mc_create_end_btn(callui_qp_mc_h qp);
 
-static void __callui_qp_mc_update_caller(Evas_Object *eo, call_data_t *call_data);
+static void __callui_qp_mc_update_caller(Evas_Object *eo, const callui_call_state_data_t *call_data);
 static void __callui_qp_mc_update_comp_status(callui_qp_mc_h qp,
                Evas_Object *eo,
                bool mute_state,
                char *ls_part,
-               call_data_t *call_data);
+               const callui_call_state_data_t *call_data);
 
 static void __callui_qp_mc_draw_screen(callui_qp_mc_h qp);
 static void __callui_qp_mc_provider_cb(minicontrol_viewer_event_e event_type, bundle *event_arg);
 static Evas_Object *__callui_qp_mc_create_window();
 static Evas_Object *__callui_qp_mc_create_contents(callui_qp_mc_h qp, char *group);
 
+static void __callui_qp_set_split_call_duration_time(struct tm *time, Evas_Object *obj, const char *txt_part);
+
+static Eina_Bool __split_call_duration_timer_cb(void *data);
+static Eina_Bool __active_call_duration_timer_cb(void* data);
+
+static void __call_state_event_cb(void *user_data,
+               callui_call_event_type_e call_event_type,
+               unsigned int call_id,
+               callui_sim_slot_type_e sim_type);
+
 // TODO ecore x atom actions are not supported. Need to move on event from mini controller.
 //static Eina_Bool __callui_qp_mc_client_message_cb(void *data, int type, void *event);
 
+static void __call_state_event_cb(void *user_data,
+               callui_call_event_type_e call_event_type,
+               unsigned int call_id,
+               callui_sim_slot_type_e sim_type)
+{
+       CALLUI_RETURN_IF_FAIL(user_data);
+       callui_qp_mc_h qp = (callui_qp_mc_h)user_data;
+
+       if (!_callui_stp_is_any_calls_available(qp->ad->state_provider)) {
+               __callui_qp_mc_deactivate(qp);
+               return;
+       }
+
+       if (!qp->is_activated) {
+               callui_result_e res = __callui_qp_mc_activate(qp);
+               CALLUI_RETURN_IF_FAIL(res == CALLUI_RESULT_OK);
+       } else {
+               __callui_qp_mc_refresh(qp);
+       }
+}
+
+static callui_result_e __callui_qp_mc_init(callui_qp_mc_h qp, callui_app_data_t *ad)
+{
+       qp->ad = ad;
+
+       callui_result_e res = _callui_stp_add_call_state_event_cb(ad->state_provider, __call_state_event_cb, qp);
+       CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
+
+       if (_callui_stp_is_any_calls_available(ad->state_provider)) {
+               res = __callui_qp_mc_activate(qp);
+       }
+       return res;
+}
+
+static void __callui_qp_mc_deinit(callui_qp_mc_h qp)
+{
+       callui_app_data_t *ad = qp->ad;
+
+       __callui_qp_mc_deactivate(qp);
+
+       _callui_stp_remove_call_state_event_cb(ad->state_provider, __call_state_event_cb, qp);
+}
+
 callui_qp_mc_h _callui_qp_mc_create(callui_app_data_t *ad)
 {
        CALLUI_RETURN_NULL_IF_FAIL(ad);
 
        callui_qp_mc_h qp = calloc(1, sizeof(callui_qp_mc_t));
-
        CALLUI_RETURN_NULL_IF_FAIL(qp);
 
-       qp->ad = ad;
-
+       callui_result_e res = __callui_qp_mc_init(qp, ad);
+       if (res != CALLUI_RESULT_OK) {
+               FREE(qp);
+       }
        return qp;
 };
 
@@ -89,7 +154,7 @@ void _callui_qp_mc_destroy(callui_qp_mc_h qp)
 {
        CALLUI_RETURN_IF_FAIL(qp);
 
-       __callui_qp_mc_deactivate(qp);
+       __callui_qp_mc_deinit(qp);
 
        free(qp);
 }
@@ -127,13 +192,16 @@ static void __callui_qp_mc_caller_id_cb(void *data, Evas_Object *obj, void *even
 
        __callui_qp_mc_hide(qp);
 
-       if (ad->incom) {
-               int ret = -1;
-               ret = cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_NORMAL);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_end_call() is failed");
+       const callui_call_state_data_t *call_data = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_INCOMING);
+
+       if (call_data) {
+               callui_result_e ret = _callui_manager_answer_call(ad->call_manager, CALLUI_CALL_ANSWER_TYPE_NORMAL);
+               if (ret != CALLUI_RESULT_OK) {
+                       err("_callui_manager_answer_call() is failed");
                }
        }
+
        /***to do***after lcd changes**/
 /*     if (ad->b_lcd_on == EINA_FALSE) {
                return;
@@ -180,17 +248,19 @@ static void __callui_qp_mc_resume_btn_cb(void *data, Evas_Object *obj, void *eve
        CALLUI_RETURN_IF_FAIL(qp->ad);
        callui_app_data_t *ad = qp->ad;
 
-       int ret = -1;
+       const callui_call_state_data_t *call_data =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
 
-       if (ad->held != NULL) {
-               ret = cm_unhold_call(ad->cm_handle);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_unhold_call() is failed");
+       callui_result_e res = CALLUI_RESULT_FAIL;
+       if (call_data) {
+               res = _callui_manager_unhold_call(ad->call_manager);
+               if (res != CALLUI_RESULT_OK) {
+                       err("_callui_manager_unhold_call() failed. res[%d]", res);
                }
        } else {
-               ret = cm_hold_call(ad->cm_handle);
-               if (ret != CM_ERROR_NONE) {
-                       err("cm_hold_call() is failed");
+               res = _callui_manager_hold_call(ad->call_manager);
+               if (res != CALLUI_RESULT_OK) {
+                       err("_callui_manager_hold_call() failed. res[%d]", res);
                }
        }
 }
@@ -215,7 +285,8 @@ static Evas_Object *__callui_qp_mc_create_resume_btn(callui_qp_mc_h qp)
                elm_object_part_content_set(layout, "swallow.resume_button", btn);
        }
 
-       if (ad->held != NULL) {
+       const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       if (held) {
                elm_object_style_set(btn, "style_call_icon_only_qp_resume");
        } else {
                elm_object_style_set(btn, "style_call_icon_only_qp_resume_on");
@@ -226,34 +297,59 @@ static Evas_Object *__callui_qp_mc_create_resume_btn(callui_qp_mc_h qp)
        return btn;
 }
 
-void _callui_qp_mc_update_speaker_status(callui_qp_mc_h qp, Eina_Bool is_disable)
+
+static void __speaker_btn_audio_st_changed_cb(void *user_data, callui_audio_state_type_e state)
 {
-       CALLUI_RETURN_IF_FAIL(qp);
-       CALLUI_RETURN_IF_FAIL(qp->quickpanel_layout);
-       CALLUI_RETURN_IF_FAIL(qp->ad);
+       CALLUI_RETURN_IF_FAIL(user_data);
 
-       Evas_Object *btn, *layout, *sw;
-       layout = qp->quickpanel_layout;
+       Evas_Object *btn = (Evas_Object *)user_data;
+       if (state == CALLUI_AUDIO_STATE_SPEAKER) {
+               elm_object_style_set(btn, "style_call_icon_only_qp_speaker_on");
+       } else {
+               elm_object_style_set(btn, "style_call_icon_only_qp_speaker");
+       }
+}
+
+static void __speaker_btn_button_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_app_data_t *ad = (callui_app_data_t *)data;
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __speaker_btn_audio_st_changed_cb, obj);
+}
+
+static void __callui_qp_mc_create_update_speaker_btn(callui_qp_mc_h qp, Eina_Bool is_disable)
+{
+       Evas_Object *btn = NULL;
+       Evas_Object *layout = qp->quickpanel_layout;
        callui_app_data_t *ad = qp->ad;
 
-       sw = edje_object_part_swallow_get(_EDJ(layout), "swallow.speaker_button");
+       Evas_Object *sw = edje_object_part_swallow_get(_EDJ(layout), "swallow.speaker_button");
        if (sw) {
                sec_dbg("Object Already Exists, so Update Only");
                btn = sw;
-               evas_object_smart_callback_del(btn, "clicked", _callui_spk_btn_cb);
        } else {
                sec_dbg("Object Doesn't Exists, so Re-Create");
                btn = elm_button_add(layout);
                elm_object_part_content_set(layout, "swallow.speaker_button", btn);
        }
 
-       if (ad->speaker_status == EINA_FALSE) {
+       callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+       if (audio_state != CALLUI_AUDIO_STATE_SPEAKER) {
                elm_object_style_set(btn, "style_call_icon_only_qp_speaker");
-               evas_object_smart_callback_add(btn, "clicked", _callui_spk_btn_cb, ad);
        } else {
                elm_object_style_set(btn, "style_call_icon_only_qp_speaker_on");
-               evas_object_smart_callback_add(btn, "clicked", _callui_spk_btn_cb, ad);
        }
+
+       evas_object_smart_callback_del_full(btn, "clicked", _callui_spk_btn_cb, ad);
+       evas_object_smart_callback_add(btn, "clicked", _callui_spk_btn_cb, ad);
+
+       evas_object_event_callback_del_full(btn, EVAS_CALLBACK_DEL, __speaker_btn_button_del_cb, ad);
+       evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __speaker_btn_button_del_cb, ad);
+
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __speaker_btn_audio_st_changed_cb, btn);
+       _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __speaker_btn_audio_st_changed_cb, btn);
+
        evas_object_propagate_events_set(btn, EINA_FALSE);
 
        elm_object_disabled_set(btn, is_disable);
@@ -291,28 +387,32 @@ static void __callui_qp_mc_end_btn_cb(void *data, Evas_Object *obj, void *event_
        CALLUI_RETURN_IF_FAIL(data);
 
        callui_qp_mc_h qp = (callui_qp_mc_h)data;
-
-       CALLUI_RETURN_IF_FAIL(qp->ad);
-
        callui_app_data_t *ad = qp->ad;
 
-       int ret = -1;
        __callui_qp_mc_hide(qp);
 
-       if (ad->incom) {
-               ret = cm_reject_call(ad->cm_handle);
-       } else if (CM_CALL_STATE_DIALING == ad->active->call_state)/*(dialling_view)*/ {
-               ret = cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE);
-       } else if ((ad->active) && (ad->held)) {
-               ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
-       } else if ((ad->active) || (ad->held)) {/*single call*/
-               ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_CALLS);
+       const callui_call_state_data_t *active =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       const callui_call_state_data_t *held =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+       const callui_call_state_data_t *incom =
+                       _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+
+       callui_result_e res = CALLUI_RESULT_FAIL;
+       if (incom) {
+               res = _callui_manager_reject_call(ad->call_manager);
+       } else if (active && active->is_dialing) {
+               res = _callui_manager_end_call(ad->call_manager, active->call_id, CALLUI_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+       } else if (active && held) {
+               res = _callui_manager_end_call(ad->call_manager, 0, CALLUI_CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
+       } else if (active || held) {/*single call*/
+               res = _callui_manager_end_call(ad->call_manager, 0, CALLUI_CALL_RELEASE_TYPE_ALL_CALLS);
        } else {
                err("invalid case!!!!");
        }
-       if (ret != CM_ERROR_NONE) {
-               err("cm_end_call() is failed");
-               return;
+
+       if (res != CALLUI_RESULT_OK) {
+               err("__callui_qp_mc_end_btn_cb() failed. res[%d]", res);
        }
 }
 
@@ -342,36 +442,59 @@ static Evas_Object *__callui_qp_mc_create_end_btn(callui_qp_mc_h qp)
        return btn;
 }
 
-void _callui_qp_mc_update_mute_status(callui_qp_mc_h qp, Eina_Bool is_disable)
+static void __mute_btn_mute_st_changed_cb(void *user_data, bool is_enable)
 {
-       CALLUI_RETURN_IF_FAIL(qp);
-       CALLUI_RETURN_IF_FAIL(qp->quickpanel_layout);
-       CALLUI_RETURN_IF_FAIL(qp->ad);
+       CALLUI_RETURN_IF_FAIL(user_data);
 
-       Evas_Object *btn, *layout, *sw;
-       layout = qp->quickpanel_layout;
+       Evas_Object *btn = (Evas_Object *)user_data;
+       if (is_enable) {
+               elm_object_style_set(btn, "style_call_icon_only_qp_mute_on");
+       } else {
+               elm_object_style_set(btn, "style_call_icon_only_qp_mute");
+       }
+}
+
+static void __mute_btn_button_del_cb(void *data, Evas *e, Evas_Object *obj, void *event_info)
+{
+       CALLUI_RETURN_IF_FAIL(data);
+
+       callui_app_data_t *ad = (callui_app_data_t *)data;
+       _callui_sdm_remove_mute_state_changed_cb(ad->sound_manager, __mute_btn_mute_st_changed_cb, obj);
+}
+
+static void __callui_qp_mc_create_update_mute_btn(callui_qp_mc_h qp, Eina_Bool is_disable)
+{
+       Evas_Object *btn = NULL;
+       Evas_Object *layout = qp->quickpanel_layout;
        callui_app_data_t *ad = qp->ad;
 
-       sw = edje_object_part_swallow_get(_EDJ(layout), "swallow.mute_button");
+       Evas_Object *sw = edje_object_part_swallow_get(_EDJ(layout), "swallow.mute_button");
        if (sw) {
                dbg("Object Already Exists, so Update Only");
                btn = sw;
-               evas_object_smart_callback_del(btn, "clicked", _callui_mute_btn_cb);
        } else {
                dbg("Object Doesn't Exists, so Re-Create");
                btn = elm_button_add(layout);
                elm_object_part_content_set(layout, "swallow.mute_button", btn);
        }
 
-       if (ad->mute_status == EINA_FALSE) {
-               elm_object_style_set(btn, "style_call_icon_only_qp_mute");
-               evas_object_smart_callback_add(btn, "clicked", _callui_mute_btn_cb, ad);
-       } else {
+       if (_callui_sdm_get_mute_state(ad->sound_manager)) {
                elm_object_style_set(btn, "style_call_icon_only_qp_mute_on");
-               evas_object_smart_callback_add(btn, "clicked", _callui_mute_btn_cb, ad);
+       } else {
+               elm_object_style_set(btn, "style_call_icon_only_qp_mute");
        }
 
+       evas_object_smart_callback_del_full(btn, "clicked", _callui_mute_btn_cb, ad);
+       evas_object_smart_callback_add(btn, "clicked", _callui_mute_btn_cb, ad);
+
+       evas_object_event_callback_del_full(btn, EVAS_CALLBACK_DEL, __mute_btn_button_del_cb, ad);
+       evas_object_event_callback_add(btn, EVAS_CALLBACK_DEL, __mute_btn_button_del_cb, ad);
+
+       _callui_sdm_remove_mute_state_changed_cb(ad->sound_manager, __mute_btn_mute_st_changed_cb, btn);
+       _callui_sdm_add_mute_state_changed_cb(ad->sound_manager, __mute_btn_mute_st_changed_cb, btn);
+
        evas_object_propagate_events_set(btn, EINA_FALSE);
+
        elm_object_disabled_set(btn, is_disable);
 }
 
@@ -380,15 +503,15 @@ static void __callui_qp_mc_hide(callui_qp_mc_h qp)
        minicontrol_send_event(qp->win_quickpanel, MINICONTROL_PROVIDER_EVENT_REQUEST_HIDE, NULL);
 }
 
-static void __callui_qp_mc_update_caller(Evas_Object *eo, call_data_t *call_data)
+static void __callui_qp_mc_update_caller(Evas_Object *eo, const callui_call_state_data_t *call_data)
 {
        CALLUI_RETURN_IF_FAIL(eo);
        CALLUI_RETURN_IF_FAIL(call_data);
 
-       char *call_name = call_data->call_ct_info.call_disp_name;
-       char *file_path = call_data->call_ct_info.caller_id_path;
+       const char *call_name = call_data->call_ct_info.call_disp_name;
+       const char *file_path = call_data->call_ct_info.caller_id_path;
 
-       char *call_number = NULL;
+       const char *call_number = NULL;
        if (strlen(call_data->call_disp_num) > 0) {
                call_number = call_data->call_disp_num;
        } else {
@@ -423,64 +546,141 @@ static void __callui_qp_mc_update_comp_status(callui_qp_mc_h qp,
                Evas_Object *eo,
                bool mute_state,
                char *ls_part,
-               call_data_t *call_data)
+               const callui_call_state_data_t *call_data)
 {
        CALLUI_RETURN_IF_FAIL(qp);
 
-       _callui_qp_mc_update_mute_status(qp, mute_state);
+       __callui_qp_mc_create_update_mute_btn(qp, mute_state);
        __callui_qp_mc_update_caller(eo, call_data);
        elm_object_signal_emit(eo, ls_part, "");
 }
 
+static void __callui_qp_set_split_call_duration_time(struct tm *time, Evas_Object *obj, const char *txt_part)
+{
+       char dur[TIME_BUF_LEN];
+       if (time->tm_hour > 0) {
+               snprintf(dur, TIME_BUF_LEN, "%02d:%02d:%02d", time->tm_hour, time->tm_min, time->tm_sec);
+       } else {
+               snprintf(dur, TIME_BUF_LEN, "%02d:%02d", time->tm_min, time->tm_sec);
+       }
+
+       char buf[TXT_TIMER_BUF_LEN] = {0};
+       char buf_tmp[TXT_TIMER_BUF_LEN] = {0};
+       snprintf(buf_tmp, sizeof(buf_tmp), "%s / %s", dur, _("IDS_CALL_BODY_PD_ON_HOLD_M_STATUS_ABB"));
+       snprintf(buf, sizeof(buf), buf_tmp, CALL_NUMBER_ONE);
+
+       elm_object_part_text_set(obj, txt_part, buf);
+}
+
+static Eina_Bool __split_call_duration_timer_cb(void *data)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(data, ECORE_CALLBACK_CANCEL);
+
+       callui_qp_mc_h qp = (callui_qp_mc_h)data;
+
+       struct tm *new_tm = _callui_stp_get_call_duration(qp->ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!new_tm) {
+               qp->call_duration_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       _callui_common_try_update_call_duration_time(qp->call_duration_tm,
+                       new_tm,
+                       __callui_qp_set_split_call_duration_time,
+                       qp->quickpanel_layout,
+                       "call_txt_status");
+
+       free(new_tm);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool __active_call_duration_timer_cb(void* data)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(data, ECORE_CALLBACK_CANCEL);
+
+       callui_qp_mc_h qp = (callui_qp_mc_h)data;
+
+       struct tm *new_tm = _callui_stp_get_call_duration(qp->ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!new_tm) {
+               qp->call_duration_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       _callui_common_try_update_call_duration_time(qp->call_duration_tm,
+                       new_tm,
+                       _callui_common_set_call_duration_time,
+                       qp->quickpanel_layout,
+                       "call_txt_status");
+
+       free(new_tm);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
 static void __callui_qp_mc_draw_screen(callui_qp_mc_h qp)
 {
        CALLUI_RETURN_IF_FAIL(qp);
        CALLUI_RETURN_IF_FAIL(qp->quickpanel_layout);
        CALLUI_RETURN_IF_FAIL(qp->ad);
 
-       call_data_t *call_data = NULL;
        callui_app_data_t *ad = qp->ad;
        Evas_Object *eo = qp->quickpanel_layout;
 
        Evas_Object *call_btn = __callui_qp_mc_create_call_btn(qp);
        elm_object_disabled_set(call_btn, EINA_TRUE);
-       _callui_qp_mc_update_speaker_status(qp, EINA_FALSE);
+       __callui_qp_mc_create_update_speaker_btn(qp, EINA_FALSE);
 
-       if (ad->incom) {
-               /**incoming call**/
+       const callui_call_state_data_t *incom = _callui_stp_get_call_data(ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_INCOMING);
+       const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_HELD);
 
-               call_data = ad->incom;
-               __callui_qp_mc_update_comp_status(qp, eo, EINA_TRUE, "incoming_call", call_data);
+       DELETE_ECORE_TIMER(qp->call_duration_timer);
+       FREE(qp->call_duration_tm);
+
+       if (incom) {
+               /* Incoming call */
+               __callui_qp_mc_update_comp_status(qp, eo, EINA_TRUE, "incoming_call", incom);
                __callui_qp_mc_update_text(_("IDS_CALL_BODY_INCOMING_CALL"), 0, eo);
-               _callui_qp_mc_update_speaker_status(qp, EINA_TRUE);
+               __callui_qp_mc_create_update_speaker_btn(qp, EINA_TRUE);
                elm_object_disabled_set(call_btn, EINA_FALSE);
-       } else if (ad->active && (CM_CALL_STATE_DIALING == ad->active->call_state)) {
-               /**dialling**/
-
-               call_data = ad->active;
+       } else if (active && active->is_dialing) {
+               /* Dialing call */
                __callui_qp_mc_update_text(_("IDS_CALL_POP_DIALLING"), 0, eo);
-               __callui_qp_mc_update_comp_status(qp, eo, EINA_TRUE, "outgoing_call", call_data);
+               __callui_qp_mc_update_comp_status(qp, eo, EINA_TRUE, "outgoing_call", active);
                elm_object_signal_emit(eo, "outgoing_call", "");
-       } else if ((ad->active) && (ad->held)) {
-               /**split call**/
-
-               call_data = ad->active;
-               __callui_qp_mc_update_comp_status(qp, eo, EINA_FALSE, "during_call", call_data);
-               __callui_qp_mc_update_text(NULL, ad->active->member_count, eo);
-       } else if ((ad->active)) {
-               /**active call**/
-
-               call_data = ad->active;
-               __callui_qp_mc_update_comp_status(qp, eo, EINA_FALSE, "during_call", call_data);
-               __callui_qp_mc_update_text(NULL, ad->active->member_count, eo);
-               _callui_common_update_call_duration(call_data->start_time);
-       } else if ((ad->held)) {
-               /**held call**/
-
-               call_data = ad->held;
-               __callui_qp_mc_update_comp_status(qp, eo, EINA_TRUE, "resume_call", call_data);
+       } else if (active && held) {
+               /* Split call */
+               __callui_qp_mc_update_comp_status(qp, eo, EINA_FALSE, "during_call", active);
+               __callui_qp_mc_update_text(NULL, active->conf_member_count, eo);
+
+               qp->call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+               CALLUI_RETURN_IF_FAIL(qp->call_duration_tm);
+
+               __callui_qp_set_split_call_duration_time(qp->call_duration_tm, qp->quickpanel_layout, "txt_timer");
+
+               qp->call_duration_timer = ecore_timer_add(0.1, __split_call_duration_timer_cb, qp);
+               CALLUI_RETURN_IF_FAIL(qp->call_duration_timer);
+       } else if (active) {
+               /* Active call */
+               __callui_qp_mc_update_comp_status(qp, eo, EINA_FALSE, "during_call", active);
+               __callui_qp_mc_update_text(NULL, active->conf_member_count, eo);
+
+               qp->call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+               CALLUI_RETURN_IF_FAIL(qp->call_duration_tm);
+
+               _callui_common_set_call_duration_time(qp->call_duration_tm, qp->quickpanel_layout, "txt_timer");
+
+               qp->call_duration_timer = ecore_timer_add(0.1, __active_call_duration_timer_cb, qp);
+               CALLUI_RETURN_IF_FAIL(qp->call_duration_timer);
+       } else if (held) {
+               /* Held call */
+               __callui_qp_mc_update_comp_status(qp, eo, EINA_TRUE, "resume_call", held);
                __callui_qp_mc_create_resume_btn(qp);
-               __callui_qp_mc_update_text(_("IDS_CALL_BODY_ON_HOLD_ABB"), ad->held->member_count, eo);
+               __callui_qp_mc_update_text(_("IDS_CALL_BODY_ON_HOLD_ABB"), held->conf_member_count, eo);
        } else {
                dbg("incoming call. error!");
        }
@@ -530,7 +730,7 @@ static Evas_Object *__callui_qp_mc_create_contents(callui_qp_mc_h qp, char *grou
        return _callui_load_edj(qp->win_quickpanel, EDJ_NAME, group);
 }
 
-static int __callui_qp_mc_activate(callui_qp_mc_h qp)
+static callui_result_e __callui_qp_mc_activate(callui_qp_mc_h qp)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(qp, CALLUI_RESULT_INVALID_PARAM);
 
@@ -561,6 +761,8 @@ static int __callui_qp_mc_activate(callui_qp_mc_h qp)
 
        __callui_qp_mc_refresh(qp);
 
+       qp->is_activated = true;
+
        return CALLUI_RESULT_OK;
 }
 
@@ -613,48 +815,9 @@ static void __callui_qp_mc_update_text(char *txt_status, int count, Evas_Object
        CALLUI_RETURN_IF_FAIL(eo);
 
        if (txt_status != NULL) {
-               edje_object_part_text_set(_EDJ(eo), "txt_timer", txt_status);
+               elm_object_part_text_set(eo, "txt_timer", txt_status);
        }
        if (count > 1) {
-               edje_object_part_text_set(_EDJ(eo), "txt_call_name", _("IDS_CALL_OPT_CONFERENCE_CALL"));
+               elm_object_part_text_set(eo, "txt_call_name", _("IDS_CALL_OPT_CONFERENCE_CALL"));
        }
 }
-
-void _callui_qp_mc_update_calltime_status(callui_qp_mc_h qp, char *call_timer)
-{
-       CALLUI_RETURN_IF_FAIL(qp);
-
-       callui_app_data_t *ad  = qp->ad;
-       Evas_Object *qp_layout = qp->quickpanel_layout;
-
-       if (!ad) {
-               dbg("ad is NULL!!!");
-               return;
-       }
-
-       if (ad->active) {
-               if (ad->held) {
-                       char buf[TXT_TIMER_BUF_LEN] = {0};
-                       char buf_tmp[TXT_TIMER_BUF_LEN] = {0};
-                       snprintf(buf_tmp, sizeof(buf_tmp), "%s / %s", call_timer, _("IDS_CALL_BODY_PD_ON_HOLD_M_STATUS_ABB"));
-                       snprintf(buf, sizeof(buf), buf_tmp, CALL_NUMBER_ONE);
-                       edje_object_part_text_set(_EDJ(qp_layout), "txt_timer", buf);
-               } else {
-                       edje_object_part_text_set(_EDJ(qp_layout), "txt_timer", _(call_timer));
-               }
-       }
-}
-
-void _callui_qp_mc_update(callui_qp_mc_h qp)
-{
-       if (!qp->is_activated) {
-               int res = __callui_qp_mc_activate(qp);
-               CALLUI_RETURN_IF_FAIL(res == CALLUI_RESULT_OK);
-               qp->is_activated = true;
-       }
-
-       __callui_qp_mc_refresh(qp);
-
-       debug_leave();
-}
-
index 08c4313..1acab25 100644 (file)
  */
 
 #include <Elementary.h>
+#include <efl_extension.h>
 
 #include "callui-view-single-call.h"
+#include "callui-debug.h"
 #include "callui.h"
 #include "callui-view-elements.h"
 #include "callui-keypad.h"
 #include "callui-common.h"
 #include "callui-view-caller-info-defines.h"
+#include "callui-state-provider.h"
 
 #define         VIEW_SINGLE_CALL_STATUS_TXT_LEN 129
 
@@ -33,16 +36,17 @@ struct _call_view_single_call {
 };
 typedef struct _call_view_single_call _call_view_single_call_t;
 
-static int __callui_view_single_call_oncreate(call_view_data_base_t *view_data, void *appdata);
-static int __callui_view_single_call_onupdate(call_view_data_base_t *view_data);
-static int __callui_view_single_call_ondestroy(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t *view_data, void *appdata);
+static callui_result_e __callui_view_single_call_onupdate(call_view_data_base_t *view_data);
+static callui_result_e __callui_view_single_call_ondestroy(call_view_data_base_t *view_data);
 
-static int __create_main_content(call_view_single_call_h vd);
-static int __update_displayed_data(call_view_single_call_h vd);
+static callui_result_e __create_main_content(call_view_single_call_h vd);
+static callui_result_e __update_displayed_data(call_view_single_call_h vd);
 
 static void __more_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_info);
 static void __keypad_show_state_change_cd(void *data, Eina_Bool visibility);
+static Eina_Bool __call_duration_timer_cb(void* data);
 
 call_view_single_call_h _callui_view_single_call_new()
 {
@@ -56,7 +60,7 @@ call_view_single_call_h _callui_view_single_call_new()
        return single_call_view;
 }
 
-static int __callui_view_single_call_oncreate(call_view_data_base_t *view_data, void *appdata)
+static callui_result_e __callui_view_single_call_oncreate(call_view_data_base_t *view_data, void *appdata)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
        CALLUI_RETURN_VALUE_IF_FAIL(appdata, CALLUI_RESULT_INVALID_PARAM);
@@ -66,7 +70,7 @@ static int __callui_view_single_call_oncreate(call_view_data_base_t *view_data,
 
        vd->base_view.ad = ad;
 
-       int res = __create_main_content(vd);
+       callui_result_e res = __create_main_content(vd);
        CALLUI_RETURN_VALUE_IF_FAIL(res == CALLUI_RESULT_OK, res);
 
        _callui_lock_manager_start(ad->lock_handle);
@@ -74,20 +78,23 @@ static int __callui_view_single_call_oncreate(call_view_data_base_t *view_data,
        return __update_displayed_data(vd);
 }
 
-static int __callui_view_single_call_onupdate(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_single_call_onupdate(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        return __update_displayed_data((call_view_single_call_h)view_data);
 }
 
-static int __callui_view_single_call_ondestroy(call_view_data_base_t *view_data)
+static callui_result_e __callui_view_single_call_ondestroy(call_view_data_base_t *view_data)
 {
        CALLUI_RETURN_VALUE_IF_FAIL(view_data, CALLUI_RESULT_INVALID_PARAM);
 
        call_view_single_call_h vd = (call_view_single_call_h)view_data;
        callui_app_data_t *ad = vd->base_view.ad;
 
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       free(vd->base_view.call_duration_tm);
+
        _callui_keypad_hide_immediately(ad->keypad);
        _callui_keypad_show_status_change_callback_set(ad->keypad, NULL, NULL);
 
@@ -115,34 +122,61 @@ static void __end_call_btn_click_cb(void *data, Evas_Object *obj, void *event_in
        call_view_single_call_h vd = (call_view_single_call_h)data;
        callui_app_data_t *ad = vd->base_view.ad;
 
-       int ret = cm_end_call(ad->cm_handle, 0, CALL_RELEASE_TYPE_ALL_CALLS);
-       if (ret != CM_ERROR_NONE) {
-               err("cm_end_call() is failed");
+       callui_result_e res = _callui_manager_end_call(ad->call_manager,
+                       0, CALLUI_CALL_RELEASE_TYPE_ALL_CALLS);
+       if (res != CALLUI_RESULT_OK) {
+               err("_callui_manager_end_call() is failed. res[%d]", res);
        }
 }
 
-static int __update_displayed_data(call_view_single_call_h vd)
+static Eina_Bool __call_duration_timer_cb(void* data)
+{
+       CALLUI_RETURN_VALUE_IF_FAIL(data, ECORE_CALLBACK_CANCEL);
+
+       call_view_single_call_h vd = data;
+
+       struct tm *new_tm = _callui_stp_get_call_duration(vd->base_view.ad->state_provider,
+                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!new_tm) {
+               vd->base_view.call_duration_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       }
+
+       _callui_common_try_update_call_duration_time(
+                       vd->base_view.call_duration_tm,
+                       new_tm,
+                       _callui_common_set_call_duration_time,
+                       vd->base_view.contents,
+                       "call_txt_status");
+
+       free(new_tm);
+
+       return ECORE_CALLBACK_RENEW;
+}
+
+static callui_result_e __update_displayed_data(call_view_single_call_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
-       call_data_t *call_data = NULL;
-       char *file_path = NULL;
-       Eina_Bool is_held = EINA_FALSE;
+       const char *file_path = NULL;
        char status_txt[VIEW_SINGLE_CALL_STATUS_TXT_LEN] = { 0 };
 
-       if (ad->active) {
-               call_data = ad->active;
-               is_held = EINA_FALSE;
-       } else {
-               call_data = ad->held;
+       Eina_Bool is_held = EINA_FALSE;
+
+       const callui_call_state_data_t *call_data = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       if (!call_data) {
+               call_data = _callui_stp_get_call_data(ad->state_provider,
+                               CALLUI_CALL_DATA_TYPE_HELD);
                is_held = EINA_TRUE;
        }
        CALLUI_RETURN_VALUE_IF_FAIL(call_data, CALLUI_RESULT_FAIL);
 
-       file_path = call_data->call_ct_info.caller_id_path;
+       DELETE_ECORE_TIMER(vd->base_view.call_duration_timer);
+       FREE(vd->base_view.call_duration_tm);
 
-       sec_dbg("file_path: %s", file_path);
+       file_path = call_data->call_ct_info.caller_id_path;
 
-       if (call_data->is_emergency == EINA_TRUE) {
+       if (call_data->is_emergency) {
                elm_object_signal_emit(vd->caller_info, "set_emergency_mode", "");
        } else {
                if (strcmp(file_path, "default") != 0) {
@@ -151,16 +185,20 @@ static int __update_displayed_data(call_view_single_call_h vd)
        }
 
        if (is_held) {
-               dbg("====== HOLD ======");
                snprintf(status_txt, sizeof(status_txt), _("IDS_CALL_BODY_ON_HOLD_ABB"));
                _callui_show_caller_info_status(ad, status_txt);
        } else {
-               dbg("====== UNHOLD ======");
-               _callui_common_update_call_duration(call_data->start_time);
+               vd->base_view.call_duration_tm = _callui_stp_get_call_duration(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+               CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_tm, CALLUI_RESULT_ALLOCATION_FAIL);
+
+               _callui_common_set_call_duration_time(vd->base_view.call_duration_tm, vd->base_view.contents, "call_txt_status");
+
+               vd->base_view.call_duration_timer = ecore_timer_add(0.1, __call_duration_timer_cb, vd);
+               CALLUI_RETURN_VALUE_IF_FAIL(vd->base_view.call_duration_timer, CALLUI_RESULT_ALLOCATION_FAIL);
        }
 
-       char *call_name = call_data->call_ct_info.call_disp_name;
-       char *disp_number = NULL;
+       const char *call_name = call_data->call_ct_info.call_disp_name;
+       const char *disp_number = NULL;
 
        if (strlen(call_data->call_disp_num) > 0) {
                disp_number = call_data->call_disp_num;
@@ -168,7 +206,7 @@ static int __update_displayed_data(call_view_single_call_h vd)
                disp_number = call_data->call_num;
        }
 
-       if (call_data->is_emergency == EINA_TRUE) {
+       if (call_data->is_emergency) {
                call_name = _("IDS_COM_BODY_EMERGENCY_NUMBER");
                disp_number = "";
        }
@@ -176,7 +214,7 @@ static int __update_displayed_data(call_view_single_call_h vd)
        if (strlen(call_name) == 0) {
                _callui_show_caller_info_name(ad, disp_number);
                elm_object_signal_emit(vd->caller_info, "1line", "caller_name");
-       } else if (call_data->is_emergency == EINA_TRUE) {
+       } else if (call_data->is_emergency) {
                _callui_show_caller_info_name(ad, call_name);
                elm_object_signal_emit(vd->caller_info, "1line", "caller_name");
        } else {
@@ -216,7 +254,7 @@ static int __update_displayed_data(call_view_single_call_h vd)
        return CALLUI_RESULT_OK;
 }
 
-static int __create_main_content(call_view_single_call_h vd)
+static callui_result_e __create_main_content(call_view_single_call_h vd)
 {
        callui_app_data_t *ad = vd->base_view.ad;
        CALLUI_RETURN_VALUE_IF_FAIL(ad->main_ly, CALLUI_RESULT_FAIL);
index 63b3422..a2a38a9 100755 (executable)
 #include <sys/un.h>
 
 #include "callui.h"
+#include "callui-debug.h"
 #include "callui-view-elements.h"
 #include "callui-common.h"
 #include "callui-view-quickpanel.h"
 #include "callui-view-layout.h"
+#include "callui-sound-manager.h"
+#include "callui-state-provider.h"
 
-#define EARSET_KEY_LONG_PRESS_TIMEOUT                  1.0
+#define EARSET_KEY_LONG_PRESS_TIMEOUT  1.0
 
 static bool _callui_app_create_layout(void *data);
 static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *event);
 static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *event);
-static void __callui_app_terminate(void *data);
-static void __callui_app_terminate_or_view_change(callui_app_data_t *ad);
+static void __app_deinit(callui_app_data_t *ad);
+static void __audio_state_changed_cb(void *user_data,
+               callui_audio_state_type_e audio_state);
+static void __call_state_change_cb(void *user_data,
+               callui_call_event_type_e call_event_type,
+               unsigned int call_id,
+               callui_sim_slot_type_e sim_type);
 
 static callui_app_data_t g_ad;
 
-static call_data_t *__callui_call_data_new(char *number)
-{
-       dbg("__calldoc_call_data_new()");
-       call_data_t *call_data = NULL;
-       if (NULL == number) {
-               warn("number is NULL");
-       }
-
-       call_data = (call_data_t *)calloc(1, sizeof(call_data_t));
-       if (NULL == call_data) {
-               warn("failed to alloc memory");
-               return NULL;
-       }
-
-       call_data->call_id = NO_HANDLE;
-       call_data->member_count = 0;
-       if (number) {
-               g_strlcpy(call_data->call_num, number, CALLUI_PHONE_NUMBER_LENGTH_MAX);
-       }
-       call_data->call_ct_info.person_id = -1;
-
-       return call_data;
-}
-
 static void __callui_app_win_key_grab(callui_app_data_t *ad)
 {
        int result = 0;
@@ -88,255 +72,103 @@ static void __callui_app_win_key_grab(callui_app_data_t *ad)
                ad->upkey_handler = ecore_event_handler_add(ECORE_EVENT_KEY_UP, __callui_app_win_hard_key_up_cb, ad);
 }
 
-static void __callui_update_call_data(call_data_t **call_data, cm_call_data_t* cm_call_data)
-{
-       dbg("__callui_update_call_data()");
-       call_data_t *tmp_call_data = NULL;
-       char *call_number = NULL;
-       int person_id = -1;
-       if (NULL == cm_call_data) {
-               warn("cm_call_data is NULL");
-               g_free(*call_data);
-               *call_data = NULL;
-               return;
-       }
-
-       cm_call_data_get_call_number(cm_call_data, &call_number);
-       tmp_call_data = __callui_call_data_new(call_number);
-       CALLUI_RETURN_IF_FAIL(tmp_call_data);
-
-       cm_call_data_get_call_id(cm_call_data, &tmp_call_data->call_id);
-       cm_call_data_get_call_member_count(cm_call_data, &tmp_call_data->member_count);
-       cm_call_data_get_call_direction(cm_call_data, &tmp_call_data->call_direction);
-       cm_call_data_get_call_domain(cm_call_data, &tmp_call_data->call_domain);
-       cm_call_data_get_call_state(cm_call_data, &tmp_call_data->call_state);
-       cm_call_data_get_call_type(cm_call_data, &tmp_call_data->call_type);
-       cm_call_data_is_emergency_call(cm_call_data, &tmp_call_data->is_emergency);
-       cm_call_data_get_start_time(cm_call_data, &tmp_call_data->start_time);
-
-       /* Check for Contact Index and accordingly update the contact information if the contact is saved */
-       cm_call_data_get_person_id(cm_call_data, &person_id);
-       if ((person_id != -1) && (tmp_call_data->call_ct_info.person_id == -1)) {
-               dbg("contact exists with index:[%d]", person_id);
-               _callui_common_get_contact_info(person_id, &tmp_call_data->call_ct_info);
-       }
-
-       if (strlen(tmp_call_data->call_ct_info.caller_id_path) <= 0) {
-               g_strlcpy(tmp_call_data->call_ct_info.caller_id_path, "default", CALLUI_IMAGE_PATH_LENGTH_MAX);
-       }
-
-       g_free(*call_data);
-       *call_data = tmp_call_data;
-
-       return;
-}
-
-static void __callui_update_all_call_data(callui_app_data_t *ad, cm_call_event_data_t* call_state_data)
-{
-       cm_call_data_t *call_data = NULL;
-       CALLUI_RETURN_IF_FAIL(ad);
-       CALLUI_RETURN_IF_FAIL(call_state_data);
-       dbg("doc_data active!");
-       cm_call_event_data_get_active_call(call_state_data, &call_data);
-       __callui_update_call_data(&(ad->active), call_data);
-       dbg("doc_data incom!");
-       cm_call_event_data_get_incom_call(call_state_data, &call_data);
-       __callui_update_call_data(&(ad->incom), call_data);
-       dbg("doc_data held!");
-       cm_call_event_data_get_held_call(call_state_data, &call_data);
-       __callui_update_call_data(&(ad->held), call_data);
-}
-
 static void __callui_process_incoming_call(callui_app_data_t *ad)
 {
-       dbg("..");
-       cm_call_data_t *cm_incom = NULL;
-
        CALLUI_RETURN_IF_FAIL(ad);
 
-       cm_get_all_calldata(ad->cm_handle, &cm_incom, NULL, NULL);
-       CALLUI_RETURN_IF_FAIL(cm_incom);
-
-       __callui_update_call_data(&(ad->incom), cm_incom);
+       const callui_call_state_data_t *incom = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_INCOMING);
+       const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_HELD);
 
        callui_view_type_e type = VIEW_TYPE_INCOMING_CALL;
-
-#ifdef ACTIVE_NOTIFICATION_AVAILABLE
+       callui_view_type_e cur_type = _callui_vm_get_cur_view_type(ad->view_manager);
        if (_callui_common_get_idle_lock_type() == LOCK_TYPE_UNLOCK &&
-                       ad->active == NULL &&
-                       ad->held == NULL &&
-                       ad->incom != NULL &&
-                       ad->incoming_noti == false) {
+                       active == NULL &&
+                       held == NULL &&
+                       incom != NULL &&
+                       (cur_type == VIEW_TYPE_UNDEFINED || cur_type == VIEW_TYPE_ENDCALL)) {
                type = VIEW_TYPE_INCOMING_CALL_NOTI;
        }
-#endif
-       _callui_vm_change_view(ad->view_manager_handle, type);
-
-       cm_call_data_free(cm_incom);
-       return;
+       _callui_vm_change_view(ad->view_manager, type);
 }
 
 static void __callui_process_outgoing_call(callui_app_data_t *ad, char *number)
 {
-       sec_dbg("number is (%s)", number);
        CALLUI_RETURN_IF_FAIL(ad);
+       sec_dbg("Number is (%s)", number);
 
-       if (CM_ERROR_NONE != cm_dial_call(ad->cm_handle, number, CM_CALL_TYPE_VOICE, CM_SIM_SLOT_DEFAULT_E)) {
-               err("cm_dial_call failed!!");
-               __callui_app_terminate_or_view_change(ad);
-               return;
+       callui_result_e res = _callui_manager_dial_voice_call(ad->call_manager,
+                       number, CALLUI_SIM_SLOT_DEFAULT);
+
+       if (CALLUI_RESULT_OK != res && _callui_stp_is_any_calls_available(ad->state_provider)) {
+               err("_callui_manager_dial_voice_call() failed. ret[%d]", res);
+               if (_callui_stp_is_any_calls_available(ad->state_provider)) {
+                       dbg("No more calls available. Exit application");
+                       _callui_common_exit_app();
+               }
+       } else {
+               ad->waiting_dialing = true;
        }
-       ad->waiting_dialing = true;
-       ad->active = __callui_call_data_new(number);
-       return;
 }
 
-static void __callui_call_event_cb(cm_call_event_e call_event, cm_call_event_data_t *call_state_data, void *user_data)
+static void __audio_state_changed_cb(void *user_data, callui_audio_state_type_e audio_state)
 {
-       CALLUI_RETURN_IF_FAIL(call_state_data);
-       info("Call event changed!! %d", call_event);
+       CALLUI_RETURN_IF_FAIL(user_data);
+
        callui_app_data_t *ad = (callui_app_data_t *)user_data;
-       CALLUI_RETURN_IF_FAIL(ad);
 
-       cm_call_event_data_get_sim_slot(call_state_data, &ad->sim_slot);
+       switch (audio_state) {
+               case CALLUI_AUDIO_STATE_SPEAKER:
+               case CALLUI_AUDIO_STATE_EARJACK:
+               case CALLUI_AUDIO_STATE_BT:
+                       _callui_lock_manager_force_stop(ad->lock_handle);
+                       break;
+               case CALLUI_AUDIO_STATE_RECEIVER:
+                       _callui_lock_manager_start(ad->lock_handle);
+                       break;
+               default:
+                       break;
+       }
+}
+
+static void __call_state_change_cb(void *user_data,
+               callui_call_event_type_e call_event_type,
+               unsigned int call_id,
+               callui_sim_slot_type_e sim_type)
+{
+       CALLUI_RETURN_IF_FAIL(user_data);
+
+       callui_app_data_t *ad = user_data;
+
        ad->waiting_dialing = false;
-       switch (call_event) {
-       case CM_CALL_EVENT_ACTIVE:
+
+       switch (call_event_type) {
+       case CALLUI_CALL_EVENT_TYPE_ACTIVE:
                if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
                        _callui_common_dvc_control_lcd_state(LCD_UNLOCK);
                } else {
                        _callui_common_dvc_control_lcd_state(LCD_ON_UNLOCK);
                }
-               __callui_update_all_call_data(ad, call_state_data);
-               _callui_common_create_duration_timer();
-               _callui_vm_auto_change_view(ad->view_manager_handle);
-
 #ifdef _DBUS_DVC_LSD_TIMEOUT_
-               if (ad->speaker_status == EINA_TRUE) {
+               callui_audio_state_type_e audio_state = _callui_sdm_get_audio_state(ad->sound_manager);
+               if (audio_state == CALLUI_AUDIO_STATE_SPEAKER) {
                        _callui_common_dvc_set_lcd_timeout(LCD_TIMEOUT_SET);
                }
 #endif
                break;
-       case CM_CALL_EVENT_IDLE:
-               {
-                       unsigned int call_id = 0;
-                       cm_call_data_t *incom_call = NULL;
-                       cm_call_data_t *active_call = NULL;
-                       cm_call_data_t *held_call = NULL;
-                       if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
-                               _callui_common_dvc_control_lcd_state(LCD_UNLOCK);
-                       } else {
-                               _callui_common_dvc_control_lcd_state(LCD_ON_UNLOCK);
-                       }
-                       cm_call_event_data_get_call_id(call_state_data, &call_id);
-                       cm_call_event_data_get_active_call(call_state_data, &active_call);
-                       cm_call_event_data_get_incom_call(call_state_data, &incom_call);
-                       cm_call_event_data_get_held_call(call_state_data, &held_call);
-                       if ((ad->incom) && (call_id == ad->incom->call_id)) {
-                               __callui_update_all_call_data(ad, call_state_data);
-                               __callui_app_terminate_or_view_change(ad);
-                       } else if (incom_call == NULL && active_call == NULL && held_call == NULL) {
-                               _callui_common_delete_duration_timer();
-                               _callui_vm_change_view(ad->view_manager_handle, VIEW_TYPE_ENDCALL);
-                               _callui_lock_manager_stop(ad->lock_handle);
-                               __callui_update_all_call_data(ad, call_state_data);
-                       } else {
-                               __callui_update_all_call_data(ad, call_state_data);
-                               __callui_app_terminate_or_view_change(ad);
-                       }
-               }
-               break;
-       case CM_CALL_EVENT_INCOMING:
-               {
-                       _callui_common_dvc_control_lcd_state(LCD_ON_LOCK);
-                       __callui_update_all_call_data(ad, call_state_data);
-                       _callui_vm_auto_change_view(ad->view_manager_handle);
+       case CALLUI_CALL_EVENT_TYPE_END:
+               if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
+                       _callui_common_dvc_control_lcd_state(LCD_UNLOCK);
+               } else {
+                       _callui_common_dvc_control_lcd_state(LCD_ON_UNLOCK);
                }
                break;
-       case CM_CALL_EVENT_DIALING:
-       case CM_CALL_EVENT_HELD:
-       case CM_CALL_EVENT_RETRIEVED:
-       case CM_CALL_EVENT_SWAPPED:
-       case CM_CALL_EVENT_JOIN:
-       case CM_CALL_EVENT_SPLIT:
-               __callui_update_all_call_data(ad, call_state_data);
-               _callui_vm_auto_change_view(ad->view_manager_handle);
-               break;
        default:
                break;
        }
-
-       dbg("Call event changed cb done");
-       return;
-}
-
-static void __callui_audio_state_changed_cb(cm_audio_state_type_e audio_state, void *user_data)
-{
-       callui_app_data_t *ad = (callui_app_data_t *)user_data;
-       CALLUI_RETURN_IF_FAIL(ad);
-       dbg("__callui_audio_state_changed_cb, audio_state[%d]", audio_state);
-       switch (audio_state) {
-               case CM_AUDIO_STATE_SPEAKER_E:
-                       _callui_update_speaker_btn(ad, EINA_TRUE);
-                       _callui_update_headset_btn(ad, EINA_FALSE);
-                       ad->earphone_status = EINA_FALSE;
-                       if ((_callui_common_is_extra_volume_available() == EINA_TRUE) && (ad->extra_volume_status_force_stop == EINA_TRUE)) {
-                               int retextravol = -1;
-                               retextravol = cm_set_extra_vol(ad->cm_handle, TRUE);
-                               if (retextravol == CM_ERROR_NONE) {
-                                       ad->extra_volume_status_force_stop = EINA_FALSE;
-                                       _callui_update_extra_vol_btn(ad, EINA_TRUE);
-                               }
-                       }
-                       _callui_lock_manager_force_stop(ad->lock_handle);
-                       break;
-               case CM_AUDIO_STATE_RECEIVER_E:
-                       _callui_update_speaker_btn(ad, EINA_FALSE);
-                       _callui_update_headset_btn(ad, EINA_FALSE);
-                       ad->earphone_status = EINA_FALSE;
-                       if ((_callui_common_is_extra_volume_available() == EINA_TRUE) && (ad->extra_volume_status_force_stop == EINA_TRUE)) {
-                               int retextravol = -1;
-                               retextravol = cm_set_extra_vol(ad->cm_handle, TRUE);
-                               if (retextravol == CM_ERROR_NONE) {
-                                       ad->extra_volume_status_force_stop = EINA_FALSE;
-                                       _callui_update_extra_vol_btn(ad, EINA_TRUE);
-                               }
-                       }
-                       _callui_lock_manager_start(ad->lock_handle);
-                       break;
-               case CM_AUDIO_STATE_EARJACK_E:
-               {
-                       ad->earphone_status = EINA_TRUE;
-                       _callui_update_speaker_btn(ad, EINA_FALSE);
-                       _callui_update_headset_btn(ad, EINA_FALSE);
-                       if (ad->extra_volume_status == EINA_TRUE) {
-                               dbg("Disable extra volume when earphone connected and speaker is turned off");
-                               int ret = -1;
-                               ret = cm_set_extra_vol(ad->cm_handle, FALSE);
-                               if (ret == CM_ERROR_NONE) {
-                                       ad->extra_volume_status_force_stop = EINA_TRUE;
-                                       _callui_create_extravolume_notify_popup();
-                                       _callui_update_extra_vol_btn(ad, EINA_FALSE);
-                               } else {
-                                       err("cm_set_extra_vol() is failed");
-                               }
-                       }
-                       _callui_lock_manager_force_stop(ad->lock_handle);
-                       break;
-               }
-               case CM_AUDIO_STATE_BT_E:
-                       ad->earphone_status = EINA_FALSE;
-                       _callui_update_speaker_btn(ad, EINA_FALSE);
-                       _callui_update_headset_btn(ad, EINA_TRUE);
-                       _callui_lock_manager_force_stop(ad->lock_handle);
-                       break;
-               case CM_AUDIO_STATE_NONE_E:
-               default:
-                       err("unhandled state[%d]", audio_state);
-                       break;
-       }
-
-       return;
 }
 
 static void __callui_call_list_init(callui_app_data_t *ad)
@@ -344,10 +176,6 @@ static void __callui_call_list_init(callui_app_data_t *ad)
        dbg("..");
        CALLUI_RETURN_IF_FAIL(ad);
 
-       ad->active = NULL;
-       ad->incom = NULL;
-       ad->held = NULL;
-       ad->incoming_noti = false;
        ad->multi_call_list_end_clicked = false;
        ad->start_lock_manager_on_resume = false;
        ad->on_background = false;
@@ -370,13 +198,6 @@ static gboolean __callui_init_sys_api(callui_app_data_t *ad)
 {
        dbg("..");
 
-       if (CM_ERROR_NONE != cm_init(&ad->cm_handle)) {
-               err("cm_init() err");
-               return false;
-       }
-       cm_set_call_event_cb(ad->cm_handle, __callui_call_event_cb, ad);
-       cm_set_audio_state_changed_cb(ad->cm_handle, __callui_audio_state_changed_cb, ad);
-
        __callui_bt_init();
 
        return true;
@@ -465,22 +286,36 @@ static bool _callui_app_create(void *data)
 
        elm_app_base_scale_set(2.6);
 
-       elm_config_preferred_engine_set("opengl_x11");
+       elm_config_accel_preference_set("3d");
 
        _callui_common_dvc_control_lcd_state(LCD_OFF_SLEEP_LOCK);
 
        int ret = __callui_init_sys_api(ad);
        if (!ret) {
                err("__callui_init_sys_api failed");
-               return FALSE;
+               return false;
+       }
+
+       ad->call_manager = _callui_manager_create();
+       if (!ad->call_manager) {
+               err("_callui_manager_create() failed");
+               __app_deinit(ad);
+               return false;
        }
 
+       ad->state_provider = _callui_manager_get_state_provider(ad->call_manager);
+       ad->sound_manager = _callui_manager_get_sound_manager(ad->call_manager);
+
+       _callui_stp_add_call_state_event_cb(ad->state_provider, __call_state_change_cb, ad);
+       _callui_sdm_add_audio_state_changed_cb(ad->sound_manager, __audio_state_changed_cb, ad);
+
        if (!_callui_app_create_layout(ad)) {
-               err("_callui_app_create_layout failed");
-               return FALSE;
+               err("_callui_app_create_layout() failed");
+               __app_deinit(ad);
+               return false;
        }
 
-       ad->view_manager_handle = _callui_vm_create(ad);
+       ad->view_manager = _callui_vm_create(ad);
 
        ad->keypad = _callui_keypad_create(ad->main_ly, ad);
 
@@ -500,12 +335,12 @@ static bool _callui_app_create_layout(void *data)
        ad->win = __callui_create_main_win(ad);
        if (ad->win == NULL) {
                err("__callui_create_main_win failed");
-               return FALSE;
+               return false;
        }
        ad->main_ly = __callui_create_base_layout(ad);
        if (ad->main_ly == NULL) {
                err("__callui_create_base_layout failed");
-               return FALSE;
+               return false;
        }
        elm_object_content_set(ad->win_conformant, ad->main_ly);
 
@@ -526,29 +361,33 @@ static void __callui_bt_deinit()
        }
 }
 
-static void _callui_app_terminate(void *data)
+static void __app_deinit(callui_app_data_t *ad)
 {
-       callui_app_data_t *ad = data;
        Evas_Object *contents = NULL;
        Evas_Object *caller_info = NULL;
        Evas_Object *btn_ly = NULL;
 
-       contents = elm_object_part_content_get(ad->main_ly, "elm.swallow.content");
-       if (contents) {
-               caller_info = elm_object_part_content_get(contents, "caller_info");
-               if (caller_info) {
-                       evas_object_del(caller_info);
-                       caller_info = NULL;
-               }
+       _callui_stp_remove_call_state_event_cb(ad->state_provider, __call_state_change_cb, ad);
+       _callui_sdm_remove_audio_state_changed_cb(ad->sound_manager, __audio_state_changed_cb, ad);
 
-               btn_ly = elm_object_part_content_get(contents, "btn_region");
-               if (btn_ly) {
-                       evas_object_del(btn_ly);
-                       btn_ly = NULL;
-               }
+       if (ad->main_ly) {
+               contents = elm_object_part_content_get(ad->main_ly, "elm.swallow.content");
+               if (contents) {
+                       caller_info = elm_object_part_content_get(contents, "caller_info");
+                       if (caller_info) {
+                               evas_object_del(caller_info);
+                               caller_info = NULL;
+                       }
+
+                       btn_ly = elm_object_part_content_get(contents, "btn_region");
+                       if (btn_ly) {
+                               evas_object_del(btn_ly);
+                               btn_ly = NULL;
+                       }
 
-               evas_object_del(contents);
-               contents = NULL;
+                       evas_object_del(contents);
+                       contents = NULL;
+               }
        }
 
        if (ad->downkey_handler) {
@@ -564,9 +403,9 @@ static void _callui_app_terminate(void *data)
        elm_win_keygrab_unset(ad->win, CALLUI_KEY_POWER, 0, 0);
        elm_win_keygrab_unset(ad->win, CALLUI_KEY_MEDIA, 0, 0);
 
-       if (ad->view_manager_handle) {
-               _callui_vm_destroy(ad->view_manager_handle);
-               ad->view_manager_handle = NULL;
+       if (ad->view_manager) {
+               _callui_vm_destroy(ad->view_manager);
+               ad->view_manager = NULL;
        }
 
        if (ad->qp_minicontrol) {
@@ -590,10 +429,11 @@ static void _callui_app_terminate(void *data)
        }
 
        __callui_bt_deinit();
+}
 
-       cm_unset_audio_state_changed_cb(ad->cm_handle);
-
-       cm_unset_call_event_cb(ad->cm_handle);
+static void _callui_app_terminate(void *data)
+{
+       __app_deinit(data);
 }
 
 static void _callui_app_pause(void *data)
@@ -622,7 +462,7 @@ static void _callui_app_service(app_control_h app_control, void *data)
        char *uri_bundle = NULL;
        char *operation = NULL;
 
-       if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_UNDEFINED
+       if (_callui_vm_get_cur_view_type(ad->view_manager) == VIEW_TYPE_UNDEFINED
                        && !ad->waiting_dialing) {
                err("VIEW_TYPE_UNDEFINED. Clear data");
                __callui_call_list_init(ad);
@@ -655,16 +495,6 @@ static void _callui_app_service(app_control_h app_control, void *data)
                                err("handle val is NULL");
                                return;
                        }
-                       ret = app_control_get_extra_data(app_control, "sim_slot", &tmp);
-                       if (ret != APP_CONTROL_ERROR_NONE) {
-                               err("app_control_get_extra_data failed");
-                       }
-                       if (tmp) {
-                               dbg("sim_slot: [%s]", tmp);
-                               ad->sim_slot = atoi(tmp);
-                               free(tmp);
-                               tmp = NULL;
-                       }
                        __callui_process_incoming_call(ad);
                } else {
                        tmp = (char *)uri_bundle + 4;
@@ -683,14 +513,18 @@ static void _callui_app_service(app_control_h app_control, void *data)
                /* */
                warn("Unsupported operation type");
        } else if (strcmp(operation, APP_CONTROL_OPERATION_DURING_CALL) == 0) {
-               if (CM_ERROR_NONE != cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_NORMAL)) {
-                       err("cm_answer_call failed. ret[%d]", ret);
+               ret = _callui_manager_answer_call(ad->call_manager, CALLUI_CALL_ANSWER_TYPE_NORMAL);
+               if (CALLUI_RESULT_OK != ret) {
+                       err("_callui_manager_answer_call() failed. ret[%d]", ret);
                }
        } else if (strcmp(operation, APP_CONTROL_OPERATION_MESSAGE_REJECT) == 0) {
+
                /* TODO Implement reject with message button functionality */
+
        } else if (strcmp(operation, APP_CONTROL_OPERATION_END_CALL) == 0) {
-               if (CM_ERROR_NONE != cm_reject_call(ad->cm_handle)) {
-                       err("cm_reject_call failed. ret[%d]", ret);
+               ret = _callui_manager_reject_call(ad->call_manager);
+               if (CALLUI_RESULT_OK != ret) {
+                       err("_callui_manager_reject_call() failed. ret[%d]", ret);
                }
        }
 
@@ -733,16 +567,24 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve
 
        callui_app_data_t *ad = (callui_app_data_t *)data;
        Ecore_Event_Key *ev = event;
+       const callui_call_state_data_t *call_data = NULL;
 
        if (ev == NULL) {
                err("ERROR!!! ========= Event is NULL!!!");
                return 0;
        }
 
-       callui_view_type_e view_type = _callui_vm_get_cur_view_type(ad->view_manager_handle);
+       callui_view_type_e view_type = _callui_vm_get_cur_view_type(ad->view_manager);
 
        dbg("Top view(%d)", view_type);
 
+       const callui_call_state_data_t *incom = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_INCOMING);
+       const callui_call_state_data_t *active = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_ACTIVE);
+       const callui_call_state_data_t *held = _callui_stp_get_call_data(ad->state_provider,
+                                       CALLUI_CALL_DATA_TYPE_HELD);
+
        /*power key case */
        if (!strcmp(ev->keyname, CALLUI_KEY_POWER)) {
                dbg("in keypower");
@@ -752,38 +594,53 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve
                if (is_powerkey_enabled && !_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
 
                        if (view_type == VIEW_TYPE_DIALLING) {
-                               if (ad->active) {
-                                       cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+                               if (active) {
+                                       call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+                                       if (call_data) {
+                                               _callui_manager_end_call(ad->call_manager, call_data->call_id,
+                                                               CALLUI_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+                                       }
                                }
                        } else if (view_type == VIEW_TYPE_INCOMING_CALL ||
                                        view_type == VIEW_TYPE_INCOMING_CALL_NOTI) {
-                               if (ad->incom) {
-                                       cm_end_call(ad->cm_handle, ad->incom->call_id, CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+                               if (incom) {
+                                       call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+                                       if (call_data) {
+                                               _callui_manager_end_call(ad->call_manager, call_data->call_id,
+                                                               CALLUI_CALL_RELEASE_TYPE_BY_CALL_HANDLE);
+                                       }
                                }
                        } else if (view_type == VIEW_TYPE_SINGLECALL ||
                                        view_type == VIEW_TYPE_MULTICALL_CONF ||
                                        view_type == VIEW_TYPE_MULTICALL_LIST) {
-                               if (ad->active) {
-                                       cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_ALL_CALLS);
-                               } else if (ad->held) {
-                                       cm_end_call(ad->cm_handle, ad->held->call_id, CALL_RELEASE_TYPE_ALL_CALLS);
+
+                               call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+                               if (call_data) {
+                                        _callui_manager_end_call(ad->call_manager, call_data->call_id,
+                                                       CALLUI_CALL_RELEASE_TYPE_ALL_CALLS);
+                               } else {
+                                       call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_HELD);
+                                       if (call_data) {
+                                               _callui_manager_end_call(ad->call_manager, call_data->call_id,
+                                                               CALLUI_CALL_RELEASE_TYPE_ALL_CALLS);
+                                       }
                                }
                        } else if (view_type == VIEW_TYPE_MULTICALL_SPLIT) {
-                               if (ad->active) {
-                                       cm_end_call(ad->cm_handle, ad->active->call_id, CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
+                               call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_ACTIVE);
+                               if (call_data) {
+                                       _callui_manager_end_call(ad->call_manager, call_data->call_id,
+                                                       CALLUI_CALL_RELEASE_TYPE_ALL_ACTIVE_CALLS);
                                }
                        }
                } else {
-                       if (ad->incom && !ad->active && !ad->held) {
+                       if (incom && !active && !held) {
                                callui_view_type_e type = VIEW_TYPE_INCOMING_CALL;
-
-#ifdef ACTIVE_NOTIFICATION_AVAILABLE
+                               callui_view_type_e cur_type = _callui_vm_get_cur_view_type(ad->view_manager);
                                if (_callui_common_get_idle_lock_type() == LOCK_TYPE_UNLOCK &&
-                                               ad->incoming_noti == false) {
+                                               (cur_type == VIEW_TYPE_UNDEFINED || cur_type == VIEW_TYPE_ENDCALL)) {
                                        type = VIEW_TYPE_INCOMING_CALL_NOTI;
                                }
-#endif
-                               _callui_vm_change_view(ad->view_manager_handle, type);
+                               _callui_vm_change_view(ad->view_manager, type);
                        }
                }
        } else if (!strcmp(ev->keyname, CALLUI_KEY_MEDIA)) {
@@ -791,8 +648,9 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve
                dbg("in key-media");
        } else if (!strcmp(ev->keyname, CALLUI_KEY_VOLUMEUP) || !strcmp(ev->keyname, CALLUI_KEY_VOLUMEDOWN)) {
                dbg("Handle Volume Up or Down key");
-               if (ad->incom) {
-                       cm_stop_alert(ad->cm_handle);
+               call_data = _callui_stp_get_call_data(ad->state_provider, CALLUI_CALL_DATA_TYPE_INCOMING);
+               if (call_data) {
+                       _callui_manager_stop_alert(ad->call_manager);
                }
        } else if (!strcmp(ev->keyname,  CALLUI_KEY_SELECT) || !strcmp(ev->keyname,  CALLUI_KEY_HOME)) {
                dbg("in KEY_SELECT");
@@ -810,13 +668,15 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve
                                dbg("Answering mode on and Home key pressed on MT screen");
 
                                int unhold_call_count = 0;
-                               if (ad->active) {
-                                       unhold_call_count = ad->active->member_count;
+                               if (active) {
+                                       unhold_call_count = active->conf_member_count;
                                }
 
                                if (unhold_call_count == 0) {
                                        dbg("No Call Or Held call - Accept");
-                                       cm_answer_call(ad->cm_handle, CALL_ANSWER_TYPE_NORMAL);
+
+                                       _callui_manager_answer_call(ad->call_manager, CALLUI_CALL_ANSWER_TYPE_NORMAL);
+
                                        if (_callui_common_get_idle_lock_type() == LOCK_TYPE_SWIPE_LOCK) {
                                                _callui_common_unlock_swipe_lock();
                                        }
@@ -844,13 +704,7 @@ static Eina_Bool __callui_app_win_hard_key_up_cb(void *data, int type, void *eve
                dbg("KEY_BACK section");
        }
 
-
-       ad->b_earset_key_longpress = EINA_FALSE;
-
-       if (ad->earset_key_longpress_timer) {
-               ecore_timer_del(ad->earset_key_longpress_timer);
-               ad->earset_key_longpress_timer = NULL;
-       }
+       DELETE_ECORE_TIMER(ad->earset_key_longpress_timer);
 
        return EINA_FALSE;
 }
@@ -861,7 +715,6 @@ static Eina_Bool __callui_app_win_earset_key_longpress_timer_cb(void *data)
 
        callui_app_data_t *ad = (callui_app_data_t *)data;
 
-       ad->b_earset_key_longpress = EINA_TRUE;
        ad->earset_key_longpress_timer = NULL;
 
        return ECORE_CALLBACK_CANCEL;
@@ -879,7 +732,7 @@ static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *e
                return EINA_FALSE;
        }
 
-       if (_callui_vm_get_cur_view_type(ad->view_manager_handle) == VIEW_TYPE_UNDEFINED) {
+       if (_callui_vm_get_cur_view_type(ad->view_manager) == VIEW_TYPE_UNDEFINED) {
                dbg("ad->view_top is UNDEFINED");
                return EINA_FALSE;
        }
@@ -892,23 +745,3 @@ static Eina_Bool __callui_app_win_hard_key_down_cb(void *data, int type, void *e
        dbg("End..");
        return EINA_FALSE;
 }
-
-static void __callui_app_terminate(void *data)
-{
-       _callui_common_exit_app();
-}
-
-static void __callui_app_terminate_or_view_change(callui_app_data_t *ad)
-{
-       CALLUI_RETURN_IF_FAIL(ad);
-
-       if ((NULL == ad->active) && (NULL == ad->incom) && (NULL == ad->held)) {
-               if (_callui_lock_manager_is_lcd_off(ad->lock_handle)) {
-                       _callui_lock_manager_set_callback_on_unlock(ad->lock_handle, __callui_app_terminate, NULL);
-               } else {
-                       __callui_app_terminate(ad->lock_handle);
-               }
-       } else {
-               _callui_vm_auto_change_view(ad->view_manager_handle);
-       }
-}