12 #include "include/mm_sound_proxy.h"
13 #include "include/mm_sound_device.h"
14 #include "include/mm_sound_common.h"
15 #include "include/mm_sound_dbus.h"
16 #include "include/mm_sound_intf.h"
19 #include <security-server.h>
20 #define COOKIE_SIZE 20
24 struct callback_data {
28 mm_sound_proxy_userdata_free free_func;
31 #define GET_CB_DATA(_cb_data, _func, _userdata, _freefunc, _extradata) \
33 _cb_data = (struct callback_data*) g_malloc0(sizeof(struct callback_data)); \
34 _cb_data->user_cb = _func; \
35 _cb_data->user_data = _userdata; \
36 _cb_data->free_func = _freefunc; \
37 _cb_data->extra_data = _extradata; \
41 /* This callback unmarshall general-formed paramters to subject specific parameters,
42 * and call proper callback */
43 static void dbus_callback(audio_event_t event, GVariant *params, void *userdata)
45 struct callback_data *cb_data = (struct callback_data*) userdata;
47 if (event == AUDIO_EVENT_VOLUME_CHANGED) {
48 char *volume_type_str = NULL, *direction = NULL;
49 unsigned volume_level;
51 g_variant_get(params, "(&s&su)", &direction, &volume_type_str, &volume_level);
52 ((mm_sound_volume_changed_wrapper_cb)(cb_data->user_cb))(direction, volume_type_str, volume_level, cb_data->user_data);
53 } else if (event == AUDIO_EVENT_DEVICE_CONNECTED) {
54 const char *name = NULL, *device_type = NULL;
55 gboolean is_connected = FALSE;
56 int device_id, io_direction, state;
58 g_variant_get(params, "((i&sii&s)b)", &device_id, &device_type, &io_direction,
59 &state, &name, &is_connected);
60 ((mm_sound_device_connected_wrapper_cb)(cb_data->user_cb))(device_id, device_type, io_direction, state, name, is_connected, cb_data->user_data);
61 } else if (event == AUDIO_EVENT_DEVICE_INFO_CHANGED) {
62 const char *name = NULL, *device_type = NULL;
63 int changed_device_info_type = 0;
64 int device_id, io_direction, state;
66 g_variant_get(params, "((i&sii&s)i)", &device_id, &device_type, &io_direction,
67 &state, &name, &changed_device_info_type);
68 ((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);
69 } else if (event == AUDIO_EVENT_FOCUS_CHANGED) {
70 } else if (event == AUDIO_EVENT_FOCUS_WATCH) {
71 } else if (event == AUDIO_EVENT_TEST) {
73 g_variant_get(params, "(i)", &test_var);
74 ((mm_sound_test_cb)(cb_data->user_cb))(test_var, cb_data->user_data);
75 } else if (event == AUDIO_EVENT_PLAY_FILE_END) {
77 g_variant_get(params, "(i)", &ended_handle);
78 ((mm_sound_stop_callback_wrapper_func)(cb_data->user_cb))(ended_handle, cb_data->user_data);
82 static void simple_callback_data_free_func(void *data)
84 struct callback_data *cb_data = (struct callback_data*) data;
86 if (cb_data->free_func)
87 cb_data->free_func(cb_data->user_data);
92 int mm_sound_proxy_add_test_callback(mm_sound_test_cb func, void *userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
94 int ret = MM_ERROR_NONE;
95 struct callback_data *cb_data;
99 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
101 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) {
102 debug_error("add test callback failed");
109 int mm_sound_proxy_remove_test_callback(unsigned subs_id)
111 int ret = MM_ERROR_NONE;
114 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
115 debug_error("remove test callback failed");
122 int mm_sound_proxy_test(int a, int b, int *get)
124 int ret = MM_ERROR_NONE;
126 GVariant *params = NULL, *result = NULL;
130 params = g_variant_new("(ii)", a, b);
132 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_TEST, params, &result)) != MM_ERROR_NONE) {
133 debug_error("dbus test call failed");
137 debug_error("Construct Param for method call failed");
138 return MM_ERROR_SOUND_INTERNAL;
142 g_variant_get(result, "(i)", &reply);
143 debug_log("reply : %d", reply);
146 debug_error("reply null");
151 g_variant_unref(result);
157 int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** device_list)
159 int ret = MM_ERROR_NONE;
160 GVariant *result = NULL, *child = NULL;
163 mm_sound_device_t* device_item;
164 const gchar *device_name_tmp = NULL, *device_type_tmp = NULL;
169 debug_error("Invalid Parameter, device_list null");
170 ret = MM_ERROR_INVALID_ARGUMENT;
174 params = g_variant_new("(i)", device_flags);
177 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_DEVICE_MANAGER, AUDIO_METHOD_GET_CONNECTED_DEVICE_LIST, params, &result)) != MM_ERROR_NONE) {
178 debug_error("Get current connected device list failed");
182 debug_error("Construct Param for get current connected device failed");
183 return MM_ERROR_SOUND_INTERNAL;
186 child = g_variant_get_child_value(result, 0);
187 g_variant_iter_init(&iter, child);
189 device_item = g_malloc0(sizeof(mm_sound_device_t));
190 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)) {
191 MMSOUND_STRNCPY(device_item->name, device_name_tmp, MAX_DEVICE_NAME_NUM);
192 MMSOUND_STRNCPY(device_item->type, device_type_tmp, MAX_DEVICE_TYPE_STR_LEN);
193 *device_list = g_list_append(*device_list, device_item);
194 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);
204 g_variant_unref(result);
210 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)
212 int ret = MM_ERROR_NONE;
213 struct callback_data *cb_data;
217 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
219 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) {
220 debug_error("add device connected callback failed");
227 int mm_sound_proxy_remove_device_connected_callback(unsigned subs_id)
229 int ret = MM_ERROR_NONE;
232 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
233 debug_error("remove device connected callback failed");
240 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)
242 int ret = MM_ERROR_NONE;
243 struct callback_data *cb_data;
247 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
249 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) {
250 debug_error("Add device info changed callback failed");
257 int mm_sound_proxy_remove_device_info_changed_callback(unsigned subs_id)
259 int ret = MM_ERROR_NONE;
262 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
263 debug_error("remove device info changed callback failed");
270 int mm_sound_proxy_set_volume_by_type(const char *volume_type, const unsigned volume_level)
272 int ret = MM_ERROR_NONE;
273 char *reply = NULL, *direction = "out";
274 GVariant *params = NULL, *result = NULL;
278 params = g_variant_new("(ssu)", direction, volume_type, volume_level);
280 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_STREAM_MANAGER, AUDIO_METHOD_SET_VOLUME_LEVEL, params, &result)) != MM_ERROR_NONE) {
281 debug_error("dbus set volume by type failed");
285 debug_error("Construct Param for method call failed");
286 return MM_ERROR_SOUND_INTERNAL;
290 g_variant_get(result, "(&s)", &reply);
291 debug_log("reply : %s", reply);
292 if (!strcmp(reply, "STREAM_MANAGER_RETURN_ERROR"))
293 ret = MM_ERROR_SOUND_INTERNAL;
295 debug_error("reply null");
300 g_variant_unref(result);
306 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)
308 int ret = MM_ERROR_NONE;
309 struct callback_data *cb_data;
313 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
315 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) {
316 debug_error("Add Volume changed callback failed");
324 int mm_sound_proxy_remove_volume_changed_callback(unsigned subs_id)
326 int ret = MM_ERROR_NONE;
329 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
330 debug_error("Remove Volume changed callback failed");
337 int mm_sound_proxy_play_tone(int tone, int repeat, int volume, int volume_config,
338 int session_type, int session_options, int client_pid,
339 bool enable_session, int *codechandle, char *stream_type, int stream_index)
341 int ret = MM_ERROR_NONE;
343 GVariant* params = NULL, *result = NULL;
344 gboolean _enable_session = enable_session;
347 debug_error("Param for play is null");
348 return MM_ERROR_INVALID_ARGUMENT;
353 params = g_variant_new("(iiiiiiibsi)", tone, repeat, volume,
354 volume_config, session_type, session_options, client_pid , _enable_session, stream_type, stream_index);
356 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_DTMF, params, &result)) != MM_ERROR_NONE) {
357 debug_error("dbus play tone failed");
361 debug_error("Construct Param for method call failed");
365 g_variant_get(result, "(i)", &handle);
366 debug_log("handle : %d", handle);
367 *codechandle = handle;
369 debug_error("reply null");
374 g_variant_unref(result);
382 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)
384 int ret = MM_ERROR_NONE;
386 GVariant* params = NULL, *result = NULL;
391 debug_error("Param for play is null");
392 return MM_ERROR_INVALID_ARGUMENT;
395 params = g_variant_new("(iiiisi)", tone, repeat, volume, client_pid, stream_type, stream_index);
397 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_DTMF_WITH_STREAM_INFO, params, &result)) != MM_ERROR_NONE) {
398 debug_error("dbus play tone failed");
402 debug_error("Construct Param for method call failed");
406 g_variant_get(result, "(i)", &handle);
407 debug_log("handle : %d", handle);
408 *codechandle = handle;
410 debug_error("reply null");
415 g_variant_unref(result);
423 int mm_sound_proxy_play_sound(const char* filename, int tone, int repeat, int volume, int volume_config,
424 int priority, int session_type, int session_options, int client_pid, int handle_route,
425 bool enable_session, int *codechandle, char *stream_type, int stream_index)
427 int ret = MM_ERROR_NONE;
429 GVariant* params = NULL, *result = NULL;
430 gboolean _enable_session = enable_session;
432 if (!filename || !codechandle) {
433 debug_error("Param for play is null");
434 return MM_ERROR_INVALID_ARGUMENT;
439 params = g_variant_new("(siiiiiiiiibsi)", filename, tone, repeat, volume,
440 volume_config, priority, session_type, session_options, client_pid, handle_route, _enable_session, stream_type, stream_index);
442 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_SOUND_SERVER, AUDIO_METHOD_PLAY_FILE_START, params, &result)) != MM_ERROR_NONE) {
443 debug_error("dbus play file failed");
447 debug_error("Construct Param for method call failed");
451 g_variant_get(result, "(i)", &handle);
452 debug_log("handle : %d", handle);
453 *codechandle = handle;
455 debug_error("reply null");
460 g_variant_unref(result);
466 int mm_sound_proxy_play_sound_with_stream_info(const char* filename, int repeat, int volume,
467 int priority, int client_pid, int handle_route, int *codechandle, char *stream_type, int stream_index)
469 int ret = MM_ERROR_NONE;
471 GVariant* params = NULL, *result = NULL;
473 if (!filename || !codechandle) {
474 debug_error("Param for play is null");
475 return MM_ERROR_INVALID_ARGUMENT;
480 params = g_variant_new("(siiiiisi)", filename, repeat, volume,
481 priority, client_pid, handle_route, stream_type, stream_index);
483 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) {
484 debug_error("dbus play file failed");
488 debug_error("Construct Param for method call failed");
492 g_variant_get(result, "(i)", &handle);
493 debug_log("handle : %d", handle);
494 *codechandle = handle;
496 debug_error("reply null");
501 g_variant_unref(result);
510 int mm_sound_proxy_stop_sound(int handle)
512 int ret = MM_ERROR_NONE;
513 GVariant *result = NULL;
517 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) {
518 debug_error("dbus stop file playing failed");
524 g_variant_unref(result);
530 int mm_sound_proxy_clear_focus(int pid)
532 int ret = MM_ERROR_NONE;
533 GVariant *result = NULL;
537 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) {
538 debug_error("dbus clear focus failed");
542 g_variant_unref(result);
548 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)
550 int ret = MM_ERROR_NONE;
551 struct callback_data *cb_data;
555 GET_CB_DATA(cb_data, func, userdata, freefunc, NULL);
557 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) {
558 debug_error("add play sound end callback failed");
566 int mm_sound_proxy_remove_play_sound_end_callback(unsigned subs_id)
568 int ret = MM_ERROR_NONE;
571 if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
572 debug_error("Remove Play File End callback failed");
579 int mm_sound_proxy_emergent_exit(int exit_pid)
581 int ret = MM_ERROR_NONE;
582 GVariant* params = NULL;
586 params = g_variant_new("(i)", exit_pid);
588 if ((ret = mm_sound_dbus_emit_signal(AUDIO_PROVIDER_AUDIO_CLIENT, AUDIO_EVENT_EMERGENT_EXIT, params)) != MM_ERROR_NONE) {
589 debug_error("dbus emergent exit failed");
593 debug_error("Construct Param for emergent exit signal failed");
594 ret = MM_ERROR_SOUND_INTERNAL;
603 /*------------------------------------------ FOCUS --------------------------------------------------*/
606 #ifdef SUPPORT_CONTAINER
608 char* _get_cookie(int cookie_size)
613 if (security_server_get_cookie_size() != cookie_size) {
614 debug_error ("[Security] security_server_get_cookie_size() != COOKIE_SIZE(%d)\n", cookie_size);
618 cookie = (char*)malloc (cookie_size);
620 retval = security_server_request_cookie (cookie, cookie_size);
621 if (retval == SECURITY_SERVER_API_SUCCESS) {
622 debug_msg ("[Security] security_server_request_cookie() returns [%d]\n", retval);
624 debug_error ("[Security] security_server_request_cookie() returns [%d]\n", retval);
630 static GVariant* _get_cookie_variant ()
633 GVariantBuilder builder;
636 cookie = _get_cookie(COOKIE_SIZE);
641 g_variant_builder_init(&builder, G_VARIANT_TYPE_ARRAY);
642 for (i = 0; i < COOKIE_SIZE; i++)
643 g_variant_builder_add(&builder, "y", cookie[i]);
646 return g_variant_builder_end(&builder);
649 #endif /* USE_SECURITY */
650 #endif /* SUPPORT_CONTAINER */
652 int mm_sound_proxy_get_unique_id(int *id)
654 int ret = MM_ERROR_NONE;
656 GVariant *result = NULL;
660 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_GET_UNIQUE_ID, NULL, &result)) != MM_ERROR_NONE) {
661 debug_error("dbus get unique id failed");
665 g_variant_get(result, "(i)", &res);
667 debug_msg("got unique id(%d)", *id);
668 g_variant_unref(result);
676 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)
678 int ret = MM_ERROR_NONE;
679 GVariant* params = NULL, *result = NULL;
680 #ifdef SUPPORT_CONTAINER
686 #ifdef SUPPORT_CONTAINER
688 params = g_variant_new("(@ayiisb)", _get_cookie_variant(), instance, id, stream_type, is_for_session);
689 #else /* USE_SECURITY */
690 gethostname(container, sizeof(container));
691 debug_error("container = %s", container);
692 params = g_variant_new("(siisb)", container, instance, id, stream_type, is_for_session);
693 #endif /* USE_SECURITY */
695 #else /* SUPPORT_CONTAINER */
696 params = g_variant_new("(iisb)", instance, id, stream_type, is_for_session);
698 #endif /* SUPPORT_CONTAINER */
701 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_REGISTER_FOCUS, params, &result)) != MM_ERROR_NONE) {
702 debug_error("dbus register focus failed");
705 debug_error("Construct Param for method call failed");
708 if(ret != MM_ERROR_NONE)
709 g_variant_get(result, "(i)", &ret);
711 g_variant_unref(result);
719 int mm_sound_proxy_unregister_focus(int instance, int id, bool is_for_session)
721 int ret = MM_ERROR_NONE;
722 GVariant* params = NULL, *result = NULL;
726 params = g_variant_new("(iib)", instance, id, is_for_session);
728 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_UNREGISTER_FOCUS, params, &result)) != MM_ERROR_NONE) {
729 debug_error("dbus unregister focus failed");
732 debug_error("Construct Param for method call failed");
735 if (ret != MM_ERROR_NONE)
736 g_variant_get(result, "(i)", &ret);
738 g_variant_unref(result);
745 int mm_sound_proxy_set_foucs_reacquisition(int instance, int id, bool reacquisition)
747 int ret = MM_ERROR_NONE;
748 GVariant* params = NULL, *result = NULL;
752 params = g_variant_new("(iib)", instance, id, reacquisition);
754 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_SET_FOCUS_REACQUISITION, params, &result)) != MM_ERROR_NONE) {
755 debug_error("dbus set focus reacquisition failed");
758 debug_error("Construct Param for method call failed");
761 if (ret != MM_ERROR_NONE)
762 g_variant_get(result, "(i)", &ret);
764 g_variant_unref(result);
770 int mm_sound_proxy_get_acquired_focus_stream_type(int focus_type, char **stream_type, char **additional_info)
772 int ret = MM_ERROR_NONE;
773 GVariant* params = NULL, *result = NULL;
777 if (!(params = g_variant_new("(i)", focus_type))) {
778 debug_error("Construct Param for method call failed");
779 return MM_ERROR_SOUND_INTERNAL;
782 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_GET_ACQUIRED_FOCUS_STREAM_TYPE, params, &result)) == MM_ERROR_NONE) {
784 g_variant_get(result, "(ss)", stream_type, additional_info);
785 g_variant_unref(result);
788 debug_error("dbus get stream type of acquired focus failed");
795 int mm_sound_proxy_acquire_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session)
797 int ret = MM_ERROR_NONE;
798 GVariant* params = NULL, *result = NULL;
802 params = g_variant_new("(iiisb)", instance, id, type, option, is_for_session);
804 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_ACQUIRE_FOCUS, params, &result)) != MM_ERROR_NONE) {
805 debug_error("dbus acquire focus failed");
808 debug_error("Construct Param for method call failed");
811 if (ret != MM_ERROR_NONE)
812 g_variant_get(result, "(i)", &ret);
814 g_variant_unref(result);
820 int mm_sound_proxy_release_focus(int instance, int id, mm_sound_focus_type_e type, const char *option, bool is_for_session)
822 int ret = MM_ERROR_NONE;
823 GVariant* params = NULL, *result = NULL;
827 params = g_variant_new("(iiisb)", instance, id, type, option, is_for_session);
829 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_RELEASE_FOCUS, params, &result)) != MM_ERROR_NONE) {
830 debug_error("dbus release focus failed");
833 debug_error("Construct Param for method call failed");
836 if (ret != MM_ERROR_NONE)
837 g_variant_get(result, "(i)", &ret);
839 g_variant_unref(result);
845 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)
847 int ret = MM_ERROR_NONE;
848 GVariant* params = NULL, *result = NULL;
849 #ifdef SUPPORT_CONTAINER
854 #ifdef SUPPORT_CONTAINER
856 params = g_variant_new("(@ayiiib)", _get_cookie_variant(), instance, handle, type, is_for_session);
857 #else /* USE_SECURITY */
858 gethostname(container, sizeof(container));
859 debug_error("container = %s", container);
860 params = g_variant_new("(siiib)", container, instance, handle, type, is_for_session);
861 #endif /* USE_SECURITY */
863 #else /* SUPPORT_CONTAINER */
864 params = g_variant_new("(iiib)", instance, handle, type, is_for_session);
865 #endif /* SUPPORT_CONTAINER */
868 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_WATCH_FOCUS, params, &result)) != MM_ERROR_NONE) {
869 debug_error("dbus set watch focus failed");
872 debug_error("Construct Param for method call failed");
875 if (ret != MM_ERROR_NONE)
876 g_variant_get(result, "(i)", &ret);
878 g_variant_unref(result);
885 int mm_sound_proxy_unset_focus_watch_callback(int focus_tid, int handle, bool is_for_session)
887 int ret = MM_ERROR_NONE;
888 GVariant* params = NULL, *result = NULL;
892 params = g_variant_new("(iib)", focus_tid, handle, is_for_session);
894 if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_FOCUS_SERVER, AUDIO_METHOD_UNWATCH_FOCUS, params, &result)) != MM_ERROR_NONE) {
895 debug_error("dbus unset watch focus failed");
898 debug_error("Construct Param for method call failed");
900 if (ret != MM_ERROR_NONE)
901 g_variant_get(result, "(i)", &ret);
903 g_variant_unref(result);
910 #endif /* USE_FOCUS */
911 /*------------------------------------------ FOCUS --------------------------------------------------*/
913 int mm_sound_proxy_initialize(void)
915 int ret = MM_ERROR_NONE;
923 int mm_sound_proxy_finalize(void)
925 int ret = MM_ERROR_NONE;