Rename change_system_volume to set_background_volume
authorJi-hoon Lee <dalton.lee@samsung.com>
Tue, 10 Sep 2019 11:38:59 +0000 (20:38 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 11 Sep 2019 04:39:46 +0000 (13:39 +0900)
Change-Id: I783e088153afbe99da30f56207368d3e852b2d3c

24 files changed:
inc/multi_assistant_main.h
inc/multi_assistant_service.h
inc/multi_assistant_service_plugin.h
plugins/wakeup-manager/dependency-default/inc/dependency_default.h
plugins/wakeup-manager/dependency-default/inc/dependency_default_audio.h
plugins/wakeup-manager/dependency-default/src/dependency_default.cpp
plugins/wakeup-manager/dependency-default/src/dependency_default_audio.cpp
plugins/wakeup-manager/dependency-tv/inc/dependency_tv.h
plugins/wakeup-manager/dependency-tv/inc/dependency_tv_audio.h
plugins/wakeup-manager/dependency-tv/src/dependency_tv.cpp
plugins/wakeup-manager/dependency-tv/src/dependency_tv_audio.cpp
plugins/wakeup-manager/inc/dependency_resolver.h
plugins/wakeup-manager/inc/wakeup_audio_manager.h
plugins/wakeup-manager/inc/wakeup_manager.h
plugins/wakeup-manager/inc/wakeup_manager_wrapper.h
plugins/wakeup-manager/src/dependency_resolver.cpp
plugins/wakeup-manager/src/wakeup_audio_manager.cpp
plugins/wakeup-manager/src/wakeup_manager.cpp
plugins/wakeup-manager/src/wakeup_manager_wrapper.cpp
src/multi_assistant_dbus.c
src/multi_assistant_dbus_server.c
src/multi_assistant_dbus_server.h
src/multi_assistant_service.c
src/multi_assistant_service_plugin.c

index 5c2e7eb..6a40549 100644 (file)
@@ -62,7 +62,7 @@
 #define MA_METHOD_STOP_STREAMING_AUDIO_DATA                    "ma_method_stop_streaming_audio_data"
 #define MA_METHOD_UPDATE_VOICE_FEEDBACK_STATE          "ma_method_update_voice_feedback_state"
 #define MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND      "ma_method_send_assistant_specific_command"
-#define MA_METHOD_CHANGE_SYSTEM_VOLUME                         "ma_method_change_system_volume"
+#define MA_METHOD_SET_BACKGROUND_VOLUME                                "ma_method_set_background_volume"
 #define MA_METHOD_ERROR                                                                "ma_method_error"
 
 #define MA_UI_METHOD_INITIALIZE                                                "ma_ui_method_initialize"
index 0e0c51c..c3b1c69 100644 (file)
@@ -51,6 +51,8 @@ int mas_client_update_voice_feedback_state(int pid, int state);
 
 int mas_client_send_assistant_specific_command(int pid, const char *command);
 
+int mas_client_set_background_volume(int pid, double ratio);
+
 int mas_client_update_recognition_result(int pid, int result);
 
 int mas_ui_client_initialize(int pid);
index b23ee3e..7b686d4 100644 (file)
@@ -61,7 +61,7 @@ int multi_assistant_service_plugin_update_voice_feedback_state(const char* appid
 
 int multi_assistant_service_plugin_send_assistant_specific_command(const char *appid, const char* command);
 
-int multi_assistant_service_plugin_change_system_volume(const char *appid, int event);
+int multi_assistant_service_plugin_set_background_volume(const char *appid, double ratio);
 
 int multi_assistant_service_plugin_update_recognition_result(const char* appid, int result);
 
@@ -124,8 +124,8 @@ typedef int (*wakeup_manager_deactivate)(void);
 typedef int (*wakeup_manager_update_voice_feedback_state)(const char* appid, int state);
 #define MA_WAKEUP_MANAGER_FUNC_SEND_ASSISTANT_SPECIFIC_COMMAND "wakeup_manager_send_assistant_specific_command"
 typedef int (*wakeup_manager_send_assistant_specific_command)(const char* appid, const char* command);
-#define MA_WAKEUP_MANAGER_FUNC_CHANGE_SYSTEM_VOLUME "wakeup_manager_change_system_volume"
-typedef int (*wakeup_manager_change_system_volume)(const char* appid, int event);
+#define MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME "wakeup_manager_set_background_volume"
+typedef int (*wakeup_manager_set_background_volume)(const char* appid, double ratio);
 #define MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT "wakeup_manager_update_recognition_result"
 typedef int (*wakeup_manager_update_recognition_result)(const char* appid, int result);
 #define MA_WAKEUP_MANAGER_FUNC_PROCESS_EVENT "wakeup_manager_process_event"
@@ -171,7 +171,7 @@ typedef struct {
        wakeup_manager_deactivate                                                                deactivate;
        wakeup_manager_update_voice_feedback_state                               update_voice_feedback_state;
        wakeup_manager_send_assistant_specific_command                   send_assistant_specific_command;
-       wakeup_manager_change_system_volume                                              change_system_volume;
+       wakeup_manager_set_background_volume                                     set_background_volume;
        wakeup_manager_update_recognition_result                                 update_recognition_result;
        wakeup_manager_process_event                                                     process_event;
        wakeup_manager_start_streaming_utterance_data                    start_streaming_utterance_data;
index 0c536d9..2598200 100644 (file)
@@ -65,8 +65,7 @@ EXPORT_API int mas_dependency_set_error_callback(mas_dependency_error_cb callbac
 EXPORT_API int mas_dependency_start_recording(void);
 EXPORT_API int mas_dependency_stop_recording(void);
 EXPORT_API int mas_dependency_set_recording_session(unsigned int session);
-EXPORT_API int mas_dependency_change_system_volume(void);
-EXPORT_API int mas_dependency_recover_system_volume(void);
+EXPORT_API int mas_dependency_set_background_volume(double ratio);
 EXPORT_API int mas_dependency_get_audio_format(int* rate, int* channel, int* audio_type);
 EXPORT_API int mas_dependency_get_audio_source_type(char** type);
 
index 2a40379..a51bb03 100644 (file)
@@ -27,8 +27,7 @@ void dependency_default_audio_set_recording_session(unsigned int session);
 
 void dependency_default_audio_voice_key_pressed_set(bool pressed);
 
-void dependency_default_audio_change_system_volume();
-void dependency_default_audio_recover_system_volume();
+void dependency_default_audio_set_background_volume(double ratio);
 
 void dependency_default_audio_get_audio_format(int* rate, int* channel, int* audio_type);
 void dependency_default_audio_get_audio_source_type(char** type);
index 0a44973..be13250 100644 (file)
@@ -50,15 +50,9 @@ int mas_dependency_set_recording_session(unsigned int session)
        return 0;
 }
 
-int mas_dependency_change_system_volume(void)
+int mas_dependency_set_background_volume(double ratio)
 {
-       dependency_default_audio_change_system_volume();
-       return 0;
-}
-
-int mas_dependency_recover_system_volume()
-{
-       dependency_default_audio_recover_system_volume();
+       dependency_default_audio_set_background_volume(ratio);
        return 0;
 }
 
index 86b2df1..1bc67c5 100644 (file)
@@ -305,67 +305,55 @@ void dependency_default_audio_voice_key_pressed_set(bool pressed)
        g_voice_key_pressed = pressed;
 }
 
-void dependency_default_audio_change_system_volume()
+void dependency_default_audio_set_background_volume(double ratio)
 {
        int ret;
 
-       if (!g_volume_stream) {
-               ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_VOICE_RECOGNITION_SERVICE, NULL, NULL, &g_volume_stream);
-               if (0 != ret) {
-                       LOGD("[Audio] Fail to create stream information, ret(%d)", ret);
-                       return;
+       if (ratio >= 0.5) {
+               if (g_virtual_sound_stream) {
+                       ret = sound_manager_stop_virtual_stream(g_virtual_sound_stream);
+                       if (0 != ret) {
+                                       LOGD("[Audio ERROR] Fail to stop virtual stream, ret(%d)", ret);
+                       }
+                       ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream);
+                       if (0 != ret) {
+                                       LOGD("[Audio ERROR] Fail to destroy virtual stream, ret(%d)", ret);
+                                       return;
+                       }
+                       g_virtual_sound_stream = NULL;
                }
-       }
 
-       if (!g_virtual_sound_stream) {
-               ret = sound_manager_create_virtual_stream(g_volume_stream, &g_virtual_sound_stream);
-               if (0 != ret) {
-                       if (g_volume_stream) {
-                               sound_manager_destroy_stream_information(g_volume_stream);
-                               g_volume_stream = NULL;
+               if (g_volume_stream) {
+                       ret = sound_manager_destroy_stream_information(g_volume_stream);
+                       if (0 != ret) {
+                                       LOGD("[Audio ERROR] Fail to destroy stream information, ret(%d)", ret);
+                                       return;
                        }
-                       LOGD("[Audio ERROR] Fail to create virtual stream, ret(%d)", ret);
-                       return;
+                       g_volume_stream = NULL;
                }
-       }
-       if (g_virtual_sound_stream) {
-               ret = sound_manager_start_virtual_stream(g_virtual_sound_stream);
-               if (0 != ret) {
-                       if (g_virtual_sound_stream) {
-                               sound_manager_destroy_virtual_stream(g_virtual_sound_stream);
-                               g_virtual_sound_stream = NULL;
-                       }
-                       if (g_volume_stream) {
-                               sound_manager_destroy_stream_information(g_volume_stream);
-                               g_volume_stream = NULL;
+       } else {
+               if (!g_volume_stream) {
+                       ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_VOICE_RECOGNITION_SERVICE, NULL, NULL, &g_volume_stream);
+                       if (0 != ret) {
+                               LOGD("[Audio] Fail to create stream information, ret(%d)", ret);
+                               return;
                        }
-                       LOGD("[Audio ERROR] Fail to start virtual stream, ret(%d)", ret);
-                       return;
                }
-       }
-}
 
-void dependency_default_audio_recover_system_volume()
-{
-       int ret;
-       if (g_virtual_sound_stream) {
-               ret = sound_manager_stop_virtual_stream(g_virtual_sound_stream);
-               if (0 != ret) {
-                               LOGD("[Audio ERROR] Fail to stop virtual stream, ret(%d)", ret);
-               }
-               ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream);
-               if (0 != ret) {
-                               LOGD("[Audio ERROR] Fail to destroy virtual stream, ret(%d)", ret);
+               if (!g_virtual_sound_stream) {
+                       ret = sound_manager_create_virtual_stream(g_volume_stream, &g_virtual_sound_stream);
+                       if (0 != ret) {
+                               LOGD("[Audio ERROR] Fail to create virtual stream, ret(%d)", ret);
+                               return;
+                       }
                }
-               g_virtual_sound_stream = NULL;
-       }
-
-       if (g_volume_stream) {
-               ret = sound_manager_destroy_stream_information(g_volume_stream);
-               if (0 != ret) {
-                               LOGD("[Audio ERROR] Fail to destroy stream information, ret(%d)", ret);
+               if (g_virtual_sound_stream) {
+                       ret = sound_manager_start_virtual_stream(g_virtual_sound_stream);
+                       if (0 != ret) {
+                               LOGD("[Audio ERROR] Fail to start virtual stream, ret(%d)", ret);
+                               return;
+                       }
                }
-               g_volume_stream = NULL;
        }
 }
 
index fddc4e6..bf39e54 100644 (file)
@@ -90,8 +90,7 @@ EXPORT_API int mas_dependency_set_error_callback(mas_dependency_error_cb callbac
 EXPORT_API int mas_dependency_start_recording(void);
 EXPORT_API int mas_dependency_stop_recording(void);
 EXPORT_API int mas_dependency_set_recording_session(unsigned int session);
-EXPORT_API int mas_dependency_change_system_volume(void);
-EXPORT_API int mas_dependency_recover_system_volume(void);
+EXPORT_API int mas_dependency_set_background_volume(double ratio);
 EXPORT_API int mas_dependency_get_audio_format(int* rate, int* channel, int* audio_type);
 EXPORT_API int mas_dependency_get_audio_source_type(char** type);
 
index a0b9d24..b829865 100644 (file)
@@ -25,8 +25,7 @@ void dependency_tv_audio_stop_recording();
 
 void dependency_tv_audio_set_recording_session(unsigned int session);
 
-void dependency_tv_audio_change_system_volume();
-void dependency_tv_audio_recover_system_volume();
+void dependency_tv_audio_set_background_volume(double ratio);
 
 void dependency_tv_audio_voice_key_pressed_set(bool pressed);
 
index aec2a52..d6eb6f1 100644 (file)
@@ -50,15 +50,9 @@ int mas_dependency_set_recording_session(unsigned int session)
        return 0;
 }
 
-int mas_dependency_change_system_volume(void)
+int mas_dependency_set_background_volume(double ratio)
 {
-       dependency_tv_audio_change_system_volume();
-       return 0;
-}
-
-int mas_dependency_recover_system_volume()
-{
-       dependency_tv_audio_recover_system_volume();
+       dependency_tv_audio_set_background_volume(ratio);
        return 0;
 }
 
index ca55d9d..8b66842 100644 (file)
@@ -328,67 +328,55 @@ void dependency_tv_audio_set_recording_session(unsigned int session)
        );
 }
 
-void dependency_tv_audio_change_system_volume()
+void dependency_tv_audio_set_background_volume(double ratio)
 {
        int ret;
 
-       if (!g_volume_stream) {
-               ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_VOICE_RECOGNITION_SERVICE, NULL, NULL, &g_volume_stream);
-               if (0 != ret) {
-                       LOGE("[Audio] Fail to create stream information, ret(%d)", ret);
-                       return;
+       if (ratio >= 0.5) {
+               if (g_virtual_sound_stream) {
+                       ret = sound_manager_stop_virtual_stream(g_virtual_sound_stream);
+                       if (0 != ret) {
+                                       LOGD("[Audio ERROR] Fail to stop virtual stream, ret(%d)", ret);
+                       }
+                       ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream);
+                       if (0 != ret) {
+                                       LOGD("[Audio ERROR] Fail to destroy virtual stream, ret(%d)", ret);
+                                       return;
+                       }
+                       g_virtual_sound_stream = NULL;
                }
-       }
 
-       if (!g_virtual_sound_stream) {
-               ret = sound_manager_create_virtual_stream(g_volume_stream, &g_virtual_sound_stream);
-               if (0 != ret) {
-                       if (g_volume_stream) {
-                               sound_manager_destroy_stream_information(g_volume_stream);
-                               g_volume_stream = NULL;
+               if (g_volume_stream) {
+                       ret = sound_manager_destroy_stream_information(g_volume_stream);
+                       if (0 != ret) {
+                                       LOGD("[Audio ERROR] Fail to destroy stream information, ret(%d)", ret);
+                                       return;
                        }
-                       LOGE("[Audio ERROR] Fail to create virtual stream, ret(%d)", ret);
-                       return;
+                       g_volume_stream = NULL;
                }
-       }
-       if (g_virtual_sound_stream) {
-               ret = sound_manager_start_virtual_stream(g_virtual_sound_stream);
-               if (0 != ret) {
-                       if (g_virtual_sound_stream) {
-                               sound_manager_destroy_virtual_stream(g_virtual_sound_stream);
-                               g_virtual_sound_stream = NULL;
-                       }
-                       if (g_volume_stream) {
-                               sound_manager_destroy_stream_information(g_volume_stream);
-                               g_volume_stream = NULL;
+       } else {
+               if (!g_volume_stream) {
+                       ret = sound_manager_create_stream_information_internal(SOUND_STREAM_TYPE_VOICE_RECOGNITION_SERVICE, NULL, NULL, &g_volume_stream);
+                       if (0 != ret) {
+                               LOGD("[Audio] Fail to create stream information, ret(%d)", ret);
+                               return;
                        }
-                       LOGE("[Audio ERROR] Fail to start virtual stream, ret(%d)", ret);
-                       return;
                }
-       }
-}
 
-void dependency_tv_audio_recover_system_volume()
-{
-       int ret;
-       if (g_virtual_sound_stream) {
-               ret = sound_manager_stop_virtual_stream(g_virtual_sound_stream);
-               if (0 != ret) {
-                       LOGE("[Audio ERROR] Fail to stop virtual stream, ret(%d)", ret);
-               }
-               ret = sound_manager_destroy_virtual_stream(g_virtual_sound_stream);
-               if (0 != ret) {
-                       LOGE("[Audio ERROR] Fail to destroy virtual stream, ret(%d)", ret);
+               if (!g_virtual_sound_stream) {
+                       ret = sound_manager_create_virtual_stream(g_volume_stream, &g_virtual_sound_stream);
+                       if (0 != ret) {
+                               LOGD("[Audio ERROR] Fail to create virtual stream, ret(%d)", ret);
+                               return;
+                       }
                }
-               g_virtual_sound_stream = NULL;
-       }
-
-       if (g_volume_stream) {
-               ret = sound_manager_destroy_stream_information(g_volume_stream);
-               if (0 != ret) {
-                       LOGE("[Audio ERROR] Fail to destroy stream information, ret(%d)", ret);
+               if (g_virtual_sound_stream) {
+                       ret = sound_manager_start_virtual_stream(g_virtual_sound_stream);
+                       if (0 != ret) {
+                               LOGD("[Audio ERROR] Fail to start virtual stream, ret(%d)", ret);
+                               return;
+                       }
                }
-               g_volume_stream = NULL;
        }
 }
 
@@ -402,9 +390,9 @@ void dependency_tv_audio_voice_key_pressed_set(bool pressed)
        if (pressed != g_voice_key_pressed) {
                if (pressed) {
                        set_audio_source_type(VC_AUDIO_ID_BLUETOOTH);
-                       dependency_tv_audio_change_system_volume();
+                       dependency_tv_audio_set_background_volume(0.3);
                } else {
-                       dependency_tv_audio_recover_system_volume();
+                       dependency_tv_audio_set_background_volume(1.0);
                }
        }
 
index 3d24f98..b1ed068 100644 (file)
@@ -40,8 +40,7 @@ int dependency_resolver_set_error_callback(mas_dependency_error_cb callback, voi
 int dependency_resolver_start_recording();
 int dependency_resolver_stop_recording();
 int dependency_resolver_set_recording_session(unsigned int);
-int dependency_resolver_change_system_volume();
-int dependency_resolver_recover_system_volume();
+int dependency_resolver_set_background_volume(double ratio);
 int dependency_resolver_get_audio_format(int* rate, int* channel, int* audio_type);
 int dependency_resolver_get_audio_source_type(char** type);
 
@@ -68,10 +67,8 @@ typedef int (*mas_dependency_start_recording)(void);
 typedef int (*mas_dependency_stop_recording)(void);
 #define MAS_DEPENDENCY_FUNC_SET_RECORDING_SESSION "mas_dependency_set_recording_session"
 typedef int (*mas_dependency_set_recording_session)(unsigned int);
-#define MAS_DEPENDENCY_FUNC_CHANGE_SYSTEM_VOLUME "mas_dependency_change_system_volume"
-typedef int (*mas_dependency_change_system_volume)(void);
-#define MAS_DEPENDENCY_FUNC_RECOVER_SYSTEM_VOLUME "mas_dependency_recover_system_volume"
-typedef int (*mas_dependency_recover_system_volume)(void);
+#define MAS_DEPENDENCY_FUNC_SET_BACKGROUND_VOLUME "mas_dependency_set_background_volume"
+typedef int (*mas_dependency_set_background_volume)(double ratio);
 #define MAS_DEPENDENCY_FUNC_GET_AUDIO_FORMAT "mas_dependency_get_audio_format"
 typedef int (*mas_dependency_get_audio_format)(int* rate, int* channel, int* audio_type);
 #define MAS_DEPENDENCY_FUNC_GET_AUDIO_SOURCE_TYPE "mas_dependency_get_audio_source_type"
@@ -84,8 +81,7 @@ typedef struct {
        mas_dependency_start_recording                                                  start_recording;
        mas_dependency_stop_recording                                                   stop_recording;
        mas_dependency_set_recording_session                                    set_recording_session;
-       mas_dependency_change_system_volume                                             change_system_volume;
-       mas_dependency_recover_system_volume                                    recover_system_volume;
+       mas_dependency_set_background_volume                                    set_background_volume;
        mas_dependency_get_audio_format                                                 get_audio_format;
        mas_dependency_get_audio_source_type                                    get_audio_source_type;
 } mas_dependency;
index 2b38a77..966e77a 100644 (file)
@@ -89,8 +89,7 @@ public:
        void start_streaming_follow_up_data();
        void stop_streaming_follow_up_data();
 
-       void change_system_volume();
-       void recover_system_volume();
+       void set_background_volume(double ratio);
 private:
        void add_audio_data(wakeup_speech_data& data, long time);
        void notify_audio_data_recording(long time, void* data, int len);
index 01481ff..54bac7f 100644 (file)
@@ -77,7 +77,7 @@ public:
 
        bool update_voice_feedback_state(string appid, bool state);
        bool send_assistant_specific_command(string appid, string command);
-       bool change_system_volume(string appid, int event);
+       bool set_background_volume(string appid, double ratio);
        bool update_recognition_result(string appid, int result);
        bool process_event(ma_plugin_event_e event, void* data, int len);
        bool get_audio_format(int* rate, int* channel, int* audio_type);
index c9c0781..de080d0 100644 (file)
@@ -92,7 +92,7 @@ EXPORT_API int wakeup_manager_update_voice_feedback_state(const char *appid, int
 
 EXPORT_API int wakeup_manager_send_assistant_specific_command(const char* appid, const char* command);
 
-EXPORT_API int wakeup_manager_change_system_volume(const char *appid, int event);
+EXPORT_API int wakeup_manager_set_background_volume(const char *appid, double ratio);
 
 EXPORT_API int wakeup_manager_update_recognition_result(const char *appid, int result);
 
index 7a1f35a..551290e 100644 (file)
@@ -75,12 +75,9 @@ int dependency_resolver_initialize(mas_proxy_interface interface)
        g_mas_dependency.set_recording_session =
                (mas_dependency_set_recording_session)dlsym(g_handle,
                MAS_DEPENDENCY_FUNC_SET_RECORDING_SESSION);
-       g_mas_dependency.change_system_volume =
-               (mas_dependency_change_system_volume)dlsym(g_handle,
-               MAS_DEPENDENCY_FUNC_CHANGE_SYSTEM_VOLUME);
-       g_mas_dependency.recover_system_volume =
-               (mas_dependency_recover_system_volume)dlsym(g_handle,
-               MAS_DEPENDENCY_FUNC_RECOVER_SYSTEM_VOLUME);
+       g_mas_dependency.set_background_volume =
+               (mas_dependency_set_background_volume)dlsym(g_handle,
+               MAS_DEPENDENCY_FUNC_SET_BACKGROUND_VOLUME);
        g_mas_dependency.get_audio_format =
                (mas_dependency_get_audio_format)dlsym(g_handle,
                MAS_DEPENDENCY_FUNC_GET_AUDIO_FORMAT);
@@ -213,37 +210,17 @@ int dependency_resolver_set_recording_session(unsigned int session)
        return ret;
 }
 
-int dependency_resolver_change_system_volume()
+int dependency_resolver_set_background_volume(double ratio)
 {
        int ret = -1;
        if (NULL != g_handle) {
-               mas_dependency_change_system_volume func = g_mas_dependency.change_system_volume;
+               mas_dependency_set_background_volume func = g_mas_dependency.set_background_volume;
                if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_CHANGE_SYSTEM_VOLUME);
+                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_SET_BACKGROUND_VOLUME);
                } else {
-                       ret = func();
-                       if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to change system volume, ret(%d)", ret);
-                       }
-               }
-       } else {
-               MAS_LOGE("[ERROR] g_handle is not valid");
-       }
-
-       return ret;
-}
-
-int dependency_resolver_recover_system_volume()
-{
-       int ret = -1;
-       if (NULL != g_handle) {
-               mas_dependency_recover_system_volume func = g_mas_dependency.recover_system_volume;
-               if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MAS_DEPENDENCY_FUNC_RECOVER_SYSTEM_VOLUME);
-               } else {
-                       ret = func();
+                       ret = func(ratio);
                        if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to recover system volume, ret(%d)", ret);
+                               MAS_LOGE("[ERROR] Fail to set background volume to %f, ret(%d)", ratio, ret);
                        }
                }
        } else {
index 74d53b0..c324b4d 100644 (file)
@@ -424,14 +424,9 @@ void CAudioManager::stop_streaming_follow_up_data()
        mStopStreamingThread.store(false);
 }
 
-void CAudioManager::change_system_volume()
+void CAudioManager::set_background_volume(double ratio)
 {
-       dependency_resolver_change_system_volume();
-}
-
-void CAudioManager::recover_system_volume()
-{
-       dependency_resolver_recover_system_volume();
+       dependency_resolver_set_background_volume(ratio);
 }
 
 } // wakeup
index c765d16..fec05e4 100644 (file)
@@ -337,17 +337,12 @@ bool CWakeupManager::send_assistant_specific_command(string appid, string comman
        return true;
 }
 
-bool CWakeupManager::change_system_volume(string appid, int event)
+bool CWakeupManager::set_background_volume(string appid, double ratio)
 {
-       MWR_LOGD("[DEBUG] change system volume, system volume event(%d)", event);
+       MWR_LOGD("[DEBUG] set background volume (%f)", ratio);
 
        int ret = 0;
-       if (MA_SYSTEM_VOLUME_EVENT_CHANGE == event) {
-               mAudioManager.change_system_volume();
-       } else if (MA_SYSTEM_VOLUME_EVENT_RECOVER == event) {
-               mAudioManager.recover_system_volume();
-       }
-
+       mAudioManager.set_background_volume(ratio);
        return ret;
 }
 
index 73fe02f..dc33842 100644 (file)
@@ -225,7 +225,7 @@ int wakeup_manager_send_assistant_specific_command(const char* appid, const char
        return 0;
 }
 
-int wakeup_manager_change_system_volume(const char* appid, int event)
+int wakeup_manager_set_background_volume(const char* appid, double ratio)
 {
        MWR_LOGD("[ENTER]");
 
@@ -236,7 +236,7 @@ int wakeup_manager_change_system_volume(const char* appid, int event)
                appid_string = appid;
        }
 
-       g_wakeup_manager.change_system_volume(appid_string, event);
+       g_wakeup_manager.set_background_volume(appid_string, ratio);
 
        MWR_LOGD("[END]");
        return 0;
index 6130846..4da5cef 100644 (file)
@@ -692,8 +692,8 @@ static Eina_Bool listener_event_callback(void* data, Ecore_Fd_Handler *fd_handle
                } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SEND_ASSISTANT_SPECIFIC_COMMAND)) {
                        ma_service_dbus_send_assistant_specific_command(g_conn_listener, msg);
 
-               } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_CHANGE_SYSTEM_VOLUME)) {
-                       ma_service_dbus_change_system_volume(g_conn_listener, msg);
+               } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_METHOD_SET_BACKGROUND_VOLUME)) {
+                       ma_service_dbus_set_background_volume(g_conn_listener, msg);
 
                } else if (dbus_message_is_method_call(msg, MA_SERVER_SERVICE_INTERFACE, MA_UI_METHOD_INITIALIZE)) {
                        ma_service_ui_dbus_initialize(g_conn_listener, msg);
index 1c70b09..f26b8db 100644 (file)
@@ -531,29 +531,29 @@ int ma_service_dbus_send_assistant_specific_command(DBusConnection* conn, DBusMe
        return 0;
 }
 
-int ma_service_dbus_change_system_volume(DBusConnection* conn, DBusMessage* msg)
+int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg)
 {
        DBusError err;
        dbus_error_init(&err);
 
        int pid;
        int ret = 0;
-       int event;
+       double ratio;
 
        dbus_message_get_args(msg, &err,
                DBUS_TYPE_INT32, &pid,
-               DBUS_TYPE_INT32, &event,
+               DBUS_TYPE_DOUBLE, &ratio,
                DBUS_TYPE_INVALID);
 
-       MAS_LOGD("[DEBUG] MAS CHANGE SYSTEM VOLUME");
+       MAS_LOGD("[DEBUG] MAS SET BACKGROUND VOLUME");
 
        if (dbus_error_is_set(&err)) {
-               MAS_LOGE("[IN ERROR] mas change system volume : Get arguments error (%s)", err.message);
+               MAS_LOGE("[IN ERROR] mas set background volume : Get arguments error (%s)", err.message);
                dbus_error_free(&err);
                ret = -1; //MAS_ERROR_OPERATION_FAILED;
        } else {
-               MAS_LOGD("[IN] mas change system volume : pid(%d), event(%d)", pid, event);
-               ret =  mas_client_change_system_volume(pid, event);
+               MAS_LOGD("[IN] mas set background volume : pid(%d), ratio(%f)", pid, ratio);
+               ret =  mas_client_set_background_volume(pid, ratio);
        }
 
        MAS_LOGD("<<<<<");
index 0738f40..f949784 100644 (file)
@@ -47,7 +47,7 @@ int ma_service_dbus_update_voice_feedback_state(DBusConnection* conn, DBusMessag
 
 int ma_service_dbus_send_assistant_specific_command(DBusConnection* conn, DBusMessage* msg);
 
-int ma_service_dbus_change_system_volume(DBusConnection* conn, DBusMessage* msg);
+int ma_service_dbus_set_background_volume(DBusConnection* conn, DBusMessage* msg);
 
 int ma_service_ui_dbus_initialize(DBusConnection* conn, DBusMessage* msg);
 
index 847d122..49c784b 100644 (file)
@@ -361,9 +361,9 @@ int mas_client_send_assistant_specific_command(int pid, const char *command)
        return 0;
 }
 
-int mas_client_change_system_volume(int pid, int event)
+int mas_client_set_background_volume(int pid, double ratio)
 {
-       multi_assistant_service_plugin_change_system_volume(NULL, event);
+       multi_assistant_service_plugin_set_background_volume(NULL, ratio);
        return 0;
 }
 
index 9a4e38b..7d6de4b 100644 (file)
@@ -380,9 +380,9 @@ int multi_assistant_service_plugin_initialize(void)
        _wakeup_manager_interface.send_assistant_specific_command =
                (wakeup_manager_send_assistant_specific_command)dlsym(g_handle,
                MA_WAKEUP_MANAGER_FUNC_SEND_ASSISTANT_SPECIFIC_COMMAND);
-       _wakeup_manager_interface.change_system_volume =
-               (wakeup_manager_change_system_volume)dlsym(g_handle,
-               MA_WAKEUP_MANAGER_FUNC_CHANGE_SYSTEM_VOLUME);
+       _wakeup_manager_interface.set_background_volume =
+               (wakeup_manager_set_background_volume)dlsym(g_handle,
+               MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME);
        _wakeup_manager_interface.update_recognition_result =
                (wakeup_manager_update_recognition_result)dlsym(g_handle,
                MA_WAKEUP_MANAGER_FUNC_UPDATE_RECOGNITION_RESULT);
@@ -665,17 +665,17 @@ int multi_assistant_service_plugin_send_assistant_specific_command(const char* a
        return ret;
 }
 
-int multi_assistant_service_plugin_change_system_volume(const char* appid, int event)
+int multi_assistant_service_plugin_set_background_volume(const char* appid, double ratio)
 {
        int ret = -1;
        if (NULL != g_handle) {
-               wakeup_manager_change_system_volume func = _wakeup_manager_interface.change_system_volume;
+               wakeup_manager_set_background_volume func = _wakeup_manager_interface.set_background_volume;
                 if (NULL == func) {
-                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_CHANGE_SYSTEM_VOLUME);
+                       MAS_LOGE("[ERROR] symbol lookup failed : %s", MA_WAKEUP_MANAGER_FUNC_SET_BACKGROUND_VOLUME);
                } else {
-                       ret = func(appid, event);
+                       ret = func(appid, ratio);
                        if (0 != ret) {
-                               MAS_LOGE("[ERROR] Fail to change system volume, ret(%d)", ret);
+                               MAS_LOGE("[ERROR] Fail to set background volume, ret(%d)", ret);
                        }
                }
        } else {