int _callmgr_popup_dbus_deinit(void *user_data);
int _callmgr_popup_dial_call(char *number, int call_type, int sim_slot, int disable_fm, gboolean is_emergency_contact, void *user_data);
+int _callmgr_popup_set_popup_result(callmgr_popup_type_e popup_type, int result, void *user_data);
#endif /* _CALLMGR_POPUP_DBUS_H_ */
#define DBUS_CALL_MANAGER_DEFAULT_INTERFACE DBUS_CALL_MANAGER
#define DBUS_CALL_MANAGER_METHOD_DIAL_CALL "DialCall"
+#define DBUS_CALL_MANAGER_METHOD_SET_POPUP_RESULT "SetPopupResult"
#define CM_DEFAULT_TIMEOUT (60 * 1000)
-static void __callmgr_popup_dial_call_cb(GObject *source_object, GAsyncResult *res, gpointer user_data)
+static void __callmgr_popup_response_cb(GObject *source_object, GAsyncResult *res, gpointer user_data)
{
GError *error = NULL;
GDBusConnection *conn = NULL;
g_dbus_connection_call(ad->dbus_conn, DBUS_CALL_MANAGER,
DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE, DBUS_CALL_MANAGER_METHOD_DIAL_CALL,
g_variant_new("(siiib)", number, call_type, sim_slot, disable_fm, is_emergency_contact), NULL, G_DBUS_CALL_FLAGS_NONE,
- CM_DEFAULT_TIMEOUT, ad->ca, __callmgr_popup_dial_call_cb, user_data);
+ CM_DEFAULT_TIMEOUT, ad->ca, __callmgr_popup_response_cb, user_data);
+
+ DBG("<<");
+ return value;
+}
+
+int _callmgr_popup_set_popup_result(callmgr_popup_type_e popup_type, int result, void *user_data)
+{
+ CallMgrPopAppData_t *ad = (CallMgrPopAppData_t *)user_data;
+
+ gint value = 0;
+ DBG("Set callmgr-popup result!! popup_type[%d], result[%s]",
+ popup_type, result == 0 ? "CANCEL" : "OK");
+
+ g_dbus_connection_call(ad->dbus_conn, DBUS_CALL_MANAGER,
+ DBUS_CALL_MANAGER_PATH, DBUS_CALL_MANAGER_DEFAULT_INTERFACE,
+ DBUS_CALL_MANAGER_METHOD_SET_POPUP_RESULT,
+ g_variant_new("(ii)", popup_type, result), NULL, G_DBUS_CALL_FLAGS_NONE,
+ CM_DEFAULT_TIMEOUT, ad->ca, NULL, NULL);
DBG("<<");
return value;
case CALLMGR_POPUP_HIDE_E:
if (ad->request) {
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "0"); /* "0" means CANCEL */
+ _callmgr_popup_set_popup_result(ad->popup_type, 0, ad); /* 0 means CANCEL */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
}
elm_exit();
break;
if ((ad->popup) && (ad->popup_type != CALLMGR_POPUP_FLIGHT_MODE_DISABLING_E)) {
evas_object_del(ad->popup);
ad->popup = NULL;
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "0"); /* "0" means CANCEL */
+ _callmgr_popup_set_popup_result(ad->popup_type, 0, ad); /* 0 means CANCEL */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
elm_exit();
}
evas_object_del(ad->popup);
}
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "0"); /* "0" means CANCEL */
+ _callmgr_popup_set_popup_result(ad->popup_type, 0, ad); /* 0 means OK */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
elm_exit();
}
{
CallMgrPopAppData_t *ad = (CallMgrPopAppData_t *)data;
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "1"); /* "1" means OK */
+ _callmgr_popup_set_popup_result(ad->popup_type, 1, ad); /* 1 means OK */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
_callmgr_popup_dial_call(ad->dial_num, ad->call_type, ad->active_sim, 1, FALSE, ad);
if (ad->popup) {
evas_object_del(ad->popup);
evas_object_del(ad->popup);
}
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "0"); /* "0" means CANCEL */
+ _callmgr_popup_set_popup_result(ad->popup_type, 0, ad); /* 0 means CANCEL */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
elm_exit();
}
int index = GPOINTER_TO_INT(elm_object_item_data_get(item));
DBG("index: %d", index);
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "1"); /* "1" means OK */
+ _callmgr_popup_set_popup_result(ad->popup_type, 1, ad); /* "1" means OK */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
_callmgr_popup_dial_call(ad->dial_num, ad->call_type, index, 0, FALSE, ad);
} else {
ERR("item is NULL");
{
CallMgrPopAppData_t *ad = (CallMgrPopAppData_t *)data;
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "1"); /* "1" means OK */
+ _callmgr_popup_set_popup_result(ad->popup_type, 1, ad); /* 1 means OK */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
_callmgr_popup_dial_call(ad->dial_num, ad->call_type, ad->active_sim, 0, FALSE, ad);
if (ad->popup) {
evas_object_del(ad->popup);
if (ad->popup) {
evas_object_del(ad->popup);
}
- _callmgr_popup_reply_to_launch_request(ad, "RESULT", "0"); /* "0" means CANCEL */
+ _callmgr_popup_set_popup_result(ad->popup_type, 0, ad); /* 0 means CANCEL */
+ app_control_destroy(ad->request);
+ ad->request = NULL;
elm_exit();
}
callmgr_thread_data_t *cb_data = (callmgr_thread_data_t*)data;
CM_RETURN_VAL_IF_FAIL(cb_data, NULL);
char buf[2] = {0, };
- bundle *kb = NULL;
+ bundle *kb = NULL;
uid_t uid = 0;
kb = bundle_create();
callmgr_thread_data_t *cb_data = (callmgr_thread_data_t*)data;
CM_RETURN_VAL_IF_FAIL(cb_data, NULL);
char buf[500 + 1] = {0, };
- bundle *kb = NULL;
+ bundle *kb = NULL;
+ uid_t uid = 0;
kb = bundle_create();
g_snprintf(buf, 2, "%d", cb_data->sim_slot);
dbg("sim_slot : [%s]", buf);
appsvc_add_data(kb, "sim_slot", buf);
- appsvc_run_service(kb, 0, NULL, NULL);
+ /* To support multi-user, launch call-ui with active uid */
+ __callmgr_util_get_active_uid(&uid);
+ appsvc_usr_run_service(kb, 0, NULL, NULL, uid);
bundle_free(kb);
g_free(cb_data);
callmgr_thread_data_t *cb_data = (callmgr_thread_data_t*)data;
CM_RETURN_VAL_IF_FAIL(cb_data, NULL);
char buf[2] = {0, };
- bundle *kb = NULL;
+ bundle *kb = NULL;
+ uid_t uid = 0;
kb = bundle_create();
/*
g_snprintf(buf, 2, "%d", cb_data->sim_slot);
dbg("sim_slot : [%s]", buf);
appsvc_add_data(kb, "sim_slot", buf);
- appsvc_run_service(kb, 0, NULL, NULL);
+ /* To support multi-user, launch vt-call with active uid */
+ __callmgr_util_get_active_uid(&uid);
+ appsvc_usr_run_service(kb, 0, NULL, NULL, uid);
bundle_free(kb);
g_free(cb_data);
return 0;
}
+/*
+ * system session daemon can't receive result-callback from application.
+ * so, do not use this code and refer the 'SetPopupResult' method.
static void __callmgr_util_popup_reply_cb(app_control_h request, app_control_h reply, app_control_result_e result, void *user_data)
{
dbg("__callmgr_util_popup_reply_cb");
}
return;
}
+*/
int _callmgr_util_launch_popup(call_popup_type popup_type, int info, const char* number, int active_sim, callmgr_util_popup_result_cb cb, void *user_data)
{
dbg("_callmgr_util_launch_popup: popup_type(%d), info(%d)", popup_type, info);
- char type_buf[10] = { 0, };
- char err_buf[10] = { 0, };
- char sim_buf[10] = { 0, };
- _callmgr_util_popup_data_t *popup_data = NULL;
- int result = APP_CONTROL_ERROR_NONE;
+ char type_buf[10] = {0, };
+ char err_buf[10] = {0, };
+ char sim_buf[10] = {0, };
+ bundle *kb = NULL;
+ uid_t uid = 0;
+ GThread* selfi = g_thread_self();
- app_control_h app_control = NULL;
- result = app_control_create(&app_control);
- if (result != APP_CONTROL_ERROR_NONE) {
- warn("app_control_create() return error : %d", result);
- return -1;
- }
- app_control_set_app_id(app_control, CALLMGR_POPUP_NAME);
+ kb = bundle_create();
+
+ appsvc_set_appid(kb, CALLMGR_POPUP_NAME);
snprintf(type_buf, sizeof(type_buf), "%d", popup_type);
- app_control_add_extra_data(app_control, "TYPE", type_buf);
+ appsvc_add_data(kb, "TYPE", type_buf);
snprintf(err_buf, sizeof(err_buf), "%d", info);
- app_control_add_extra_data(app_control, "SUB_INFO", err_buf);
+ appsvc_add_data(kb, "SUB_INFO", err_buf);
- app_control_add_extra_data(app_control, "NUMBER", number);
+ appsvc_add_data(kb, "NUMBER", number);
snprintf(sim_buf, sizeof(sim_buf), "%d", active_sim);
- app_control_add_extra_data(app_control, "ACTIVE_SIM", sim_buf);
+ appsvc_add_data(kb, "ACTIVE_SIM", sim_buf);
- if (cb) {
- popup_data = (_callmgr_util_popup_data_t*)calloc(1, sizeof(_callmgr_util_popup_data_t));
- if (popup_data == NULL) {
- app_control_destroy(app_control);
- return -1;
- }
- popup_data->popup_type = popup_type;
- popup_data->popup_result_cb = cb;
- popup_data->user_data = user_data;
- }
+ /* To support multi-user, launch call-ui with active uid */
+ __callmgr_util_get_active_uid(&uid);
+ appsvc_usr_run_service(kb, 0, NULL, NULL, uid);
+
+ bundle_free(kb);
- result = app_control_send_launch_request(app_control, __callmgr_util_popup_reply_cb, popup_data);
- if (result != APP_CONTROL_ERROR_NONE) {
- warn("Retry");
- result = app_control_send_launch_request(app_control, __callmgr_util_popup_reply_cb, popup_data);
- err("retry : %d", result);
+ if (TRUE == __callmgr_util_thread_dispatch(g_main_context_default(), G_PRIORITY_LOW, (GSourceFunc)__callmgr_util_thread_finish_cb, selfi)) {
+ dbg("Thread %p processing is complete", selfi);
}
- app_control_destroy(app_control);
return 0;
}
<arg direction="out" type="b" name="is_video_recording" />
</method>
+ <method name="SetPopupResult">
+ <arg direction="in" type="i" name="popup_type" />
+ <arg direction="in" type="i" name="result" />
+ <arg direction="out" type="i" name="err" />
+ </method>
+
<!--signal list -->
<signal name="CallEvent">
%define major 0
%define minor 1
-%define patchlevel 88
+%define patchlevel 89
%define ext_feature 0
Name: call-manager
return TRUE;
}
+static gboolean __set_popup_result_handler(GDBusInterfaceSkeleton *di,
+ GDBusMethodInvocation *invoc, gint popup_type, gint result, gpointer user_data)
+{
+ callmgr_core_data_t *core_data = (callmgr_core_data_t *)user_data;
+ CM_RETURN_VAL_IF_FAIL(core_data, FALSE);
+
+ dbg("__set_popup_result_handler() is called. popup_type[%d], result[%d]",
+ popup_type, result == 0 ? "CANCEL" : "OK");
+
+ if (popup_type == CALL_POPUP_FLIGHT_MODE) {
+ cm_util_popup_result_e popup_result = (cm_util_popup_result_e)result;
+ if (popup_result == CM_UTIL_POPUP_RESP_CANCEL)
+ _callmgr_dbus_send_dial_status(core_data, CALL_MANAGER_DIAL_FAIL_FLIGHT_MODE);
+ else
+ info("OK button on FM popup is clicked ");
+ } else if (popup_type == CALL_POPUP_SIM_SELECT || popup_type == CALL_POPUP_OUT_OF_3G_TRY_VOICE_CALL) {
+ cm_util_popup_result_e popup_result = (cm_util_popup_result_e)result;
+ if (popup_result == CM_UTIL_POPUP_RESP_CANCEL)
+ _callmgr_dbus_send_dial_status(core_data, CALL_MANAGER_DIAL_CANCEL);
+ }
+
+ return TRUE;
+}
/********************************************/
static gchar *__callmgr_dbus_convert_name_to_path(const gchar *name)
g_signal_connect(di, "handle-get-mute-status", G_CALLBACK(__get_mute_status_handler), core_data);
g_signal_connect(di, "handle-get-answering-machine-status", G_CALLBACK(__get_answering_machine_status_handler), core_data);
g_signal_connect(di, "handle-get-video-recording-status", G_CALLBACK(__get_video_recording_status_handler), core_data);
+ g_signal_connect(di, "handle-set-popup-result", G_CALLBACK(__set_popup_result_handler), core_data);
__callmgr_dbus_object_export(core_data, di, CALLMGR_DBUS_PATH);
core_data->dbus_skeleton_interface = di;