Remove the validation check of volume level in the client side 53/217553/2 accepted/tizen/unified/20191118.122950 submit/tizen/20191115.044113
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 12 Nov 2019 09:11:04 +0000 (18:11 +0900)
committerSangchul Lee <sc11.lee@samsung.com>
Tue, 12 Nov 2019 09:59:42 +0000 (18:59 +0900)
It was the only hard-coded condition which limits the maxium
volume level per each volume type. The rest of volume policy
has been implemented with fixing the maximum level by the values
in the volume table loaded inside of the PulseAudio.

[Version] 0.12.54
[Issue Type] Improvement

Change-Id: Id34f818764062da0060a8288f16e4281fd7aae05
Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
mm_sound_client.c
mm_sound_proxy.c
packaging/libmm-sound.spec

index a42459b..ad7e57c 100644 (file)
@@ -38,8 +38,6 @@
 
 #define CLIENT_HANDLE_MAX 256
 #define VOLUME_TYPE_LEN 64
-#define VOLUME_MAX_MULTIMEDIA  16
-#define VOLUME_MAX_BASIC               8
 
 #define VCONF_KEY_VOLUME_PREFIX                                "file/private/sound/volume"
 #define VCONF_KEY_VOLUME_TYPE_SYSTEM           VCONF_KEY_VOLUME_PREFIX"/system"
@@ -85,18 +83,6 @@ static char *g_mute_vconf[] = {
        VCONF_KEY_MUTE_TYPE_VOICE,              /* MUTE_TYPE_VOICE */
 };
 
-static char *g_volume_str[VOLUME_TYPE_MAX] = {
-       "SYSTEM",
-       "NOTIFICATION",
-       "ALARM",
-       "RINGTONE",
-       "MEDIA",
-       "CALL",
-       "VOIP",
-       "VOICE",
-       "FIXED",
-};
-
 struct callback_data {
        void *user_cb;
        void *user_data;
@@ -128,35 +114,6 @@ typedef struct _focus_idle_event {
        int data;
 } focus_idle_event_t;
 
-static int _validate_volume(volume_type_t type, int level)
-{
-       if (level < 0)
-               return -1;
-
-       switch (type) {
-       case VOLUME_TYPE_CALL:
-       case VOLUME_TYPE_VOIP:
-               if (level >= VOLUME_MAX_BASIC) {
-                       return -1;
-               }
-               break;
-       case VOLUME_TYPE_SYSTEM:
-       case VOLUME_TYPE_MEDIA:
-       case VOLUME_TYPE_ALARM:
-       case VOLUME_TYPE_NOTIFICATION:
-       case VOLUME_TYPE_RINGTONE:
-       case VOLUME_TYPE_VOICE:
-               if (level >= VOLUME_MAX_MULTIMEDIA) {
-                       return -1;
-               }
-               break;
-       default:
-               return -1;
-               break;
-       }
-       return 0;
-}
-
 int mm_sound_client_initialize(void)
 {
        int ret = MM_ERROR_NONE;
@@ -823,12 +780,6 @@ int mm_sound_client_set_volume_by_type(volume_type_t type, const unsigned int le
                return MM_ERROR_INVALID_ARGUMENT;
        }
 
-       /* Check input param */
-       if (0 > _validate_volume(type, (int)level)) {
-               debug_error("invalid level %u of %s", level, g_volume_str[type]);
-               return MM_ERROR_INVALID_ARGUMENT;
-       }
-
        if ((ret = __convert_volume_type_to_str(type, &type_str)) != MM_ERROR_NONE) {
                debug_error("volume type convert failed");
                goto failed;
index 5f3548c..817aa58 100644 (file)
@@ -675,7 +675,9 @@ int mm_sound_proxy_set_volume_by_type(const char *volume_type, const unsigned vo
        if (result) {
                g_variant_get(result, "(&s)",  &reply);
                debug_log("reply : %s", reply);
-               if (strcmp(reply, "STREAM_MANAGER_RETURN_OK"))
+               if (!strcmp(reply, "STREAM_MANAGER_RETURN_ERROR_INVALID_ARGUMENT"))
+                       ret = MM_ERROR_INVALID_ARGUMENT;
+               else if (strcmp(reply, "STREAM_MANAGER_RETURN_OK"))
                        ret = MM_ERROR_SOUND_INTERNAL;
                g_variant_unref(result);
        } else {
index e4f1e59..2c13d70 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.12.53
+Version:    0.12.54
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0