Manage focus cb thread and focus watch cb thread separately
[platform/core/multimedia/libmm-sound.git] / mm_sound_focus.c
index 21e8a82..1b0fd5f 100644 (file)
@@ -30,7 +30,7 @@
 { \
        int ret = MM_ERROR_NONE; \
        bool result = false; \
-       ret = mm_sound_client_is_focus_cb_thread(x_thread, &result); \
+       ret = mm_sound_client_is_focus_cb_thread(x_thread, &result, NULL); \
        if (ret) \
                return ret; \
        if (result) { \
 } \
 
 EXPORT_API
-int mm_sound_focus_is_cb_thread(bool *result)
+int mm_sound_focus_is_cb_thread(bool *result, bool *is_for_watching)
 {
        int ret = MM_ERROR_NONE;
 
        debug_fenter();
 
-       ret = mm_sound_client_is_focus_cb_thread(g_thread_self(), result);
+       if (result == NULL) {
+               debug_error("argument is not valid");
+               return MM_ERROR_INVALID_ARGUMENT;
+       }
+
+       ret = mm_sound_client_is_focus_cb_thread(g_thread_self(), result, is_for_watching);
        if (!ret) {
                if (*result)
                        debug_msg("it might be called in the thread of focus callback");
+               if (is_for_watching && *is_for_watching)
+                       debug_msg("it's in the focus watch callback");
        }
 
        debug_fleave();
@@ -93,7 +100,7 @@ int mm_sound_unregister_focus(int id)
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       mm_sound_client_is_focus_cb_thread(g_thread_self(), &result);
+       mm_sound_client_is_focus_cb_thread(g_thread_self(), &result, NULL);
        if (!result) {
                if ((ret = mm_sound_client_unregister_focus(id)))
                        debug_error("Could not unregister focus, ret = %x", ret);
@@ -347,7 +354,7 @@ int mm_sound_unset_focus_watch_callback(int id)
                return ret;
        }
 
-       mm_sound_client_is_focus_cb_thread(g_thread_self(), &result);
+       mm_sound_client_is_focus_cb_thread(g_thread_self(), &result, NULL);
        if (!result) {
                if ((ret = mm_sound_client_unset_focus_watch_callback(id)))
                        debug_error("Could not unset focus watch callback, id(%d), ret[0x%x]", id, ret);