Remove the dependency of audio-session-manager 49/54949/2 accepted/tizen/mobile/20151223.052509 accepted/tizen/tv/20151223.052514 accepted/tizen/wearable/20151223.052604 submit/tizen/20151223.015118 submit/tizen_common/20151229.142028 submit/tizen_common/20151229.144031 submit/tizen_common/20151229.154718
authorSangchul Lee <sc11.lee@samsung.com>
Mon, 21 Dec 2015 02:45:40 +0000 (11:45 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 22 Dec 2015 23:58:11 +0000 (08:58 +0900)
Remove codes related to ASM
Remove unused mm_sound_pcm.c

[Version] Release 0.10.1
[Profile] Common
[Issue Type] Code clean-up

Change-Id: I3bba4ee89e051b6358744e251cd6c7ea541bee4e
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
20 files changed:
Makefile.am
configure.ac
dump_audio.sh
focus_server/mm_sound_mgr_focus_dbus.c
include/mm_sound_client_dbus.h
include/mm_sound_msg.h
include/mm_sound_pcm_async.h [deleted file]
include/mm_sound_private.h
mm_sound_client_dbus.c
mm_sound_pcm.c [deleted file]
packaging/libmm-sound.spec
server/Makefile.am
server/include/mm_sound_mgr_asm.h [deleted file]
server/include/mm_sound_mgr_common.h
server/include/mm_sound_mgr_ipc.h
server/mm_sound_mgr_asm.c [deleted file]
server/mm_sound_mgr_ipc.c
server/mm_sound_mgr_ipc_dbus.c
server/mm_sound_server.c
testsuite/mm_sound_testsuite_simple.c

index d7246e8..ffa025e 100644 (file)
@@ -18,7 +18,6 @@ libmmfsound_la_SOURCES = mm_sound.c \
                        mm_sound_client.c \
                        mm_sound_client_dbus.c \
                        mm_sound_device.c \
-                       mm_sound_pcm.c \
                        mm_sound_pa_client.c
 if USE_FOCUS
 libmmfsound_la_SOURCES += mm_sound_focus.c
@@ -33,7 +32,6 @@ libmmfsound_la_CFLAGS = -I$(srcdir)/include \
                        $(GLIB2_CFLAGS) \
                        $(GIO_CFLAGS) \
                        $(MMSESSION_CFLAGS) \
-                       $(AUDIOSESSIONMGR_CFLAGS) \
                        -D_USE_INTERNAL_SOUND_PATH_ \
                        $(PASIMPLE_CFLAGS) \
                        $(PA_CFLAGS) \
@@ -45,7 +43,6 @@ endif
 
 libmmfsound_la_LIBADD = $(MMCOMMON_LIBS) \
                        $(MMSESSION_LIBS) \
-                       $(AUDIOSESSIONMGR_LIBS) \
                        $(GLIB2_LIBS) \
                        $(GIO_LIBS) \
                        $(srcdir)/common/libmmfsoundcommon.la \
index 902764c..1b1281b 100644 (file)
@@ -42,10 +42,6 @@ PKG_CHECK_MODULES(MMSESSION, mm-session)
 AC_SUBST(MMSESSION_CFLAGS)
 AC_SUBST(MMSESSION_LIBS)
 
-PKG_CHECK_MODULES(AUDIOSESSIONMGR, audio-session-mgr)
-AC_SUBST(AUDIOSESSIONMGR_CFLAGS)
-AC_SUBST(AUDIOSESSIONMGR_LIBS)
-
 PKG_CHECK_MODULES(GLIB2, glib-2.0 gthread-2.0)
 AC_SUBST(GLIB2_CFLAGS)
 AC_SUBST(GLIB2_LIBS)
index 052d73b..4122a7f 100644 (file)
@@ -16,7 +16,7 @@ ls /dev/snd/ -alZ >> ${AUDIO_DEBUG}/device_dump
 ls /usr/share/alsa/ucm/* -alZ >> ${AUDIO_DEBUG}/device_dump
 amixer contents >> ${AUDIO_DEBUG}/device_dump
 hcitool con >> ${AUDIO_DEBUG}/device_dump
-ls /tmp/ -alZ | grep ASM >> ${AUDIO_DEBUG}/tmp_dump
+ls /tmp/ -alZ | grep focus >> ${AUDIO_DEBUG}/tmp_dump
 ls /tmp/ -alZ | grep session >> ${AUDIO_DEBUG}/tmp_dump
 ipcs >> ${AUDIO_DEBUG}/ipcs_dump
 rpm -qa | egrep "mm-sound|avsystem|audio|session|sound|ext0|wav-player|tone-player|alsa|sysconf|openal" >> ${AUDIO_DEBUG}/rpm_dump
index 0464709..fc87c43 100644 (file)
@@ -672,36 +672,6 @@ static const GDBusInterfaceVTable interface_vtable =
        handle_set_property
 };
 
-#if 0
-static void handle_signal(GDBusConnection  *connection,
-                                     const gchar      *sender_name,
-                                     const gchar      *object_path,
-                                     const gchar      *interface_name,
-                                     const gchar      *signal_name,
-                                     GVariant         *params,
-                                     gpointer          user_data)
-{
-       if (!object_path || !interface_name || !signal_name) {
-               debug_error("Invalid Parameters");
-               return;
-       }
-
-       debug_log("Got Signal : Object '%s, Interface '%s', Signal '%s'", object_path, interface_name, signal_name);
-
-       if (!g_strcmp0(object_path, OBJECT_ASM)) {
-               if (!g_strcmp0(interface_name, INTERFACE_ASM) && !g_strcmp0(signal_name, "EmergentExit")) {
-                       debug_log("handle signal '%s.%s'", interface_name, signal_name);
-                       handle_signal_asm_emergent_exit(params, user_data);
-               } else {
-                       debug_log("Unknown Signal '%s.%s'", interface_name, signal_name);
-               }
-       } else {
-               debug_log("Unknown Object '%s'", object_path);
-       }
-
-}
-#endif
-
 static void on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
 {
        guint reg_id;
index 00c0885..db3024e 100644 (file)
@@ -45,6 +45,7 @@ int mm_sound_client_dbus_remove_volume_changed_callback(unsigned int subs_id);
 int mm_sound_client_dbus_get_audio_path(mm_sound_device_in *device_in, mm_sound_device_out *device_out);
 
 #ifdef USE_FOCUS
+int mm_sound_client_dbus_get_unique_id(int *id);
 int mm_sound_client_dbus_register_focus(int id, int instance, const char *stream_type, mm_sound_focus_changed_cb callback, bool is_for_session, void* user_data);
 int mm_sound_client_dbus_unregister_focus(int instance, int id, bool is_for_session);
 int mm_sound_client_dbus_set_foucs_reacquisition(int instance, int id, bool reacquisition);
index 97d2407..d4fd10b 100644 (file)
@@ -142,23 +142,6 @@ enum {
         METHOD_CALL_UNWATCH_FOCUS,
         METHOD_CALL_EMERGENT_EXIT_FOCUS,
 
-        METHOD_CALL_ASM_REGISTER_SOUND,
-        METHOD_CALL_ASM_UNREGISTER_SOUND,
-        METHOD_CALL_ASM_REGISTER_WATCHER,
-        METHOD_CALL_ASM_UNREGISTER_WATCHER,
-        METHOD_CALL_ASM_GET_MYSTATE,
-        METHOD_CALL_ASM_GET_STATE,
-        METHOD_CALL_ASM_SET_STATE,
-        METHOD_CALL_ASM_SET_SUBSESSION,
-        METHOD_CALL_ASM_GET_SUBSESSION,
-        METHOD_CALL_ASM_SET_SUBEVENT,
-        METHOD_CALL_ASM_GET_SUBEVENT,
-        METHOD_CALL_ASM_SET_SESSION_OPTION,
-        METHOD_CALL_ASM_GET_SESSION_OPTION,
-        METHOD_CALL_ASM_RESET_RESUME_TAG,
-        METHOD_CALL_ASM_DUMP,
-        METHOD_CALL_ASM_EMERGENT_EXIT,
-
         METHOD_CALL_MAX,
 };
 
diff --git a/include/mm_sound_pcm_async.h b/include/mm_sound_pcm_async.h
deleted file mode 100644 (file)
index 74322d8..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * libmm-sound
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungbae Shin <seungbae.shin@samsung.com>
- *
- * 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 __MM_SOUND_PCM_ASYNC__
-#define __MM_SOUND_PCM_ASYNC__
-
-/* Common */
-typedef void (*mm_sound_pcm_stream_cb_t)(void *p, size_t nbytes, void *userdata);
-
-int mm_sound_pcm_set_message_callback_async (MMSoundPcmHandle_t handle, MMMessageCallback callback, void *user_param);
-int mm_sound_pcm_get_latency_async(MMSoundPcmHandle_t handle, int *latency);
-int mm_sound_pcm_is_started_async(MMSoundPcmHandle_t handle, bool *is_started);
-
-/* PCM capture async */
-int mm_sound_pcm_capture_open_async(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel,
-                                                                       MMSoundPcmFormat_t format, mm_sound_source_type_e source_type,
-                                                                       mm_sound_pcm_stream_cb_t callback, void* userdata);
-int mm_sound_pcm_capture_start_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_capture_stop_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_capture_flush_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_capture_peek(MMSoundPcmHandle_t handle, const void **buffer, const unsigned int *length);
-int mm_sound_pcm_capture_drop(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_capture_close_async(MMSoundPcmHandle_t handle);
-
-/* PCM playback async */
-int mm_sound_pcm_play_open_async (MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel,
-                                                       MMSoundPcmFormat_t format, int volume_config,
-                                                       mm_sound_pcm_stream_cb_t callback, void* userdata);
-int mm_sound_pcm_play_start_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_play_stop_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_play_drain_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_play_flush_async(MMSoundPcmHandle_t handle);
-int mm_sound_pcm_play_write_async(MMSoundPcmHandle_t handle, void* ptr, unsigned int length_byte);
-int mm_sound_pcm_play_close_async(MMSoundPcmHandle_t handle);
-
-#endif /* __MM_SOUND_PCM_ASYNC__ */
index bd5d66a..9d90147 100644 (file)
@@ -157,8 +157,6 @@ int mm_sound_play_sound_with_stream_info(const char *filename, char *stream_type
  */
 int mm_sound_play_keysound(const char *filename, int volume_config);
 
-int mm_sound_pcm_play_open_ex (MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, int volume_config, int asm_event);
-
 int mm_sound_boot_ready(int timeout_sec);
 
 int mm_sound_boot_play_sound(char* path);
index 085e446..5febb17 100644 (file)
 #define COOKIE_SIZE 20
 #endif
 
-
 #define BUS_NAME_PULSEAUDIO "org.pulseaudio.Server"
-#define OBJECT_PULSE_MODULE_POLICY "/org/pulseaudio/policy1"
-#define INTERFACE_PULSE_MODULE_POLICY "org.PulseAudio.Ext.Policy1"
 #define OBJECT_PULSE_MODULE_DEVICE_MANAGER "/org/pulseaudio/DeviceManager"
 #define INTERFACE_PULSE_MODULE_DEVICE_MANAGER "org.pulseaudio.DeviceManager"
 #define OBJECT_PULSE_MODULE_STREAM_MANAGER "/org/pulseaudio/StreamManager"
@@ -50,7 +47,6 @@ enum {
        DBUS_TO_SOUND_SERVER,
        DBUS_TO_PULSE_MODULE_DEVICE_MANAGER,
        DBUS_TO_PULSE_MODULE_STREAM_MANAGER,
-       DBUS_TO_PULSE_MODULE_POLICY,
        DBUS_TO_FOCUS_SERVER,
 };
 
@@ -287,6 +283,7 @@ static int _dbus_method_call(GDBusConnection* conn, const char* bus_name, const
        return ret;
 }
 
+#if 0
 static int _dbus_set_property(GDBusConnection* conn, const char* bus_name, const char* object, const char* intf,
                                                        const char* prop, GVariant* args, GVariant** result)
 {
@@ -327,6 +324,7 @@ static int _dbus_get_property(GDBusConnection *conn, const char* bus_name, const
 
        return ret;
 }
+#endif
 
 static int _dbus_subscribe_signal(GDBusConnection *conn, const char* object_name, const char* intf_name,
                                        const char* signal_name, GDBusSignalCallback signal_cb, guint *subscribe_id, void* userdata)
@@ -391,12 +389,14 @@ static GDBusConnection* _dbus_get_connection(GBusType bustype)
 
 }
 
+#if 0
 static void _dbus_disconnect(GDBusConnection* conn)
 {
        debug_fenter ();
        g_object_unref(conn);
        debug_fleave ();
 }
+#endif
 
 /******************************************************************************************
                Simple Functions For Communicate with Sound-Server
@@ -425,10 +425,6 @@ static int _dbus_method_call_to(int dbus_to, int method_type, GVariant *args, GV
                bus_name = BUS_NAME_PULSEAUDIO;
                object = OBJECT_PULSE_MODULE_STREAM_MANAGER;
                interface = INTERFACE_PULSE_MODULE_STREAM_MANAGER;
-       } else if (dbus_to == DBUS_TO_PULSE_MODULE_POLICY) {
-               bus_name = BUS_NAME_PULSEAUDIO;
-               object = OBJECT_PULSE_MODULE_POLICY;
-               interface = INTERFACE_PULSE_MODULE_POLICY;
        } else if (dbus_to == DBUS_TO_FOCUS_SERVER) {
                bus_name = BUS_NAME_FOCUS_SERVER;
                object = OBJECT_FOCUS_SERVER;
@@ -554,9 +550,6 @@ static int _dbus_signal_subscribe_to(int dbus_to, sound_server_signal_t signalty
        } else if (dbus_to == DBUS_TO_PULSE_MODULE_STREAM_MANAGER) {
                object = OBJECT_PULSE_MODULE_STREAM_MANAGER;
                interface = INTERFACE_PULSE_MODULE_STREAM_MANAGER;
-       } else if (dbus_to == DBUS_TO_PULSE_MODULE_POLICY) {
-               object = OBJECT_PULSE_MODULE_POLICY;
-               interface = INTERFACE_PULSE_MODULE_POLICY;
        } else {
                debug_error("Invalid case, dbus_to %d", dbus_to);
                return MM_ERROR_SOUND_INTERNAL;
@@ -593,59 +586,6 @@ static int _dbus_signal_unsubscribe(unsigned int subs_id)
        return MM_ERROR_NONE;
 }
 
-static int _pulseaudio_dbus_set_property(pulseaudio_property_t property, GVariant* args, GVariant **result)
-{
-       int ret = MM_ERROR_NONE;
-       GDBusConnection *conn = NULL;
-
-       if (property < 0 || property > PULSEAUDIO_PROP_MAX) {
-               debug_error("Invalid property [%d]", property);
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       if (args == NULL) {
-               debug_error("Invalid args");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       if ((conn = _dbus_get_connection(G_BUS_TYPE_SYSTEM))) {
-               if((ret = _dbus_set_property(conn, BUS_NAME_PULSEAUDIO, OBJECT_PULSE_MODULE_POLICY, INTERFACE_PULSE_MODULE_POLICY,
-                                                                       g_pulseaudio_properties[property].name, args, result)) != MM_ERROR_NONE) {
-                       debug_error("Dbus Call on Client Error");
-                       return ret;
-               }
-       } else {
-               debug_error("Get Dbus Connection Error");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       return MM_ERROR_NONE;
-}
-
-static int _pulseaudio_dbus_get_property(pulseaudio_property_t property, GVariant **result)
-{
-       int ret = MM_ERROR_NONE;
-       GDBusConnection *conn = NULL;
-
-       if (property < 0 || property > PULSEAUDIO_PROP_MAX) {
-               debug_error("Invalid property [%d]", property);
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       if ((conn = _dbus_get_connection(G_BUS_TYPE_SYSTEM))) {
-               if((ret = _dbus_get_property(conn, BUS_NAME_PULSEAUDIO, OBJECT_PULSE_MODULE_POLICY, INTERFACE_PULSE_MODULE_POLICY,
-                                                                       g_pulseaudio_properties[property].name, result)) != MM_ERROR_NONE) {
-                       debug_error("Dbus Call on Client Error");
-                       return ret;
-               }
-       } else {
-               debug_error("Get Dbus Connection Error");
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       return MM_ERROR_NONE;
-}
-
 /******************************************************************************************
                Implementation of each dbus client code (Construct Params,..)
 ******************************************************************************************/
diff --git a/mm_sound_pcm.c b/mm_sound_pcm.c
deleted file mode 100644 (file)
index 50e0280..0000000
+++ /dev/null
@@ -1,1298 +0,0 @@
-/*
- * libmm-sound
- *
- * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungbae Shin <seungbae.shin@samsung.com>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-#include <memory.h>
-#include <unistd.h>
-#include <pthread.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include <vconf.h>
-
-#include <sys/stat.h>
-#include <errno.h>
-
-#include <mm_types.h>
-#include <mm_error.h>
-#include <mm_message.h>
-#include <mm_debug.h>
-#include "include/mm_sound_private.h"
-#include "include/mm_sound.h"
-#include "include/mm_sound_utils.h"
-#include "include/mm_sound_common.h"
-#include "include/mm_sound_pa_client.h"
-
-#include <audio-session-manager.h>
-#include <mm_session.h>
-#include <mm_session_private.h>
-
-
-#define _MIN_SYSTEM_SAMPLERATE 8000
-#define _MAX_SYSTEM_SAMPLERATE 48000
-#define RW_LOG_PERIOD 5 /* period(second) for print log in capture read or play write*/
-
-#define PCM_LOCK_INTERNAL(LOCK) do { pthread_mutex_lock(LOCK); } while (0)
-#define PCM_UNLOCK_INTERNAL(LOCK) do { pthread_mutex_unlock(LOCK); } while (0)
-#define PCM_LOCK_DESTROY_INTERNAL(LOCK) do { pthread_mutex_destroy(LOCK); } while (0)
-
-int g_capture_h_count = 0;
-#define PCM_CAPTURE_H_COUNT_INC() do { g_capture_h_count++; } while (0)
-#define PCM_CAPTURE_H_COUNT_DEC() do { g_capture_h_count--; if(g_capture_h_count < 0) debug_error ("g_capture_h_count[%d] is not valid, check application side for proper handle usage\n", g_capture_h_count); } while (0)
-#define PCM_CAPTURE_H_COUNT_GET(x_val) do { x_val = g_capture_h_count; } while (0)
-
-typedef enum {
-       MMSOUND_SESSION_TYPE_PLAYBACK,
-       MMSOUND_SESSION_TYPE_CAPTURE,
-}MMSound_session_type_e;
-
-enum {
-       MMSOUND_SESSION_REGISTERED_INTERNALLY,
-       MMSOUND_SESSION_REGISTERED_BY_OUTSIDE_MEDIA,
-};
-
-typedef struct {
-       int                     handle;
-       int                     asm_handle;
-       ASM_sound_events_t      asm_event;
-       int                     asm_options;
-       int                     session_registered_type;
-
-       bool                    is_started;
-       bool                    is_playback;
-       bool                    skip_session;
-       ASM_resource_t resource;
-       pthread_mutex_t pcm_mutex_internal;
-       MMMessageCallback       msg_cb;
-       void *msg_cb_param;
-
-       unsigned int rate;
-       MMSoundPcmChannel_t channel;
-       MMSoundPcmFormat_t format;
-       unsigned int byte_per_sec;
-
-       int volume_config;
-
-} mm_sound_pcm_t;
-
-static int _pcm_sound_start (MMSoundPcmHandle_t handle);
-static int _pcm_sound_stop_internal (MMSoundPcmHandle_t handle);
-static int _pcm_sound_stop(MMSoundPcmHandle_t handle);
-static void _sound_pcm_send_message (mm_sound_pcm_t *pcmHandle, int message, int code);
-static int _pcm_sound_ignore_session (MMSoundPcmHandle_t handle, MMSound_session_type_e type);
-
-static char* _get_channel_str(MMSoundPcmChannel_t channel)
-{
-       if (channel == MMSOUND_PCM_MONO)
-               return "Mono";
-       else if (channel == MMSOUND_PCM_STEREO)
-               return "Stereo";
-       else
-               return "Unknown";
-}
-
-static char* _get_format_str(MMSoundPcmFormat_t format)
-{
-       if (format == MMSOUND_PCM_S16_LE)
-               return "S16LE";
-       else if (format == MMSOUND_PCM_U8)
-               return "U8";
-       else
-               return "Unknown";
-}
-
-static int _get_asm_information(MMSound_session_type_e session_type, ASM_sound_events_t *type, int *options, int *session_registered_type)
-{
-       int cur_session = MM_SESSION_TYPE_MEDIA;
-       int session_options = 0;
-       int ret = MM_ERROR_NONE;
-       ASM_sound_events_t asm_event;
-
-       if(type == NULL)
-               return MM_ERROR_SOUND_INVALID_POINTER;
-
-       /* read session information */
-       if(_mm_session_util_read_information(-1, &cur_session, &session_options) < 0) {
-               debug_log("Read Session Information failed. Set default \"Media\" type\n");
-               if (session_type == MMSOUND_SESSION_TYPE_PLAYBACK) {
-                       cur_session = MM_SESSION_TYPE_MEDIA;
-               } else if (session_type == MMSOUND_SESSION_TYPE_CAPTURE) {
-                       cur_session = MM_SESSION_TYPE_MEDIA_RECORD;
-               }
-               ret = _mm_session_util_write_type(-1, cur_session);
-               if (ret) {
-                       debug_error("_mm_session_util_write_type() failed\n");
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-               *session_registered_type = MMSOUND_SESSION_REGISTERED_INTERNALLY;
-       } else {
-               /* session was already registered */
-               if (session_type == MMSOUND_SESSION_TYPE_CAPTURE) {
-                       if (cur_session > MM_SESSION_TYPE_MEDIA && cur_session < MM_SESSION_TYPE_CALL) {
-                               debug_error("current session type(%d) does not support capture\n", session_type);
-                               return MM_ERROR_POLICY_BLOCKED;
-                       } else if (cur_session == MM_SESSION_TYPE_MEDIA) {
-                               debug_log("session was already registered to MEDIA, update it to MEDIA_RECORD");
-                               /* update session information */
-                               ret = _mm_session_util_write_information(-1, MM_SESSION_TYPE_MEDIA_RECORD, session_options);
-                               if (ret) {
-                                       debug_error("_mm_session_util_write_type() failed\n");
-                                       return MM_ERROR_SOUND_INTERNAL;
-                               }
-                               *session_registered_type = MMSOUND_SESSION_REGISTERED_BY_OUTSIDE_MEDIA;
-                       }
-               }
-       }
-
-       /* convert MM_SESSION_TYPE to ASM_EVENT_TYPE */
-       switch (cur_session)
-       {
-       case MM_SESSION_TYPE_MEDIA:
-       case MM_SESSION_TYPE_MEDIA_RECORD:
-               asm_event = ASM_EVENT_MEDIA_MMSOUND;
-               break;
-       case MM_SESSION_TYPE_NOTIFY:
-               asm_event = ASM_EVENT_NOTIFY;
-               break;
-       case MM_SESSION_TYPE_ALARM:
-               asm_event = ASM_EVENT_ALARM;
-               break;
-       case MM_SESSION_TYPE_CALL:
-               asm_event = ASM_EVENT_CALL;
-               break;
-       case MM_SESSION_TYPE_VIDEOCALL:
-               asm_event = ASM_EVENT_VIDEOCALL;
-               break;
-       case MM_SESSION_TYPE_VOIP:
-               asm_event = ASM_EVENT_VOIP;
-               break;
-       case MM_SESSION_TYPE_EMERGENCY:
-               asm_event = ASM_EVENT_EMERGENCY;
-               break;
-       case MM_SESSION_TYPE_VOICE_RECOGNITION:
-               asm_event = ASM_EVENT_VOICE_RECOGNITION;
-               break;
-       case MM_SESSION_TYPE_RECORD_AUDIO:
-               asm_event = ASM_EVENT_MMCAMCORDER_AUDIO;
-               break;
-       case MM_SESSION_TYPE_RECORD_VIDEO:
-               asm_event = ASM_EVENT_MMCAMCORDER_VIDEO;
-               break;
-       default:
-               debug_error("Unexpected %d\n", cur_session);
-               return MM_ERROR_SOUND_INTERNAL;
-       }
-
-       *type = asm_event;
-       *options = session_options;
-       return MM_ERROR_NONE;
-}
-
-static bool _check_skip_session_type_for_capture(mm_sound_pcm_t *pcmHandle, mm_sound_source_type_e type)
-{
-       bool ret = false;
-       int session_result = MM_ERROR_NONE;
-       switch (type)
-       {
-       case SUPPORT_SOURCE_TYPE_DEFAULT:
-       case SUPPORT_SOURCE_TYPE_VOICECONTROL:
-               ret = false;
-               break;
-       case SUPPORT_SOURCE_TYPE_MIRRORING:
-               ret = true;
-               break;
-       default:
-               debug_error("Unexpected %d\n", type);
-               return false;
-       }
-       if (ret) {
-               int capture_h_count = 0;
-               PCM_CAPTURE_H_COUNT_GET(capture_h_count);
-               if (capture_h_count == 1) { /* if it is last one */
-                       /* Recover session information */
-                       session_result = _mm_session_util_write_information(-1, MM_SESSION_TYPE_MEDIA, pcmHandle->asm_options);
-                       if (session_result) {
-                               debug_error("_mm_session_util_write_information() [type %d, options %x] failed[%x]", MM_SESSION_TYPE_MEDIA, pcmHandle->asm_options, session_result);
-                       }
-               }
-       }
-       return ret;
-}
-
-static void _sound_pcm_send_message (mm_sound_pcm_t *pcmHandle, int message, int code)
-{
-       int ret = 0;
-       if (pcmHandle->msg_cb) {
-               MMMessageParamType msg;
-               msg.union_type = MM_MSG_UNION_CODE;
-               msg.code = code;
-
-               debug_log ("calling msg callback(%p) with message(%d), code(%d), msg callback param(%p)\n",
-                               pcmHandle->msg_cb, message, msg.code, pcmHandle->msg_cb_param);
-               ret = pcmHandle->msg_cb(message, &msg, pcmHandle->msg_cb_param);
-               debug_log ("msg callback returned (%d)\n", ret);
-       } else {
-               debug_log ("No pcm msg callback\n");
-       }
-}
-
-static ASM_cb_result_t sound_pcm_asm_callback(int handle, ASM_event_sources_t event_src, ASM_sound_commands_t command, unsigned int sound_status, void *cb_data)
-{
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t *)cb_data;
-       ASM_cb_result_t cb_res = ASM_CB_RES_IGNORE;
-       int message = MM_MESSAGE_SOUND_PCM_INTERRUPTED;
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error("sound_pcm_asm_callback cb_data is null\n");
-               return cb_res;
-       }
-
-       debug_log ("command = %d, handle = %p, is_started = %d\n",command, pcmHandle, pcmHandle->is_started);
-       switch(command)
-       {
-       case ASM_COMMAND_PAUSE:
-       case ASM_COMMAND_STOP:
-               /* Do stop */
-               PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               _pcm_sound_stop_internal (pcmHandle);
-               PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               cb_res = ASM_CB_RES_PAUSE;
-               break;
-
-       case ASM_COMMAND_RESUME:
-               cb_res = ASM_CB_RES_IGNORE;
-               message = MM_MESSAGE_READY_TO_RESUME;
-               break;
-
-       case ASM_COMMAND_PLAY:
-       case ASM_COMMAND_NONE:
-               debug_error ("Not an expected case!!!!\n");
-               break;
-       }
-
-       /* execute user callback if callback available */
-       _sound_pcm_send_message (pcmHandle, message, event_src);
-
-       return cb_res;
-}
-
-static int _pcm_sound_ignore_session (MMSoundPcmHandle_t handle, MMSound_session_type_e type)
-{
-       int result = MM_ERROR_NONE;
-       int session_result = MM_ERROR_NONE;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-       int errorcode = 0;
-
-       debug_fenter();
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               result = MM_ERROR_INVALID_ARGUMENT;
-               goto EXIT;
-       }
-
-       if (pcmHandle->is_started) {
-               debug_error ("Operation is not permitted while started\n");
-               result = MM_ERROR_SOUND_INVALID_STATE;
-               goto EXIT;
-       }
-
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-       /* Unregister ASM */
-       if (pcmHandle->skip_session == false && pcmHandle->asm_handle) {
-               if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
-                       debug_error("ASM_unregister failed with 0x%x\n", errorcode);
-                       result = MM_ERROR_SOUND_INTERNAL;
-               }
-               pcmHandle->skip_session = true;
-               pcmHandle->asm_handle = 0;
-       }
-       if (type == MMSOUND_SESSION_TYPE_CAPTURE){
-               int capture_h_count = 0;
-               PCM_CAPTURE_H_COUNT_GET(capture_h_count);
-               if (capture_h_count == 1) { /* if it is last one */
-                       /* Recover session information */
-                       session_result = _mm_session_util_write_information(-1, MM_SESSION_TYPE_MEDIA, pcmHandle->asm_options);
-                       if (session_result) {
-                               debug_error("_mm_session_util_write_information() [type %d, options %x] failed[%x]", MM_SESSION_TYPE_MEDIA, pcmHandle->asm_options, session_result);
-                       }
-               }
-       }
-
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-EXIT:
-       debug_fleave();
-       return result;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_open(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format)
-{
-       mm_sound_pcm_t *pcmHandle = NULL;
-       int size = 0;
-       int result = MM_ERROR_NONE;
-       int errorcode = 0;
-       int ret_mutex = 0;
-       int ret = MM_ERROR_NONE;
-
-       int volume_config = 0;
-       pa_sample_spec ss;
-       char stream_type[MM_SOUND_STREAM_TYPE_LEN] = {0, };
-
-       mm_sound_handle_route_info route_info;
-       route_info.policy = HANDLE_ROUTE_POLICY_DEFAULT;
-
-       debug_warning ("enter : rate=[%d], channel=[%x], format=[%x]\n", rate, channel, format);
-
-       if (rate < _MIN_SYSTEM_SAMPLERATE || rate > _MAX_SYSTEM_SAMPLERATE) {
-               debug_error("unsupported sample rate %u", rate);
-               return MM_ERROR_SOUND_DEVICE_INVALID_SAMPLERATE;
-       } else {
-               ss.rate = rate;
-       }
-
-       switch(channel)
-       {
-       case MMSOUND_PCM_MONO:
-               ss.channels = 1;
-               break;
-       case MMSOUND_PCM_STEREO:
-               ss.channels = 2;
-               break;
-
-       default:
-               debug_error("Unsupported channel type\n");
-               return MM_ERROR_SOUND_DEVICE_INVALID_CHANNEL;
-       }
-
-       switch(format)
-       {
-       case MMSOUND_PCM_U8:
-               ss.format = PA_SAMPLE_U8;
-               break;
-       case MMSOUND_PCM_S16_LE:
-               ss.format = PA_SAMPLE_S16LE;
-               break;
-       default:
-               debug_error("Unsupported format type\n");
-               return MM_ERROR_SOUND_DEVICE_INVALID_FORMAT;
-       }
-
-       pcmHandle = calloc(sizeof(mm_sound_pcm_t), 1);
-       if(pcmHandle == NULL)
-               return MM_ERROR_OUT_OF_MEMORY;
-
-       ret_mutex = pthread_mutex_init(&pcmHandle->pcm_mutex_internal, NULL);
-       if(ret_mutex != 0)
-       {
-               free(pcmHandle);
-               return MM_ERROR_OUT_OF_MEMORY;
-       }
-
-       /* Register ASM */
-       /* get session information */
-       ret = _get_asm_information(MMSOUND_SESSION_TYPE_CAPTURE, &pcmHandle->asm_event, &pcmHandle->asm_options, &pcmHandle->session_registered_type);
-       if(ret) {
-               PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               free(pcmHandle);
-               return ret;
-       }
-       PCM_CAPTURE_H_COUNT_INC();
-
-       /* register asm */
-       if(pcmHandle->asm_event != ASM_EVENT_CALL &&
-               pcmHandle->asm_event != ASM_EVENT_VIDEOCALL &&
-               pcmHandle->asm_event != ASM_EVENT_VOIP &&
-               pcmHandle->asm_event != ASM_EVENT_VOICE_RECOGNITION &&
-               pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_AUDIO &&
-               pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_VIDEO &&
-               pcmHandle->skip_session == false) {
-               if(!ASM_register_sound(-1, &pcmHandle->asm_handle, pcmHandle->asm_event,
-                               /* ASM_STATE_PLAYING */ ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, pcmHandle->resource, &errorcode))
-               {
-                       debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
-                       PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-                       free(pcmHandle);
-                       PCM_CAPTURE_H_COUNT_DEC();
-                       return MM_ERROR_POLICY_BLOCKED;
-               }
-               if(!ASM_set_session_option(pcmHandle->asm_handle, pcmHandle->asm_options, &errorcode)) {
-                       debug_error("ASM_set_session_option() failed 0x%x\n", errorcode);
-               }
-       } else {
-               pcmHandle->skip_session = true;
-       }
-
-       /* Open */
-       if(pcmHandle->asm_event == ASM_EVENT_VOIP)
-               volume_config = VOLUME_TYPE_VOIP;
-       else
-               volume_config = VOLUME_TYPE_SYSTEM; //dose not effect at capture mode
-
-       mm_sound_convert_volume_type_to_stream_type(volume_config, stream_type);
-       pcmHandle->handle = mm_sound_pa_open(HANDLE_MODE_INPUT, &route_info, 0, volume_config, &ss, NULL, &size, stream_type, -1);
-       if(pcmHandle->handle<0) {
-               result = pcmHandle->handle;
-               debug_error("Device Open Error 0x%x\n", result);
-               PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               free(pcmHandle);
-               PCM_CAPTURE_H_COUNT_DEC();
-               return result;
-       }
-
-       pcmHandle->is_playback = false;
-       pcmHandle->rate = rate;
-       pcmHandle->channel = channel;
-       pcmHandle->format = format;
-       pcmHandle->byte_per_sec = rate*(format==MMSOUND_PCM_U8?1:2)*(channel==MMSOUND_PCM_MONO?1:2);
-
-       /* Set handle to return */
-       *handle = (MMSoundPcmHandle_t)pcmHandle;
-
-       debug_warning ("success : handle=[%p], size=[%d]\n", pcmHandle, size);
-
-       return size;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_open_ex(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, mm_sound_source_type_e source_type)
-{
-       mm_sound_pcm_t *pcmHandle = NULL;
-       int size = 0;
-       int result = MM_ERROR_NONE;
-       int errorcode = 0;
-       int ret_mutex = 0;
-
-       int volume_config = 0;
-       pa_sample_spec ss;
-       mm_sound_handle_route_info route_info;
-       route_info.policy = HANDLE_ROUTE_POLICY_DEFAULT;
-       char stream_type[MM_SOUND_STREAM_TYPE_LEN] = {0, };
-
-       debug_warning ("enter : rate=[%d Hz], channel=[%x][%s], format=[%x][%s], source_type=[%x]\n",
-                               rate, channel, _get_channel_str(channel), format, _get_format_str(format), source_type);
-
-       if (rate < _MIN_SYSTEM_SAMPLERATE || rate > _MAX_SYSTEM_SAMPLERATE) {
-               debug_error("unsupported sample rate %u", rate);
-               return MM_ERROR_SOUND_DEVICE_INVALID_SAMPLERATE;
-       } else {
-               ss.rate = rate;
-       }
-
-       switch(channel)
-       {
-       case MMSOUND_PCM_MONO:
-               ss.channels = 1;
-               break;
-       case MMSOUND_PCM_STEREO:
-               ss.channels = 2;
-               break;
-
-       default:
-               debug_error("Unsupported channel type\n");
-               return MM_ERROR_SOUND_DEVICE_INVALID_CHANNEL;
-       }
-
-       switch(format)
-       {
-       case MMSOUND_PCM_U8:
-               ss.format = PA_SAMPLE_U8;
-               break;
-       case MMSOUND_PCM_S16_LE:
-               ss.format = PA_SAMPLE_S16LE;
-               break;
-       default:
-               debug_error("Unsupported format type\n");
-               return MM_ERROR_SOUND_DEVICE_INVALID_FORMAT;
-       }
-
-       pcmHandle = calloc(sizeof(mm_sound_pcm_t), 1);
-       if(pcmHandle == NULL)
-               return MM_ERROR_OUT_OF_MEMORY;
-
-       ret_mutex = pthread_mutex_init(&pcmHandle->pcm_mutex_internal, NULL);
-       if(ret_mutex != 0)
-       {
-               free(pcmHandle);
-               return MM_ERROR_OUT_OF_MEMORY;
-       }
-
-       /* Register ASM */
-       /* get session information */
-       if(MM_ERROR_NONE != _get_asm_information(MMSOUND_SESSION_TYPE_CAPTURE, &pcmHandle->asm_event, &pcmHandle->asm_options, &pcmHandle->session_registered_type)) {
-               PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               free(pcmHandle);
-               return MM_ERROR_POLICY_INTERNAL;
-       }
-       PCM_CAPTURE_H_COUNT_INC();
-
-       switch (source_type) {
-       case SUPPORT_SOURCE_TYPE_VOIP:
-               route_info.policy = HANDLE_ROUTE_POLICY_IN_VOIP;
-               break;
-       case SUPPORT_SOURCE_TYPE_MIRRORING:
-               route_info.policy = HANDLE_ROUTE_POLICY_IN_MIRRORING;
-               break;
-       case SUPPORT_SOURCE_TYPE_DEFAULT:
-       case SUPPORT_SOURCE_TYPE_VIDEOCALL:
-       case SUPPORT_SOURCE_TYPE_VOICERECORDING:
-               break;
-       case SUPPORT_SOURCE_TYPE_VOICECONTROL:
-               pcmHandle->asm_event = ASM_EVENT_EXCLUSIVE_RESOURCE;
-               pcmHandle->resource = ASM_RESOURCE_VOICECONTROL;
-               break;
-       default:
-               break;
-       }
-
-       /* register asm */
-       if(pcmHandle->asm_event != ASM_EVENT_CALL &&
-               pcmHandle->asm_event != ASM_EVENT_VIDEOCALL &&
-               pcmHandle->asm_event != ASM_EVENT_VOIP &&
-               pcmHandle->asm_event != ASM_EVENT_VOICE_RECOGNITION &&
-               pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_AUDIO &&
-               pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_VIDEO &&
-               pcmHandle->skip_session == false &&
-               _check_skip_session_type_for_capture(pcmHandle, source_type) == false) {
-               if(!ASM_register_sound(-1, &pcmHandle->asm_handle, pcmHandle->asm_event,
-                               /* ASM_STATE_PLAYING */ ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, pcmHandle->resource, &errorcode))     {
-                       debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
-                       PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-                       free(pcmHandle);
-                       PCM_CAPTURE_H_COUNT_DEC();
-                       return MM_ERROR_POLICY_BLOCKED;
-               }
-               if(!ASM_set_session_option(pcmHandle->asm_handle, pcmHandle->asm_options, &errorcode)) {
-                       debug_error("ASM_set_session_option() failed 0x%x\n", errorcode);
-               }
-       } else {
-               pcmHandle->skip_session = true;
-       }
-
-       /* For Video Call or VoIP select volume type VOLUME_TYPE_VOIP for sink/source */
-       if( (pcmHandle->asm_event == ASM_EVENT_VIDEOCALL) || (pcmHandle->asm_event == ASM_EVENT_VOIP) )
-               volume_config = VOLUME_TYPE_VOIP;
-       else
-               volume_config = VOLUME_TYPE_SYSTEM; //dose not effect at capture mode
-
-       mm_sound_convert_volume_type_to_stream_type(volume_config, stream_type);
-       if (result) {
-               debug_error("mm_sound_convert_volume_type_to_stream_type failed (0x%x)", result);
-               return result;
-       }
-
-       pcmHandle->handle = mm_sound_pa_open(HANDLE_MODE_INPUT, &route_info, 0, volume_config, &ss, NULL, &size, stream_type, -1);
-       if(pcmHandle->handle<0) {
-               result = pcmHandle->handle;
-               debug_error("Device Open Error 0x%x\n", result);
-               PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               free(pcmHandle);
-               PCM_CAPTURE_H_COUNT_DEC();
-               return result;
-       }
-
-       pcmHandle->is_playback = false;
-       pcmHandle->rate = rate;
-       pcmHandle->channel = channel;
-       pcmHandle->format = format;
-       pcmHandle->byte_per_sec = rate*(format==MMSOUND_PCM_U8?1:2)*(channel==MMSOUND_PCM_MONO?1:2);
-
-       /* Set handle to return */
-       *handle = (MMSoundPcmHandle_t)pcmHandle;
-
-       debug_warning ("success : handle=[%p], size=[%d]\n", handle, size);
-
-       return size;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_ignore_session(MMSoundPcmHandle_t *handle)
-{
-       return _pcm_sound_ignore_session(handle, MMSOUND_SESSION_TYPE_CAPTURE);
-}
-
-static int _pcm_sound_start (MMSoundPcmHandle_t handle)
-{
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-       int errorcode = 0;
-       int ret = 0;
-
-       debug_fenter();
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               ret = MM_ERROR_INVALID_ARGUMENT;
-               goto NULL_HANDLE;
-       }
-
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-       if (pcmHandle->skip_session == false) {
-               /* ASM set state to PLAYING */
-               if (!ASM_set_sound_state(pcmHandle->asm_handle, pcmHandle->asm_event, ASM_STATE_PLAYING, pcmHandle->resource, &errorcode)) {
-                       debug_error("ASM_set_sound_state(PLAYING) failed 0x%x\n", errorcode);
-                       ret = MM_ERROR_POLICY_BLOCKED;
-                       goto EXIT;
-               }
-       }
-
-       /* Update State */
-       pcmHandle->is_started = true;
-
-       /* Un-Cork */
-       mm_sound_pa_cork(pcmHandle->handle, 0);
-
-EXIT:
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-NULL_HANDLE:
-       debug_fleave();
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_start(MMSoundPcmHandle_t handle)
-{
-       int ret = MM_ERROR_NONE;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-
-       ret = _pcm_sound_start (handle);
-       if (ret != MM_ERROR_NONE)  {
-               debug_error ("_pcm_sound_start() failed (%x)\n", ret);
-               goto EXIT;
-       }
-
-EXIT:
-       debug_warning ("leave : handle=[%p], ret=[0x%X]", handle, ret);
-
-       return ret;
-}
-
-static int _pcm_sound_stop_internal (MMSoundPcmHandle_t handle)
-{
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if(pcmHandle == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       /* Check State */
-       if (pcmHandle->is_started == false) {
-               debug_warning ("Can't stop because not started\n");
-               return MM_ERROR_SOUND_INVALID_STATE;
-       }
-
-       /* Drain if playback mode */
-       if (pcmHandle->is_playback) {
-               if(MM_ERROR_NONE != mm_sound_pa_drain(pcmHandle->handle)) {
-                       debug_error("drain failed\n");
-               }
-       }
-
-       /* Update State */
-       pcmHandle->is_started = false;
-
-       /* Cork */
-       return mm_sound_pa_cork(pcmHandle->handle, 1);
-}
-
-static int _pcm_sound_stop(MMSoundPcmHandle_t handle)
-{
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-       int errorcode = 0;
-       int ret = MM_ERROR_NONE;
-
-       debug_fenter();
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               ret = MM_ERROR_INVALID_ARGUMENT;
-               goto NULL_HANDLE;
-       }
-
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-       /* Do stop procedure */
-       ret = _pcm_sound_stop_internal(handle);
-       if (ret == MM_ERROR_NONE) {
-               /* Set ASM State to STOP */
-               if (pcmHandle->skip_session == false) {
-                       if (!ASM_set_sound_state(pcmHandle->asm_handle, pcmHandle->asm_event, ASM_STATE_STOP, pcmHandle->resource, &errorcode)) {
-                               debug_error("ASM_set_sound_state(STOP) failed 0x%x\n", errorcode);
-                               ret = MM_ERROR_POLICY_BLOCKED;
-                               goto EXIT;
-                       }
-               }
-       }
-
-EXIT:
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-NULL_HANDLE:
-       debug_fleave();
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_stop(MMSoundPcmHandle_t handle)
-{
-       int ret = 0;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-       ret = _pcm_sound_stop(handle);
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, ret);
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_flush(MMSoundPcmHandle_t handle)
-{
-       int ret = 0;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if(pcmHandle == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-       ret = mm_sound_pa_flush(pcmHandle->handle);
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, ret);
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_read(MMSoundPcmHandle_t handle, void *buffer, const unsigned int length )
-{
-       int ret = 0;
-       static int read_byte = 0;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               ret =  MM_ERROR_INVALID_ARGUMENT;
-               goto NULL_HANDLE;
-       }
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-       if(buffer == NULL) {
-               debug_error("Invalid buffer pointer\n");
-               ret = MM_ERROR_SOUND_INVALID_POINTER;
-               goto EXIT;
-       }
-       if(length == 0 ) {
-               debug_error ("length is 0, return 0\n");
-               ret = 0;
-               goto EXIT;
-       }
-
-       /* Check State : return fail if not started */
-       if (!pcmHandle->is_started) {
-               /*  not started, return fail */
-               debug_error ("Not started yet, return Invalid State \n");
-               ret = MM_ERROR_SOUND_INVALID_STATE;
-               goto EXIT;
-       }
-
-       /* Read */
-       ret = mm_sound_pa_read(pcmHandle->handle, buffer, length);
-
-EXIT:
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-NULL_HANDLE:
-       read_byte += length;
-
-       if(ret > 0 && read_byte>pcmHandle->byte_per_sec*RW_LOG_PERIOD){
-               debug_log ("(%d)/read-once, (%d)/%dsec bytes read \n", length, read_byte, RW_LOG_PERIOD);
-               read_byte = 0;
-       }
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_capture_close(MMSoundPcmHandle_t handle)
-{
-       int result = MM_ERROR_NONE;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-       int errorcode = 0;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               result = MM_ERROR_INVALID_ARGUMENT;
-               goto NULL_HDL;
-       }
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-       /* Close */
-       if(MM_ERROR_NONE != mm_sound_pa_close(pcmHandle->handle)) {
-               debug_error("handle close failed 0x%X", result);
-               result = MM_ERROR_SOUND_INTERNAL;
-               goto EXIT;
-       }
-
-       /* Unregister ASM */
-       if (pcmHandle->skip_session == false) {
-               if(pcmHandle->asm_event != ASM_EVENT_CALL &&
-                       pcmHandle->asm_event != ASM_EVENT_VIDEOCALL &&
-                       pcmHandle->asm_event != ASM_EVENT_VOIP &&
-                       pcmHandle->asm_event != ASM_EVENT_VOICE_RECOGNITION &&
-                       pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_AUDIO &&
-                       pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_VIDEO) {
-                       if (pcmHandle->asm_handle) {
-                               if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
-                                       debug_error("ASM_unregister failed with 0x%x\n", errorcode);
-                                       result = MM_ERROR_SOUND_INTERNAL;
-                                       goto EXIT;
-                               }
-                       }
-               }
-               int capture_h_count = 0;
-               PCM_CAPTURE_H_COUNT_GET(capture_h_count);
-               if (capture_h_count == 1) { /* if it is last one */
-                       /* Recover session information */
-                       result = _mm_session_util_write_information(-1, MM_SESSION_TYPE_MEDIA, pcmHandle->asm_options);
-                       if (result) {
-                               debug_error("_mm_session_util_write_information() [type %d, options %x] failed[%x]", MM_SESSION_TYPE_MEDIA, pcmHandle->asm_options, result);
-                       }
-               }
-       }
-
-EXIT:
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-NULL_HDL:
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, result);
-       /* Free handle */
-       if (pcmHandle) {
-               PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               free(pcmHandle);
-               pcmHandle = NULL;
-       }
-       PCM_CAPTURE_H_COUNT_DEC();
-
-       return result;
-}
-
-EXPORT_API
-int mm_sound_pcm_set_message_callback (MMSoundPcmHandle_t handle, MMMessageCallback callback, void *user_param)
-{
-       mm_sound_pcm_t *pcmHandle =  (mm_sound_pcm_t*)handle;
-
-       if(pcmHandle == NULL || callback == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       pcmHandle->msg_cb = callback;
-       pcmHandle->msg_cb_param = user_param;
-
-       debug_log ("set pcm message callback (%p,%p)\n", callback, user_param);
-
-       return MM_ERROR_NONE;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_open_ex (MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, int volume_config, ASM_sound_events_t asm_event)
-{
-       mm_sound_pcm_t *pcmHandle = NULL;
-       int size = 0;
-       int result = MM_ERROR_NONE;
-       int errorcode = 0;
-       int volume_type = MM_SOUND_VOLUME_CONFIG_TYPE(volume_config);
-       int ret_mutex = 0;
-       mm_sound_handle_route_info route_info;
-       route_info.policy = HANDLE_ROUTE_POLICY_OUT_AUTO;
-       char stream_type[MM_SOUND_STREAM_TYPE_LEN] = {0, };
-
-       pa_sample_spec ss;
-
-       debug_warning ("enter : rate=[%d], channel=[%x][%s], format=[%x][%s], volconf=[%d], event=[%d]\n",
-                       rate, channel, _get_channel_str(channel), format, _get_format_str(format), volume_config, asm_event);
-
-       /* Check input param */
-       if (volume_type < 0 || volume_type >= VOLUME_TYPE_MAX) {
-               debug_error("Volume type is invalid %d\n", volume_type);
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-       if (rate < _MIN_SYSTEM_SAMPLERATE || rate > _MAX_SYSTEM_SAMPLERATE) {
-               debug_error("unsupported sample rate %u", rate);
-               return MM_ERROR_SOUND_DEVICE_INVALID_SAMPLERATE;
-       } else {
-               ss.rate = rate;
-       }
-
-       switch(channel)
-       {
-       case MMSOUND_PCM_MONO:
-               ss.channels = 1;
-               break;
-       case MMSOUND_PCM_STEREO:
-               ss.channels = 2;
-               break;
-       default:
-               debug_error("Unsupported channel type\n");
-               return MM_ERROR_SOUND_DEVICE_INVALID_CHANNEL;
-       }
-
-       switch(format)
-       {
-       case MMSOUND_PCM_U8:
-               ss.format = PA_SAMPLE_U8;
-               break;
-       case MMSOUND_PCM_S16_LE:
-               ss.format = PA_SAMPLE_S16LE;
-               break;
-       default:
-               debug_error("Unsupported format type\n");
-               return MM_ERROR_SOUND_DEVICE_INVALID_FORMAT;
-       }
-
-       pcmHandle = calloc(sizeof(mm_sound_pcm_t),1);
-       if(pcmHandle == NULL)
-               return MM_ERROR_OUT_OF_MEMORY;
-
-       ret_mutex = pthread_mutex_init(&pcmHandle->pcm_mutex_internal, NULL);
-       if(ret_mutex != 0) {
-               debug_error ("error mutex init....%d");
-               result = MM_ERROR_OUT_OF_MEMORY;
-               goto ERROR;
-       }
-
-       /* Register ASM */
-       debug_log ("session start : input asm_event = %d-------------\n", asm_event);
-       if (asm_event == ASM_EVENT_MONITOR) {
-               debug_log ("Skip SESSION for event (%d)\n", asm_event);
-               pcmHandle->skip_session = true;
-       } else if (asm_event == ASM_EVENT_NONE) {
-               /* get session information */
-               if(MM_ERROR_NONE != _get_asm_information(MMSOUND_SESSION_TYPE_PLAYBACK, &pcmHandle->asm_event, &pcmHandle->asm_options, &pcmHandle->session_registered_type)) {
-                       debug_error ("_get_asm_information failed....\n");
-                       result = MM_ERROR_POLICY_INTERNAL;
-                       goto ERROR;
-               }
-
-               // should be fixed. call forwarding engine(voip) use call volume type.
-               if(volume_type == VOLUME_TYPE_CALL) {
-                       pcmHandle->skip_session = true;
-               }
-
-               if(pcmHandle->asm_event != ASM_EVENT_CALL &&
-                       pcmHandle->asm_event != ASM_EVENT_VIDEOCALL &&
-                       pcmHandle->asm_event != ASM_EVENT_VOIP &&
-                       pcmHandle->asm_event != ASM_EVENT_VOICE_RECOGNITION &&
-                       pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_AUDIO &&
-                       pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_VIDEO &&
-                       pcmHandle->skip_session == false) {
-
-                       /* register asm */
-                       if(!ASM_register_sound(-1, &pcmHandle->asm_handle, pcmHandle->asm_event,
-                                       ASM_STATE_NONE, sound_pcm_asm_callback, (void*)pcmHandle, pcmHandle->resource, &errorcode)) {
-                               debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
-                               result = MM_ERROR_POLICY_BLOCKED;
-                               goto ERROR;
-                       }
-                       if(!ASM_set_session_option(pcmHandle->asm_handle, pcmHandle->asm_options, &errorcode)) {
-                               debug_error("ASM_set_session_option() failed 0x%x\n", errorcode);
-                       }
-               } else {
-                       pcmHandle->skip_session = true;
-               }
-       } else {
-               /* register asm using asm_event input */
-               if(!ASM_register_sound(-1, &pcmHandle->asm_handle, asm_event,
-                               ASM_STATE_NONE, NULL, (void*)pcmHandle, pcmHandle->resource, &errorcode)) {
-                       debug_error("ASM_register_sound() failed 0x%x\n", errorcode);
-                       result = MM_ERROR_POLICY_BLOCKED;
-                       goto ERROR;
-               }
-       }
-
-
-       /* Open */
-       mm_sound_convert_volume_type_to_stream_type(volume_type, stream_type);
-       pcmHandle->handle = mm_sound_pa_open(HANDLE_MODE_OUTPUT, &route_info, 0, volume_config, &ss, NULL, &size, stream_type, -1);
-       if(!pcmHandle->handle) {
-               debug_error("Device Open Error 0x%x\n");
-               result = MM_ERROR_SOUND_DEVICE_NOT_OPENED;
-               goto ERROR;
-       }
-
-       /* Set corked state, uncork will be done at prepare()
-          FIXME: we should consider audio_open() return with corked state */
-       result = mm_sound_pa_cork(pcmHandle->handle, 1);
-       if(result) {
-               debug_error("Cork Error 0x%x\n", result);
-               result = MM_ERROR_SOUND_INTERNAL;
-               goto ERROR;
-       }
-
-       pcmHandle->is_playback = true;
-       pcmHandle->rate = rate;
-       pcmHandle->channel = channel;
-       pcmHandle->format = format;
-       pcmHandle->byte_per_sec = rate*(format==MMSOUND_PCM_U8?1:2)*(channel==MMSOUND_PCM_MONO?1:2);
-       pcmHandle->volume_config = volume_config;
-
-       /* Set handle to return */
-       *handle = (MMSoundPcmHandle_t)pcmHandle;
-
-       debug_warning ("success : handle=[%p], size=[%d]\n", pcmHandle, size);
-       return size;
-
-ERROR:
-       if (pcmHandle) {
-               if(ret_mutex == 0) {
-                       PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               }
-               free(pcmHandle);
-       }
-       return result;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_open_no_session(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, int volume_config)
-{
-       return mm_sound_pcm_play_open_ex (handle, rate, channel, format, volume_config, ASM_EVENT_MONITOR);
-}
-
-EXPORT_API
-int mm_sound_pcm_play_open(MMSoundPcmHandle_t *handle, const unsigned int rate, MMSoundPcmChannel_t channel, MMSoundPcmFormat_t format, int volume_config)
-{
-       return mm_sound_pcm_play_open_ex (handle, rate, channel, format, volume_config, ASM_EVENT_NONE);
-}
-
-EXPORT_API
-int mm_sound_pcm_play_start(MMSoundPcmHandle_t handle)
-{
-       int ret = 0;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-       ret = _pcm_sound_start (handle);
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, ret);
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_stop(MMSoundPcmHandle_t handle)
-{
-       int ret = 0;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-       ret = _pcm_sound_stop(handle);
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, ret);
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_drain(MMSoundPcmHandle_t handle)
-{
-       int ret = 0;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if(pcmHandle == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-       ret = mm_sound_pa_drain(pcmHandle->handle);
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, ret);
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_flush(MMSoundPcmHandle_t handle)
-{
-       int ret = 0;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if(pcmHandle == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-       ret = mm_sound_pa_flush(pcmHandle->handle);
-       debug_warning ("leave : handle=[%p], ret=[0x%X]\n", handle, ret);
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_write(MMSoundPcmHandle_t handle, void* ptr, unsigned int length_byte)
-{
-       int ret = 0;
-       static int written_byte = 0;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               ret = MM_ERROR_INVALID_ARGUMENT;
-               goto NULL_HANDLE;
-       }
-
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-
-       if(ptr == NULL) {
-               debug_error("Invalid buffer pointer\n");
-               ret = MM_ERROR_SOUND_INVALID_POINTER;
-               goto EXIT;
-       }
-       if(length_byte == 0 ) {
-               debug_error ("length is 0, return 0\n");
-               ret = 0;
-               goto EXIT;
-       }
-
-       /* Check State : return fail if not started */
-       if (!pcmHandle->is_started) {
-               /* not started, return fail */
-               debug_error ("Not started yet, return Invalid State \n");
-               ret = MM_ERROR_SOUND_INVALID_STATE;
-               goto EXIT;
-       }
-
-       /* Write */
-       ret = mm_sound_pa_write(pcmHandle->handle, ptr, length_byte);
-
-
-EXIT:
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-NULL_HANDLE:
-       written_byte += length_byte;
-       if(ret > 0 && written_byte>pcmHandle->byte_per_sec*RW_LOG_PERIOD){
-               debug_log ("(%d)/write-once, (%d)/%dsec bytes written\n", length_byte, written_byte, RW_LOG_PERIOD);
-               written_byte = 0;
-       }
-
-       return ret;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_close(MMSoundPcmHandle_t handle)
-{
-       int result = MM_ERROR_NONE;
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-       int errorcode = 0;
-
-       debug_warning ("enter : handle=[%p]\n", handle);
-
-       /* Check input param */
-       if(pcmHandle == NULL) {
-               debug_error ("Handle is null, return Invalid Argument\n");
-               result = MM_ERROR_INVALID_ARGUMENT;
-               goto NULL_HANDLE;
-       }
-       PCM_LOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-       /* Drain if needed */
-       if (pcmHandle->is_started) {
-               /* stop() is not called before close(), drain is needed */
-               if(MM_ERROR_NONE != mm_sound_pa_drain(pcmHandle->handle)) {
-                       debug_error("drain failed\n");
-                       result = MM_ERROR_SOUND_INTERNAL;
-                       goto EXIT;
-               }
-       }
-       pcmHandle->is_started = false;
-       /* Close */
-       if(MM_ERROR_NONE != mm_sound_pa_close(pcmHandle->handle)) {
-               debug_error("handle close failed. handle(%d)", pcmHandle->handle);
-               result = MM_ERROR_SOUND_INTERNAL;
-               goto EXIT;
-       }
-
-       if (pcmHandle->skip_session == false) {
-               /* Unregister ASM */
-               if(pcmHandle->asm_event != ASM_EVENT_CALL &&
-                       pcmHandle->asm_event != ASM_EVENT_VIDEOCALL &&
-                       pcmHandle->asm_event != ASM_EVENT_VOIP &&
-                       pcmHandle->asm_event != ASM_EVENT_VOICE_RECOGNITION &&
-                       pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_AUDIO &&
-                       pcmHandle->asm_event != ASM_EVENT_MMCAMCORDER_VIDEO) {
-                       if(!ASM_unregister_sound(pcmHandle->asm_handle, pcmHandle->asm_event, &errorcode)) {
-                               debug_error("ASM_unregister failed with 0x%x\n", errorcode);
-                       }
-               }
-       }
-
-EXIT:
-       PCM_UNLOCK_INTERNAL(&pcmHandle->pcm_mutex_internal);
-NULL_HANDLE:
-       debug_warning ("leave : handle=[%p], result[0x%X]\n", handle, result);
-       if (pcmHandle) {
-               /* Free handle */
-               PCM_LOCK_DESTROY_INTERNAL(&pcmHandle->pcm_mutex_internal);
-               free(pcmHandle);
-               pcmHandle= NULL;
-       }
-
-       return result;
-}
-
-EXPORT_API
-int mm_sound_pcm_play_ignore_session(MMSoundPcmHandle_t *handle)
-{
-       return _pcm_sound_ignore_session(handle, MMSOUND_SESSION_TYPE_PLAYBACK);
-}
-
-EXPORT_API
-int mm_sound_pcm_get_latency(MMSoundPcmHandle_t handle, int *latency)
-{
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-       int mlatency = 0;
-
-       /* Check input param */
-       if (latency == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       if (MM_ERROR_NONE != mm_sound_pa_get_latency(pcmHandle->handle, &mlatency)) {
-               debug_error("Get Latency Error");
-               /* FIXME : is this correct return value? */
-               return MM_ERROR_SOUND_DEVICE_NOT_OPENED;
-       }
-
-       *latency = mlatency;
-
-       return MM_ERROR_NONE;
-}
-
-EXPORT_API
-int mm_sound_pcm_is_started(MMSoundPcmHandle_t handle, bool *is_started)
-{
-       mm_sound_pcm_t *pcmHandle = (mm_sound_pcm_t*)handle;
-
-       /* Check input param */
-       if (is_started == NULL)
-               return MM_ERROR_INVALID_ARGUMENT;
-
-       *is_started = pcmHandle->is_started;
-
-       return MM_ERROR_NONE;
-}
index 40a561b..979e216 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.9.276
+Version:    0.10.1
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0
@@ -17,7 +17,6 @@ Requires(postun): /sbin/ldconfig
 BuildRequires: pkgconfig(mm-common)
 BuildRequires: pkgconfig(mm-log)
 BuildRequires: pkgconfig(mm-session)
-BuildRequires: pkgconfig(audio-session-mgr)
 BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(gio-2.0)
 BuildRequires: pkgconfig(vconf)
index 6998c3c..85db407 100644 (file)
@@ -4,7 +4,6 @@ bin_PROGRAMS = sound_server
 sound_server_SOURCES = mm_sound_mgr_codec.c \
                                                mm_sound_mgr_ipc.c \
                                                mm_sound_mgr_ipc_dbus.c \
-                                               mm_sound_mgr_asm.c \
                                                mm_sound_mgr_run.c \
                                                mm_sound_plugin.c \
                                                mm_sound_server.c \
diff --git a/server/include/mm_sound_mgr_asm.h b/server/include/mm_sound_mgr_asm.h
deleted file mode 100644 (file)
index d07471d..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * libmm-sound
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungbae Shin <seungbae.shin@samsung.com>
- *
- * 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 __MM_SOUND_MGR_ASM_H__
-#define __MM_SOUND_MGR_ASM_H__
-
-#include "mm_ipc.h"
-#include <audio-session-manager.h>
-
-int MMSoundMgrASMInit(void);
-int MMSoundMgrASMFini(void);
-
-int _mm_sound_mgr_asm_register_sound(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                     int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state);
-int _mm_sound_mgr_asm_unregister_sound(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource);
-int _mm_sound_mgr_asm_register_watcher(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                       int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state);
-int _mm_sound_mgr_asm_unregister_watcher(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource);
-int _mm_sound_mgr_asm_get_mystate(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                  int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_state);
-int _mm_sound_mgr_asm_set_state(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                               int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state, int *snd_error_code);
-int _mm_sound_mgr_asm_get_state(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                               int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_state);
-int _mm_sound_mgr_asm_set_subsession(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                     int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id);
-int _mm_sound_mgr_asm_get_subsession(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                     int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command);
-int _mm_sound_mgr_asm_set_subevent(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                   int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state);
-int _mm_sound_mgr_asm_get_subevent(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                   int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command);
-int _mm_sound_mgr_asm_set_session_option(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                         int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_error_code);
-int _mm_sound_mgr_asm_get_session_option(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                         int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_option_flag);
-int _mm_sound_mgr_asm_reset_resume_tag(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                       int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state);
-int _mm_sound_mgr_asm_dump(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource);
-int _mm_sound_mgr_asm_emergent_exit(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state);
-
-int __asm_process_message (void *asm_rcv_msg, void *asm_ret_msg);
-
-#ifdef SUPPORT_CONTAINER
-void _mm_sound_mgr_asm_update_container_data(int instance_id, const char* container_name, int container_pid);
-#endif
-
-#endif /* __MM_SOUND_MGR_ASM_H__ */
-
index eb29029..47aaa01 100644 (file)
@@ -27,7 +27,6 @@
 
 #include <mm_session.h>
 #include <mm_session_private.h>
-#include <audio-session-manager.h>
 
 #endif /* __MM_SOUND_MGR_COMMON_H__ */
 
index 7dba5a8..3a163cc 100644 (file)
@@ -62,70 +62,11 @@ int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
                           gboolean enable_session, int *codechandle, char *stream_type, int stream_index);
 int _MMSoundMgrIpcPlayDTMFWithStreamInfo(int tone, int repeat, int volume, int client_pid, int *codechandle, char *stream_type, int stream_index);
 
-/*
-int _MMSoundMgrIpcPlayMemory(int *codechandle, mm_ipc_msg_t *msg);
-int __mm_sound_mgr_ipc_is_route_available(mm_ipc_msg_t *msg, bool *is_available);
-int __mm_sound_mgr_ipc_foreach_available_route_cb(mm_ipc_msg_t *msg);
-int __mm_sound_mgr_ipc_set_active_route(mm_ipc_msg_t *msg);
-int __mm_sound_mgr_ipc_set_active_route_auto(void);
-int __mm_sound_mgr_ipc_get_active_device(mm_ipc_msg_t *msg, mm_sound_device_in *device_in, mm_sound_device_out *device_out);
-int __mm_sound_mgr_ipc_add_active_device_changed_cb(mm_ipc_msg_t *msg);
-int __mm_sound_mgr_ipc_remove_active_device_changed_cb(mm_ipc_msg_t *msg);
-int __mm_sound_mgr_ipc_add_available_device_changed_cb(mm_ipc_msg_t *msg);
-int __mm_sound_mgr_ipc_remove_available_device_changed_cb(mm_ipc_msg_t *msg);
-*/
 int __mm_sound_mgr_ipc_set_sound_path_for_active_device(mm_sound_device_in _device_in, mm_sound_device_out _device_out);
 int __mm_sound_mgr_ipc_get_audio_path(mm_sound_device_in *device_in, mm_sound_device_out *device_out);
 //int __mm_sound_mgr_ipc_get_current_connected_device_list(mm_ipc_msg_t *msg, GList **device_list, int *total_num);
 int __mm_sound_mgr_ipc_get_current_connected_device_list(int device_flags, mm_sound_device_t **device_list, int *total_num);
 
-int __mm_sound_mgr_ipc_asm_register_sound(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-#ifdef SUPPORT_CONTAINER
-                                               const char* container_name, int container_pid,
-#endif
-                                         int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                         int* request_id_r, int* sound_command_r, int* sound_state_r );
-int __mm_sound_mgr_ipc_asm_unregister_sound(int pid, int handle, int sound_event, int request_id, int sound_state, int resource);
-int __mm_sound_mgr_ipc_asm_register_watcher(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-#ifdef SUPPORT_CONTAINER
-                                               const char* container_name, int container_pid,
-#endif
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_cmd_r, int* sound_state_r );
-int __mm_sound_mgr_ipc_asm_unregister_watcher(int pid, int handle, int sound_event, int request_id, int sound_state, int resource);
-int __mm_sound_mgr_ipc_asm_get_mystate(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_state_r );
-int __mm_sound_mgr_ipc_asm_set_state(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* sound_state_r , int* error_code_r);
-int __mm_sound_mgr_ipc_asm_get_state(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_state_r );
-int __mm_sound_mgr_ipc_asm_set_subsession(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r, int* request_id_r);
-int __mm_sound_mgr_ipc_asm_get_subsession(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r, int* request_id_r, int* sound_command_r);
-
-int __mm_sound_mgr_ipc_asm_set_subevent(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_cmd_r, int* sound_state_r );
-int __mm_sound_mgr_ipc_asm_get_subevent(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_cmd_r);
-int __mm_sound_mgr_ipc_asm_set_session_option(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_cmd_r, int* error_code_r );
-int __mm_sound_mgr_ipc_asm_get_session_option(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_cmd_r, int* option_flag_r );
-int __mm_sound_mgr_ipc_asm_reset_resume_tag(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_cmd_r, int* sound_state_r );
-int __mm_sound_mgr_ipc_asm_dump(int pid, int handle, int sound_event, int request_id, int sound_state, int resource);
-int __mm_sound_mgr_ipc_asm_emergent_exit(int pid, int handle, int sound_event, int request_id, int sound_state);
-
-
 /* send signal : mgr_xxx -> mgr_ipc_dbus */
 int _MMIpcCBSndMsg(mm_ipc_msg_t *msg);
 int _MMIpcCBRecvMsg(mm_ipc_msg_t *msg);
diff --git a/server/mm_sound_mgr_asm.c b/server/mm_sound_mgr_asm.c
deleted file mode 100644 (file)
index df4cc68..0000000
+++ /dev/null
@@ -1,3978 +0,0 @@
-/*
- * libmm-sound
- *
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungbae Shin <seungbae.shin@samsung.com>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <pthread.h>
-#include <sys/shm.h>
-#include <sys/msg.h>
-#include <sys/mman.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <stdbool.h>
-
-#include <errno.h>
-
-#include "include/mm_sound_mgr_common.h"
-#include "include/mm_sound_thread_pool.h"
-#include "../include/mm_sound_common.h"
-
-#include <mm_error.h>
-#include <mm_debug.h>
-
-#include "include/mm_sound_mgr_asm.h"
-#include "include/mm_sound_mgr_ipc.h"
-#include "../include/mm_sound_utils.h"
-
-pthread_mutex_t g_mutex_asm = PTHREAD_MUTEX_INITIALIZER;
-
-/******************************* ASM Code **********************************/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include <sys/types.h>
-#include <sys/wait.h>
-#include <sys/ipc.h>
-#include <sys/select.h>
-#include <sys/time.h>
-#include <sys/msg.h>
-#include <glib.h>
-#include <glib/gprintf.h>
-#include <poll.h>
-
-#include <vconf.h>
-#include <audio-session-manager.h>
-#include <string.h>
-#include <errno.h>
-
-/* for temporal : copied from mgr_session.c */
-typedef enum
-{
-       SESSION_END = 0,
-       SESSION_START,
-} session_state_t;
-
-typedef enum
-{
-       SESSION_MEDIA = 0,
-       SESSION_VOICECALL,
-       SESSION_VIDEOCALL,
-       SESSION_VOIP,
-       SESSION_FMRADIO,
-       SESSION_NOTIFICATION,
-       SESSION_ALARM,
-       SESSION_EMERGENCY,
-       SESSION_VOICE_RECOGNITION,
-       SESSION_NUM
-} session_t;
-
-typedef enum
-{
-       SUBSESSION_VOICE = 0,
-       SUBSESSION_RINGTONE,
-       SUBSESSION_MEDIA,
-       SUBSESSION_INIT,
-       SUBSESSION_VR_NORMAL,
-       SUBSESSION_VR_DRIVE,
-       SUBSESSION_RECORD_STEREO,
-       SUBSESSION_RECORD_MONO,
-       SUBSESSION_NUM
-} subsession_t;
-/* -------------- */
-
-#define USE_SYSTEM_SERVER_PROCESS_MONITORING
-
-#define ROW_NUM_OF_SUB_EVENT           12 /* it should be exactly same with number of ASM_CASE_SUB_EVENT in ASM_sound_case table */
-#define NUM_OF_ADV_ASM_EVENT           3
-
-#define SERVER_HANDLE_MAX_COUNT        256
-
-/* check whether if it is advanced event type */
-#define ASM_IS_ADVANCED_ASM_EVENT(x_sound_event) (x_sound_event == ASM_EVENT_VOICE_RECOGNITION || x_sound_event == ASM_EVENT_MMCAMCORDER_AUDIO || x_sound_event == ASM_EVENT_MMCAMCORDER_VIDEO)
-
-static const ASM_sound_cases_t ASM_sound_case[ASM_EVENT_MAX][ASM_EVENT_MAX] =
-{
-       /*
-               0 == ASM_CASE_NONE
-               1 == ASM_CASE_1PLAY_2STOP
-               2 == ASM_CASE_1STOP_2PLAY
-               3 == ASM_CASE_1PAUSE_2PLAY
-               4 == ASM_CASE_1PLAY_2PLAY_MIX
-               5 == ASM_CASE_RESOURCE_CHECK
-               6 == ASM_CASE_SUB_EVENT
-       */
-       /*   MP MC MS MO MF MW  NT AL EU  CL VC VO  MT EM ER  VR CA CV */
-               { 4, 4, 4, 4, 3, 4,  3, 3, 3,  3, 3, 3,  4, 3, 5,  6, 6, 6},    /* 00 Media MMPlayer */
-               { 4, 4, 4, 4, 4, 4,  4, 3, 4,  3, 3, 3,  4, 3, 5,  6, 6, 6},    /* 01 Media MMCamcorder */
-               { 4, 4, 4, 4, 3, 4,  3, 3, 2,  3, 3, 3,  4, 3, 5,  6, 6, 6},    /* 02 Media MMSound */
-               { 4, 4, 4, 4, 3, 4,  3, 3, 4,  3, 3, 3,  4, 3, 5,  6, 6, 6},    /* 03 Media OpenAL */
-               { 3, 4, 3, 3, 3, 3,  3, 3, 3,  3, 3, 3,  4, 3, 5,  6, 6, 6},    /* 04 Media FMradio */
-               { 4, 4, 4, 4, 3, 4,  3, 3, 3,  3, 3, 3,  4, 3, 5,  6, 6, 6},    /* 05 Media Webkit */
-
-               { 4, 4, 4, 4, 4, 4,  4, 2, 4,  2, 2, 2,  4, 2, 5,  4, 4, 4},    /* 06 Notify */
-               { 1, 1, 1, 1, 1, 1,  4, 4, 4,  2, 2, 2,  4, 2, 5,  1, 1, 1},    /* 07 Alarm */
-               { 4, 4, 4, 4, 4, 4,  4, 4, 4,  4, 4, 4,  4, 4, 5,  4, 4, 4},    /* 08 Earjack Unplug */
-
-               { 1, 1, 1, 1, 1, 1,  1, 4, 4,  1, 1, 1,  4, 1, 5,  1, 6, 6},    /* 09 Call */
-               { 1, 1, 1, 1, 1, 1,  1, 4, 4,  1, 1, 1,  4, 1, 5,  1, 6, 1},    /* 10 Video Call */
-               { 1, 1, 1, 1, 1, 1,  1, 4, 4,  2, 2, 2,  4, 1, 5,  1, 6, 1},    /* 11 VOIP */
-
-               { 4, 4, 4, 4, 4, 4,  4, 4, 4,  4, 4, 4,  4, 4, 5,  4, 4, 4},    /* 12 Monitor */
-               { 4, 4, 4, 4, 4, 4,  4, 4, 4,  2, 2, 2,  4, 2, 5,  1, 1, 1},    /* 13 Emergency */
-               { 5, 5, 5, 5, 5, 5,  5, 5, 5,  5, 5, 5,  5, 5, 5,  5, 5, 5},    /* 14 Exclusive Resource */
-
-               { 6, 6, 6, 6, 6, 6,  4, 2, 4,  2, 2, 2,  4, 2, 5,  6, 6, 6},    /* 15 Voice Recognition */
-               { 6, 6, 6, 6, 6, 6,  6, 2, 4,  4, 2, 2,  4, 2, 5,  6, 6, 6},    /* 16 MMCamcorder Audio */
-               { 6, 6, 6, 6, 6, 6,  6, 2, 4,  2, 2, 2,  4, 2, 5,  6, 6, 2},    /* 17 MMCamcorder Video */
-
-};
-
-static const ASM_sound_cases_t ASM_sound_case_sub[NUM_OF_ADV_ASM_EVENT][ASM_SUB_EVENT_MAX][ROW_NUM_OF_SUB_EVENT] =
-{
-       /*
-               0 == ASM_CASE_NONE
-               1 == ASM_CASE_1PLAY_2STOP
-               2 == ASM_CASE_1STOP_2PLAY
-               3 == ASM_CASE_1PAUSE_2PLAY
-               4 == ASM_CASE_1PLAY_2PLAY_MIX
-               5 == ASM_CASE_RESOURCE_CHECK
-               6 == ASM_CASE_SUB_EVENT
-       */
-       /*    MP MC MS MO MF MW  NT CL ER  VR CA CV  <== Current playing event */
-               {{ 4, 4, 4, 4, 4, 4,  4, 4, 5,  2, 6, 6 }, /* Voice Recognition - SH */
-                { 3, 3, 3, 3, 2, 3,  4, 1, 5,  2, 2, 2 }},/* Voice Recognition - EX */
-
-               {{ 4, 4, 4, 4, 4, 4,  4, 4, 5,  2, 2, 2 }, /* MMCamcorder Audio - SH */
-                { 3, 3, 3, 3, 2, 3,  4, 1, 5,  6, 2, 2 }},/* MMCamcorder Audio - EX */
-
-               {{ 4, 4, 4, 4, 4, 4,  4, 4, 5,  6, 2, 2 }, /* MMCamcorder Video - SH */
-                { 3, 3, 3, 3, 2, 3,  4, 1, 5,  2, 2, 2 }} /* MMCamcorder Video - EX */
-};
-
-typedef struct _paused_by_id
-{
-       int pid;
-       int sound_handle;
-       ASM_event_sources_t eventsrc;
-} asm_paused_by_id_t;
-
-typedef struct asm_subsession_option
-{
-       int pid;
-       ASM_resource_t resource;
-} asm_subsession_option_t;
-
-typedef struct _list
-{
-       int                                     instance_id;              /* pid */
-       int                                     sound_handle;             /* unique id */
-       ASM_sound_events_t              sound_event;
-       ASM_sound_sub_events_t  sound_sub_event;
-       ASM_sound_states_t              sound_state;
-       ASM_sound_states_t              prev_sound_state;
-       ASM_resume_states_t             need_resume;
-       ASM_resource_t                  mm_resource;
-       asm_paused_by_id_t              paused_by_id;
-       int                                     option_flags;
-       asm_subsession_option_t option;
-       unsigned short                  monitor_active;
-       unsigned short                  monitor_dirty;
-       bool                                    is_registered_for_watching;
-
-#ifdef SUPPORT_CONTAINER
-       container_info_t                container;
-#endif
-
-       struct _list                    *next;
-} asm_instance_list_t;
-
-asm_instance_list_t *head_list_ptr = NULL;
-asm_instance_list_t *tail_list_ptr = NULL;
-
-typedef struct handle_info
-{
-       int is_registered;
-       int option_flags;
-       ASM_resource_t resource;
-}handle_info;
-
-/* struct array for fast access information */
-handle_info g_handle_info[SERVER_HANDLE_MAX_COUNT];
-
-typedef struct asm_compare_result
-{
-       int previous_num_of_changes;
-       int incoming_num_of_changes;
-       asm_instance_list_t* previous_asm_handle[SERVER_HANDLE_MAX_COUNT];
-       asm_instance_list_t* incoming_asm_handle[SERVER_HANDLE_MAX_COUNT];
-} asm_compare_result_t;
-
-int asm_snd_msgid;
-int asm_rcv_msgid;
-int asm_cb_msgid;
-
-bool asm_is_send_msg_to_cb = false;
-
-unsigned int g_sound_status_pause = 0;
-unsigned int g_sound_status_playing = 0;
-unsigned int g_sound_status_waiting = 0;
-int g_session_ref_count = 0;
-
-static const char* ASM_sound_event_str[] =
-{
-       "MEDIA_MMPLAYER",
-       "MEDIA_MMCAMCORDER",
-       "MEDIA_MMSOUND",
-       "MEDIA_OPENAL",
-       "MEDIA_FMRADIO",
-       "MEDIA_WEBKIT",
-       "NOTIFY",
-       "ALARM",
-       "EARJACK_UNPLUG",
-       "CALL",
-       "VIDEOCALL",
-       "VOIP",
-       "MONITOR",
-       "EMERGENCY",
-       "EXCLUSIVE_RESOURCE",
-       "VOICE_RECOGNITION",
-       "MMCAMCORDER_AUDIO",
-       "MMCAMCORDER_VIDEO"
-};
-
-static const char* ASM_sound_sub_event_str[] =
-{
-       "SUB_EVENT_NONE",
-       "SUB_EVENT_SHARE",
-       "SUB_EVENT_EXCLUSIVE"
-};
-
-static const char* ASM_sound_state_str[] =
-{
-       "STATE_NONE",
-       "STATE_PLAYING",
-       "STATE_WAITING",
-       "STATE_STOP",
-       "STATE_PAUSE",
-};
-
-
-static const char* ASM_sound_request_str[] =
-{
-       "REQUEST_REGISTER",
-       "REQUEST_UNREGISTER",
-       "REQUEST_GETSTATE",
-       "REQUEST_GETMYSTATE",
-       "REQUEST_SETSTATE",
-       "REQUEST_EMEGENT_EXIT",
-       "REQUEST_DUMP",
-       "REQUEST_SET_SUBSESSION",
-       "REQUEST_GET_SUBSESSION",
-       "REQUEST_REGISTER_WATCHER",
-       "REQUEST_UNREGISTER_WATCHER",
-       "REQUEST_SET_SUBEVENT",
-       "REQUEST_GET_SUBEVENT",
-       "REQUEST_RESET_RESUME_TAG",
-       "REQUEST_SET_SESSION_OPTIONS",
-       "REQUEST_GET_SESSION_OPTIONS"
-};
-
-
-static const char* ASM_sound_case_str[] =
-{
-       "CASE_NONE",
-       "CASE_1PLAY_2STOP",
-       "CASE_1STOP_2PLAY",
-       "CASE_1PAUSE_2PLAY",
-       "CASE_1PLAY_2PLAY_MIX",
-       "CASE_RESOURCE_CHECK",
-       "CASE_SUB_EVENT",
-};
-
-static const char* ASM_sound_resume_str[] =
-{
-       "NO-RESUME",
-       "RESUME"
-};
-
-
-static const char* ASM_sound_command_str[] =
-{
-       "CMD_NONE",
-       "CMD_WAIT",
-       "CMD_PLAY",
-       "CMD_STOP",
-       "CMD_PAUSE",
-       "CMD_RESUME"
-};
-
-static char *subsession_str[] =
-{
-       "VOICE",
-       "RINGTONE",
-       "MEDIA",
-       "VOICE_ANSWER_PLAY",
-       "VOICE_ANSWER_REC",
-       "VOICE_CALL_FORWARDING",
-       "INIT",
-       "VR_NORMAL",
-       "VR_DRIVE",
-       "RECORD_STEREO",
-       "RECORD_STEREO_INTERVIEW",
-       "RECORD_STEREO_CONVERSATION",
-       "RECORD_MONO",
-};
-
-static char *subevent_str[] =
-{
-       "SUB_EVENT_NONE",
-       "SUB_EVENT_SHARE",
-       "SUB_EVENT_EXCLUSIVE"
-};
-
-#define ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, x_instance_id, x_alloc_handle, x_cmd_handle, x_source_request_id) \
-do { \
-       asm_snd_msg.instance_id               = x_instance_id; \
-       asm_snd_msg.data.alloc_handle         = x_alloc_handle; \
-       asm_snd_msg.data.cmd_handle           = x_cmd_handle; \
-       asm_snd_msg.data.source_request_id    = x_source_request_id; \
-} while (0)
-
-#define ASM_SND_MSG_SET_RESULT(asm_snd_msg, x_result_sound_command, x_result_sound_state) \
-do { \
-       asm_snd_msg->data.result_sound_command = x_result_sound_command; \
-       asm_snd_msg->data.result_sound_state   = x_result_sound_state; \
-} while (0)
-
-/* reference count of session */
-#define SESSION_REF(x_cur_session) \
-do { \
-       g_session_ref_count++; \
-       debug_log("session ref.count is increased:%d (by cur_session(%d))", g_session_ref_count, x_cur_session); \
-} while (0)
-
-#define SESSION_UNREF(x_cur_session) \
-do { \
-       g_session_ref_count--; \
-       debug_log("session ref.count is decreased:%d (by cur_session(%d))", g_session_ref_count, x_cur_session); \
-} while (0)
-
-#define SESSION_REF_INIT() \
-do { \
-       g_session_ref_count = 0; \
-       debug_log("session ref.count is initialized:%d", g_session_ref_count); \
-} while (0)
-
-#define IS_ON_GOING_SESSION() (g_session_ref_count > 0)
-
-/* execute watch callback */
-#define ASM_DO_WATCH_CALLBACK(x_interest_event, x_interest_state) \
-do { \
-       if (__do_watch_callback(x_interest_event, x_interest_state)) { \
-               debug_error(" oops! failed to _do_watch_callback(%d, %d)\n", x_interest_event, x_interest_state); \
-       } \
-} while (0)
-
-/* execute monitor callback */
-#define ASM_DO_MONITOR_CALLBACK(x_current_instance_id, x_monitor_handle, x_asm_command, x_event_src) \
-do { \
-       int cb_res = 0; \
-       if (__find_clean_monitor_handle(x_current_instance_id, &x_monitor_handle)) { \
-               cb_res = __do_callback(x_current_instance_id, x_monitor_handle, x_asm_command, x_event_src); \
-               debug_warning(" send stop callback for monitor handle of pid %d\n", x_current_instance_id); \
-               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) { \
-                       debug_error(" oops! not suspected callback result %d\n", cb_res); \
-               } \
-               __set_monitor_dirty(x_current_instance_id); \
-       } \
-} while (0)
-
-/* execute watch callback from result structure */
-#define ASM_DO_WATCH_CALLBACK_FROM_RESULT(x_compare_result) \
-do { \
-       while(x_compare_result.incoming_num_of_changes--) { \
-               ASM_DO_WATCH_CALLBACK(x_compare_result.incoming_asm_handle[x_compare_result.incoming_num_of_changes]->sound_event, x_compare_result.incoming_asm_handle[x_compare_result.incoming_num_of_changes]->sound_state); \
-       } \
-       while(x_compare_result.previous_num_of_changes--) { \
-               ASM_DO_WATCH_CALLBACK(x_compare_result.previous_asm_handle[x_compare_result.previous_num_of_changes]->sound_event, x_compare_result.previous_asm_handle[x_compare_result.previous_num_of_changes]->sound_state); \
-       } \
-} while (0)
-
-/* check whether if it needs to be resumed later */
-#define ASM_CHECK_RESUME(x_sound_event, x_resource, x_current_sound_event, x_current_instance_id, x_current_state, x_current_handle, x_paused_by_pid, x_paused_by_sound_handle, x_paused_by_eventsrc) \
-do { \
-       if ( __is_need_resume(x_sound_event, x_resource, x_current_sound_event, x_current_handle) && (x_current_state == ASM_STATE_PLAYING || x_current_state == ASM_STATE_WAITING) ) { \
-               __asm_change_need_resume_list(x_current_instance_id, x_current_handle, ASM_NEED_RESUME, x_paused_by_pid, x_paused_by_sound_handle, x_paused_by_eventsrc); \
-       } \
-} while (0)
-
-/* defines for special cases */
-subsession_t g_camcorder_ex_subsession = SUBSESSION_NUM;
-
-#define MAX_WATCH_CALLBACK_CALCUL_NUM 128
-
-static void ___select_sleep(int secs)
-{
-       struct timeval timeout;
-       timeout.tv_sec = (secs < 1 || secs > 10) ? 3 : secs;
-       timeout.tv_usec = 0;
-       select(0, NULL, NULL, NULL, &timeout);
-       return;
-}
-
-static int __get_adv_event_idx_for_subtable(ASM_sound_events_t sound_event, int *index)
-{
-       int ret = MM_ERROR_NONE;
-       if (!index) {
-               debug_error("index is null");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       switch (sound_event) {
-       case ASM_EVENT_VOICE_RECOGNITION:
-               *index = 0;
-               break;
-       case ASM_EVENT_MMCAMCORDER_AUDIO:
-               *index = 1;
-               break;
-       case ASM_EVENT_MMCAMCORDER_VIDEO:
-               *index = 2;
-               break;
-       default:
-               debug_error("Not supported advanced sound_type(%d) for subtable", sound_event);
-               ret = MM_ERROR_SOUND_INTERNAL;
-               break;
-       }
-
-       return ret;
-}
-
-static int __get_sub_case_table_idx(ASM_sound_events_t sound_event, int *index)
-{
-       int ret = MM_ERROR_NONE;
-       if (!index) {
-               debug_error("index is null");
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
-       switch (sound_event) {
-       case ASM_EVENT_MEDIA_MMPLAYER:
-       case ASM_EVENT_MEDIA_MMCAMCORDER:
-       case ASM_EVENT_MEDIA_MMSOUND:
-       case ASM_EVENT_MEDIA_OPENAL:
-       case ASM_EVENT_MEDIA_FMRADIO:
-       case ASM_EVENT_MEDIA_WEBKIT:
-       case ASM_EVENT_NOTIFY:
-               *index = sound_event;
-               break;
-       case ASM_EVENT_CALL:
-       case ASM_EVENT_VIDEOCALL:
-       case ASM_EVENT_VOIP:
-               *index = ASM_EVENT_NOTIFY + 1;
-               break;
-       case ASM_EVENT_EXCLUSIVE_RESOURCE:
-               *index = ASM_EVENT_NOTIFY + 2;
-               break;
-       case ASM_EVENT_VOICE_RECOGNITION:
-               *index = ASM_EVENT_NOTIFY + 3;
-               break;
-       case ASM_EVENT_MMCAMCORDER_AUDIO:
-               *index = ASM_EVENT_NOTIFY + 4;
-               break;
-       case ASM_EVENT_MMCAMCORDER_VIDEO:
-               *index = ASM_EVENT_NOTIFY + 5;
-               break;
-       default:
-               debug_error("Not supported sound_type(%d) for subtable index", sound_event);
-               ret = MM_ERROR_SOUND_INTERNAL;
-               break;
-       }
-
-       return ret;
-}
-
-static gboolean __is_media_session (ASM_sound_events_t sound_event)
-{
-       gboolean result = FALSE;
-       switch (sound_event) {
-       case ASM_EVENT_MEDIA_MMPLAYER:
-       case ASM_EVENT_MEDIA_MMCAMCORDER:
-       case ASM_EVENT_MEDIA_MMSOUND:
-       case ASM_EVENT_MEDIA_OPENAL:
-       case ASM_EVENT_MEDIA_FMRADIO:
-       case ASM_EVENT_MEDIA_WEBKIT:
-               result = TRUE;
-               break;
-       default:
-               break;
-       }
-       return result;
-}
-
-static ASM_event_sources_t __mapping_sound_event_to_event_src(ASM_sound_events_t sound_event,
-                                                                                                               ASM_resource_t resource, ASM_sound_cases_t sound_case)
-{
-       ASM_event_sources_t event_src = ASM_EVENT_SOURCE_MEDIA;
-
-       switch (sound_event) {
-       case ASM_EVENT_CALL:
-       case ASM_EVENT_VIDEOCALL:
-       case ASM_EVENT_VOIP:
-               event_src = ASM_EVENT_SOURCE_CALL_START;
-               break;
-
-       case ASM_EVENT_EARJACK_UNPLUG:
-               event_src = ASM_EVENT_SOURCE_EARJACK_UNPLUG;
-               break;
-
-       case ASM_EVENT_ALARM:
-               event_src = ASM_EVENT_SOURCE_ALARM_START;
-               break;
-
-       case ASM_EVENT_EMERGENCY:
-               event_src = ASM_EVENT_SOURCE_EMERGENCY_START;
-               break;
-
-       case ASM_EVENT_NOTIFY:
-               event_src = ASM_EVENT_SOURCE_NOTIFY_START;
-               break;
-
-       case ASM_EVENT_MMCAMCORDER_AUDIO:
-       case ASM_EVENT_MMCAMCORDER_VIDEO:
-               event_src = ASM_EVENT_SOURCE_MEDIA;
-               break;
-
-       case ASM_EVENT_MEDIA_MMPLAYER:
-               event_src = ASM_EVENT_SOURCE_OTHER_PLAYER_APP;
-               break;
-
-       default:
-               event_src = ASM_EVENT_SOURCE_MEDIA;
-               break;
-       }
-
-       return event_src;
-}
-
-static ASM_event_sources_t __convert_eventsrc_interrupted_to_completed(ASM_event_sources_t eventsrc)
-{
-       ASM_event_sources_t completed_eventsrc = ASM_EVENT_SOURCE_MEDIA;
-
-       switch(eventsrc) {
-       case ASM_EVENT_SOURCE_CALL_START:
-               completed_eventsrc = ASM_EVENT_SOURCE_CALL_END;
-               break;
-       case ASM_EVENT_SOURCE_ALARM_START:
-               completed_eventsrc = ASM_EVENT_SOURCE_ALARM_END;
-               break;
-       case ASM_EVENT_SOURCE_EMERGENCY_START:
-               completed_eventsrc = ASM_EVENT_SOURCE_EMERGENCY_END;
-               break;
-       case ASM_EVENT_SOURCE_NOTIFY_START:
-               completed_eventsrc = ASM_EVENT_SOURCE_NOTIFY_END;
-               break;
-       default:
-               completed_eventsrc = eventsrc;
-               break;
-       }
-       debug_warning(" completed EventSrc[%d]", completed_eventsrc);
-       return completed_eventsrc;
-}
-
-static gboolean __is_valid_session_options(ASM_sound_events_t sound_event, int option_flags, int *error_code)
-{
-       gboolean result = true;
-       *error_code = ERR_ASM_ERROR_NONE;
-
-       /* Check if those flags are valid according to sound_event */
-       switch (sound_event) {
-       case ASM_EVENT_MEDIA_MMPLAYER:
-       case ASM_EVENT_MEDIA_MMCAMCORDER:
-       case ASM_EVENT_MEDIA_MMSOUND:
-       case ASM_EVENT_MEDIA_OPENAL:
-       case ASM_EVENT_MEDIA_FMRADIO:
-       case ASM_EVENT_MEDIA_WEBKIT:
-               result = true;
-               break;
-       default :
-               *error_code = ERR_ASM_NOT_SUPPORTED;
-               result = false;
-               break;
-       }
-
-       return result;
-}
-
-static gboolean __is_need_resume (ASM_sound_events_t incoming_sound_event, ASM_resource_t incoming_resource,
-                                                               ASM_sound_events_t current_sound_event, int current_handle)
-{
-       gboolean result = FALSE;
-       switch (incoming_sound_event) {
-       case ASM_EVENT_CALL:
-       case ASM_EVENT_VIDEOCALL:
-       case ASM_EVENT_VOIP:
-       case ASM_EVENT_NOTIFY:
-       case ASM_EVENT_ALARM:
-       case ASM_EVENT_EMERGENCY:
-       case ASM_EVENT_VOICE_RECOGNITION:
-       case ASM_EVENT_MMCAMCORDER_AUDIO:
-       case ASM_EVENT_MMCAMCORDER_VIDEO:
-               result = TRUE;
-               break;
-       default:
-               result = FALSE;
-               break;
-       }
-
-       /* exception case : if current playing sound event is one of below list, check false*/
-       switch (current_sound_event) {
-       case ASM_EVENT_VOICE_RECOGNITION:
-       case ASM_EVENT_MMCAMCORDER_VIDEO:
-               return FALSE;
-               break;
-       default:
-               break;
-       }
-
-       if (__is_media_session(current_sound_event) && __is_media_session(incoming_sound_event)) {
-               if (g_handle_info[current_handle].option_flags & ASM_SESSION_OPTION_RESUME_BY_MEDIA_PAUSED) {
-                       result = TRUE;
-               }
-       }
-       if (current_sound_event == ASM_EVENT_MEDIA_OPENAL) {
-               result = TRUE;
-       }
-
-       debug_warning(" resume check(%d)", result);
-       return result;
-}
-
-gboolean __is_session_using_media_volume (ASM_sound_events_t sound_event)
-{
-       gboolean result = FALSE;
-       switch (sound_event) {
-       case ASM_EVENT_MEDIA_MMPLAYER:
-       case ASM_EVENT_MEDIA_MMCAMCORDER:
-       case ASM_EVENT_MEDIA_MMSOUND:
-       case ASM_EVENT_MEDIA_OPENAL:
-       case ASM_EVENT_MEDIA_FMRADIO:
-       case ASM_EVENT_MEDIA_WEBKIT:
-       case ASM_EVENT_MMCAMCORDER_AUDIO:
-       case ASM_EVENT_MMCAMCORDER_VIDEO:
-       case ASM_EVENT_VOICE_RECOGNITION:
-               debug_log("it's a session type using media volume (%d)", sound_event);
-               result = TRUE;
-               break;
-       default:
-               break;
-       }
-       return result;
-}
-
-static gboolean __find_clean_monitor_handle(int instance_id, int *handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int lhandle = ASM_HANDLE_INIT_VAL;
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) {
-                       if (temp_list->monitor_dirty == 0) {
-                               lhandle = temp_list->sound_handle;
-                       }
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-       if (lhandle == ASM_HANDLE_INIT_VAL) {
-               debug_warning(" could not find a clean monitor handle");
-               return FALSE;
-       } else {
-               *handle = lhandle;
-               debug_log(" found a clean monitor handle(%d)", *handle);
-               return TRUE;
-       }
-}
-
-static void __update_monitor_active(int instance_id)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       asm_instance_list_t *monitor_list = NULL;
-       unsigned short active = 0;
-       debug_log(" \n");
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) {
-                       /* backup monitor pointer */
-                       monitor_list = temp_list;
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-       if (NULL == monitor_list) {
-               debug_warning(" No monitor instance for %d\n", instance_id);
-               return;
-       }
-
-       temp_list = head_list_ptr;
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_event != ASM_EVENT_MONITOR) {
-                       if (ASM_STATE_PLAYING == temp_list->sound_state) {
-                               active = 1;
-                               break;
-                       }
-               }
-               temp_list = temp_list->next;
-       }
-
-       monitor_list->monitor_active = active;
-}
-
-static void __set_all_monitor_clean()
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       while (temp_list != NULL) {
-               if (temp_list->sound_event == ASM_EVENT_MONITOR) {
-                       temp_list->monitor_dirty = 0;
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-static void __set_monitor_dirty(int instance_id)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_event == ASM_EVENT_MONITOR) {
-                       temp_list->monitor_dirty = 1;
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-#ifdef SUPPORT_CONTAINER
-static void __set_container_data(int handle, const char* container_name, int container_pid)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       while (temp_list != NULL) {
-               if (temp_list->sound_handle == handle) {
-                       debug_error("Set container [%s][%d] to handle[%d] instanceID[%d]",
-                                               container_name, container_pid, handle, temp_list->instance_id);
-                       if (container_name)
-                               strcpy (temp_list->container.name, container_name);
-                       temp_list->container.pid = container_pid;
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-static container_info_t* __get_container_info(int instance_id)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id) {
-                       return &temp_list->container;
-               }
-               temp_list = temp_list->next;
-       }
-
-       return NULL;
-}
-#endif /* SUPPORT_CONTAINER */
-
-static char* __get_asm_pipe_path(int instance_id, int handle, const char* postfix)
-{
-       char* path = NULL;
-       char* path2 = NULL;
-
-#ifdef SUPPORT_CONTAINER
-       container_info_t* container_info = __get_container_info(instance_id);
-       if (container_info == NULL) {
-               debug_error("error getting container info!!!");
-               return NULL;
-       }
-
-       if (instance_id == container_info->pid) {
-               debug_error ("This might be in the HOST(%s)[%d], let's form normal path",
-                                       container_info->name, instance_id);
-               path = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle);
-       } else {
-               path = g_strdup_printf("/var/lib/lxc/%s/rootfs/tmp/ASM.%d.%d",
-                                                               container_info->name, container_info->pid, handle);
-       }
-#else
-       path = g_strdup_printf("/tmp/ASM.%d.%d", instance_id, handle);
-#endif
-       if (path && postfix) {
-               path2 = g_strconcat(path, postfix, NULL);
-               g_free(path);
-               path = path2;
-       }
-
-       return path;
-}
-
-/* callback without retcb */
-void __do_callback_wo_retcb(int instance_id,int handle,int command)
-{
-       int fd_ASM = -1, cur_handle = 0;
-       char *filename = __get_asm_pipe_path(instance_id, handle, NULL);
-
-       if ((fd_ASM = open(filename,O_WRONLY|O_NONBLOCK)) < 0) {
-               debug_log("[CallCB] %s open error",filename);
-               g_free(filename);
-               return;
-       }
-       cur_handle = (unsigned int)(handle |(command << 4));
-       if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) {
-               debug_log("[CallCB] %s write error",filename);
-               g_free(filename);
-               if (fd_ASM != -1) {
-                       close(fd_ASM);
-               }
-               return;
-       }
-       close(fd_ASM);
-       g_free(filename);
-       ___select_sleep(2); /* if return immediately bad sound occur */
-}
-
-int __do_callback(int instance_id, int handle, int command, ASM_event_sources_t event_src)
-{
-       char *filename = NULL;
-       char *filename2 = NULL;
-       struct timeval time;
-       int starttime = 0;
-       int endtime = 0;
-       int fd=-1;
-       int fd_ASM = -1, cur_handle = 0;
-       int buf = 0;
-       struct pollfd pfd;
-       int pret = 0;
-       int pollingTimeout = 2500; /* NOTE : This is temporary code, because of Deadlock issues. If you fix that issue, remove this comment */
-
-       debug_log(" __do_callback for pid(%d) handle(%d)\n", instance_id, handle);
-
-       /* Set start time */
-       gettimeofday(&time, NULL);
-       starttime = time.tv_sec * 1000000 + time.tv_usec;
-
-       /**************************************
-        *
-        * Open callback cmd pipe
-        *
-        **************************************/
-       filename = __get_asm_pipe_path(instance_id, handle, NULL);
-       if ((fd_ASM = open(filename, O_WRONLY|O_NONBLOCK)) < 0) {
-               debug_error("[CallCB] %s open error\n", filename);
-               goto fail;
-       }
-
-       /******************************************
-        *
-        * Open callback result pipe
-        * before writing callback cmd to pipe
-        *
-        ******************************************/
-       filename2 = __get_asm_pipe_path(instance_id, handle, "r");
-       if ((fd=open(filename2,O_RDONLY|O_NONBLOCK))== -1) {
-               char str_error[256];
-               strerror_r (errno, str_error, sizeof(str_error));
-               debug_error("[RETCB] Fail to open fifo (%s)\n", str_error);
-               goto fail;
-       }
-       debug_log(" open return cb %s\n", filename2);
-       g_free (filename2);
-       filename2 = NULL;
-
-       /*******************************************
-        * Write Callback msg
-        *******************************************/
-       cur_handle = (unsigned int)((0x0000ffff & handle) |(command << 16) | (event_src << 24));
-       if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) {
-               debug_error("[CallCB] %s write error\n", filename);
-               goto fail;
-       }
-       /**************************************
-        *
-        * Close callback cmd pipe
-        *
-        **************************************/
-       if (fd_ASM != -1) {
-               close(fd_ASM);
-               fd_ASM = -1;
-       }
-       g_free(filename);
-       filename = NULL;
-
-       /* Check if do not need to wait for client return */
-       if (command == ASM_COMMAND_RESUME) {
-               debug_log("[RETCB] No need to wait return from client. \n");
-               if (fd != -1) {
-                       close (fd);
-                       fd = -1;
-               }
-               return ASM_CB_RES_NONE;
-       }
-
-       pfd.fd = fd;
-       pfd.events = POLLIN;
-
-       /*********************************************
-        *
-        * Wait callback result msg
-        *
-        ********************************************/
-       debug_log("[RETCB]wait callback(tid=%d, handle=%d, cmd=%d, timeout=%d)\n", instance_id, handle, command, pollingTimeout);
-       pret = poll(&pfd, 1, pollingTimeout); //timeout 7sec
-       if (pret < 0) {
-               debug_error("[RETCB]poll failed (%d)\n", pret);
-               goto fail;
-       }
-       if (pfd.revents & POLLIN) {
-               if (read(fd, (void *)&buf, sizeof(buf)) == -1) {
-                       debug_error("read error\n");
-                       goto fail;
-               }
-       }
-
-       /* Calculate endtime and display*/
-       gettimeofday(&time, NULL);
-       endtime = time.tv_sec * 1000000 + time.tv_usec;
-       debug_log("[RETCB] ASM_CB_END cbtimelab=%3.3f(second), timeout=%d(milli second) (reciever=%d)\n", ((endtime-starttime)/1000000.), pollingTimeout, instance_id);
-
-       /**************************************
-        *
-        * Close callback result pipe
-        *
-        **************************************/
-       if (fd != -1) {
-               close(fd);
-               fd = -1;
-       }
-       debug_log("[RETCB] Return value 0x%x\n", buf);
-       return buf;
-
-fail:
-       if (filename) {
-               g_free (filename);
-               filename = NULL;
-       }
-       if (filename2) {
-               g_free (filename2);
-               filename2 = NULL;
-       }
-       if (fd_ASM != -1) {
-               close(fd_ASM);
-               fd_ASM = -1;
-       }
-       if (fd != -1) {
-               close (fd);
-               fd = -1;
-       }
-
-       return -1;
-}
-
-gboolean __is_it_redundant_request(int instance_id, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       while (temp_list != NULL) {
-               if (temp_list->is_registered_for_watching) {
-                       if (temp_list->instance_id == instance_id && temp_list->sound_event == sound_event && temp_list->sound_state == sound_state) {
-                                       return TRUE;
-                       }
-               }
-               temp_list = temp_list->next;
-       }
-       return FALSE;
-}
-
-int __get_watcher_list (ASM_sound_events_t interest_sound_event, ASM_sound_states_t interest_sound_state, int *instance_id_list, int *handle_list)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int num = 0;
-
-       while (temp_list != NULL) {
-               if (temp_list->is_registered_for_watching) {
-                       if (temp_list->sound_event == interest_sound_event && temp_list->sound_state == interest_sound_state) {
-                               instance_id_list[num] = temp_list->instance_id;
-                               handle_list[num] = temp_list->sound_handle;
-                               num++;
-                               debug_warning(" found a watcher[pid:%d] for :: INTEREST event(%s) state(%s)", temp_list->instance_id, ASM_sound_event_str[interest_sound_event], ASM_sound_state_str[interest_sound_state]);
-                               if (__mm_sound_mgr_ipc_freeze_send(FREEZE_COMMAND_WAKEUP, temp_list->instance_id)) {
-                                       debug_warning("failed to send wake-up msg to the client pid(%d)",temp_list->instance_id);
-                               }
-                       }
-               }
-               if (num >= MAX_WATCH_CALLBACK_CALCUL_NUM) {
-                       debug_warning(" out of bound for checking registered watch handles, num(%d)");
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-
-       return num;
-}
-
-int __do_watch_callback(ASM_sound_events_t sound_event, ASM_sound_states_t updated_sound_state)
-{
-       char *filename = NULL;
-       char *filename2 = NULL;
-       struct timeval time;
-       int starttime = 0;
-       int endtime = 0;
-       int fd = -1;
-       int fd_ASM = -1;
-       int cur_handle = 0;
-       int buf = 0;
-       struct pollfd pfd;
-       int pret = 0;
-       int pollingTimeout = 1500; /* NOTE : This is temporary code, because of Deadlock issues. If you fix that issue, remove this comment */
-       int instance_id_list[MAX_WATCH_CALLBACK_CALCUL_NUM] = {0};
-       int handle_list[MAX_WATCH_CALLBACK_CALCUL_NUM] = {0};
-       int num = 0;
-
-       debug_fenter();
-
-       /* find candidates' instance_id and handle for providing session-changed notification, get number of candidates */
-       num = __get_watcher_list (sound_event, updated_sound_state, instance_id_list, handle_list);
-
-       while (num--) {
-
-               debug_log(" pid(%d), handle(%d), sound_event(%d), sound_state(%d)\n", instance_id_list[num], handle_list[num], sound_event, updated_sound_state);
-
-               /* Set start time */
-               gettimeofday(&time, NULL);
-               starttime = time.tv_sec * 1000000 + time.tv_usec;
-
-               /**************************************
-                *
-                * Open callback cmd pipe
-                *
-                **************************************/
-               filename = __get_asm_pipe_path(instance_id_list[num], handle_list[num], NULL);
-               if ((fd_ASM = open(filename, O_WRONLY|O_NONBLOCK)) < 0) {
-                       debug_error("[CallCB] %s open error\n", filename);
-                       goto fail;
-               }
-
-               /******************************************
-                *
-                * Open callback result pipe
-                * before writing callback cmd to pipe
-                *
-                ******************************************/
-               filename2 = __get_asm_pipe_path(instance_id_list[num], handle_list[num], "r");
-               if ((fd=open(filename2,O_RDONLY|O_NONBLOCK))== -1) {
-                       char str_error[256];
-                       strerror_r (errno, str_error, sizeof(str_error));
-                       debug_error("[RETCB] Fail to open fifo (%s)\n", str_error);
-                       goto fail;
-               }
-               debug_log(" open return cb %s\n", filename2);
-
-
-               /*******************************************
-                * Write Callback msg
-                *******************************************/
-               //cur_handle = (unsigned int)((0x0000ffff & handle_list[num]));
-               cur_handle = (unsigned int)((0x0000ffff & handle_list[num]) | (sound_event << 16) | (updated_sound_state << 24));
-               if (write(fd_ASM, (void *)&cur_handle, sizeof(cur_handle)) < 0) {
-                       debug_error("[CallCB] %s write error\n", filename);
-                       goto fail;
-               }
-               /**************************************
-                *
-                * Close callback cmd pipe
-                *
-                **************************************/
-               if (fd_ASM != -1) {
-                       close(fd_ASM);
-                       fd_ASM = -1;
-               }
-               g_free(filename);
-               filename = NULL;
-
-               pfd.fd = fd;
-               pfd.events = POLLIN;
-
-               /*********************************************
-                *
-                * Wait callback result msg
-                *
-                ********************************************/
-               debug_log("[RETCB]wait callback(tid=%d, handle=%d, timeout=%d)\n",
-                                       instance_id_list[num], handle_list[num], pollingTimeout);
-               pret = poll(&pfd, 1, pollingTimeout); //timeout 7sec
-               if (pret < 0) {
-                       debug_error("[RETCB]poll failed (%d)\n", pret);
-                       goto fail;
-               }
-               if (pfd.revents & POLLIN) {
-                       if (read(fd, (void *)&buf, sizeof(buf)) == -1) {
-                               debug_error("read error\n");
-                               goto fail;
-                       }
-               }
-               g_free(filename2);
-               filename2 = NULL;
-
-               /* Calculate endtime and display*/
-               gettimeofday(&time, NULL);
-               endtime = time.tv_sec * 1000000 + time.tv_usec;
-               debug_log("[RETCB] ASM_CB_END cbtimelab=%3.3f(second), timeout=%d(milli second) (reciever=%d)\n",
-                                       ((endtime-starttime)/1000000.), pollingTimeout, instance_id_list[num]);
-
-               /**************************************
-                *
-                * Close callback result pipe
-                *
-                **************************************/
-               if (fd != -1) {
-                       close(fd);
-                       fd = -1;
-               }
-               debug_log("[RETCB] Return value 0x%x\n", buf);
-               //return buf;
-
-       }
-
-       debug_fleave();
-
-       return 0;
-
-fail:
-       if (filename) {
-               g_free (filename);
-               filename = NULL;
-       }
-       if (filename2) {
-               g_free (filename2);
-               filename2 = NULL;
-       }
-       if (fd_ASM != -1) {
-               close(fd_ASM);
-               fd_ASM = -1;
-       }
-       if (fd != -1) {
-               close (fd);
-               fd = -1;
-       }
-
-       return -1;
-}
-
-gboolean __is_it_playing_now(int instance_id, int handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
-                       if (temp_list->sound_state == ASM_STATE_PLAYING) {
-                               return TRUE;
-                       }
-               }
-
-               temp_list = temp_list->next;
-       }
-       return FALSE;
-}
-
-void __temp_print_list(char * msg)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int i = 0;
-
-       if (NULL != msg) {
-               debug_warning(" => MSG: %s\n", msg);
-       }
-       while (temp_list != NULL) {
-               if (!temp_list->is_registered_for_watching) {
-#ifdef SUPPORT_CONTAINER
-                       if (!ASM_IS_ADVANCED_ASM_EVENT(temp_list->sound_event)) {
-                               debug_msg(" List[%02d] ( %10s, %5d(%5d), %2d, %-22s, %-15s, %9s checked by%5d/%d, 0x%04x, 0x%04x)\n" , i,
-                                                                                               temp_list->container.name,
-                                                                                               temp_list->instance_id, temp_list->container.pid, temp_list->sound_handle,
-                                                                                               ASM_sound_event_str[temp_list->sound_event],
-                                                                                               ASM_sound_state_str[temp_list->sound_state],
-                                                                                               ASM_sound_resume_str[temp_list->need_resume],
-                                                                                               temp_list->paused_by_id.pid,
-                                                                                               temp_list->paused_by_id.sound_handle,
-                                                                                               temp_list->mm_resource,
-                                                                                               temp_list->option_flags);
-                       } else {
-                               debug_msg(" List[%02d] ( %10s, %5d(%5d), %2d, %-22s, %-15s, %-15s, 0x%04x)\n", i,
-                                                                                               temp_list->container.name,
-                                                                                               temp_list->instance_id, temp_list->container.pid,
-                                                                                               temp_list->sound_handle,
-                                                                                               ASM_sound_event_str[temp_list->sound_event],
-                                                                                               ASM_sound_state_str[temp_list->sound_state],
-                                                                                               ASM_sound_sub_event_str[temp_list->sound_sub_event],
-                                                                                               temp_list->mm_resource);
-                       }
-#else
-                       if (!ASM_IS_ADVANCED_ASM_EVENT(temp_list->sound_event)) {
-                               debug_msg(" List[%02d] ( %5d, %2d, %-22s, %-15s, %9s checked by%5d/%d, 0x%04x, 0x%04x)\n" , i,
-                                                                                               temp_list->instance_id, temp_list->sound_handle,
-                                                                                               ASM_sound_event_str[temp_list->sound_event],
-                                                                                               ASM_sound_state_str[temp_list->sound_state],
-                                                                                               ASM_sound_resume_str[temp_list->need_resume],
-                                                                                               temp_list->paused_by_id.pid,
-                                                                                               temp_list->paused_by_id.sound_handle,
-                                                                                               temp_list->mm_resource,
-                                                                                               temp_list->option_flags);
-                       } else {
-                               debug_msg(" List[%02d] ( %5d, %2d, %-22s, %-15s, %-15s, 0x%04x)\n", i,
-                                                                                               temp_list->instance_id,
-                                                                                               temp_list->sound_handle,
-                                                                                               ASM_sound_event_str[temp_list->sound_event],
-                                                                                               ASM_sound_state_str[temp_list->sound_state],
-                                                                                               ASM_sound_sub_event_str[temp_list->sound_sub_event],
-                                                                                               temp_list->mm_resource);
-                       }
-#endif
-                       i++;
-               }
-               temp_list = temp_list->next;
-       }
-       temp_list = head_list_ptr;
-       debug_log(" listed below are requests for watching session\n");
-       while (temp_list != NULL) {
-               if (temp_list->is_registered_for_watching) {
-#ifdef SUPPORT_CONTAINER
-                       debug_msg(" List[%02d] ( %10s, %5d(%5d), %2d, %-22s, %-15s, %5s)\n", i, temp_list->container.name,
-                                                                                               temp_list->instance_id, temp_list->container.pid, temp_list->sound_handle,
-                                                                                               ASM_sound_event_str[temp_list->sound_event],
-                                                                                               ASM_sound_state_str[temp_list->sound_state],
-                                                                                               "WATCHING");
-#else
-                       debug_msg(" List[%02d] ( %5d, %2d, %-22s, %-15s, %5s)\n", i, temp_list->instance_id, temp_list->sound_handle,
-                                                                                               ASM_sound_event_str[temp_list->sound_event],
-                                                                                               ASM_sound_state_str[temp_list->sound_state],
-                                                                                               "WATCHING");
-#endif
-                       i++;
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-void ___update_phone_status()
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int error = 0;
-
-       g_sound_status_pause = 0;
-       g_sound_status_playing = 0;
-       g_sound_status_waiting = 0;
-
-       while (temp_list != NULL) {
-               if (!temp_list->is_registered_for_watching) {
-                       if (temp_list->sound_state == ASM_STATE_PLAYING) {
-                               if (temp_list->sound_event >= ASM_EVENT_MEDIA_MMPLAYER && temp_list->sound_event  < ASM_EVENT_MAX) {
-                                       g_sound_status_playing |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status;
-                               }
-                       } else if (temp_list->sound_state == ASM_STATE_PAUSE ) {
-                               if (temp_list->sound_event >= ASM_EVENT_MEDIA_MMPLAYER && temp_list->sound_event < ASM_EVENT_MAX) {
-                                       g_sound_status_pause |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status;
-                               }
-                       } else if (temp_list->sound_state == ASM_STATE_WAITING ) {
-                               if (temp_list->sound_event >= ASM_EVENT_MEDIA_MMPLAYER && temp_list->sound_event < ASM_EVENT_MAX) {
-                                       g_sound_status_waiting |= ASM_sound_type[(temp_list->sound_event) + 1].sound_status;
-                               }
-                       }
-               }
-               temp_list = temp_list->next;
-       }
-
-       if ((error = vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing))) {
-               debug_error("[ASM_Server[Error = %d][1st try] phonestatus_set \n", error);
-               if ((error = vconf_set_int(SOUND_STATUS_KEY, g_sound_status_playing))) {
-                       debug_error("[Error = %d][2nd try]  phonestatus_set \n", error);
-               }
-       }
-
-       //debug_log(" soundstatus : playing(0x%08x), pause(0x%08x), waiting(0x%08x)\n", g_sound_status_playing, g_sound_status_pause, g_sound_status_waiting);
-}
-
-asm_instance_list_t* __asm_register_list(int instance_id, int handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource, bool is_requested_for_watching)
-{
-       asm_instance_list_t *temp_list;
-       temp_list = (asm_instance_list_t *)malloc(sizeof(asm_instance_list_t));
-       if (!temp_list) {
-               debug_error("could not allocate memory for asm_instance_list_t\n");
-               return NULL;
-       }
-       temp_list->instance_id = instance_id;
-       temp_list->sound_handle = handle;
-       temp_list->sound_event = sound_event;
-       temp_list->sound_sub_event = ASM_SUB_EVENT_NONE;
-       temp_list->sound_state = sound_state;
-       temp_list->need_resume = 0;
-       temp_list->mm_resource = mm_resource;
-       temp_list->option_flags = 0;
-       temp_list->paused_by_id.pid = 0;
-       temp_list->paused_by_id.sound_handle = ASM_HANDLE_INIT_VAL;
-       temp_list->paused_by_id.eventsrc = ASM_EVENT_SOURCE_MEDIA;
-       temp_list->monitor_active = 0;
-       temp_list->monitor_dirty = 0;
-       temp_list->is_registered_for_watching = is_requested_for_watching;
-#ifdef SUPPORT_CONTAINER
-       memset (&temp_list->container, 0, sizeof (container_info_t));
-       strcpy (temp_list->container.name, "NONAME");
-       temp_list->container.pid = instance_id;
-#endif
-
-       temp_list->next = head_list_ptr;
-       head_list_ptr = temp_list;
-       if (tail_list_ptr == NULL) {
-               tail_list_ptr = temp_list;
-               debug_warning("tail_list_ptr is null, this is the first entry");
-       }
-
-       __temp_print_list("Register List");
-       ___update_phone_status();
-
-       return temp_list;
-}
-
-int __asm_unregister_list(int handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       asm_instance_list_t *temp_list_prev = head_list_ptr;
-       int instance_id = ASM_HANDLE_INIT_VAL;
-
-       debug_log(" __asm_unregister_list \n");
-
-       while (temp_list != NULL) {
-               if (temp_list->sound_handle == handle) {
-                       instance_id = temp_list->instance_id;
-                       g_handle_info[temp_list->sound_handle].is_registered = 0;
-                       g_handle_info[temp_list->sound_handle].option_flags = 0;
-                       g_handle_info[temp_list->sound_handle].resource = 0;
-                       if (temp_list == head_list_ptr) {
-                               head_list_ptr = temp_list->next;
-                       } else {
-                               temp_list_prev->next = temp_list->next;
-                       }
-                       if (temp_list == tail_list_ptr) {
-                               if (head_list_ptr == NULL) {
-                                       tail_list_ptr = NULL;
-                                       debug_warning (" this entry is the last one, set tail_list_ptr to NULL");
-                               } else {
-                                       tail_list_ptr = temp_list_prev;
-                                       debug_warning (" this entry is the last of this list, set tail_list_ptr to temp_list_prev");
-                               }
-                       }
-                       free(temp_list);
-                       break;
-               }
-               temp_list_prev = temp_list;
-               temp_list = temp_list->next;
-       }
-
-       __temp_print_list("Unregister List for handle");
-       ___update_phone_status();
-       return instance_id;
-}
-
-/* -------------------------
- *
- */
-static void __check_dead_process()
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       asm_instance_list_t *temp_list_prev = head_list_ptr;
-       while (temp_list != NULL) {
-               if (!mm_sound_util_is_process_alive(temp_list->instance_id)) {
-                       debug_warning(" PID(%d) not exist! -> ASM_Server resource of pid(%d) will be cleared \n", temp_list->instance_id, temp_list->instance_id);
-                       g_handle_info[temp_list->sound_handle].is_registered = 0;
-                       g_handle_info[temp_list->sound_handle].option_flags = 0;
-                       g_handle_info[temp_list->sound_handle].resource = 0;
-                       if (temp_list == head_list_ptr) {
-                               head_list_ptr = temp_list->next;
-                               temp_list_prev = head_list_ptr;
-                               free(temp_list);
-                               temp_list = temp_list_prev;
-                               if (head_list_ptr == NULL) {
-                                       tail_list_ptr = NULL;
-                               }
-                       } else {
-                               temp_list_prev->next = temp_list->next;
-                               if (temp_list->next == NULL) {
-                                       tail_list_ptr = temp_list_prev;
-                               }
-                               free(temp_list);
-                               temp_list = temp_list_prev->next;
-                       }
-               } else {
-                       if (temp_list->paused_by_id.pid) {
-                               if (!mm_sound_util_is_process_alive(temp_list->paused_by_id.pid)) {
-                                       temp_list->need_resume = ASM_NEED_NOT_RESUME;
-                                       temp_list->paused_by_id.pid = 0;
-                                       temp_list->paused_by_id.sound_handle = ASM_HANDLE_INIT_VAL;
-                                       temp_list->paused_by_id.eventsrc = ASM_EVENT_SOURCE_MEDIA;
-                               }
-                       }
-                       temp_list_prev = temp_list;
-                       temp_list = temp_list->next;
-               }
-       }
-       ___update_phone_status();
-}
-
-void __reset_resume_check(int instance_id, int handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       while (temp_list != NULL) {
-               if (handle == ASM_HANDLE_INIT_VAL) {
-                       if (temp_list->instance_id == instance_id && temp_list->paused_by_id.pid) {
-                               temp_list->need_resume = ASM_NEED_NOT_RESUME;
-                               temp_list->paused_by_id.pid = 0;
-                               temp_list->paused_by_id.sound_handle = ASM_HANDLE_INIT_VAL;
-                               temp_list->paused_by_id.eventsrc = ASM_EVENT_SOURCE_MEDIA;
-                       }
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-static void __emergent_exit(int exit_pid)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int handle = ASM_HANDLE_INIT_VAL;
-       int instance_id = -1;
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == exit_pid) {
-                       handle = temp_list->sound_handle;
-                       if (temp_list->instance_id != -1) {
-                               char str_error[256];
-                               char* filename = __get_asm_pipe_path(temp_list->instance_id, handle, NULL);
-                               char* filename2 = __get_asm_pipe_path(temp_list->instance_id, handle, "r");
-                               if (!remove(filename)) {
-                                       debug_log(" remove %s success\n", filename);
-                               } else {
-                                       strerror_r (errno, str_error, sizeof (str_error));
-                                       debug_error(" remove %s failed with %s\n", filename, str_error);
-                               }
-
-                               if (!remove(filename2)) {
-                                       debug_log(" remove %s success\n", filename2);
-                               } else {
-                                       strerror_r (errno, str_error, sizeof (str_error));
-                                       debug_error(" remove %s failed with %s\n", filename2, str_error);
-                               }
-
-                               g_free(filename);
-                               g_free(filename2);
-                       }
-                       instance_id = __asm_unregister_list(handle);
-                       temp_list = head_list_ptr;
-               } else {
-                       temp_list = temp_list->next;
-               }
-       }
-
-       debug_warning("[EMERGENT_EXIT] complete\n");
-       return;
-}
-
-int ___reorder_state(ASM_sound_states_t input)
-{
-       int res = 0;
-
-       switch (input) {
-       case ASM_STATE_NONE:
-               res = 0;
-               break;
-       case ASM_STATE_WAITING:
-       case ASM_STATE_STOP:
-               res = 1;
-               break;
-       case ASM_STATE_PAUSE:
-               res = 2;
-               break;
-       case ASM_STATE_PLAYING:
-               res = 3;
-               break;
-       }
-       return res;
-}
-
-ASM_sound_states_t __asm_find_process_status(int pid)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       ASM_sound_states_t result_state = ASM_STATE_NONE;
-
-       debug_log(" __asm_find_process_status for pid %d\n", pid);
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == pid && !temp_list->is_registered_for_watching) {
-                       if ( ___reorder_state(temp_list->sound_state) >= ___reorder_state(result_state)) {
-                               result_state = temp_list->sound_state;
-                       }
-               }
-               temp_list = temp_list->next;
-       }
-
-       return result_state;
-}
-
-asm_instance_list_t* __asm_find_list(int handle)
-{
-       asm_instance_list_t* temp_list = head_list_ptr;
-
-       debug_fenter();
-
-       while (temp_list != NULL) {
-               if (temp_list->sound_handle == handle) {
-                       debug_fleave();
-                       return temp_list;
-               } else {
-                       temp_list = temp_list->next;
-               }
-       }
-
-       debug_warning("could not find handle for handle id(%d)", handle);
-
-       return NULL;
-}
-
-ASM_sound_states_t __asm_find_state_of_handle(int handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       debug_fenter();
-
-       while (temp_list != NULL) {
-               if (temp_list->sound_handle == handle) {
-                       return temp_list->sound_state;
-               }
-               temp_list = temp_list->next;
-       }
-
-       debug_fleave();
-
-       return ASM_STATE_NONE;
-}
-
-ASM_sound_events_t __asm_find_event_of_handle(int instance_id, int handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       debug_fenter();
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
-                       return temp_list->sound_event;
-               }
-               temp_list = temp_list->next;
-       }
-
-       debug_fleave();
-
-       return ASM_EVENT_NONE;
-}
-
-int __asm_find_pid_of_resume_tagged(int paused_by_handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-
-       debug_fenter();
-
-       while (temp_list != NULL) {
-               if (temp_list->need_resume == ASM_NEED_RESUME && temp_list->paused_by_id.sound_handle == paused_by_handle) {
-                       return temp_list->instance_id;
-               }
-               temp_list = temp_list->next;
-       }
-
-       debug_fleave();
-
-       return -1;
-}
-
-asm_instance_list_t* __asm_change_state_list(int instance_id, int handle, ASM_sound_states_t sound_state, ASM_resource_t mm_resource)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       debug_log(" __asm_change_state_list\n");
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
-                       temp_list->prev_sound_state = temp_list->sound_state;
-                       temp_list->sound_state = sound_state;
-                       temp_list->mm_resource = mm_resource;
-                       __update_monitor_active(instance_id);
-                       ___update_phone_status();
-                       return temp_list;
-               }
-               temp_list = temp_list->next;
-       }
-
-       debug_warning("could not find handle for pid(%d), handle(%d)", instance_id, handle);
-
-       return NULL;
-}
-
-void __asm_change_sub_event_list(int instance_id, int handle, ASM_sound_sub_events_t sub_event)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       debug_log("[ASM_Server] __asm_change_sub_event_list\n");
-
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
-                       temp_list->sound_sub_event = sub_event;
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-void __asm_change_need_resume_list(int instance_id, int handle, ASM_resume_states_t need_resume, int paused_by_pid, int paused_by_sound_handle, ASM_event_sources_t paused_by_eventsrc)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       debug_log(" __asm_change_need_resume_list\n");
-       while (temp_list != NULL) {
-               if (temp_list->instance_id == instance_id && temp_list->sound_handle == handle) {
-                       temp_list->need_resume = need_resume;
-                       temp_list->paused_by_id.pid = paused_by_pid;
-                       temp_list->paused_by_id.sound_handle = paused_by_sound_handle;
-                       temp_list->paused_by_id.eventsrc = paused_by_eventsrc;
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-}
-
-void __asm_get_empty_handle(int instance_id, int *handle)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       unsigned int i = 0, find_empty = 0;
-
-       debug_log(" __asm_make_handle for %d\n", instance_id);
-       //__temp_print_list("current list before get new handle");
-
-       while (temp_list != NULL) {
-               g_handle_info[temp_list->sound_handle].is_registered = 1;
-               temp_list = temp_list->next;
-       }
-
-       for (i = 0; i < ASM_SERVER_HANDLE_MAX; i++) {
-               if (g_handle_info[i].is_registered == 0) {
-                       find_empty = 1;
-                       break;
-               }
-       }
-       if (find_empty && (i != ASM_SERVER_HANDLE_MAX)) {
-               debug_log(" New handle for %d is %d\n", instance_id, i);
-               *handle = i;
-               g_handle_info[i].is_registered = 1;
-       } else {
-               debug_error(" Handle is full for pid %d\n", instance_id);
-               *handle = ASM_HANDLE_INIT_VAL;
-       }
-}
-
-void __print_resource(unsigned short resource_status)
-{
-       if (resource_status == ASM_RESOURCE_NONE)
-               debug_warning(" resource NONE\n");
-       if (resource_status & ASM_RESOURCE_CAMERA)
-               debug_warning(" resource CAMERA\n");
-       if (resource_status & ASM_RESOURCE_VIDEO_OVERLAY)
-               debug_warning(" resource VIDEO OVERLAY\n");
-       if (resource_status & ASM_RESOURCE_STREAMING)
-               debug_warning(" resource STREAMING\n");
-       if (resource_status & ASM_RESOURCE_HW_ENCODER)
-               debug_warning(" resource HW ENCODER\n");
-       if (resource_status & ASM_RESOURCE_HW_DECODER)
-               debug_warning(" resource HW DECODER\n");
-       if (resource_status & ASM_RESOURCE_RADIO_TUNNER)
-               debug_warning(" resource RADIO TUNNER\n");
-       if (resource_status & ASM_RESOURCE_TV_TUNNER)
-               debug_warning(" resource TV TUNNER\n");
-       if (resource_status & ASM_RESOURCE_VOICECONTROL)
-               debug_warning(" resource for VOICECONTROL\n");
-}
-
-gboolean __need_to_compare_again(ASM_sound_events_t current_playing_event, int current_playing_handle, ASM_sound_events_t incoming_playing_event, int incoming_playing_handle, int *sound_case, int *blocked_reason)
-{
-       *blocked_reason = ERR_ASM_ERROR_NONE;
-
-       switch(*sound_case) {
-       case ASM_CASE_1PLAY_2STOP:
-               break;
-       case ASM_CASE_1STOP_2PLAY:
-               break;
-       case ASM_CASE_1PAUSE_2PLAY:
-       {
-               int ret = MM_ERROR_NONE;
-               bool available = false;
-
-               if (incoming_playing_event == ASM_EVENT_NOTIFY && (mm_sound_util_is_recording() || mm_sound_util_is_mute_policy()) ) {
-//                     ret = MMSoundMgrSessionIsDeviceAvailable (device_out_wired_accessory, device_in, &available);
-                       if (ret) {
-                               debug_error("Failed to IsDeviceAvailable()\n");
-                       } else {
-                               /* if current playing event is NOTIFY with external device out, then we're going to jump to 1STOP_2PLAY */
-                               if (!available) {
-                                       debug_warning("EXCEPTION case in 1PAUSE_2PLAY => go to 1PLAY_2STOP\n");
-                                       *sound_case = ASM_CASE_1PLAY_2STOP;
-                                       *blocked_reason = ERR_ASM_POLICY_CANNOT_PLAY_BY_PROFILE; /* check this value to let client know via message */
-                                       return TRUE;
-                               }
-                       }
-               }
-       }
-               break;
-       case ASM_CASE_1PLAY_2PLAY_MIX:
-       {
-               int ret = MM_ERROR_NONE;
-               mm_sound_device_out device_out = MM_SOUND_DEVICE_OUT_NONE;
-
-               if (__is_media_session(current_playing_event) && __is_media_session(incoming_playing_event)) {
-                       if ((!(g_handle_info[current_playing_handle].option_flags & ASM_SESSION_OPTION_UNINTERRUPTIBLE)) &&
-                               (g_handle_info[incoming_playing_handle].option_flags & ASM_SESSION_OPTION_PAUSE_OTHERS)) {
-                               *sound_case = ASM_CASE_1PAUSE_2PLAY;
-                               return TRUE;
-                       }
-               } else if (current_playing_event == ASM_EVENT_NOTIFY &&
-                       (incoming_playing_event != ASM_EVENT_EARJACK_UNPLUG && __is_session_using_media_volume(incoming_playing_event))) {
-//                     ret = MMSoundMgrSessionGetDeviceActive(&device_out, &device_in);
-                       if (ret) {
-                               debug_error("Failed to GetDeviceActive()\n");
-                       } else {
-                               /* if current playing event is NOTIFY with external device out, then we're going to jump to 1STOP_2PLAY */
-                               if (device_out == MM_SOUND_DEVICE_OUT_HDMI ||
-                                       device_out == MM_SOUND_DEVICE_OUT_MIRRORING ||
-                                       device_out == MM_SOUND_DEVICE_OUT_USB_AUDIO ||
-                                       device_out == MM_SOUND_DEVICE_OUT_MULTIMEDIA_DOCK) {
-                                       debug_warning("EXCEPTION case for external device in 1PLAY_2PLAY_MIX => go to 1STOP_2PLAY\n");
-                                       *sound_case = ASM_CASE_1STOP_2PLAY;
-                                       *blocked_reason = ERR_ASM_POLICY_CANNOT_PLAY_BY_CUSTOM;
-                                       return TRUE;
-                               }
-                       }
-               } else if (current_playing_event == ASM_EVENT_ALARM && incoming_playing_event == ASM_EVENT_NOTIFY) {
-                       if ((mm_sound_util_is_recording() || mm_sound_util_is_mute_policy())) {
-                               debug_warning("EXCEPTION case for notification on alarm in 1PAUSE_2PLAY => go to 1PLAY_2STOP\n");
-                               *sound_case = ASM_CASE_1PLAY_2STOP;
-                               *blocked_reason = ERR_ASM_POLICY_CANNOT_PLAY_BY_PROFILE;
-                               return TRUE;
-                       }
-               } else if ((current_playing_event == ASM_EVENT_MMCAMCORDER_VIDEO) && (incoming_playing_event == ASM_EVENT_MEDIA_MMPLAYER)) {
-                       if ((g_handle_info[incoming_playing_handle].option_flags & ASM_SESSION_OPTION_PAUSE_OTHERS) &&
-                               (g_handle_info[incoming_playing_handle].resource & ASM_RESOURCE_HW_DECODER))    {
-                               debug_warning("EXCEPTION case for current MMCAMCORDER_VIDEO / incoming MEDIA_MMPLAYER(PAUSE_OTHERS with HW_DECODER resource)\n");
-                               *sound_case = ASM_CASE_1PAUSE_2PLAY;
-                               return TRUE;
-                       }
-               }
-
-#if 0 /*as new UX defined camera can be launch during call*/
-               else if (current_playing_event == ASM_EVENT_CALL && incoming_playing_event == ASM_EVENT_MMCAMCORDER_VIDEO) {
-                       int shutter_policy_state = 0;
-                       vconf_get_int(VCONFKEY_CAMERA_SHUTTER_SOUND_POLICY, &shutter_policy_state);
-                       if (shutter_policy_state == 1) {
-                               debug_warning("EXCEPTION case for shutter policy in 1PLAY_2PLAY_MIX => go to 1PLAY_2STOP\n");
-                               *sound_case = ASM_CASE_1PLAY_2STOP;
-                               *blocked_reason = ERR_ASM_POLICY_CANNOT_PLAY_BY_CUSTOM;
-                               return TRUE;
-                       }
-               }
-#endif
-       }
-               break;
-       default:
-               break;
-       }
-       debug_log("no need to compare again, sound_case:%d, event_type:current(%d), incoming(%d)\n", *sound_case, current_playing_event, incoming_playing_event);
-       return FALSE;
-}
-
-asm_compare_result_t __asm_compare_priority_matrix(ASM_msg_asm_to_lib_t *asm_snd_msg, ASM_msg_asm_to_lib_t *asm_ret_msg,
-                                                               int instance_id, int handle, ASM_requests_t request_id,
-                                                               ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource)
-{
-       int no_conflict_flag = 0;
-       asm_instance_list_t *incoming_list = NULL;
-       asm_compare_result_t compare_result;
-       memset(&compare_result, 0, sizeof(asm_compare_result_t));
-
-       debug_log(" ENTER >>>>>> \n");
-
-       g_handle_info[handle].resource = mm_resource;
-
-       /* If nobody is playing and waiting now, this means no conflict */
-       if (ASM_STATUS_NONE == g_sound_status_playing && ASM_STATUS_NONE == g_sound_status_waiting) {
-               debug_log(" No conflict ( No existing Sound )\n");
-
-               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_NONE, sound_state);
-
-               no_conflict_flag = 1;
-       } else { /* Somebody is playing */
-               asm_instance_list_t *temp_list = head_list_ptr;
-               int is_already_updated = 0;
-               int cb_res = 0;
-               int update_state = ASM_STATE_NONE;
-               ASM_sound_sub_events_t incoming_sound_sub_event = sound_event;
-
-               while (temp_list != NULL) {
-
-                       /* Find who's playing now (include waiting state) */
-                       if ((temp_list->sound_state != ASM_STATE_PLAYING && temp_list->sound_state != ASM_STATE_WAITING)
-                                       || temp_list->is_registered_for_watching) {
-                               temp_list = temp_list->next;
-                               continue;
-                       }
-
-                       debug_warning("( %5d, %2d, %-20s, %-20s, %9s, 0x%04x) ..... [%s]\n",
-                                       temp_list->instance_id, temp_list->sound_handle,
-                                       ASM_sound_event_str[temp_list->sound_event],
-                                       ASM_sound_state_str[temp_list->sound_state],
-                                       ASM_sound_resume_str[temp_list->need_resume],
-                                       temp_list->mm_resource,
-                                       (temp_list->sound_state != ASM_STATE_PLAYING)? "PASS" : "CHECK");
-
-
-                       /* Found it */
-                       ASM_sound_states_t current_playing_state = temp_list->sound_state;
-                       ASM_sound_events_t current_playing_sound_event = temp_list->sound_event;
-                       int current_playing_instance_id = temp_list->instance_id;
-                       int current_playing_handle = temp_list->sound_handle;
-                       ASM_resource_t current_using_resource = temp_list->mm_resource;
-
-                       if ((current_playing_instance_id == instance_id) && (current_playing_handle == handle)) {
-                               debug_warning(" This is my handle. skip %d %d\n", instance_id, handle);
-                               temp_list = temp_list->next;
-                               if (current_playing_state != sound_state) {
-                                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                               }
-                               continue;
-                       }
-
-                       /* Request is PLAYING */
-                       if (sound_state == ASM_STATE_PLAYING) {
-                               ASM_sound_cases_t sound_case = ASM_CASE_NONE;
-                               ASM_sound_sub_events_t current_playing_sound_sub_event = ASM_SUB_EVENT_NONE;
-
-                               if (request_id ==  ASM_REQUEST_SET_SUBEVENT) {
-                                       int adv_asm_idx = 0;
-                                       int subtable_row_idx = 0;
-                                       int ret = MM_ERROR_NONE;
-                                       current_playing_sound_sub_event = temp_list->sound_sub_event;
-                                       /* Determine sound policy using SubTable */
-                                       ret = __get_sub_case_table_idx(current_playing_sound_event, &subtable_row_idx);
-                                       if (ret) {
-                                               temp_list = temp_list->next;
-                                               continue;
-                                       }
-
-                                       sound_event = __asm_find_event_of_handle(instance_id, handle);
-                                       ret = __get_adv_event_idx_for_subtable(sound_event, &adv_asm_idx);
-                                       if (ret) {
-                                               temp_list = temp_list->next;
-                                               continue;
-                                       }
-
-                                       sound_case = ASM_sound_case_sub[adv_asm_idx][incoming_sound_sub_event][subtable_row_idx];
-                                       if (sound_case == ASM_CASE_SUB_EVENT) {
-                                               switch (incoming_sound_sub_event) {
-                                                       case ASM_SUB_EVENT_NONE:
-                                                       case ASM_SUB_EVENT_SHARE:
-                                                               if (current_playing_sound_sub_event == ASM_SUB_EVENT_NONE ||
-                                                                       current_playing_sound_sub_event == ASM_SUB_EVENT_SHARE) {
-                                                                       sound_case = ASM_CASE_1PLAY_2PLAY_MIX;
-                                                               }
-                                                               break;
-                                                       case ASM_SUB_EVENT_EXCLUSIVE:
-                                                               sound_case = ASM_CASE_1STOP_2PLAY;
-                                                               break;
-                                                       default:
-                                                               sound_case = ASM_CASE_SUB_EVENT;
-                                                               debug_warning("incoming_sound_sub_event is not valid: %d", incoming_sound_sub_event);
-                                                               break;
-                                               }
-                                       }
-                                       debug_warning(" SubTable result:%s, sub-event:%s, adv. event type:%s",
-                                                       ASM_sound_case_str[sound_case], ASM_sound_sub_event_str[incoming_sound_sub_event+1], ASM_sound_event_str[sound_event]);
-                               } else {
-                                       /* Determine sound policy using MainTable */
-                                       sound_case = ASM_sound_case[current_playing_sound_event][sound_event];
-                               }
-
-                               debug_warning(" Conflict policy[0x%x][0x%x]: %s\n", current_playing_sound_event,sound_event,ASM_sound_case_str[sound_case]);
-CONFLICT_AGAIN:
-                               switch (sound_case) {
-                               case ASM_CASE_1PLAY_2STOP:
-                               {
-                                       if (current_playing_instance_id == instance_id) {
-                                               /* PID is policy group.*/
-                                               debug_log(" Do not send Stop callback in same pid %d\n", instance_id);
-
-                                               /* Prepare msg to send */
-                                               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_PLAY, sound_state);
-
-                                               if (!is_already_updated && request_id == ASM_REQUEST_REGISTER){
-                                                       __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                                       is_already_updated = 1;
-                                               } else {
-                                                       __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                               }
-                                               break;
-                                       } else {
-                                               switch(current_playing_sound_event) {
-                                               case ASM_EVENT_ALARM:
-                                                       debug_warning("blocked by ALARM");
-                                                       asm_snd_msg->data.error_code = ERR_ASM_POLICY_CANNOT_PLAY_BY_ALARM;
-                                                       break;
-                                               case ASM_EVENT_CALL:
-                                               case ASM_EVENT_VIDEOCALL:
-                                               case ASM_EVENT_VOIP:
-                                                       debug_warning("blocked by CALL/VIDEOCALL/VOIP");
-                                                       asm_snd_msg->data.error_code = ERR_ASM_POLICY_CANNOT_PLAY_BY_CALL;
-                                                       break;
-                                               default:
-                                                       debug_warning("blocked by Other(sound_event num:%d)", current_playing_sound_event);
-                                                       asm_snd_msg->data.error_code = ERR_ASM_POLICY_CANNOT_PLAY;
-                                                       break;
-                                               }
-                                               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_STOP, ASM_STATE_STOP);
-                                               temp_list = tail_list_ptr;      /* skip all remain list */
-                                               __asm_change_state_list(instance_id, handle, ASM_STATE_STOP, mm_resource);
-                                               break;
-                                       }
-                               }
-
-                               case ASM_CASE_1STOP_2PLAY:
-                               {
-                                       if (current_playing_instance_id == instance_id) {
-                                               /* PID is policy group. */
-                                               debug_warning(" Do not send Stop callback in same pid %d\n", instance_id);
-
-                                       } else {
-                                               ASM_event_sources_t event_src;
-
-                                               /* Determine root cause of conflict */
-                                               event_src = __mapping_sound_event_to_event_src(sound_event, mm_resource, ASM_CASE_1STOP_2PLAY);
-
-                                               /* Execute callback function for monitor handle */
-                                               int monitor_handle = -1;
-                                               ASM_DO_MONITOR_CALLBACK(current_playing_instance_id, monitor_handle, ASM_COMMAND_STOP, event_src);
-
-                                               /* Execute callback function for worker handle */
-                                               cb_res = __do_callback(current_playing_instance_id,current_playing_handle, ASM_COMMAND_STOP, event_src);
-                                               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
-                                                       debug_error(" oops! not suspected result %d\n", cb_res);
-                                               }
-                                               debug_warning(" 1STOP_2PLAY : __do_callback Complete, TID=%d, handle=%d",
-                                                               current_playing_instance_id,current_playing_handle );
-
-                                               /* Set state to STOP or NONE */
-                                               __asm_change_state_list(current_playing_instance_id, current_playing_handle, ASM_STATE_STOP, current_using_resource);
-
-                                               compare_result.previous_asm_handle[compare_result.previous_num_of_changes++] = temp_list;
-                                       }
-
-                                       /* Prepare msg to send */
-                                       ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_PLAY, sound_state);
-
-                                       if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                               incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                               is_already_updated = 1;
-                                       } else {
-                                               incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                       }
-                                       if (incoming_list) {
-                                               compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                                       }
-
-                                       break;
-                               }
-
-                               case ASM_CASE_1PAUSE_2PLAY:
-                               {
-                                       ASM_resource_t  update_resource = current_using_resource;
-                                       if (current_playing_instance_id == instance_id) {
-                                               debug_warning(" Do not send Pause callback in same pid %d\n", instance_id);
-                                       } else {
-                                               ASM_event_sources_t event_src;
-                                               ASM_sound_commands_t command;
-
-                                               /* Check exception */
-                                               if (__need_to_compare_again(current_playing_sound_event, current_playing_handle, sound_event, handle, (int *)(&sound_case), &asm_snd_msg->data.error_code)) {
-                                                       goto CONFLICT_AGAIN;
-                                               }
-
-                                               unsigned short resource_status = current_using_resource & mm_resource;
-                                               if (resource_status != ASM_RESOURCE_NONE) {
-                                                       debug_log(" resource conflict found 0x%x\n", resource_status);
-                                                       event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT;
-                                                       command = ASM_COMMAND_STOP;
-                                               } else {
-                                                       event_src = __mapping_sound_event_to_event_src(sound_event, mm_resource, ASM_CASE_1PAUSE_2PLAY);
-                                                       command = ASM_COMMAND_PAUSE;
-                                               }
-
-                                               /* Execute callback function for monitor handle */
-                                               int monitor_handle = -1;
-                                               ASM_DO_MONITOR_CALLBACK(current_playing_instance_id, monitor_handle, command, event_src);
-                                               ASM_CHECK_RESUME (sound_event, mm_resource, current_playing_sound_event, current_playing_instance_id, current_playing_state, monitor_handle,
-                                                                                       instance_id, handle, event_src);
-
-                                               /* Execute callback function for worker handle */
-                                               cb_res = __do_callback(current_playing_instance_id,current_playing_handle, command, event_src);
-                                               debug_warning(" 1PAUSE_2PLAY : Callback of %s, TID(%d), result(%d)",
-                                                                       ASM_sound_command_str[command], current_playing_instance_id, cb_res);
-                                               /*Change current sound' state when it is in 1Pause_2Play case */
-                                               switch (cb_res) {
-                                               case ASM_CB_RES_PAUSE:
-                                                       update_state = ASM_STATE_PAUSE;
-                                                       break;
-                                               case ASM_CB_RES_IGNORE:
-                                               case ASM_CB_RES_NONE:
-                                                       update_state = ASM_STATE_NONE;
-                                                       break;
-                                               case ASM_CB_RES_STOP:
-                                                       update_state = ASM_STATE_STOP;
-                                                       break;
-                                               default:
-                                                       debug_error(" oops! not suspected result %d\n", cb_res);
-                                                       update_state = ASM_STATE_NONE;
-                                                       break;
-                                               }
-                                               if(current_playing_sound_event == ASM_EVENT_MEDIA_OPENAL) {
-                                                       update_state = ASM_STATE_PLAYING;
-                                               }
-                                               ASM_CHECK_RESUME (sound_event, mm_resource, current_playing_sound_event, current_playing_instance_id, current_playing_state, current_playing_handle,
-                                                                                       instance_id, handle, event_src);
-
-                                               __asm_change_state_list(current_playing_instance_id, current_playing_handle, update_state, update_resource);
-
-                                               compare_result.previous_asm_handle[compare_result.previous_num_of_changes++] = temp_list;
-                                       }
-
-                                       /* Prepare msg to send */
-                                       ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_PLAY, sound_state);
-
-                                       if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                               incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                               is_already_updated = 1;
-                                       } else {
-                                               incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                       }
-                                       if (incoming_list) {
-                                               compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                                       }
-                                       break;
-                               }
-
-                               case ASM_CASE_1PLAY_2PLAY_MIX:
-                               {
-                                       if (current_playing_instance_id == instance_id) {
-                                               debug_warning(" Do not send check resource conflict in same pid %d\n", instance_id);
-                                       } else {
-                                               /* MIX but need to check resource conflict */
-                                               debug_warning(" 1PLAY_2PLAY_MIX\n");
-
-                                               /* Check exception */
-                                               if (__need_to_compare_again(current_playing_sound_event, current_playing_handle, sound_event, handle, (int *)(&sound_case), &asm_snd_msg->data.error_code)) {
-                                                       goto CONFLICT_AGAIN;
-                                               }
-
-                                               ASM_resource_t update_resource = current_using_resource;
-                                               unsigned short resource_status = current_using_resource & mm_resource;
-                                               if (resource_status) { /* Resouce conflict */
-                                                       debug_warning(" there is system resource conflict 0x%x\n", resource_status);
-                                                       __print_resource(resource_status);
-
-                                                       /* Execute callback function for monitor handle */
-                                                       int monitor_handle = -1;
-                                                       ASM_DO_MONITOR_CALLBACK(current_playing_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
-
-                                                       /* Execute callback function for worker handle */
-                                                       /* Stop current resource holding instance */
-                                                       cb_res = __do_callback(current_playing_instance_id, current_playing_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
-                                                       debug_warning(" 1PLAY_2PLAY_MIX : Resource Conflict, TID(%d)\n", current_playing_instance_id);
-
-                                                       /* Change current sound */
-                                                       switch (cb_res) {
-                                                       case ASM_CB_RES_IGNORE:
-                                                       case ASM_CB_RES_NONE:
-                                                               update_state = ASM_STATE_NONE;
-                                                               break;
-                                                       case ASM_CB_RES_STOP:
-                                                               update_state = ASM_STATE_STOP;
-                                                               break;
-                                                       default:
-                                                               debug_error(" oops! not suspected result %d\n", cb_res);
-                                                               update_state = ASM_STATE_NONE;
-                                                               break;
-                                                       }
-
-                                                       __asm_change_state_list(current_playing_instance_id, current_playing_handle, update_state, update_resource);
-
-                                                       compare_result.previous_asm_handle[compare_result.previous_num_of_changes++] = temp_list;
-                                               }
-                                       }
-
-                                       /* Prepare msg to send */
-                                       ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_PLAY, sound_state);
-
-                                       if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                               incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                               is_already_updated = 1;
-                                       } else {
-                                               incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                       }
-                                       if (incoming_list) {
-                                               compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                                       }
-
-                                       break;
-                               }
-
-                               case ASM_CASE_RESOURCE_CHECK:
-                               {
-                                       unsigned short resource_status = current_using_resource & mm_resource;
-                                       if (resource_status!= ASM_RESOURCE_NONE) {
-                                               debug_log(" ASM_CASE_RESOURCE_CHECK : resource conflict found 0x%x\n", resource_status);
-
-                                               switch (resource_status){
-                                               case ASM_RESOURCE_CAMERA:
-                                                       if (current_playing_sound_event == ASM_EVENT_MMCAMCORDER_VIDEO ||
-                                                               current_playing_sound_event == ASM_EVENT_VIDEOCALL) {
-                                                               /* 1PLAY,2STOP */
-                                                               debug_log(" ASM_CASE_RESOURCE_CHECK : 1PLAY_2STOP");
-
-                                                               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_STOP, ASM_STATE_STOP);
-                                                               temp_list = tail_list_ptr;      /* skip all remain list */
-                                                               __asm_change_state_list(instance_id, handle, ASM_STATE_STOP, mm_resource);
-
-                                                       } else if (current_playing_sound_event == ASM_EVENT_EXCLUSIVE_RESOURCE){
-                                                               /* 1STOP,2PLAY */
-                                                               ASM_event_sources_t event_src;
-                                                               event_src = ASM_EVENT_SOURCE_RESOURCE_CONFLICT;
-
-                                                               /* Execute callback function for worker handle */
-                                                               cb_res = __do_callback(current_playing_instance_id,current_playing_handle,ASM_COMMAND_STOP, event_src);
-                                                               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
-                                                                       debug_error(" oops! not suspected result %d\n", cb_res);
-                                                               }
-                                                               debug_warning(" ASM_CASE_RESOURCE_CHECK : 1STOP_2PLAY, __do_callback Complete : TID=%d, handle=%d",
-                                                                               current_playing_instance_id,current_playing_handle );
-
-                                                               /* Set state to STOP */
-                                                               __asm_change_state_list(current_playing_instance_id, current_playing_handle, ASM_STATE_STOP, current_using_resource);
-
-                                                               /* Prepare msg to send */
-                                                               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_PLAY, sound_state);
-
-                                                               if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                                                       incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                                                       is_already_updated = 1;
-                                                               } else {
-                                                                       incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                                               }
-                                                               if (incoming_list) {
-                                                                       compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                                                               }
-                                                       }
-                                                       break;
-                                               default:
-                                                       debug_warning(" ASM_CASE_RESOURCE_CHECK : Not support it(0x%x)", resource_status);
-                                                       break;
-                                               }
-                                       } else {
-                                               debug_log(" ASM_CASE_RESOURCE_CHECK : do MIX");
-                                               /* Prepare msg to send */
-                                               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_PLAY, sound_state);
-
-                                               if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                                       incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                                       is_already_updated = 1;
-                                               } else {
-                                                       incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                               }
-                                               if (incoming_list) {
-                                                       compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                                               }
-                                       }
-                                       break;
-                               }
-
-                               case ASM_CASE_SUB_EVENT:
-                               {
-                                       ASM_sound_commands_t result_command = ASM_COMMAND_PLAY;
-                                       ASM_sound_states_t result_sound_state = sound_state;
-                                       if (current_playing_instance_id == instance_id) {
-                                               /* PID is policy group. */
-                                               debug_warning(" Do not compare with same pid %d in case of ASM_CASE_SUB_EVENT\n", instance_id);
-
-                                       } else if (!ASM_IS_ADVANCED_ASM_EVENT(sound_event)) {
-                                               /* (current)advanced event type VS. (incoming)common event type */
-                                               /* get previous sub-event type */
-                                               asm_instance_list_t *asm_instance_h = NULL;
-                                               asm_instance_h = __asm_find_list(current_playing_handle);
-                                               if (!asm_instance_h) {
-                                                       debug_error(" Something is wrong, skip this request..");
-                                               } else {
-                                                       debug_warning("current playing sub-event type : %s", subevent_str[asm_instance_h->sound_sub_event]);
-                                                       /* get sub event type of current */
-                                                       if (asm_instance_h->sound_sub_event == ASM_SUB_EVENT_NONE || asm_instance_h->sound_sub_event == ASM_SUB_EVENT_SHARE) {
-                                                               debug_warning(" ASM_CASE_SUB_EVENT : 1PLAY_2PLAY_MIX\n");
-                                                               sound_case = ASM_CASE_1PLAY_2PLAY_MIX;
-                                                               goto CONFLICT_AGAIN;
-
-                                                       } else {
-                                                               /* define exception case */
-                                                               bool is_exception_case = false;
-                                                               is_exception_case = (sound_event == ASM_EVENT_NOTIFY);
-                                                               if (is_exception_case) {
-                                                                       /* exception case : do not start it */
-                                                                       debug_warning("EXCEPTION case ASM_CASE_SUB_EVENT : Do not start it");
-                                                                       sound_case = ASM_CASE_1PLAY_2STOP;
-                                                               } else {
-                                                                       sound_case = ASM_CASE_1STOP_2PLAY;
-                                                               }
-                                                               goto CONFLICT_AGAIN;
-
-                                                       }
-                                               }
-                                       }
-
-                                       /* Prepare msg to send */
-                                       ASM_SND_MSG_SET_RESULT(asm_snd_msg, result_command, result_sound_state);
-
-                                       if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                               incoming_list = __asm_register_list(instance_id, handle, sound_event, result_sound_state, mm_resource, false);
-                                               is_already_updated = 1;
-                                       } else {
-                                               incoming_list = __asm_change_state_list(instance_id, handle, result_sound_state, mm_resource);
-                                       }
-                                       if (incoming_list) {
-                                               compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                                       }
-                                       break;
-                               }
-
-                               default:
-                               {
-                                       ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_NONE, sound_state);
-                                       debug_warning(" ASM_CASE_NONE [It should not be seen] !!!\n");
-                                       break;
-                               }
-                               } /* switch (sound_case) */
-                       } else {
-                               /* Request was not PLAYING, this means no conflict, just do set */
-                               debug_log(" No Conflict (Just Register or Set State) !!!\n");
-                               ASM_SND_MSG_SET_RESULT(asm_snd_msg, ASM_COMMAND_NONE, sound_state);
-
-                               if (sound_state == ASM_STATE_NONE) {
-                                       debug_log(" 1PLAY_2NONE : No Conflict !!!\n");
-                               } else if (sound_state == ASM_STATE_WAITING) {
-                                       /* Request is WAITING */
-                                       if (current_playing_instance_id == instance_id) {
-                                               debug_warning(" Do not check in same pid %d\n", instance_id);
-                                       } else {
-                                               ASM_resource_t update_resource = current_using_resource;
-                                               unsigned short resource_status = current_using_resource & mm_resource;
-                                               if (resource_status) { /* Resouce conflict */
-                                                       debug_warning(" there is system resource conflict 0x%x\n", resource_status);
-                                                       __print_resource(resource_status);
-
-                                                       /* Execute callback function for monitor handle */
-                                                       int monitor_handle = -1;
-                                                       ASM_DO_MONITOR_CALLBACK(current_playing_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
-
-                                                       /* Execute callback function for worker handle */
-                                                       /* Stop current resource holding instance */
-                                                       cb_res = __do_callback(current_playing_instance_id, current_playing_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
-                                                       debug_warning(" Resource Conflict, TID(%d)\n", current_playing_instance_id);
-
-                                                       /* Change current sound */
-                                                       switch (cb_res) {
-                                                       case ASM_CB_RES_IGNORE:
-                                                       case ASM_CB_RES_NONE:
-                                                               update_state = ASM_STATE_NONE;
-                                                               break;
-                                                       case ASM_CB_RES_STOP:
-                                                               update_state = ASM_STATE_STOP;
-                                                               break;
-                                                       default:
-                                                               debug_error(" oops! not suspected result %d\n", cb_res);
-                                                               update_state = ASM_STATE_NONE;
-                                                               break;
-                                                       }
-                                                       __asm_change_state_list(current_playing_instance_id, current_playing_handle, update_state, update_resource);
-                                                       compare_result.previous_asm_handle[compare_result.previous_num_of_changes++] = temp_list;
-                                               }
-                                       }
-                               }
-
-                               if (!is_already_updated && request_id == ASM_REQUEST_REGISTER) {
-                                       incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-                                       is_already_updated = 1;
-                               } else {
-                                       incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                               }
-                               if (incoming_list) {
-                                       compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-                               }
-                       }
-
-                       temp_list = temp_list->next;
-
-               } /* while (temp_list != NULL) */
-
-               /* Make all monitor handle dirty flag clean. */
-               __set_all_monitor_clean();
-       }
-
-       /* Find if resource conflict exists in case of 1Pause 2Play or 1Stop 2Play */
-       if (ASM_STATUS_NONE != g_sound_status_pause && mm_resource != ASM_RESOURCE_NONE &&
-               (asm_snd_msg->data.result_sound_command == ASM_COMMAND_PLAY || no_conflict_flag)) {
-               asm_instance_list_t *temp_list = head_list_ptr;
-               int cb_res = 0;
-
-               while (temp_list != NULL) {
-                       /* Who is in PAUSE state? */
-                       if (temp_list->sound_state == ASM_STATE_PAUSE) {
-                               /* Found PAUSE state */
-                               debug_warning(" Now list's state is pause. %d %d\n", temp_list->instance_id, temp_list->sound_handle);
-                               ASM_sound_events_t current_playing_sound_event = temp_list->sound_event;
-                               int current_playing_instance_id = temp_list->instance_id;
-                               int current_playing_handle = temp_list->sound_handle;
-                               ASM_resource_t current_using_resource = temp_list->mm_resource;
-
-                               if ((current_playing_instance_id == instance_id) && (current_playing_handle == handle)) {
-                                       if (request_id == ASM_REQUEST_SETSTATE) {
-                                               debug_warning(" Own handle. Pause state change to play. %d %d\n", instance_id, handle);
-                                               __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-                                       } else {
-                                               debug_warning(" This is my handle. skip %d %d\n", instance_id, handle);
-                                       }
-                                       temp_list = temp_list->next;
-                                       continue;
-                               }
-
-                               if (sound_state == ASM_STATE_PLAYING) {
-                                       ASM_sound_cases_t sound_case = ASM_sound_case[current_playing_sound_event][sound_event];
-
-                                       debug_log(" Conflict policy[0x%x][0x%x]: %s\n", current_playing_sound_event, sound_event, ASM_sound_case_str[sound_case]);
-                                       switch (sound_case) {
-                                       case ASM_CASE_1PAUSE_2PLAY:
-                                       case ASM_CASE_1STOP_2PLAY:
-                                       {
-                                               if (current_playing_instance_id == instance_id) {
-                                                       //PID is policy group.
-                                                       debug_log(" Do not send Stop callback in same pid %d\n", instance_id);
-                                               } else {
-                                                       unsigned short resource_status = current_using_resource & mm_resource;
-
-                                                       /* Check conflict with paused instance */
-                                                       if (resource_status != ASM_RESOURCE_NONE) {
-                                                               debug_warning(" there is system resource conflict with paused instance 0x%x\n", resource_status);
-                                                               __print_resource(resource_status);
-                                                       } else {
-                                                               debug_log(" no resource conflict with paused instance\n");
-                                                               break;
-                                                       }
-
-                                                       /* Execute callback function for monitor handle */
-                                                       int monitor_handle = -1;
-                                                       ASM_DO_MONITOR_CALLBACK(current_playing_instance_id, monitor_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
-
-                                                       /* Execute callback function for worker handle */
-                                                       cb_res = __do_callback(current_playing_instance_id,current_playing_handle, ASM_COMMAND_STOP, ASM_EVENT_SOURCE_RESOURCE_CONFLICT);
-                                                       if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
-                                                               debug_error(" oops! not suspected result %d\n", cb_res);
-                                                       }
-                                                       debug_warning("  1STOP_2PLAY cause RESOURCE, __do_callback Complete : TID=%d, handle=%d",
-                                                                       current_playing_instance_id,current_playing_handle );
-
-                                                       __asm_change_state_list(current_playing_instance_id, current_playing_handle, ASM_STATE_NONE, ASM_RESOURCE_NONE);
-
-                                                       compare_result.previous_asm_handle[compare_result.previous_num_of_changes++] = temp_list;
-                                               }
-
-                                               debug_log(" 1STOP_2PLAY cause RESOURCE : msg sent and  then received msg !!!\n");
-                                               break;
-                                       }
-
-                                       default:
-                                               /* debug_warning(" >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */
-                                               break;
-
-                                       } /* switch (sound_case) */
-                               } else {
-                                       /* debug_warning(" >>>> __asm_compare_priority_matrix : ASM_CASE_NONE [do not anything] !!!\n"); */
-                               }
-                       } /* if (temp_list->sound_state == ASM_STATE_PAUSE) */
-
-                       temp_list = temp_list->next;
-               } /* while (temp_list != NULL) */
-       }
-
-       /* Finally, no conflict */
-       if (no_conflict_flag) {
-               if (request_id == ASM_REQUEST_REGISTER) {
-                       incoming_list = __asm_register_list(instance_id, handle, sound_event, sound_state, mm_resource, false);
-               } else {
-                       incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-               }
-
-               if (incoming_list) {
-                       compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-               }
-       }
-
-       if (asm_ret_msg) {
-               *asm_ret_msg = *asm_snd_msg;
-       }
-
-       debug_log(" LEAVE <<<<<< \n");
-
-       return compare_result;
-}
-
-void __asm_do_all_resume_callback(asm_paused_by_id_t paused_by_id)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int cb_res = 0;
-
-       debug_log(" >>>>>>>>>> ENTER\n");
-
-       while (temp_list != NULL) {
-               if ((temp_list->need_resume == ASM_NEED_RESUME) &&
-                       temp_list->paused_by_id.pid == paused_by_id.pid && temp_list->paused_by_id.sound_handle == paused_by_id.sound_handle) {
-                       if (__mm_sound_mgr_ipc_freeze_send (FREEZE_COMMAND_WAKEUP, temp_list->instance_id)) {
-                               debug_warning("failed to send wake-up msg to the client pid(%d)",temp_list->instance_id);
-                       }
-                       debug_warning("EXECUTE RESUME CALLBACKS with interrupted EventSrc[%d], paused_by_pid[%d]/handle[%d], resumption pid[%d]/handle[%d]\n",
-                                       temp_list->paused_by_id.eventsrc, paused_by_id.pid, paused_by_id.sound_handle, temp_list->instance_id, temp_list->sound_handle);
-                       cb_res = __do_callback(temp_list->instance_id, temp_list->sound_handle, temp_list->need_resume == ASM_NEED_RESUME ? ASM_COMMAND_RESUME : ASM_COMMAND_PAUSE, __convert_eventsrc_interrupted_to_completed(temp_list->paused_by_id.eventsrc));
-                       debug_warning("RESUME CALLBACKS END, cb_res(%d)\n", cb_res);
-                       switch (cb_res) {
-                       case ASM_CB_RES_PLAYING:
-                               temp_list->sound_state = ASM_STATE_PLAYING;
-                               break;
-                       case ASM_CB_RES_IGNORE:
-                       case ASM_CB_RES_NONE:
-                       case ASM_CB_RES_STOP:
-                       case ASM_CB_RES_PAUSE:
-                       default:
-                               /* do nothing */
-                               break;
-                       }
-                       temp_list->need_resume = ASM_NEED_NOT_RESUME;
-                       temp_list->paused_by_id.pid = 0;
-                       temp_list->paused_by_id.sound_handle = ASM_HANDLE_INIT_VAL;
-                       temp_list->paused_by_id.eventsrc = ASM_EVENT_SOURCE_MEDIA;;
-               }
-               temp_list = temp_list->next;
-       }
-
-       debug_log(" <<<<<<<<<< LEAVE\n");
-}
-
-void ___check_camcorder_status(int instance_id, int handle, ASM_sound_events_t sound_event, ASM_sound_states_t sound_state, ASM_resource_t mm_resource)
-{
-       asm_instance_list_t *temp_list = head_list_ptr;
-       int camcordering = 0;
-       asm_instance_list_t *incoming_list = NULL;
-       asm_compare_result_t compare_result;
-       memset(&compare_result, 0x00, sizeof(asm_compare_result_t));
-
-       while (temp_list != NULL) {
-               if (temp_list->sound_state == ASM_STATE_PLAYING && (temp_list->sound_event == ASM_EVENT_MMCAMCORDER_VIDEO || temp_list->sound_event == ASM_EVENT_MMCAMCORDER_AUDIO)) {
-                       camcordering = 1;
-                       break;
-               }
-               temp_list = temp_list->next;
-       }
-       if (camcordering == 1) {
-               ASM_event_sources_t event_src;
-               int cb_res = 0;
-
-               /* Determine root cause of conflict */
-               event_src = __mapping_sound_event_to_event_src(sound_event, mm_resource, ASM_CASE_1STOP_2PLAY);
-
-               /* Execute callback function for monitor handle */
-               int monitor_handle = -1;
-               ASM_DO_MONITOR_CALLBACK(temp_list->instance_id, monitor_handle, ASM_COMMAND_STOP, event_src);
-
-               /* Execute callback function for worker handle */
-               cb_res = __do_callback(temp_list->instance_id, temp_list->sound_handle, ASM_COMMAND_STOP, event_src);
-               if (cb_res != ASM_CB_RES_NONE && cb_res != ASM_CB_RES_STOP) {
-                       debug_error(" oops! not suspected result %d\n", cb_res);
-               }
-               debug_warning(" 1STOP_2PLAY : __do_callback Complete, TID=%d, handle=%d",
-                               temp_list->instance_id, temp_list->sound_handle);
-
-               /* Set state to STOP or NONE */
-               __asm_change_state_list(temp_list->instance_id, temp_list->sound_handle, ASM_STATE_STOP, temp_list->mm_resource);
-
-               compare_result.previous_asm_handle[compare_result.previous_num_of_changes++] = temp_list;
-
-               incoming_list = __asm_change_state_list(instance_id, handle, sound_state, mm_resource);
-               if (incoming_list) {
-                       compare_result.incoming_asm_handle[compare_result.incoming_num_of_changes++] = incoming_list;
-               }
-               ASM_DO_WATCH_CALLBACK_FROM_RESULT(compare_result);
-       }
-}
-
-int __asm_change_session (ASM_requests_t rcv_request, ASM_sound_events_t rcv_sound_event, ASM_sound_states_t rcv_sound_state, ASM_resource_t rcv_resource, bool is_for_recovery, bool *need_to_resume)
-{
-       int ret = MM_ERROR_NONE;
-       session_t cur_session;
-
-       /* FIXME */
-//     MMSoundMgrSessionGetSession(&cur_session);
-       debug_warning (" cur_session[%d] (0:MEDIA 1:VC 2:VT 3:VOIP 4:FM 5:NOTI 6:ALARM 7:EMER 8:VR)\n",cur_session);
-       if (is_for_recovery) {
-               if (need_to_resume) {
-                       *need_to_resume = false;
-               } else {
-                       debug_error (" need_to_resume(%x) is null..", need_to_resume);
-                       return MM_ERROR_SOUND_INTERNAL;
-               }
-       }
-
-       if (!is_for_recovery) {
-       /* change session setting for new sound event */
-               if (rcv_request == ASM_REQUEST_REGISTER) {
-
-                       switch (rcv_sound_event) {
-                       case ASM_EVENT_CALL:
-                               debug_warning (" ****** SESSION_VOICECALL start ******\n");
-//                             ret = MMSoundMgrSessionSetSession(SESSION_VOICECALL, SESSION_START);
-                               if (ret) {
-                                       goto ERROR_CASE;
-                               }
-                               break;
-                       case ASM_EVENT_VIDEOCALL:
-                               debug_warning (" ****** SESSION_VIDEOCALL start ******\n");
-//                             ret = MMSoundMgrSessionSetSession(SESSION_VIDEOCALL, SESSION_START);
-                               if (ret) {
-                                       goto ERROR_CASE;
-                               }
-                               break;
-                       case ASM_EVENT_VOIP:
-                               debug_warning (" ****** SESSION_VOIP start ******\n");
-//                             ret = MMSoundMgrSessionSetSession(SESSION_VOIP, SESSION_START);
-                               if (ret) {
-                                       goto ERROR_CASE;
-                               }
-                               break;
-                       case ASM_EVENT_EXCLUSIVE_RESOURCE:
-                               if ( rcv_resource & ASM_RESOURCE_VOICECONTROL ) {
-                                       debug_warning (" ****** ASM_RESOURCE_VOICECONTROL START ******\n");
-//                                     MMSoundMgrSessionSetVoiceControlState(true);
-                               }
-                               break;
-                       default:
-                               break;
-                       }
-
-               } else if (rcv_request == ASM_REQUEST_SETSTATE) {
-
-                       switch (rcv_sound_event) {
-                       case ASM_EVENT_NOTIFY:
-                               if (cur_session == SESSION_NOTIFICATION) {
-                                       debug_warning (" ****** SESSION_NOTIFICATION ongoing ******\n");
-                                       SESSION_REF(cur_session);
-                               } else if (cur_session == SESSION_ALARM) {
-                                       debug_warning (" ****** SESSION_ALARM ongoing ******\n");
-                                       SESSION_REF(cur_session);
-                               } else if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VIDEOCALL || cur_session == SESSION_VOIP) {
-                                       debug_warning (" ****** Notify starts on Call/Voip session ******\n");
-                               } else {
-                                       debug_warning (" ****** SESSION_NOTIFICATION start ******\n");
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_NOTIFICATION, SESSION_START);
-                                       if (ret) {
-                                               goto ERROR_CASE;
-                                       }
-                                       SESSION_REF_INIT();
-                                       SESSION_REF(cur_session);
-                               }
-                               break;
-                       case ASM_EVENT_ALARM:
-                               if (cur_session == SESSION_ALARM) {
-                                       debug_warning (" ****** SESSION_ALARM ongoing ******\n");
-                                       SESSION_REF(cur_session);
-                               } else if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VIDEOCALL || cur_session == SESSION_VOIP) {
-                                       debug_warning (" ****** Alarm starts on Call/Voip session ******\n");
-                               } else {
-                                       debug_warning (" ****** SESSION_ALARM start ******\n");
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_ALARM, SESSION_START);
-                                       if (ret) {
-                                               goto ERROR_CASE;
-                                       }
-                                       SESSION_REF_INIT();
-                                       SESSION_REF(cur_session);
-                               }
-                               break;
-                       case ASM_EVENT_EMERGENCY:
-                               if (cur_session == SESSION_EMERGENCY) {
-                                       debug_warning (" ****** SESSION_EMERGENCY ongoing ******\n");
-                                       SESSION_REF(cur_session);
-                               } else {
-                                       debug_warning (" ****** SESSION_EMERGENCY start ******\n");
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_EMERGENCY, SESSION_START);
-                                       if (ret) {
-                                               goto ERROR_CASE;
-                                       }
-                                       SESSION_REF_INIT();
-                                       SESSION_REF(cur_session);
-                               }
-                               break;
-                       case ASM_EVENT_MEDIA_FMRADIO:
-                               if (cur_session == SESSION_FMRADIO) {
-                                       debug_warning (" ****** SESSION_FMRADIO ongoing ******\n");
-                                       SESSION_REF(cur_session);
-                               } else {
-                                       debug_warning (" ****** SESSION_FMRADIO start ******\n");
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_START);
-                                       if (ret) {
-                                               goto ERROR_CASE;
-                                       }
-                                       SESSION_REF_INIT();
-                                       SESSION_REF(cur_session);
-                               }
-                               break;
-                       case ASM_EVENT_MEDIA_MMPLAYER:
-                               if (cur_session != SESSION_MEDIA) {
-                                       if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                               /* Media and Voice Recognition can be mixed */
-                                               debug_warning (" SESSION_VOICE_RECOGNITION exception case, no change\n");
-                                       } else {
-                                               goto RECOVERY_CASE;
-                                       }
-                               }
-                               break;
-                       case ASM_EVENT_MMCAMCORDER_AUDIO:
-                       case ASM_EVENT_MMCAMCORDER_VIDEO:
-                               if (cur_session != SESSION_MEDIA) {
-                                       if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VIDEOCALL ||
-                                               cur_session == SESSION_VOIP || cur_session == SESSION_FMRADIO) {
-                                               debug_warning (" ****** Voice/FMRadio recording starts on Call/Voip/FMRadio session ******\n");
-                                       } else if (cur_session == SESSION_MEDIA) {
-                                               debug_warning (" ****** SESSION_MEDIA ongoing ******\n");
-                                       } else {
-                                               goto RECOVERY_CASE;
-                                       }
-                               }
-                               break;
-                       case ASM_EVENT_EARJACK_UNPLUG:
-                       case ASM_EVENT_CALL:
-                       case ASM_EVENT_VIDEOCALL:
-                       case ASM_EVENT_VOIP:
-                       case ASM_EVENT_EXCLUSIVE_RESOURCE:
-                               break;
-                       case ASM_EVENT_VOICE_RECOGNITION:
-                               if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                       debug_warning (" ****** SESSION_VOICE_RECOGNITION ongoing ******\n");
-                                       SESSION_REF(cur_session);
-                               } else {
-                                       debug_warning (" ****** SESSION_VOICE_RECOGNITION start ******\n");
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_VOICE_RECOGNITION, SESSION_START);
-                                       if (ret) {
-                                               goto ERROR_CASE;
-                                       }
-                                       SESSION_REF_INIT();
-                                       SESSION_REF(cur_session);
-                               }
-                               break;
-
-                       default:
-                               /* recovery path for normal ASM event type */
-                               if (cur_session != SESSION_MEDIA) {
-                                       if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                               /* Media and Voice Recognition can be mixed */
-                                               debug_warning (" SESSION_VOICE_RECOGNITION exception case, no change\n");
-                                       } else if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VIDEOCALL || cur_session == SESSION_VOIP) {
-                                               debug_warning (" SESSION_VOICECALL/VIDEOCALL/VOIP exception case, no change\n");
-                                       } else {
-                                               goto RECOVERY_CASE;
-                                       }
-                               }
-                               break;
-                       }
-               } else if (rcv_request == ASM_REQUEST_SET_SUBEVENT) {
-
-                       switch (rcv_sound_event) {
-                       case ASM_SUB_EVENT_SHARE:
-                               /* wakeup mode */
-                               if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                       subsession_t subsession = 0;
-//                                     MMSoundMgrSessionGetSubSession(&subsession);
-                                       if (subsession == SUBSESSION_VR_NORMAL || subsession == SUBSESSION_VR_DRIVE) {
-                                               /* do nothing */
-                                       }
-                               }
-                               break;
-                       case ASM_SUB_EVENT_EXCLUSIVE:
-                               /* command mode */
-                               if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                       subsession_t subsession = 0;
-//                                     MMSoundMgrSessionGetSubSession(&subsession);
-                                       if (subsession == SUBSESSION_VR_NORMAL || subsession == SUBSESSION_VR_DRIVE) {
-                                               /* do nothing */
-                                       }
-                               }
-                               break;
-                       default:
-                               /* recovery path for normal ASM event type */
-                               if (cur_session != SESSION_MEDIA) {
-                                       goto RECOVERY_CASE;
-                               }
-                               break;
-                       }
-               }
-       } else {
-       /* change session setting for recovery */
-               if (rcv_request == ASM_REQUEST_UNREGISTER) {
-
-                       switch (rcv_sound_event) {
-                       case ASM_EVENT_CALL:
-                               debug_warning (" ****** SESSION_VOICECALL end ******\n");
-//                             ret = MMSoundMgrSessionSetSession(SESSION_VOICECALL, SESSION_END);
-                               if (ret) {
-                                       goto ERROR_CASE;
-                               }
-                               *need_to_resume = true;
-                               break;
-                       case ASM_EVENT_VIDEOCALL:
-                               debug_warning (" ****** SESSION_VIDEOCALL end ******\n");
-//                             ret = MMSoundMgrSessionSetSession(SESSION_VIDEOCALL, SESSION_END);
-                               if (ret) {
-                                       goto ERROR_CASE;
-                               }
-                               *need_to_resume = true;
-                               break;
-                       case ASM_EVENT_VOIP:
-                               debug_warning (" ****** SESSION_VOIP end ******\n");
-//                             ret = MMSoundMgrSessionSetSession(SESSION_VOIP, SESSION_END);
-                               if (ret) {
-                                       goto ERROR_CASE;
-                               }
-                               *need_to_resume = true;
-                               break;
-                       case ASM_EVENT_NOTIFY:
-                               *need_to_resume = true;
-                               break;
-                       case ASM_EVENT_ALARM:
-                               *need_to_resume = true;
-                               break;
-                       case ASM_EVENT_VOICE_RECOGNITION:
-                               if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                       SESSION_UNREF(cur_session);
-                                       if (IS_ON_GOING_SESSION()) {
-                                               debug_warning (" ****** KEEP GOING SESSION_VOICE_RECOGNITION ****** current ref.count(%d)\n", g_session_ref_count);
-                                       } else {
-                                               debug_warning (" ****** SESSION_VOICE_RECOGNITION end ******\n");
-//                                             ret = MMSoundMgrSessionSetSession(SESSION_VOICE_RECOGNITION, SESSION_END);
-                                               if (ret) {
-                                                       goto ERROR_CASE;
-                                               }
-                                       }
-                               }
-                               *need_to_resume = true;
-                               break;
-                       case ASM_EVENT_MMCAMCORDER_AUDIO:
-                       case ASM_EVENT_MMCAMCORDER_VIDEO:
-                               if (cur_session == SESSION_MEDIA) {
-                                       debug_warning (" ****** SESSION_MEDIA for MMCAMCORDER end ******\n");
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_MEDIA, SESSION_END);
-                                       if (ret) {
-                                               goto ERROR_CASE;
-                                       }
-                               }
-                               break;
-                       case ASM_EVENT_EXCLUSIVE_RESOURCE:
-                               if ( rcv_resource & ASM_RESOURCE_VOICECONTROL ) {
-//                                     MMSoundMgrSessionSetVoiceControlState(false);
-                                       debug_warning (" ****** ASM_RESOURCE_VOICECONTROL END ******\n");
-                               }
-                               break;
-                       default:
-                               *need_to_resume = true;
-                               break;
-                       }
-
-               } else if (rcv_request == ASM_REQUEST_SETSTATE) {
-
-                       if (rcv_sound_state == ASM_STATE_STOP) {
-                               switch (rcv_sound_event) {
-                               case ASM_EVENT_NOTIFY:
-                                       if (cur_session == SESSION_NOTIFICATION) {
-                                               SESSION_UNREF(cur_session);
-                                               if (IS_ON_GOING_SESSION()) {
-                                                       debug_warning (" ****** KEEP GOING SESSION_NOTIFICATION ****** current ref.count(%d)\n", g_session_ref_count);
-                                               } else {
-                                                       debug_warning (" ****** SESSION_NOTIFICATON end ******\n");
-//                                                     ret = MMSoundMgrSessionSetSession(SESSION_NOTIFICATION, SESSION_END);
-                                                       if (ret) {
-                                                               goto ERROR_CASE;
-                                                       }
-                                               }
-                                       } else if (cur_session == SESSION_ALARM) {
-                                               SESSION_UNREF(cur_session);
-                                               if (IS_ON_GOING_SESSION()) {
-                                                       debug_warning (" ****** KEEP GOING SESSION_ALARM ****** current ref.count(%d)\n", g_session_ref_count);
-                                               } else {
-                                                       debug_warning (" ****** SESSION_ALARM end ******\n");
-//                                                     ret = MMSoundMgrSessionSetSession(SESSION_ALARM, SESSION_END);
-                                                       if (ret) {
-                                                               goto ERROR_CASE;
-                                                       }
-                                               }
-                                       } else {
-                                               debug_warning (" ****** No need to end session : current session was [%d] ******\n", cur_session);
-                                       }
-                                       *need_to_resume = true;
-                                       break;
-                               case ASM_EVENT_ALARM:
-                                       if (cur_session == SESSION_ALARM) {
-                                               SESSION_UNREF(cur_session);
-                                               if (IS_ON_GOING_SESSION()) {
-                                                       debug_warning (" ****** KEEP GOING SESSION_ALARM ****** current ref.count(%d)\n", g_session_ref_count);
-                                               } else {
-                                                       debug_warning (" ****** SESSION_ALARM end ******\n");
-//                                                     ret = MMSoundMgrSessionSetSession(SESSION_ALARM, SESSION_END);
-                                                       if (ret) {
-                                                               goto ERROR_CASE;
-                                                       }
-                                               }
-                                       } else if (cur_session == SESSION_VOICECALL || cur_session == SESSION_VIDEOCALL || cur_session == SESSION_VOIP) {
-                                               debug_warning (" ****** Alarm ends on Call/Voip session ******\n");
-                                       } else {
-                                               debug_warning (" ****** Not expected case : current session was [%d] ******\n", cur_session);
-                                       }
-                                       *need_to_resume = true;
-                                       break;
-                               case ASM_EVENT_EMERGENCY:
-                                       if (cur_session == SESSION_EMERGENCY) {
-                                               SESSION_UNREF(cur_session);
-                                               if (IS_ON_GOING_SESSION()) {
-                                                       debug_warning (" ****** KEEP GOING SESSION_EMERGENCY ****** current ref.count(%d)\n", g_session_ref_count);
-                                               } else {
-                                                       debug_warning (" ****** SESSION_EMERGENCY end ******\n");
-//                                                     ret = MMSoundMgrSessionSetSession(SESSION_EMERGENCY, SESSION_END);
-                                                       if (ret) {
-                                                               goto ERROR_CASE;
-                                                       }
-                                               }
-                                       } else {
-                                               debug_warning (" ****** Not expected case : current session was [%d] ******\n", cur_session);
-                                       }
-                                       *need_to_resume = true;
-                                       break;
-                               case ASM_EVENT_MEDIA_FMRADIO:
-                                       if (cur_session == SESSION_FMRADIO) {
-                                               SESSION_UNREF(cur_session);
-                                               if (IS_ON_GOING_SESSION()) {
-                                                       debug_warning (" ****** KEEP GOING SESSION_FMRADIO ****** current ref.count(%d)\n", g_session_ref_count);
-                                               } else {
-                                                       debug_warning (" ****** SESSION_FMRADIO end ******");
-//                                                     ret = MMSoundMgrSessionSetSession(SESSION_FMRADIO, SESSION_END);
-                                                       if (ret) {
-                                                               goto ERROR_CASE;
-                                                       }
-                                               }
-                                       } else {
-                                               debug_warning (" Session is not SESSION_FMRADIO");
-                                       }
-                                       *need_to_resume = true;
-                                       break;
-                               case ASM_EVENT_MEDIA_MMPLAYER:
-                               case ASM_EVENT_MEDIA_MMSOUND:
-                               case ASM_EVENT_MEDIA_OPENAL:
-                               case ASM_EVENT_MEDIA_WEBKIT:
-                                       *need_to_resume = true;
-                                       break;
-                               case ASM_EVENT_VOICE_RECOGNITION:
-                                       if (cur_session == SESSION_VOICE_RECOGNITION) {
-                                               SESSION_UNREF(cur_session);
-                                               if (IS_ON_GOING_SESSION()) {
-                                                       debug_warning (" ****** KEEP GOING SESSION_VOICE_RECOGNITION ****** current ref.count(%d)\n", g_session_ref_count);
-                                               } else {
-                                                       debug_warning (" ****** SESSION_VOICE_RECOGNITION end ******\n");
-//                                                     ret = MMSoundMgrSessionSetSession(SESSION_VOICE_RECOGNITION, SESSION_END);
-                                                       if (ret) {
-                                                               goto ERROR_CASE;
-                                                       }
-                                               }
-                                       } else {
-                                               debug_warning (" ****** Not expected case : current session was [%d] ******\n", cur_session);
-                                       }
-                                       break;
-                               default:
-                                       break;
-                               }
-                       } else if (rcv_sound_state == ASM_STATE_PAUSE)  {
-                               if (cur_session == SESSION_NOTIFICATION ||
-                                       cur_session == SESSION_ALARM ||
-                                       cur_session == SESSION_VOICE_RECOGNITION) {
-                                       if (IS_ON_GOING_SESSION()) {
-                                               SESSION_UNREF(cur_session);
-                                       }
-                               } else if (cur_session == SESSION_MEDIA) {
-                                       if (__is_media_session(rcv_sound_event)) {
-                                               *need_to_resume = true;
-                                       }
-                               }
-                       }
-               }
-               debug_warning (" need_to_resume[%d]", *need_to_resume);
-       }
-
-//     MMSoundMgrSessionGetSession(&cur_session);
-       debug_msg (" cur_session[%d] : leave", cur_session);
-
-       return ret;
-
-RECOVERY_CASE:
-       debug_warning (" ****** recovery case : current session(%d) end ******\n", cur_session);
-//     ret = MMSoundMgrSessionSetSession(cur_session, SESSION_END);
-       if (ret) {
-               goto ERROR_CASE;
-       }
-       SESSION_REF_INIT();
-       return ret;
-
-ERROR_CASE:
-       debug_error (" failed to MMSoundMgrSessionSetSession()");
-       return ret;
-}
-
-int _mm_sound_mgr_asm_register_sound(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                           int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_sound_state = asm_snd_gvariant.data.result_sound_state;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_unregister_sound(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_register_watcher(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                             int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_sound_state = asm_snd_gvariant.data.result_sound_state;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_unregister_watcher(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_get_mystate(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                        int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_state = asm_snd_gvariant.data.result_sound_state;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_get_state(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                      int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_state = asm_snd_gvariant.data.result_sound_state;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_set_state(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                      int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state, int *snd_error_code)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_sound_state = asm_snd_gvariant.data.result_sound_state;
-       *snd_error_code = asm_snd_gvariant.data.error_code;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_set_subsession(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                           int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_get_subsession(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                           int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_set_subevent(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                         int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_sound_state = asm_snd_gvariant.data.result_sound_state;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_get_subevent(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                         int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_set_session_option(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                               int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_error_code)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_error_code = asm_snd_gvariant.data.error_code;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_get_session_option(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                               int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_option_flag)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_option_flag = asm_snd_gvariant.data.error_code;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_reset_resume_tag(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource,
-                                             int *snd_pid, int *snd_alloc_handle, int *snd_cmd_handle, int *snd_request_id, int *snd_sound_command, int *snd_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       *snd_pid = asm_snd_gvariant.instance_id;
-       *snd_alloc_handle = asm_snd_gvariant.data.alloc_handle;
-       *snd_cmd_handle = asm_snd_gvariant.data.cmd_handle;
-       *snd_request_id = asm_snd_gvariant.data.source_request_id;
-       *snd_sound_command = asm_snd_gvariant.data.result_sound_command;
-       *snd_sound_state = asm_snd_gvariant.data.error_code;
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_dump(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state, int rcv_resource)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-       asm_rcv_gvariant.data.system_resource = rcv_resource;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       return ret;
-
-}
-
-int _mm_sound_mgr_asm_emergent_exit(int rcv_pid, int rcv_handle, int rcv_sound_event, int rcv_request_id, int rcv_sound_state)
-{
-       ASM_msg_lib_to_asm_t asm_rcv_gvariant;
-       ASM_msg_asm_to_lib_t asm_snd_gvariant;
-       int ret = MM_ERROR_NONE;
-
-       asm_rcv_gvariant.instance_id = rcv_pid;
-       asm_rcv_gvariant.data.handle = rcv_handle;
-       asm_rcv_gvariant.data.sound_event = rcv_sound_event;
-       asm_rcv_gvariant.data.request_id = rcv_request_id;
-       asm_rcv_gvariant.data.sound_state = rcv_sound_state;
-
-       ret = __asm_process_message(&asm_rcv_gvariant, &asm_snd_gvariant);
-
-       return ret;
-
-}
-
-#ifdef SUPPORT_CONTAINER
-void _mm_sound_mgr_asm_update_container_data(int handle, const char* container_name, int container_pid)
-{
-       __set_container_data(handle, container_name, container_pid);
-       __temp_print_list(NULL);
-}
-#endif
-
-int __asm_process_message (void *rcv_msg, void *ret_msg)
-{
-       int rcv_instance_id;
-       ASM_requests_t rcv_request_id;
-       ASM_sound_events_t rcv_sound_event;
-       ASM_sound_states_t rcv_sound_state;
-       ASM_resource_t rcv_resource;
-       int rcv_sound_handle;
-       ASM_msg_asm_to_lib_t asm_snd_msg;
-       ASM_msg_lib_to_asm_t *asm_rcv_msg = (ASM_msg_lib_to_asm_t *)rcv_msg;
-       ASM_msg_asm_to_lib_t *asm_ret_msg = (ASM_msg_asm_to_lib_t *)ret_msg;
-       int ret = MM_ERROR_NONE;
-       asm_instance_list_t *asm_instance_h = NULL;
-
-       pthread_mutex_lock(&g_mutex_asm);
-       debug_log (" ===================================================================== Started!!! (LOCKED) ");
-
-       rcv_instance_id = asm_rcv_msg->instance_id;
-       rcv_sound_handle = asm_rcv_msg->data.handle;
-       rcv_request_id = asm_rcv_msg->data.request_id;
-       rcv_sound_event = asm_rcv_msg->data.sound_event;
-       rcv_sound_state = asm_rcv_msg->data.sound_state;
-       rcv_resource = asm_rcv_msg->data.system_resource;
-
-       /*******************************************************************/
-       debug_warning(" received msg (tid=%d,handle=%d,req=%d[%s],event=%d,state=%d[%s],resource=0x%x)\n",
-                       rcv_instance_id, rcv_sound_handle, rcv_request_id, ASM_sound_request_str[rcv_request_id],
-                       rcv_sound_event, rcv_sound_state, ASM_sound_state_str[rcv_sound_state], rcv_resource);
-       if (rcv_request_id != ASM_REQUEST_EMERGENT_EXIT) {
-               if (rcv_request_id == ASM_REQUEST_SET_SUBSESSION) {
-                       debug_warning("     sub-session : %s\n", subsession_str[rcv_sound_event]);
-               } else if (rcv_request_id == ASM_REQUEST_SET_SUBEVENT) {
-                       debug_warning("     sub-event : %s\n", subevent_str[rcv_sound_event]);
-               } else if (rcv_request_id == ASM_REQUEST_SET_SESSION_OPTIONS) {
-                       debug_warning("     session-options : %x\n", rcv_sound_event);
-               } else if (rcv_request_id == ASM_REQUEST_GET_SUBSESSION || rcv_request_id == ASM_REQUEST_GET_SUBEVENT || ASM_REQUEST_GET_SESSION_OPTIONS) {
-                       /* no log */
-               } else {
-                       debug_warning("     sound_event : %s\n", ASM_sound_event_str[rcv_sound_event]);
-               }
-       }
-       /*******************************************************************/
-
-       memset(&asm_snd_msg, 0, sizeof(ASM_msg_asm_to_lib_t));
-
-       debug_log (" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ");
-
-       switch (rcv_request_id) {
-       case ASM_REQUEST_REGISTER:
-               __check_dead_process();
-
-               __asm_get_empty_handle(rcv_instance_id, &rcv_sound_handle);
-               if (rcv_sound_handle == ASM_HANDLE_INIT_VAL) {
-                       ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, ASM_HANDLE_INIT_VAL, ASM_HANDLE_INIT_VAL, rcv_request_id);
-               } else {
-                       asm_compare_result_t compare_result = __asm_compare_priority_matrix(&asm_snd_msg, asm_ret_msg,
-                                                                       rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource);
-
-                       if (asm_snd_msg.data.result_sound_command != ASM_COMMAND_STOP) {
-                               /* do not execute below when the result is ASM_COMMAND_STOP */
-                               ret = __asm_change_session (rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource, false, NULL);
-                               if (ret) {
-                                       debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-                               }
-                       }
-                       ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-                       ASM_DO_WATCH_CALLBACK_FROM_RESULT(compare_result);
-               }
-
-               break;
-
-       case ASM_REQUEST_UNREGISTER:
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-
-               bool need_to_resume = false;
-               ret = __asm_change_session (rcv_request_id, rcv_sound_event, rcv_sound_state,
-                                                               (asm_instance_h)? asm_instance_h->mm_resource : rcv_resource,
-                                                               true, &need_to_resume);
-
-               /* enforce calling watch callback when current state of rcv_instance_id is still ASM_STATE_PLAYING */
-               /* need to call the watch callback of Call event(STOP) because Call session is changed in ASM_REQUEST_UNREGISTER */
-               if (__asm_find_state_of_handle(rcv_sound_handle) == ASM_STATE_PLAYING ||
-                               rcv_sound_event == ASM_EVENT_CALL) {
-                       ASM_DO_WATCH_CALLBACK(rcv_sound_event, ASM_STATE_STOP);
-               }
-               __asm_unregister_list(rcv_sound_handle);
-
-               if (ret) {
-                       debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-               } else {
-                       if (need_to_resume) {
-                               asm_paused_by_id_t paused_by_id;
-                               paused_by_id.pid = rcv_instance_id;
-                               paused_by_id.sound_handle = rcv_sound_handle;
-                               __asm_do_all_resume_callback(paused_by_id);
-                       }
-               }
-               break;
-
-       case ASM_REQUEST_SETSTATE:
-               __check_dead_process();
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               if (rcv_sound_state == ASM_STATE_PLAYING || rcv_sound_state == ASM_STATE_WAITING) {
-                       if ( __is_it_playing_now(rcv_instance_id, rcv_sound_handle)) {
-                               __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource);
-                               asm_snd_msg.data.result_sound_command = ASM_COMMAND_NONE;
-                               asm_snd_msg.data.result_sound_state = rcv_sound_state;
-                       } else if (mm_sound_util_is_mute_policy() && (ASM_EVENT_NOTIFY == rcv_sound_event)) {
-                               /*do not play notify sound in mute profile.*/
-                               asm_snd_msg.data.result_sound_command = ASM_COMMAND_STOP;
-                               asm_snd_msg.data.result_sound_state   = ASM_STATE_STOP;
-                               asm_snd_msg.data.error_code           = ERR_ASM_POLICY_CANNOT_PLAY_BY_PROFILE;
-                               __asm_change_state_list(rcv_instance_id, rcv_sound_handle, ASM_STATE_STOP, rcv_resource);
-                               __temp_print_list("Set State (Not Play)");
-                               break;
-                       } else {
-                               __reset_resume_check(rcv_instance_id, ASM_HANDLE_INIT_VAL);
-                               asm_compare_result_t compare_result = __asm_compare_priority_matrix(&asm_snd_msg, asm_ret_msg,
-                                                                               rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource);
-
-                               if (asm_snd_msg.data.result_sound_command == ASM_COMMAND_PLAY ||
-                                       asm_snd_msg.data.result_sound_command == ASM_COMMAND_NONE) {
-
-                                       ret = __asm_change_session (rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource, false, NULL);
-                                       if (ret) {
-                                               debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-                                       }
-                               }
-
-                               ASM_DO_WATCH_CALLBACK_FROM_RESULT(compare_result);
-                       }
-                       __temp_print_list("Set State (Play)");
-               } else {
-                       asm_instance_h = __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource);
-                       if(asm_instance_h) {
-                               bool need_to_resume = false;
-                               if (asm_instance_h->prev_sound_state == ASM_STATE_PLAYING) {
-                                       if (rcv_sound_state == ASM_STATE_STOP || rcv_sound_state == ASM_STATE_PAUSE) {
-                                               ret = __asm_change_session (rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource, true, &need_to_resume);
-                                               if (ret) {
-                                                       debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-                                               } else {
-                                                       if (need_to_resume) {
-                                                               asm_paused_by_id_t paused_by_id;
-                                                               paused_by_id.pid = rcv_instance_id;
-                                                               paused_by_id.sound_handle = rcv_sound_handle;
-                                                               __asm_do_all_resume_callback(paused_by_id);
-                                                       }
-                                               }
-                                               /* Call session is changed in ASM_REQUEST_UNREGISTER */
-                                               if (rcv_sound_event != ASM_EVENT_CALL) { // exception case for the watch callback(STOP)
-                                                       ASM_DO_WATCH_CALLBACK(rcv_sound_event, rcv_sound_state);
-                                               }
-                                       }
-                               } else if (asm_instance_h->prev_sound_state == ASM_STATE_PAUSE) {
-                                       if (rcv_sound_state == ASM_STATE_STOP) {
-                                               ret = __asm_change_session (rcv_request_id, rcv_sound_event, rcv_sound_state, rcv_resource, true, &need_to_resume);
-                                               if (ret) {
-                                                       debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-                                               } else {
-                                                       if (need_to_resume) {
-                                                               asm_paused_by_id_t paused_by_id;
-                                                               paused_by_id.pid = rcv_instance_id;
-                                                               paused_by_id.sound_handle = rcv_sound_handle;
-                                                               __asm_do_all_resume_callback(paused_by_id);
-                                                       }
-                                               }
-                                               /* Call session is changed in ASM_REQUEST_UNREGISTER */
-                                               if (rcv_sound_event != ASM_EVENT_CALL) { // exception case for the watch callback(STOP)
-                                                       ASM_DO_WATCH_CALLBACK(rcv_sound_event, rcv_sound_state);
-                                               }
-                                       }
-                               }
-                       }
-                       __temp_print_list("Set State (Not Play)");
-               }
-               break;
-
-       case ASM_REQUEST_GETSTATE:
-       {
-               asm_instance_list_t *asm_instance_h = NULL;
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-               if (asm_instance_h) {
-                       asm_snd_msg.data.result_sound_state = asm_instance_h->sound_state;
-                       asm_snd_msg.data.source_request_id = rcv_request_id;
-               }
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               break;
-       }
-
-       case ASM_REQUEST_GETMYSTATE:
-               __check_dead_process();
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               asm_snd_msg.data.result_sound_state = __asm_find_process_status(rcv_instance_id);
-               break;
-
-       case ASM_REQUEST_DUMP:
-               __temp_print_list("DUMP");
-               break;
-
-       case ASM_REQUEST_SET_SUBSESSION:
-               {
-                       subsession_t rcv_subsession = rcv_sound_event; //latest rcv_subsession is needed
-                       bool do_set_subsession = true;
-
-                       if (rcv_subsession < SUBSESSION_VOICE || rcv_subsession >= SUBSESSION_NUM) {
-                               debug_error (" Invalid subsession [%d] to set\n", rcv_subsession);
-                               break;
-                       }
-
-                       debug_warning (" ****** SUB-SESSION [%s] ******\n", subsession_str[rcv_subsession]);
-
-                       ASM_sound_events_t sound_event = __asm_find_event_of_handle(rcv_instance_id, rcv_sound_handle);
-                       switch (sound_event) {
-                       case ASM_EVENT_CALL:
-                       case ASM_EVENT_VIDEOCALL:
-                       case ASM_EVENT_VOIP:
-                       {
-                               if (rcv_subsession == SUBSESSION_VOICE) {
-                                       /*check camcoder status
-                                           special case check :
-                                           call  & camcorder EX session can be mixed in Call Ringtone subsession
-                                           but in Call Voice subsession case , camcorder should stop.*/
-                                       debug_warning("g_camcorder_ex_subsession %d", g_camcorder_ex_subsession);
-                                       if (g_camcorder_ex_subsession == SUBSESSION_RECORD_STEREO || g_camcorder_ex_subsession == SUBSESSION_RECORD_MONO) {
-                                               ___check_camcorder_status(rcv_instance_id, rcv_sound_handle, sound_event, rcv_sound_state, rcv_resource);
-                                       }
-                               }
-                               break;
-                       }
-                       case ASM_EVENT_VOICE_RECOGNITION:
-                       {
-                               int ret = 0;
-                               int session_order = -1;
-
-                               session_t cur_session;
-//                             MMSoundMgrSessionGetSession(&cur_session);
-                               debug_warning (" cur_session[%d] (0:MEDIA 1:VC 2:VT 3:VOIP 4:FM 5:NOTI 6:ALARM 7:EMER 8:VR)\n",cur_session);
-                               if (cur_session == SESSION_VOICECALL ||
-                                       cur_session == SESSION_VIDEOCALL ||
-                                       cur_session == SESSION_VOIP ) {
-                                       debug_warning (" skip REQUEST_SET_SUBSESSION\n");
-                                       do_set_subsession = false;
-                                       break;
-                               }
-                               if (cur_session != SESSION_VOICE_RECOGNITION &&
-                                       (rcv_subsession == SUBSESSION_VR_NORMAL || rcv_subsession == SUBSESSION_VR_DRIVE)) {
-                                       /* if current session is not for VR, so we need to set it first */
-                                       debug_warning (" ****** SESSION_VOICE_RECOGNITION start in REQUEST_SET_SUBSESSION ******\n");
-                                       session_order = SESSION_START;
-                               } else  if (cur_session == SESSION_VOICE_RECOGNITION && rcv_subsession == SUBSESSION_INIT) {
-                                       /* if current session is for VR, but user request set sub-session to NONE, so we need to end it */
-                                       debug_warning (" ****** SESSION_VOICE_RECOGNITION end in REQUEST_SET_SUBSESSION ******\n");
-                                       session_order = SESSION_END;
-                               }
-                               if (session_order != -1) {
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_VOICE_RECOGNITION, session_order);
-                                       if (ret) {
-                                               debug_error (" failed to MMSoundMgrSessionSetSession() for VOICE_RECOGNITION\n");
-                                               do_set_subsession = false;
-                                       } else {
-                                               if (session_order == SESSION_START) {
-                                                       SESSION_REF_INIT();
-                                                       SESSION_REF(SESSION_VOICE_RECOGNITION);
-                                               } else {
-                                                       SESSION_UNREF(SESSION_VOICE_RECOGNITION);
-                                               }
-                                       }
-                               }
-//                             MMSoundMgrSessionGetSession(&cur_session);
-                               debug_msg (" cur_session[%d] : leave", cur_session);
-                               break;
-                       }
-                       case ASM_EVENT_MMCAMCORDER_AUDIO:
-                       case ASM_EVENT_MMCAMCORDER_VIDEO:
-                       {
-                               int ret = 0;
-                               int session_order = -1;
-                               session_t cur_session;
-//                             MMSoundMgrSessionGetSession(&cur_session);
-                               debug_warning (" cur_session[%d] (0:MEDIA 1:VC 2:VT 3:VOIP 4:FM 5:NOTI 6:ALARM 7:EMER 8:VR)\n",cur_session);
-                               if (cur_session == SESSION_VOICECALL ||
-                                       cur_session == SESSION_VIDEOCALL ||
-                                       cur_session == SESSION_VOIP ) {
-                                       debug_warning (" skip REQUEST_SET_SUBSESSION\n");
-                                       do_set_subsession = false;
-                                       break;
-                               }
-                               if (cur_session != SESSION_MEDIA) {
-                                       /* if current session is not for MMCAMCOARDER_AUDIO/VIDEO, so we need to set it first */
-                                       debug_warning (" ****** SESSION_MEDIA start in REQUEST_SET_SUBSESSION ******\n");
-                                       session_order = SESSION_START;
-                               } else  if (cur_session == SESSION_MEDIA && rcv_subsession == SUBSESSION_INIT) {
-                                       /* if current session is for MMCAMCORDRE_AUDIO/VIDEO, but user request set sub-session to NONE, so we need to end it */
-                                       debug_warning (" ****** SESSION_MEDIA end(initialization) in REQUEST_SET_SUBSESSION ******\n");
-                                       session_order = SESSION_END;
-                               }
-                               if (session_order != -1) {
-//                                     ret = MMSoundMgrSessionSetSession(SESSION_MEDIA, session_order);
-                                       if (ret) {
-                                               debug_error (" failed to MMSoundMgrSessionSetSession() for MMCAMCORDER_AUDIO/VIDEO\n");
-                                               do_set_subsession = false;
-                                       }
-                               }
-//                             MMSoundMgrSessionGetSession(&cur_session);
-                               debug_msg (" cur_session[%d] : leave", cur_session);
-
-                               break;
-                       }
-                       default:
-                               if (sound_event == ASM_EVENT_NONE) {
-                                       debug_error (" Could not find event type of the handle(%d)\n", rcv_sound_handle);
-                               } else {
-                                       debug_error (" Not supported ASM Event(%s) for this SUBSESSION(%s)\n", ASM_sound_event_str[sound_event], subsession_str[rcv_subsession]);
-                               }
-                               do_set_subsession = false;
-                               break;
-                       }
-
-                       if (do_set_subsession) {
-                               int result_resource = ASM_RESOURCE_NONE;
-                               ASM_sound_events_t sound_event = __asm_find_event_of_handle(rcv_instance_id, rcv_sound_handle);
-
-                               /* resource converting for sub-session */
-                               asm_instance_h = __asm_find_list(rcv_sound_handle);
-                               if (asm_instance_h) {
-                                       switch (sound_event) {
-                                       default:
-                                               /* set resource of asm handle to rcv_resource forcedly */
-                                               result_resource = rcv_resource = asm_instance_h->mm_resource;
-                                               break;
-                                       }
-                               }
-
-//                             ret = MMSoundMgrSessionSetSubSession(rcv_subsession, result_resource);
-                               if (ret != MM_ERROR_NONE) {
-                                       /* TODO : Error Handling */
-                                       debug_error (" MMSoundMgrSessionSetSubSession failed....ret = [%x]\n", ret);
-                               } else {
-                                       if (rcv_subsession != SUBSESSION_RINGTONE) {
-                                               /*only keep for special case :
-                                               camcording ex subsession & call voice subsession : camcording stop,call play
-                                               camcording ex subsession & call ringtong subsession:    mix two session*/
-                                               g_camcorder_ex_subsession = rcv_subsession;
-                                       }
-                               }
-
-                               __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource);
-                               __temp_print_list("Set Sub-session");
-                       }
-
-                       /* Return result msg */
-                       ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               }
-               break;
-
-       case ASM_REQUEST_GET_SUBSESSION:
-               {
-                       subsession_t subsession = 0;
-
-                       /* FIXME: have to check only call instance with playing stsate can request this */
-                       debug_warning (" ****** GET SUB-SESSION ******\n");
-//                     ret = MMSoundMgrSessionGetSubSession(&subsession);
-                       if (ret != MM_ERROR_NONE) {
-                               /* TODO : Error Handling */
-                               debug_error (" MMSoundMgrSessionGetSubSession failed....ret = [%x]\n", ret);
-                       }
-
-                       /* Return result msg */
-                       asm_snd_msg.data.result_sound_command = subsession;
-                       ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               }
-               break;
-
-       case ASM_REQUEST_SET_SUBEVENT:
-       {
-               ASM_sound_sub_events_t rcv_subevent = rcv_sound_event; //latest rcv_subsession is needed
-               ASM_sound_events_t sound_event = ASM_EVENT_NONE;
-               if (rcv_subevent < ASM_SUB_EVENT_NONE || rcv_subevent >= ASM_SUB_EVENT_MAX) {
-                       debug_error (" Invalid sub-event type[%d] to set\n", rcv_subevent);
-               }
-               sound_event = __asm_find_event_of_handle(rcv_instance_id, rcv_sound_handle);
-
-               /* get previous sub-session option */
-               asm_instance_list_t *asm_instance_h = NULL;
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-               if (asm_instance_h) {
-                       switch (sound_event) {
-                       case ASM_EVENT_VOICE_RECOGNITION:
-                               if (asm_instance_h->option.pid == rcv_instance_id) {
-                                       rcv_resource = asm_instance_h->option.resource;
-                               }
-                               break;
-                       default:
-                               /* set resource of asm handle to rcv_resource forcedly */
-                               rcv_resource = asm_instance_h->mm_resource;
-                               break;
-                       }
-               }
-               debug_warning (" ****** SUB-EVENT [%s] ******\n", ASM_sound_sub_event_str[rcv_subevent]);
-               __asm_change_sub_event_list(rcv_instance_id, rcv_sound_handle, rcv_subevent);
-
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-
-               if (rcv_subevent == ASM_SUB_EVENT_NONE) {
-                       /* NOTE: special case, resume paused list here */
-                       asm_paused_by_id_t paused_by_id;
-                       paused_by_id.pid = rcv_instance_id;
-                       paused_by_id.sound_handle = rcv_sound_handle;
-                       __asm_do_all_resume_callback(paused_by_id);
-
-                       __asm_change_state_list(rcv_instance_id, rcv_sound_handle, rcv_sound_state, rcv_resource);
-
-               } else {
-                       __asm_compare_priority_matrix(&asm_snd_msg, asm_ret_msg,
-                                                                               rcv_instance_id, rcv_sound_handle, rcv_request_id, rcv_subevent-1, rcv_sound_state, rcv_resource);
-
-                       if (asm_snd_msg.data.result_sound_command == ASM_COMMAND_PLAY ||
-                               asm_snd_msg.data.result_sound_command == ASM_COMMAND_NONE) {
-
-                               ret = __asm_change_session (rcv_request_id, rcv_subevent, rcv_sound_state, rcv_resource, false, NULL);
-                               if (ret) {
-                                       debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-                               }
-                       }
-               }
-
-               __temp_print_list("Set Sub-event");
-               break;
-       }
-
-       case ASM_REQUEST_GET_SUBEVENT:
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               /* Return result msg */
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-               asm_snd_msg.data.result_sound_command = (asm_instance_h ? asm_instance_h->sound_sub_event : ASM_SUB_EVENT_NONE);
-               break;
-
-       case ASM_REQUEST_SET_SESSION_OPTIONS:
-       {
-               ASM_sound_events_t sound_event = ASM_EVENT_NONE;
-               int rcv_options = rcv_sound_event;
-               asm_instance_list_t *asm_instance_h = NULL;
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-               if (asm_instance_h) {
-                       sound_event = asm_instance_h->sound_event;
-
-                       /* validate options */
-                       if (!__is_valid_session_options(sound_event, rcv_options, &asm_snd_msg.data.error_code)) {
-                               /* not supported for this type */
-                               asm_snd_msg.data.result_sound_command = ASM_COMMAND_STOP;
-                       } else {
-                               g_handle_info[asm_instance_h->sound_handle].option_flags = rcv_options;
-                               asm_instance_h->option_flags = rcv_options;
-                               asm_snd_msg.data.result_sound_command = ASM_COMMAND_PLAY;
-                               /* TODO : do action according to these options */
-                       }
-
-               } else {
-                       asm_snd_msg.data.result_sound_command = ASM_COMMAND_STOP;
-                       asm_snd_msg.data.error_code = ERR_ASM_SERVER_HANDLE_IS_INVALID;
-               }
-
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               break;
-       }
-
-       case ASM_REQUEST_GET_SESSION_OPTIONS:
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               /* Return result msg */
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-               asm_snd_msg.data.option_flags = (asm_instance_h ? asm_instance_h->option_flags : 0);
-               if (!asm_instance_h) {
-                       asm_snd_msg.data.result_sound_command = ASM_COMMAND_STOP;
-               }
-               break;
-
-       case ASM_REQUEST_EMERGENT_EXIT:
-       {
-               asm_instance_h = __asm_find_list(rcv_sound_handle);
-               bool need_to_resume = false;
-
-               /* change session forcedly */
-               if (asm_instance_h && (asm_instance_h->sound_state == ASM_STATE_PLAYING || asm_instance_h->sound_state == ASM_STATE_PAUSE)) {
-                       ret = __asm_change_session (ASM_REQUEST_SETSTATE, rcv_sound_event, ASM_STATE_STOP,
-                                                       (asm_instance_h)? asm_instance_h->mm_resource : rcv_resource,
-                                                       true, &need_to_resume);
-                       if (ret) {
-                               debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-                       } else {
-                               if (need_to_resume) {
-                                       asm_paused_by_id_t paused_by_id;
-                                       paused_by_id.pid = rcv_instance_id;
-                                       paused_by_id.sound_handle = rcv_sound_handle;
-                                       __asm_do_all_resume_callback(paused_by_id);
-                               }
-                       }
-               }
-               ret = __asm_change_session (ASM_REQUEST_UNREGISTER, rcv_sound_event, rcv_sound_state,
-                                                               (asm_instance_h)? asm_instance_h->mm_resource : rcv_resource,
-                                                               true, &need_to_resume);
-               if (ret) {
-                       debug_error (" failed to __asm_change_session(), error(0x%x)", ret);
-               } else {
-                       if (need_to_resume) {
-                               asm_paused_by_id_t paused_by_id;
-                               paused_by_id.pid = rcv_instance_id;
-                               paused_by_id.sound_handle = rcv_sound_handle;
-                               __asm_do_all_resume_callback(paused_by_id);
-                       }
-               }
-               __emergent_exit(rcv_instance_id);
-       }
-               break;
-
-       case ASM_REQUEST_REGISTER_WATCHER:
-               debug_log (" ****** REQUEST_REGISTER_WATCHER ******\n");
-               __check_dead_process();
-
-               /* check if it is redundant */
-               if (__is_it_redundant_request(rcv_instance_id, rcv_sound_event, rcv_sound_state)) {
-                       debug_error (" it is redundant request for adding watch list...");
-                       return false;
-               }
-
-               __asm_get_empty_handle(rcv_instance_id, &rcv_sound_handle);
-               if (rcv_sound_handle == ASM_HANDLE_INIT_VAL) {
-                       ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, ASM_HANDLE_INIT_VAL, ASM_HANDLE_INIT_VAL, rcv_request_id);
-               } else {
-                       ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-                       asm_snd_msg.data.result_sound_command = ASM_COMMAND_PLAY;
-                       asm_snd_msg.data.result_sound_state = rcv_sound_state;
-                       __asm_register_list(rcv_instance_id, rcv_sound_handle, rcv_sound_event, rcv_sound_state, 0, true);
-               }
-               break;
-
-       case ASM_REQUEST_UNREGISTER_WATCHER:
-               debug_log (" ****** REQUEST_UNREGISTER_WATCHER ******\n");
-               __asm_unregister_list(rcv_sound_handle);
-               break;
-
-       case ASM_REQUEST_RESET_RESUME_TAG:
-       {
-               int found_pid = -1;
-               debug_log (" ****** REQUEST_RESET_RESUME_TAG ******\n");
-               found_pid = __asm_find_pid_of_resume_tagged(rcv_sound_handle);
-               if (found_pid == -1) {
-                       debug_warning (" could not find any pid tagged for resumption");
-               } else {
-                       __reset_resume_check(found_pid, rcv_sound_handle);
-               }
-               ASM_SND_MSG_SET_DEFAULT(asm_snd_msg, rcv_instance_id, rcv_sound_handle, rcv_sound_handle, rcv_request_id);
-               asm_snd_msg.data.result_sound_command = ASM_COMMAND_PLAY;
-               asm_snd_msg.data.result_sound_state = rcv_sound_state;
-               break;
-       }
-
-       default:
-               break;
-       }
-
-       if (asm_ret_msg) {
-               *asm_ret_msg = asm_snd_msg;
-       }
-
-       pthread_mutex_unlock(&g_mutex_asm);
-       debug_log (" ===================================================================== End (UNLOCKED) ");
-
-       return ret;
-}
-
-int MMSoundMgrASMInit(void)
-{
-       int ret = 0;
-       debug_fenter();
-
-       signal(SIGPIPE, SIG_IGN);
-
-       if (vconf_set_int(SOUND_STATUS_KEY, 0)) {
-               debug_error(" vconf_set_int fail\n");
-               if (vconf_set_int(SOUND_STATUS_KEY, 0)) {
-                       debug_error(" vconf_set_int fail\n");
-               }
-       }
-
-       debug_fleave();
-       return ret;
-}
-
-int MMSoundMgrASMFini(void)
-{
-       debug_fenter();
-
-       debug_fleave();
-       return MM_ERROR_NONE;
-}
-
index 9e3d84e..888aa65 100644 (file)
 #include "../include/mm_sound_msg.h"
 //#include "include/mm_sound_thread_pool.h"
 #include "include/mm_sound_mgr_codec.h"
-#include "include/mm_sound_mgr_asm.h"
 #include <mm_error.h>
 #include <mm_debug.h>
 
-#include <audio-session-manager.h>
-
 #include <gio/gio.h>
 
 #define SHM_OPEN
@@ -64,7 +61,6 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
        mmsound_mgr_codec_param_t param = {0,};
        MMSourceType *source = NULL;
        int ret = MM_ERROR_NONE;
-       int mm_session_type = MM_SESSION_TYPE_MEDIA;
 
        /* Set source */
        source = (MMSourceType*)malloc(sizeof(MMSourceType));
@@ -88,7 +84,7 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
        param.volume = volume;
        param.volume_config = volume_config;
        param.priority = priority;
-       mm_session_type = session_type;
+       param.session_type = session_type;
        param.param = (void*)client_pid;
        param.source = source;
        param.handle_route = handle_route;
@@ -109,33 +105,6 @@ int _MMSoundMgrIpcPlayFile(char* filename,int tone, int repeat, int volume, int
                        (int)param.param, param.source->type, param.source->ptr, param.keytone, param.handle_route, param.enable_session);
                        */
 
-       //convert mm_session_type to asm_event_type
-       switch(mm_session_type)
-       {
-       case MM_SESSION_TYPE_MEDIA:
-               param.session_type = ASM_EVENT_MEDIA_MMSOUND;
-               break;
-       case MM_SESSION_TYPE_NOTIFY:
-               param.session_type = ASM_EVENT_NOTIFY;
-               break;
-       case MM_SESSION_TYPE_ALARM:
-               param.session_type = ASM_EVENT_ALARM;
-               break;
-       case MM_SESSION_TYPE_EMERGENCY:
-               param.session_type = ASM_EVENT_EMERGENCY;
-               break;
-       case MM_SESSION_TYPE_VIDEOCALL:
-               param.session_type = ASM_EVENT_VIDEOCALL;
-               break;
-       case MM_SESSION_TYPE_VOIP:
-               param.session_type = ASM_EVENT_VOIP;
-               break;
-       default:
-               debug_error("Unknown session type - use default shared type. %s %d\n", __FUNCTION__, __LINE__);
-               param.session_type = ASM_EVENT_MEDIA_MMSOUND;
-               break;
-       }
-
        ret = MMSoundMgrCodecPlay(codechandle, &param);
        if (ret != MM_ERROR_NONE) {
                debug_error("Will be closed a sources, codechandle : 0x%08X\n", *codechandle);
@@ -246,41 +215,12 @@ int _MMSoundMgrIpcPlayDTMF(int tone, int repeat, int volume, int volume_config,
        param.volume_config = volume_config;
        param.priority = 0;
        param.param = (void*)client_pid;
+       param.session_type = session_type;
        param.session_options = session_options;
        param.enable_session = enable_session;
        param.stream_index = stream_index;
        strncpy(param.stream_type, stream_type, MM_SOUND_STREAM_TYPE_LEN);
 
-       //convert mm_session_type to asm_event_type
-       switch(session_type)
-       {
-               case MM_SESSION_TYPE_MEDIA:
-                       param.session_type = ASM_EVENT_MEDIA_MMSOUND;
-                       break;
-               case MM_SESSION_TYPE_NOTIFY:
-                       param.session_type = ASM_EVENT_NOTIFY;
-                       break;
-               case MM_SESSION_TYPE_ALARM:
-                       param.session_type = ASM_EVENT_ALARM;
-                       break;
-               case MM_SESSION_TYPE_EMERGENCY:
-                       param.session_type = ASM_EVENT_EMERGENCY;
-                       break;
-               case MM_SESSION_TYPE_CALL:
-                       param.session_type = ASM_EVENT_CALL;
-                       break;
-               case MM_SESSION_TYPE_VIDEOCALL:
-                       param.session_type = ASM_EVENT_VIDEOCALL;
-                       break;
-               case MM_SESSION_TYPE_VOIP:
-                       param.session_type = ASM_EVENT_VOIP;
-                       break;
-               default:
-                       debug_error("Unknown session type - use default media type. %s %d\n", __FUNCTION__, __LINE__);
-                       param.session_type = ASM_EVENT_MEDIA_MMSOUND;
-                       break;
-       }
-
        debug_msg("DTMF %d\n", param.tone);
        debug_msg("Loop %d\n", param.repeat_count);
        debug_msg("Volume %d\n",param.volume);
@@ -364,182 +304,6 @@ int __mm_sound_mgr_ipc_get_current_connected_device_list(int device_flags, mm_so
        return ret;
 }
 
-/************************************** ASM ***************************************/
-int __mm_sound_mgr_ipc_asm_register_sound(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-#ifdef SUPPORT_CONTAINER
-                                               const char* container_name, int container_pid,
-#endif
-                                         int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                         int* request_id_r, int* sound_command_r, int* sound_state_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_register_sound(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, sound_state_r);
-#ifdef SUPPORT_CONTAINER
-       _mm_sound_mgr_asm_update_container_data(*alloc_handle_r, container_name, container_pid);
-#endif
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_unregister_sound(int pid, int handle, int sound_event, int request_id, int sound_state, int resource)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_unregister_sound(pid, handle, sound_event, request_id, sound_state, resource);
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_register_watcher(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-#ifdef SUPPORT_CONTAINER
-                                               const char* container_name, int container_pid,
-#endif
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* sound_state_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_register_watcher(pid, handle, sound_event, request_id, sound_state, resource,
-                                                 pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, sound_state_r);
-#ifdef SUPPORT_CONTAINER
-       _mm_sound_mgr_asm_update_container_data(*alloc_handle_r, container_name, container_pid);
-#endif
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_unregister_watcher(int pid, int handle, int sound_event, int request_id, int sound_state, int resource)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_unregister_watcher(pid, handle, sound_event, request_id, sound_state, resource);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_get_mystate(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_state_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_get_mystate(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_state_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_set_state(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* sound_state_r , int* error_code_r)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_set_state(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, sound_state_r, error_code_r);
-
-       return ret;
-}
-
-
-int __mm_sound_mgr_ipc_asm_get_state(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_state_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_get_state(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_state_r);
-
-       return ret;
-}
-int __mm_sound_mgr_ipc_asm_set_subsession(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r, int* request_id_r)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_set_subsession(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     pid_r, alloc_handle_r, cmd_handle_r, request_id_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_get_subsession(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r, int* request_id_r, int* sound_command_r)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_get_subsession(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_set_subevent(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* sound_state_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_set_subevent(pid, handle, sound_event, request_id, sound_state, resource,
-                                                  pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, sound_state_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_get_subevent(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_get_subevent(pid, handle, sound_event, request_id, sound_state, resource,
-                                                  pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_set_session_option(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* error_code_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_set_session_option(pid, handle, sound_event, request_id, sound_state, resource,
-                                               pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, error_code_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_get_session_option(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* option_flag_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_get_session_option(pid, handle, sound_event, request_id, sound_state, resource,
-                                            pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, option_flag_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_reset_resume_tag(int pid, int handle, int sound_event, int request_id, int sound_state, int resource,
-                                           int* pid_r, int* alloc_handle_r, int* cmd_handle_r,
-                                           int* request_id_r, int* sound_command_r, int* sound_state_r )
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_reset_resume_tag(pid, handle, sound_event, request_id, sound_state, resource,
-                                         pid_r, alloc_handle_r, cmd_handle_r, request_id_r, sound_command_r, sound_state_r);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_dump(int pid, int handle, int sound_event, int request_id, int sound_state, int resource)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_dump(pid, handle, sound_event, request_id, sound_state, resource);
-
-       return ret;
-}
-
-int __mm_sound_mgr_ipc_asm_emergent_exit(int pid, int handle, int sound_event, int request_id, int sound_state)
-{
-       int ret = MM_ERROR_NONE;
-       ret = _mm_sound_mgr_asm_emergent_exit(pid, handle, sound_event, request_id, sound_state);
-
-       return ret;
-}
-
-/**********************************************************************************/
-
-
 /******************************************************************************************
        Functions For Server-Side to notify Clients
 ******************************************************************************************/
index a89b8da..609ce55 100644 (file)
@@ -30,9 +30,6 @@
 #define PROC_DBUS_INTERFACE    "org.tizen.resourced.process"
 #define PROC_DBUS_METHOD       "ProcExclude"
 
-#define OBJECT_ASM "/org/tizen/asm"
-#define INTERFACE_ASM "org.tizen.asm"
-
 /* Introspection data for the service we are exporting */
   static const gchar introspection_xml[] =
   "<node>"
   "      <arg type='i' name='device_in' direction='out'/>"
   "      <arg type='i' name='device_out' direction='out'/>"
   "    </method>"
-  "    <method name='ASMRegisterSound'>"
-#ifdef SUPPORT_CONTAINER
-#ifdef USE_SECURITY
-  "      <arg name='container' type='ay' direction='in'/>"
-#else
-  "      <arg name='container' type='s' direction='in'/>"
-#endif
-#endif
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMUnregisterSound'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "    </method>"
-  "    <method name='ASMRegisterWatcher'>"
-#ifdef SUPPORT_CONTAINER
-#ifdef USE_SECURITY
-  "      <arg name='container' type='ay' direction='in'/>"
-#else
-  "      <arg name='container' type='s' direction='in'/>"
-#endif
-#endif
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMUnregisterWatcher'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "    </method>"
-  "    <method name='ASMGetMyState'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMGetState'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMSetState'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "      <arg name='snd_error_code' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMSetSubsession'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMGetSubsession'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMSetSubevent'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMGetSubevent'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMSetSessionOption'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMGetSessionOption'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_option_flag' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMResetResumeTag'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "      <arg name='snd_pid' type='i' direction='out'/>"
-  "      <arg name='snd_alloc_handle' type='i' direction='out'/>"
-  "      <arg name='snd_cmd_handle' type='i' direction='out'/>"
-  "      <arg name='snd_request_id' type='i' direction='out'/>"
-  "      <arg name='snd_sound_command' type='i' direction='out'/>"
-  "      <arg name='snd_sound_state' type='i' direction='out'/>"
-  "    </method>"
-  "    <method name='ASMDump'>"
-  "      <arg name='rcv_pid' type='i' direction='in'/>"
-  "      <arg name='rcv_handle' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_event' type='i' direction='in'/>"
-  "      <arg name='rcv_request_id' type='i' direction='in'/>"
-  "      <arg name='rcv_sound_state' type='i' direction='in'/>"
-  "      <arg name='rcv_resource' type='i' direction='in'/>"
-  "    </method>"
   "  </interface>"
   "</node>";
 GDBusConnection* conn_g;
@@ -341,26 +137,10 @@ static void handle_method_set_sound_path_for_active_device(GDBusMethodInvocation
 static void handle_method_get_audio_path(GDBusMethodInvocation* invocation);
 static void handle_method_get_connected_device_list(GDBusMethodInvocation* invocation);
 
-static void handle_method_asm_register_sound(GDBusMethodInvocation* invocation);
-static void handle_method_asm_unregister_sound(GDBusMethodInvocation* invocation);
-static void handle_method_asm_register_watcher(GDBusMethodInvocation* invocation);
-static void handle_method_asm_unregister_watcher(GDBusMethodInvocation* invocation);
-static void handle_method_asm_get_mystate(GDBusMethodInvocation* invocation);
-static void handle_method_asm_get_state(GDBusMethodInvocation* invocation);
-static void handle_method_asm_set_state(GDBusMethodInvocation* invocation);
-static void handle_method_asm_set_subsession(GDBusMethodInvocation* invocation);
-static void handle_method_asm_get_subsession(GDBusMethodInvocation* invocation);
-static void handle_method_asm_set_subevent(GDBusMethodInvocation* invocation);
-static void handle_method_asm_get_subevent(GDBusMethodInvocation* invocation);
-static void handle_method_asm_set_session_option(GDBusMethodInvocation* invocation);
-static void handle_method_asm_get_session_option(GDBusMethodInvocation* invocation);
-static void handle_method_asm_reset_resume_tag(GDBusMethodInvocation* invocation);
-static void handle_method_asm_dump(GDBusMethodInvocation* invocation);
-
 /* Currently , Just using method's name and handler */
 /* TODO : generate introspection xml automatically, with these value include argument and reply */
 /* TODO : argument check with these information */
-/* TODO : divide object and interface with features (ex. play, path, device, focus, asm) */
+/* TODO : divide object and interface with features (ex. play, path, device) */
 struct mm_sound_dbus_method methods[METHOD_CALL_MAX] = {
        [METHOD_CALL_TEST] = {
                .info = {
@@ -428,96 +208,6 @@ struct mm_sound_dbus_method methods[METHOD_CALL_MAX] = {
                },
                .handler = handle_method_get_connected_device_list
        },
-       [METHOD_CALL_ASM_REGISTER_SOUND] = {
-               .info = {
-                       .name = "ASMRegisterSound",
-               },
-               .handler = handle_method_asm_register_sound
-       },
-       [METHOD_CALL_ASM_UNREGISTER_SOUND] = {
-               .info = {
-                       .name = "ASMUnregisterSound",
-               },
-               .handler = handle_method_asm_unregister_sound
-       },
-       [METHOD_CALL_ASM_REGISTER_WATCHER] = {
-               .info = {
-                       .name = "ASMRegisterWatcher",
-               },
-               .handler = handle_method_asm_register_watcher
-       },
-       [METHOD_CALL_ASM_UNREGISTER_WATCHER] = {
-               .info = {
-                       .name = "ASMUnregisterWatcher",
-               },
-               .handler = handle_method_asm_unregister_watcher
-       },
-       [METHOD_CALL_ASM_GET_MYSTATE] = {
-               .info = {
-                       .name = "ASMGetMyState",
-               },
-               .handler = handle_method_asm_get_mystate
-       },
-       [METHOD_CALL_ASM_GET_STATE] = {
-               .info = {
-                       .name = "ASMGetState",
-               },
-               .handler = handle_method_asm_get_state
-       },
-       [METHOD_CALL_ASM_SET_STATE] = {
-               .info = {
-                       .name = "ASMSetState",
-               },
-               .handler = handle_method_asm_set_state
-       },
-       [METHOD_CALL_ASM_SET_SUBSESSION] = {
-               .info = {
-                       .name = "ASMSetSubsession",
-               },
-               .handler = handle_method_asm_set_subsession
-       },
-       [METHOD_CALL_ASM_GET_SUBSESSION] = {
-               .info = {
-                       .name = "ASMGetSubsession",
-               },
-               .handler = handle_method_asm_get_subsession
-       },
-       [METHOD_CALL_ASM_SET_SUBEVENT] = {
-               .info = {
-                       .name = "ASMSetSubevent",
-               },
-               .handler = handle_method_asm_set_subevent
-       },
-       [METHOD_CALL_ASM_GET_SUBEVENT] = {
-               .info = {
-                       .name = "ASMGetSubevent",
-               },
-               .handler = handle_method_asm_get_subevent
-       },
-       [METHOD_CALL_ASM_SET_SESSION_OPTION] = {
-               .info = {
-                       .name = "ASMSetSessionOption",
-               },
-               .handler = handle_method_asm_set_session_option
-       },
-       [METHOD_CALL_ASM_GET_SESSION_OPTION] = {
-               .info = {
-                       .name = "ASMGetSessionOption",
-               },
-               .handler = handle_method_asm_get_session_option
-       },
-       [METHOD_CALL_ASM_RESET_RESUME_TAG] = {
-               .info = {
-                       .name = "ASMResetResumeTag",
-               },
-               .handler = handle_method_asm_reset_resume_tag
-       },
-       [METHOD_CALL_ASM_DUMP] = {
-               .info = {
-                       .name = "ASMDump",
-               },
-               .handler = handle_method_asm_dump
-       },
 };
 
 struct mm_sound_dbus_signal signals[SIGNAL_MAX] = {
@@ -1008,529 +698,6 @@ send_reply:
        }
 }
 
-/*********************** ASM METHODS ****************************/
-
-#ifdef SUPPORT_CONTAINER
-#ifdef USE_SECURITY
-static char* _get_container_from_cookie(GVariant* cookie_data)
-{
-       char* container = NULL;
-       int cookie_len = 0;
-       char* cookie = NULL;
-       int ret = 0;
-
-       cookie_len = g_variant_get_size(cookie_data);
-       if (cookie_len != COOKIE_SIZE) {
-               debug_error ("cookie_len = [%d]", cookie_len);
-               return NULL;
-       }
-
-       ret = security_server_get_zone_by_cookie(g_variant_get_data(cookie_data), &container);
-       if (ret == SECURITY_SERVER_API_SUCCESS) {
-               debug_error ("success!!!! zone = [%s]", container);
-       } else {
-               debug_error ("failed!!!! ret = [%d]", ret);
-       }
-
-       return container;
-}
-#endif /* USE_SECURITY */
-#endif /* SUPPORT_CONTAINER */
-
-// TODO : Too many arguments..
-static void handle_method_asm_register_sound(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
-       GVariant *params = NULL;
-#ifdef SUPPORT_CONTAINER
-       int container_pid = -1;
-       char* container = NULL;
-#ifdef USE_SECURITY
-       GVariant* cookie_data;
-#endif /* USE_SECURITY */
-#else
-       int pid = 0;
-#endif /* SUPPORT_CONTAINER */
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-#ifdef SUPPORT_CONTAINER
-#ifdef USE_SECURITY
-       g_variant_get(params, "(@ayiiiiii)", &cookie_data, &container_pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       container = _get_container_from_cookie(cookie_data);
-       ret = __mm_sound_mgr_ipc_asm_register_sound(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                       container, container_pid, &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-       if (container)
-               free(container);
-#else /* USE_SECURITY */
-       g_variant_get(params, "(siiiiii)", &container, &container_pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_register_sound(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                       container, container_pid, &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-#endif /* USE_SECURITY */
-#else /* SUPPORT_CONTAINER */
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_register_sound(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                       &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-#endif /* SUPPORT_CONTAINER */
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r, sound_command_r, sound_state_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_unregister_sound(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_unregister_sound(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_register_watcher(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
-       GVariant *params = NULL;
-#ifdef SUPPORT_CONTAINER
-       int container_pid = -1;
-       char* container = NULL;
-#ifdef USE_SECURITY
-       GVariant* cookie_data;
-#endif /* USE_SECURITY */
-#else
-       int pid = 0;
-#endif /* SUPPORT_CONTAINER */
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-#ifdef SUPPORT_CONTAINER
-#ifdef USE_SECURITY
-       g_variant_get(params, "(@ayiiiiii)", &cookie_data, &container_pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       container = _get_container_from_cookie(cookie_data);
-       ret = __mm_sound_mgr_ipc_asm_register_watcher(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                               container, container_pid, &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-       if (container)
-               free(container);
-#else /* USE_SECURITY */
-       g_variant_get(params, "(siiiiii)", &container, &container_pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_register_watcher(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                       container, container_pid, &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-#endif /* USE_SECURITY */
-#else /* SUPPORT_CONTAINER */
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_register_watcher(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                       &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-#endif /* SUPPORT_CONTAINER */
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r, sound_command_r, sound_state_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_unregister_watcher(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_unregister_watcher(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_get_mystate(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_state_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_get_mystate(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                                     &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_state_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r, sound_state_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_set_state(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0, error_code_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_set_state(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                                     &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r, &error_code_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r, sound_command_r, sound_state_r, error_code_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_get_state(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_state_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_get_state(pid, handle, sound_event, request_id, sound_state, resource,
-                                                     &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_state_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r, sound_state_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_set_subsession(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_set_subsession(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                                     &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_get_subsession(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_get_subsession(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                                     &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                   request_id_r, sound_command_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_set_subevent(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_set_subevent(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                                  &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                request_id_r, sound_command_r, sound_state_r));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_get_subevent(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_get_subevent(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                                  &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                                request_id_r, sound_command_r ));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_set_session_option(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, error_code_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_set_session_option(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                               &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &error_code_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                             request_id_r, sound_command_r, error_code_r ));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_get_session_option(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, option_flag_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_get_session_option(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                            &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &option_flag_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                          request_id_r, sound_command_r, option_flag_r ));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_reset_resume_tag(GDBusMethodInvocation* invocation)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       int pid_r = 0, alloc_handle_r = 0, cmd_handle_r = 0, request_id_r = 0, sound_command_r = 0, sound_state_r = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_reset_resume_tag(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource,
-                                         &pid_r, &alloc_handle_r, &cmd_handle_r, &request_id_r, &sound_command_r, &sound_state_r);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("(iiiiii)", pid_r, alloc_handle_r, cmd_handle_r,
-                                                       request_id_r, sound_command_r, sound_state_r ));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-static void handle_method_asm_dump(GDBusMethodInvocation* invocation)
-{
-
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0, resource = 0;
-       GVariant *params = NULL;
-
-       debug_fenter();
-
-       if (!(params = g_dbus_method_invocation_get_parameters(invocation))) {
-               debug_error("Parameter for Method is NULL");
-               ret = MM_ERROR_SOUND_INTERNAL;
-               goto send_reply;
-       }
-
-       g_variant_get(params, "(iiiiii)", &pid, &handle, &sound_event, &request_id, &sound_state, &resource);
-       ret = __mm_sound_mgr_ipc_asm_dump(_get_sender_pid(invocation), handle, sound_event, request_id, sound_state, resource);
-
-send_reply:
-       if (ret == MM_ERROR_NONE) {
-               _method_call_return_value(invocation, g_variant_new("()"));
-       } else {
-               _method_call_return_error(invocation, ret);
-       }
-
-       debug_fleave();
-}
-
-/****************************************************************/
-
-
 static void handle_method_call(GDBusConnection *connection,
                                                        const gchar *sender,
                                                        const gchar *object_path,
@@ -1588,61 +755,9 @@ static const GDBusInterfaceVTable interface_vtable =
        handle_set_property
 };
 
-static void handle_signal_asm_emergent_exit(GVariant* params, gpointer user_data)
-{
-       int ret = MM_ERROR_NONE;
-       int pid = 0, handle = 0, sound_event = 0, request_id = 0, sound_state = 0;
-
-       debug_fenter();
-
-       if (!params) {
-               debug_error("Invalid Parameters");
-               return;
-       }
-
-       g_variant_get(params, "(iiiii)", &pid, &handle, &sound_event, &request_id, &sound_state);
-       ret = __mm_sound_mgr_ipc_asm_emergent_exit(pid, handle, sound_event, request_id, sound_state);
-
-       if (ret == MM_ERROR_NONE)
-               debug_error("ASM emergent exit, successfully handled");
-       else
-               debug_error("ASM emergent exit, handle failed, ret : 0x%X", ret);
-
-       debug_fleave();
-}
-
-static void handle_signal(GDBusConnection  *connection,
-                                     const gchar      *sender_name,
-                                     const gchar      *object_path,
-                                     const gchar      *interface_name,
-                                     const gchar      *signal_name,
-                                     GVariant         *params,
-                                     gpointer          user_data)
-{
-       if (!object_path || !interface_name || !signal_name) {
-               debug_error("Invalid Parameters");
-               return;
-       }
-
-       debug_log("Got Signal : Object '%s, Interface '%s', Signal '%s'", object_path, interface_name, signal_name);
-
-       if (!g_strcmp0(object_path, OBJECT_ASM)) {
-               if (!g_strcmp0(interface_name, INTERFACE_ASM) && !g_strcmp0(signal_name, "EmergentExit")) {
-                       debug_log("handle signal '%s.%s'", interface_name, signal_name);
-                       handle_signal_asm_emergent_exit(params, user_data);
-               } else {
-                       debug_log("Unknown Signal '%s.%s'", interface_name, signal_name);
-               }
-       } else {
-               debug_log("Unknown Object '%s'", object_path);
-       }
-}
-
-
 static void on_bus_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
 {
        guint reg_id;
-       guint subs_id;
        debug_log("Bus Acquired (%s)", name);
 
        conn_g = connection;
@@ -1658,13 +773,6 @@ static void on_bus_acquired(GDBusConnection *connection, const gchar *name, gpoi
                return ;
        }
 
-       subs_id = g_dbus_connection_signal_subscribe(connection, NULL, INTERFACE_ASM, "EmergentExit", OBJECT_ASM, \
-                        NULL, G_DBUS_SIGNAL_FLAGS_NONE, handle_signal, NULL, NULL );
-
-       if (!subs_id) {
-               debug_error ("g_dbus_connection_signal_subscribe() failed ");
-               return;
-       }
 }
 
 static void on_name_acquired(GDBusConnection *connection, const gchar *name, gpointer user_data)
index 00465c5..7d94365 100644 (file)
@@ -48,8 +48,6 @@
 #include "include/mm_sound_mgr_codec.h"
 #include "include/mm_sound_mgr_ipc.h"
 #include "include/mm_sound_mgr_ipc_dbus.h"
-#include "include/mm_sound_mgr_asm.h"
-#include <audio-session-manager.h>
 
 #include <glib.h>
 
@@ -165,7 +163,6 @@ int main(int argc, char **argv)
                MMSoundMgrRunInit(serveropt.plugdir);
                MMSoundMgrCodecInit(serveropt.plugdir);
                MMSoundMgrDbusInit();
-               MMSoundMgrASMInit();
        }
 
        debug_warning("sound_server [%d] initialization complete...now, start running!!\n", getpid());
@@ -196,8 +193,6 @@ int main(int argc, char **argv)
                MMSoundMgrCodecFini();
                MMSoundMgrRunFini();
                MMSoundThreadPoolFini();
-
-               MMSoundMgrASMFini();
        }
 
        debug_warning("sound_server [%d] exit ----------------- END \n", getpid());
index 979ccdb..aa33ded 100755 (executable)
@@ -46,7 +46,6 @@
 #include <dirent.h>
 #include <vconf.h>
 #include <mm_session_private.h>
-#include <audio-session-manager-types.h>
 
 #define POWERON_FILE   "/usr/share/feedback/sound/operation/power_on.wav"
 #define KEYTONE_FILE   "/usr/share/feedback/sound/operation/operation.wav"
@@ -264,7 +263,6 @@ static void displaymenu()
                g_print("N : Notification start \n");
                g_print("n : VOIP start \t");
                g_print("v : Session end   \t");
-               g_print("V : Current Status \n");
                g_print("==================================================================\n");
                g_print("       Audio device APIs\n");
                g_print("==================================================================\n");
@@ -1577,44 +1575,6 @@ static void interpret (char *cmd)
                        }
                }
 
-               else if(strncmp(cmd, "V", 1) == 0) {
-                       int value;
-                       if(vconf_get_int(SOUND_STATUS_KEY, &value)) {
-                               g_print("Can not get %s\n", SOUND_STATUS_KEY);
-                       }
-                       else
-                       {
-                               if(value == ASM_STATUS_NONE || value == ASM_STATUS_MONITOR)
-                               {
-                                       g_print("No Session Instance\n");
-                               }
-                               if(value & ASM_STATUS_MEDIA_MMPLAYER) {
-                                       g_print("MEDIA - PLAYER\n");
-                               }
-                               if(value & ASM_STATUS_MEDIA_MMSOUND) {
-                                       g_print("MEDIA - SOUND\n");
-                               }
-                               if(value & ASM_STATUS_MEDIA_OPENAL) {
-                                       g_print("MEDIA - OPENAL\n");
-                               }
-                               if(value & ASM_STATUS_NOTIFY) {
-                                       g_print("NOTIFY\n");
-                               }
-                               if(value & ASM_STATUS_ALARM) {
-                                       g_print("ALARM\n");
-                               }
-                               if(value & ASM_STATUS_CALL) {
-                                       g_print("CALL\n");
-                               }
-                               if(value & ASM_STATUS_VIDEOCALL) {
-                                       g_print("VIDEOCALL\n");
-                               }
-                               if(value & ASM_STATUS_VOIP) {
-                                       g_print("VOIP\n");
-                               }
-                       }
-               }
-
                else if(strncmp(cmd, "L", 1) == 0) {
                        int ret = 0;
                        mm_sound_device_flags_e flags = MM_SOUND_DEVICE_ALL_FLAG;