Modify notification action behavior related to sound, vibration 01/66701/3
authorSomin Kim <somin926.kim@samsung.com>
Wed, 20 Apr 2016 08:21:05 +0000 (17:21 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Wed, 20 Apr 2016 11:14:35 +0000 (04:14 -0700)
Change-Id: I95f501065cb473d6de011aa2d9fa1fe08a2bcd7a
Signed-off-by: Somin Kim <somin926.kim@samsung.com>
src/trigger/ActionManager.cpp

index 5db4ddd..f0e50fc 100644 (file)
@@ -139,34 +139,25 @@ void __triggerActionNotification(ctx::Json& action, std::string pkgId)
                }
        }
 
-       int status;
-       bool silent = true;
-       error = vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &status);
+       int soundOn = 0;
+       error = vconf_get_bool(VCONFKEY_SETAPPL_SOUND_STATUS_BOOL, &soundOn);
        if (error < 0) {
                _E("vconf error (%d)", error);
-       } else {
-               silent = (status == 0);
+       } else if (soundOn) {
+               error = notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
+               if (error != NOTIFICATION_ERROR_NONE) {
+                       _E("Set notification sound failed(%d)", error);
+               }
        }
 
-       bool vibration = true;
-       error = vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &status);
+       int vibrationOn = 0;
+       error = vconf_get_bool(VCONFKEY_SETAPPL_VIBRATION_STATUS_BOOL, &vibrationOn);
        if (error < 0) {
                _E("vconf error (%d)", error);
-       } else {
-               vibration = (status != 0);
-       }
-
-       if (!silent) {
-           error = notification_set_sound(notification, NOTIFICATION_SOUND_TYPE_DEFAULT, NULL);
+       } else if (vibrationOn) {
+               error = notification_set_vibration(notification, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
                if (error != NOTIFICATION_ERROR_NONE) {
-                       _E("Set notification sound failed(%d)", error);
-               }
-
-               if (vibration) {
-                       error = notification_set_vibration(notification, NOTIFICATION_VIBRATION_TYPE_DEFAULT, NULL);
-                       if (error != NOTIFICATION_ERROR_NONE) {
-                               _E("Set notification vibration failed(%d)", error);
-                       }
+                       _E("Set notification vibration failed(%d)", error);
                }
        }