6 #include "include/mm_sound_proxy.h"
7 #include "include/mm_sound_common.h"
8 #include "include/mm_sound_dbus.h"
9 #include "include/mm_sound_intf.h"
12 #include <security-server.h>
13 #define COOKIE_SIZE 20
17 struct callback_data {
21 mm_sound_proxy_userdata_free free_func;
24 #define GET_CB_DATA(_cb_data, _func, _userdata, _freefunc, _extradata) \
26 _cb_data = (struct callback_data*) g_malloc0(sizeof(struct callback_data)); \
27 _cb_data->user_cb = _func; \
28 _cb_data->user_data = _userdata; \
29 _cb_data->free_func = _freefunc; \
30 _cb_data->extra_data = _extradata; \
34 /* This callback unmarshall general-formed paramters to subject specific parameters,
35 * and call proper callback */
36 static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
38 struct callback_data *cb_data = (struct callback_data*) userdata;
40 if (event == AUDIO_EVENT_VOLUME_CHANGED) {
41 char *volume_type_str = NULL, *direction = NULL;
42 unsigned volume_level;
44 g_variant_get(params, "(&s&su)", &direction, &volume_type_str, &volume_level);
45 ((mm_sound_volume_changed_wrapper_cb)(cb_data->user_cb))(direction, volume_type_str, volume_level, cb_data->user_data);
46 } else if (event == AUDIO_EVENT_DEVICE_CONNECTED) {
47 const char *name = NULL, *device_type = NULL;
48 gboolean is_connected = FALSE;
49 int device_id, io_direction, state;
51 g_variant_get(params, "((i&sii&s)b)", &device_id, &device_type, &io_direction,
52 &state, &name, &is_connected);
53 ((mm_sound_device_connected_wrapper_cb)(cb_data->user_cb))(device_id, device_type, io_direction, state, name, is_connected, cb_data->user_data);
54 } else if (event == AUDIO_EVENT_DEVICE_INFO_CHANGED) {
55 const char *name = NULL, *device_type = NULL;
56 int changed_device_info_type = 0;
57 int device_id, io_direction, state;
59 g_variant_get(params, "((i&sii&s)i)", &device_id, &device_type, &io_direction,
60 &state, &name, &changed_device_info_type);
61 ((mm_sound_device_info_changed_wrapper_cb)(cb_data->user_cb))(device_id, device_type, io_direction, state, name, changed_device_info_type, cb_data->user_data);
62 } else if (event == AUDIO_EVENT_FOCUS_CHANGED) {
63 } else if (event == AUDIO_EVENT_FOCUS_WATCH) {
64 } else if (event == AUDIO_EVENT_TEST) {
66 g_variant_get(params, "(i)", &test_var);
67 ((mm_sound_test_cb)(cb_data->user_cb))(test_var, cb_data->user_data);
68 } else if (event == AUDIO_EVENT_PLAY_FILE_END) {
70 g_variant_get(params, "(i)", &ended_handle);
71 ((mm_sound_stop_callback_wrapper_func)(cb_data->user_cb))(ended_handle, cb_data->user_data);
75 static void simple_callback_data_free_func(void *data)
77 struct callback_data *cb_data = (struct callback_data*) data;
79 if (cb_data->free_func)
80 cb_data->free_func(cb_data->user_data);
85 int mm_sound_proxy_add_test_callback(mm_sound_test_cb func, void *userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
87 int ret = MM_ERROR_NONE;
88 struct callback_data *cb_data;
92 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
94 if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_EVENT_TEST, dbus_callback, cb_data, simple_callback_data_free_func, subs_id)) != MM_ERROR_NONE) {
95 debug_error("add test callback failed");
102 int mm_sound_proxy_remove_test_callback(unsigned subs_id)
104 int ret = MM_ERROR_NONE;
107 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
108 debug_error("remove test callback failed");
115 int mm_sound_proxy_test(int a, int b, int *get)
117 int ret = MM_ERROR_NONE;
119 GVariant *params = NULL, *result = NULL;
123 params = g_variant_new("(ii)", a, b);
125 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_TEST, params, &result)) != MM_ERROR_NONE) {
126 debug_error("dbus test call failed");
130 debug_error("Construct Param for method call failed");
131 return MM_ERROR_SOUND_INTERNAL;
135 g_variant_get(result, "(i)", &reply);
136 debug_log("reply : %d", reply);
139 debug_error("reply null");
144 g_variant_unref(result);
150 int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** device_list)
152 int ret = MM_ERROR_NONE;
153 GVariant *result = NULL, *child = NULL;
156 mm_sound_device_t* device_item;
157 const gchar *device_name_tmp = NULL, *device_type_tmp = NULL;
162 debug_error("Invalid Parameter, device_list null");
163 ret = MM_ERROR_INVALID_ARGUMENT;
167 params = g_variant_new("(i)", device_flags);
170 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_DEVICE_MANAGER, AUDIO_METHOD_GET_CONNECTED_DEVICE_LIST, params, &result)) != MM_ERROR_NONE) {
171 debug_error("Get current connected device list failed");
175 debug_error("Construct Param for get current connected device failed");
176 return MM_ERROR_SOUND_INTERNAL;
179 child = g_variant_get_child_value(result, 0);
180 g_variant_iter_init(&iter, child);
182 device_item = g_malloc0(sizeof(mm_sound_device_t));
183 if (device_item && g_variant_iter_loop(&iter, "(i&sii&s)", &device_item->id, &device_type_tmp, &device_item->io_direction, &device_item->state, &device_name_tmp)) {
184 MMSOUND_STRNCPY(device_item->name, device_name_tmp, MAX_DEVICE_NAME_NUM);
185 MMSOUND_STRNCPY(device_item->type, device_type_tmp, MAX_DEVICE_TYPE_STR_LEN);
186 *device_list = g_list_append(*device_list, device_item);
187 debug_log("Added device id(%d) type(%17s) direction(%d) state(%d) name(%s)", device_item->id, device_item->type,device_item->io_direction, device_item->state, device_item->name);
197 g_variant_unref(result);
203 int mm_sound_proxy_add_device_connected_callback(int device_flags, mm_sound_device_connected_wrapper_cb func, void *userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
205 int ret = MM_ERROR_NONE;
206 struct callback_data *cb_data;
210 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
212 if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_DEVICE_MANAGER, AUDIO_EVENT_DEVICE_CONNECTED, dbus_callback, cb_data, simple_callback_data_free_func, subs_id)) != MM_ERROR_NONE) {
213 debug_error("add device connected callback failed");
220 int mm_sound_proxy_remove_device_connected_callback(unsigned subs_id)
222 int ret = MM_ERROR_NONE;
225 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
226 debug_error("remove device connected callback failed");
233 int mm_sound_proxy_add_device_info_changed_callback(int device_flags, mm_sound_device_info_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
235 int ret = MM_ERROR_NONE;
236 struct callback_data *cb_data;
240 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
242 if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_DEVICE_MANAGER, AUDIO_EVENT_DEVICE_INFO_CHANGED, dbus_callback, cb_data, simple_callback_data_free_func, subs_id)) != MM_ERROR_NONE) {
243 debug_error("Add device info changed callback failed");
250 int mm_sound_proxy_remove_device_info_changed_callback(unsigned subs_id)
252 int ret = MM_ERROR_NONE;
255 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
256 debug_error("remove device info changed callback failed");
263 int mm_sound_proxy_set_volume_by_type(const char *volume_type, const unsigned volume_level)
265 int ret = MM_ERROR_NONE;
266 char *reply = NULL, *direction = "out";
267 GVariant *params = NULL, *result = NULL;
271 params = g_variant_new("(ssu)", direction, volume_type, volume_level);
273 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_STREAM_MANAGER, AUDIO_METHOD_SET_VOLUME_LEVEL, params, &result)) != MM_ERROR_NONE) {
274 debug_error("dbus set volume by type failed");
278 debug_error("Construct Param for method call failed");
279 return MM_ERROR_SOUND_INTERNAL;
283 g_variant_get(result, "(&s)", &reply);
284 debug_log("reply : %s", reply);
285 if (!strcmp(reply, "STREAM_MANAGER_RETURN_ERROR"))
286 ret = MM_ERROR_SOUND_INTERNAL;
288 debug_error("reply null");
293 g_variant_unref(result);
299 int mm_sound_proxy_add_volume_changed_callback(mm_sound_volume_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
301 int ret = MM_ERROR_NONE;
302 struct callback_data *cb_data;
306 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
308 if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_STREAM_MANAGER, AUDIO_EVENT_VOLUME_CHANGED, dbus_callback, cb_data, simple_callback_data_free_func, subs_id)) != MM_ERROR_NONE) {
309 debug_error("Add Volume changed callback failed");
317 int mm_sound_proxy_remove_volume_changed_callback(unsigned subs_id)
319 int ret = MM_ERROR_NONE;
322 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
323 debug_error("Remove Volume changed callback failed");
330 int mm_sound_proxy_play_tone(int tone, int repeat, int volume, int volume_config,
331 int session_type, int session_options, int client_pid,
332 bool enable_session, int *codechandle, char *stream_type, int stream_index)
334 int ret = MM_ERROR_NONE;
336 GVariant* params = NULL, *result = NULL;
337 gboolean _enable_session = enable_session;
340 debug_error("Param for play is null");
341 return MM_ERROR_INVALID_ARGUMENT;
346 params = g_variant_new("(iiiiiiibsi)", tone, repeat, volume,
347 volume_config, session_type, session_options, client_pid , _enable_session, stream_type, stream_index);
349 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_DTMF, params, &result)) != MM_ERROR_NONE) {
350 debug_error("dbus play tone failed");
354 debug_error("Construct Param for method call failed");
358 g_variant_get(result, "(i)", &handle);
359 debug_log("handle : %d", handle);
360 *codechandle = handle;
362 debug_error("reply null");
367 g_variant_unref(result);
375 int mm_sound_proxy_play_tone_with_stream_info(int client_pid, int tone, char *stream_type, int stream_index, int volume, int repeat, int *codechandle)
377 int ret = MM_ERROR_NONE;
379 GVariant* params = NULL, *result = NULL;
384 debug_error("Param for play is null");
385 return MM_ERROR_INVALID_ARGUMENT;
388 params = g_variant_new("(iiiisi)", tone, repeat, volume, client_pid, stream_type, stream_index);
390 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_DTMF_WITH_STREAM_INFO, params, &result)) != MM_ERROR_NONE) {
391 debug_error("dbus play tone failed");
395 debug_error("Construct Param for method call failed");
399 g_variant_get(result, "(i)", &handle);
400 debug_log("handle : %d", handle);
401 *codechandle = handle;
403 debug_error("reply null");
408 g_variant_unref(result);
416 int mm_sound_proxy_play_sound(const char* filename, int tone, int repeat, int volume, int volume_config,
417 int priority, int session_type, int session_options, int client_pid, int handle_route,
418 bool enable_session, int *codechandle, char *stream_type, int stream_index)
420 int ret = MM_ERROR_NONE;
422 GVariant* params = NULL, *result = NULL;
423 gboolean _enable_session = enable_session;
425 if (!filename || !codechandle) {
426 debug_error("Param for play is null");
427 return MM_ERROR_INVALID_ARGUMENT;
432 params = g_variant_new("(siiiiiiiiibsi)", filename, tone, repeat, volume,
433 volume_config, priority, session_type, session_options, client_pid, handle_route, _enable_session, stream_type, stream_index);
435 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_FILE_START, params, &result)) != MM_ERROR_NONE) {
436 debug_error("dbus play file failed");
440 debug_error("Construct Param for method call failed");
444 g_variant_get(result, "(i)", &handle);
445 debug_log("handle : %d", handle);
446 *codechandle = handle;
448 debug_error("reply null");
453 g_variant_unref(result);
459 int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, int volume,
460 int priority, int client_pid, int handle_route, int *codechandle, char *stream_type, int stream_index)
462 int ret = MM_ERROR_NONE;
464 GVariant* params = NULL, *result = NULL;
466 if (!filename || !codechandle) {
467 debug_error("Param for play is null");
468 return MM_ERROR_INVALID_ARGUMENT;
473 params = g_variant_new("(siiiiisi)", filename, repeat, volume,
474 priority, client_pid, handle_route, stream_type, stream_index);
476 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_FILE_START_WITH_STREAM_INFO, params, &result)) != MM_ERROR_NONE) {
477 debug_error("dbus play file failed");
481 debug_error("Construct Param for method call failed");
485 g_variant_get(result, "(i)", &handle);
486 debug_log("handle : %d", handle);
487 *codechandle = handle;
489 debug_error("reply null");
494 g_variant_unref(result);
503 int mm_sound_proxy_stop_sound(int handle)
505 int ret = MM_ERROR_NONE;
506 GVariant *result = NULL;
510 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_FILE_STOP, g_variant_new("(i)", handle), &result)) != MM_ERROR_NONE) {
511 debug_error("dbus stop file playing failed");
517 g_variant_unref(result);
523 int mm_sound_proxy_clear_focus(int pid)
525 int ret = MM_ERROR_NONE;
526 GVariant *result = NULL;
530 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_CLEAR_FOCUS, g_variant_new("(i)", pid), &result)) != MM_ERROR_NONE) {
531 debug_error("dbus clear focus failed");
535 g_variant_unref(result);
541 int mm_sound_proxy_add_play_sound_end_callback(mm_sound_stop_callback_wrapper_func func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
543 int ret = MM_ERROR_NONE;
544 struct callback_data *cb_data;
548 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
550 if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_EVENT_PLAY_FILE_END, dbus_callback, cb_data, simple_callback_data_free_func, subs_id)) != MM_ERROR_NONE) {
551 debug_error("add play sound end callback failed");
559 int mm_sound_proxy_remove_play_sound_end_callback(unsigned subs_id)
561 int ret = MM_ERROR_NONE;
564 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
565 debug_error("Remove Play File End callback failed");
572 int mm_sound_proxy_emergent_exit(int exit_pid)
574 int ret = MM_ERROR_NONE;
575 GVariant* params = NULL;
579 params = g_variant_new("(i)", exit_pid);
581 if ((ret = mm_sound_dbus_emit_signal(AUDIO_PROVIDER_AUDIO_CLIENT, AUDIO_EVENT_EMERGENT_EXIT, params)) != MM_ERROR_NONE) {
582 debug_error("dbus emergent exit failed");
586 debug_error("Construct Param for emergent exit signal failed");
587 ret = MM_ERROR_SOUND_INTERNAL;
596 /*------------------------------------------ FOCUS --------------------------------------------------*/
599 #ifdef SUPPORT_CONTAINER
601 char* _get_cookie(int cookie_size)
606 if (security_server_get_cookie_size() != cookie_size) {
607 debug_error ("[Security] security_server_get_cookie_size() != COOKIE_SIZE(%d)\n", cookie_size);
611 cookie = (char*)malloc (cookie_size);
613 retval = security_server_request_cookie (cookie, cookie_size);
614 if (retval == SECURITY_SERVER_API_SUCCESS) {
615 debug_msg ("[Security] security_server_request_cookie() returns [%d]\n", retval);
617 debug_error ("[Security] security_server_request_cookie() returns [%d]\n", retval);
623 static GVariant* _get_cookie_variant ()
626 GVariantBuilder builder;
629 cookie = _get_cookie(COOKIE_SIZE);
634 g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
635 for (i = 0; i < COOKIE_SIZE; i++)
636 g_variant_builder_add(&builder, "y", cookie[i]);
639 return g_variant_builder_end(&builder);
642 #endif /* USE_SECURITY */
643 #endif /* SUPPORT_CONTAINER */
645 int mm_sound_proxy_get_unique_id(int *id)
647 int ret = MM_ERROR_NONE;
649 GVariant *result = NULL;
653 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_GET_UNIQUE_ID, NULL, &result)) != MM_ERROR_NONE) {
654 debug_error("dbus get unique id failed");
658 g_variant_get(result, "(i)", &res);
660 debug_msg("got unique id(%d)", *id);
661 g_variant_unref(result);
669 int mm_sound_proxy_register_focus(int id, int instance, const char *stream_type, mm_sound_focus_changed_cb callback, bool is_for_session, void* userdata)
671 int ret = MM_ERROR_NONE;
672 GVariant* params = NULL, *result = NULL;
673 #ifdef SUPPORT_CONTAINER
679 #ifdef SUPPORT_CONTAINER
681 params = g_variant_new("(@ayiisb)", _get_cookie_variant(), instance, id, stream_type, is_for_session);
682 #else /* USE_SECURITY */
683 gethostname(container, sizeof(container));
684 debug_error("container = %s", container);
685 params = g_variant_new("(siisb)", container, instance, id, stream_type, is_for_session);
686 #endif /* USE_SECURITY */
688 #else /* SUPPORT_CONTAINER */
689 params = g_variant_new("(iisb)", instance, id, stream_type, is_for_session);
691 #endif /* SUPPORT_CONTAINER */
694 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_REGISTER_FOCUS, params, &result)) != MM_ERROR_NONE) {
695 debug_error("dbus register focus failed");
698 debug_error("Construct Param for method call failed");
701 if(ret != MM_ERROR_NONE)
702 g_variant_get(result, "(i)", &ret);
704 g_variant_unref(result);
712 int mm_sound_proxy_unregister_focus(int instance, int id, bool is_for_session)
714 int ret = MM_ERROR_NONE;
715 GVariant* params = NULL, *result = NULL;
719 params = g_variant_new("(iib)", instance, id, is_for_session);
721 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_UNREGISTER_FOCUS, params, &result)) != MM_ERROR_NONE) {
722 debug_error("dbus unregister focus failed");
725 debug_error("Construct Param for method call failed");
728 if (ret != MM_ERROR_NONE)
729 g_variant_get(result, "(i)", &ret);
731 g_variant_unref(result);
738 int mm_sound_proxy_set_foucs_reacquisition(int instance, int id, bool reacquisition)
740 int ret = MM_ERROR_NONE;
741 GVariant* params = NULL, *result = NULL;
745 params = g_variant_new("(iib)", instance, id, reacquisition);
747 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_SET_FOCUS_REACQUISITION, params, &result)) != MM_ERROR_NONE) {
748 debug_error("dbus set focus reacquisition failed");
751 debug_error("Construct Param for method call failed");
754 if (ret != MM_ERROR_NONE)
755 g_variant_get(result, "(i)", &ret);
757 g_variant_unref(result);
763 int mm_sound_proxy_get_acquired_focus_stream_type(int focus_type, char **stream_type, char **additional_info)
765 int ret = MM_ERROR_NONE;
766 GVariant* params = NULL, *result = NULL;
770 if (!(params = g_variant_new("(i)", focus_type))) {
771 debug_error("Construct Param for method call failed");
772 return MM_ERROR_SOUND_INTERNAL;
775 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_GET_ACQUIRED_FOCUS_STREAM_TYPE, params, &result)) == MM_ERROR_NONE) {
777 g_variant_get(result, "(ss)", stream_type, additional_info);
778 g_variant_unref(result);
781 debug_error("dbus get stream type of acquired focus failed");
788 int mm_sound_proxy_acquire_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session)
790 int ret = MM_ERROR_NONE;
791 GVariant* params = NULL, *result = NULL;
795 params = g_variant_new("(iiisb)", instance, id, type, option, is_for_session);
797 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_ACQUIRE_FOCUS, params, &result)) != MM_ERROR_NONE) {
798 debug_error("dbus acquire focus failed");
801 debug_error("Construct Param for method call failed");
804 if (ret != MM_ERROR_NONE)
805 g_variant_get(result, "(i)", &ret);
807 g_variant_unref(result);
813 int mm_sound_proxy_release_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session)
815 int ret = MM_ERROR_NONE;
816 GVariant* params = NULL, *result = NULL;
820 params = g_variant_new("(iiisb)", instance, id, type, option, is_for_session);
822 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_RELEASE_FOCUS, params, &result)) != MM_ERROR_NONE) {
823 debug_error("dbus release focus failed");
826 debug_error("Construct Param for method call failed");
829 if (ret != MM_ERROR_NONE)
830 g_variant_get(result, "(i)", &ret);
832 g_variant_unref(result);
838 int mm_sound_proxy_set_focus_watch_callback(int instance, int handle, mm_sound_focus_type_e type, mm_sound_focus_changed_watch_cb callback, bool is_for_session, void* userdata)
840 int ret = MM_ERROR_NONE;
841 GVariant* params = NULL, *result = NULL;
842 #ifdef SUPPORT_CONTAINER
847 #ifdef SUPPORT_CONTAINER
849 params = g_variant_new("(@ayiiib)", _get_cookie_variant(), instance, handle, type, is_for_session);
850 #else /* USE_SECURITY */
851 gethostname(container, sizeof(container));
852 debug_error("container = %s", container);
853 params = g_variant_new("(siiib)", container, instance, handle, type, is_for_session);
854 #endif /* USE_SECURITY */
856 #else /* SUPPORT_CONTAINER */
857 params = g_variant_new("(iiib)", instance, handle, type, is_for_session);
858 #endif /* SUPPORT_CONTAINER */
861 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_WATCH_FOCUS, params, &result)) != MM_ERROR_NONE) {
862 debug_error("dbus set watch focus failed");
865 debug_error("Construct Param for method call failed");
868 if (ret != MM_ERROR_NONE)
869 g_variant_get(result, "(i)", &ret);
871 g_variant_unref(result);
878 int mm_sound_proxy_unset_focus_watch_callback(int focus_tid, int handle, bool is_for_session)
880 int ret = MM_ERROR_NONE;
881 GVariant* params = NULL, *result = NULL;
885 params = g_variant_new("(iib)", focus_tid, handle, is_for_session);
887 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_UNWATCH_FOCUS, params, &result)) != MM_ERROR_NONE) {
888 debug_error("dbus unset watch focus failed");
891 debug_error("Construct Param for method call failed");
893 if (ret != MM_ERROR_NONE)
894 g_variant_get(result, "(i)", &ret);
896 g_variant_unref(result);
903 #endif /* USE_FOCUS */
904 /*------------------------------------------ FOCUS --------------------------------------------------*/
906 int mm_sound_proxy_initialize(void)
908 int ret = MM_ERROR_NONE;
916 int mm_sound_proxy_finalize(void)
918 int ret = MM_ERROR_NONE;