Merge changes from Tizen 2.4 (Version 0.6.3) 45/48645/1
authorMu-Woong <muwoong.lee@samsung.com>
Thu, 24 Sep 2015 06:10:58 +0000 (15:10 +0900)
committerMu-Woong <muwoong.lee@samsung.com>
Thu, 24 Sep 2015 06:10:58 +0000 (15:10 +0900)
- Modified to turn on display when rule is triggered

Change-Id: I47279fc481398e5be5fdc22531dd39463971b33f
Signed-off-by: Mu-Woong <muwoong.lee@samsung.com>
CMakeLists.txt
packaging/context-service.spec
packaging/context-service.xml
src/context_trigger/rule_manager.cpp

index 65c48c7935bafd051754c084ff8fd3983d601802..a4d2fd83c562f32ad043090580fa175dfbe56858 100644 (file)
@@ -20,6 +20,7 @@ SET(DEPS
        appsvc
        alarm-service
        notification
+       capi-system-system-settings
        cynara-creds-gdbus
        clips
        context-common
index 1eb5dfda4518eb3459b7689bb4a81535ed73f590..d9cbf58f96ff7f5ae08616d753ee3efe6bb0ef1d 100644 (file)
@@ -1,6 +1,6 @@
 Name:       context-service
 Summary:    Context-Service
-Version:    0.6.2
+Version:    0.6.3
 Release:    1
 Group:      System/Service
 License:    Apache-2.0
@@ -22,6 +22,7 @@ BuildRequires: pkgconfig(capi-appfw-app-manager)
 BuildRequires: pkgconfig(appsvc)
 BuildRequires: pkgconfig(alarm-service)
 BuildRequires: pkgconfig(notification)
+BuildRequires: pkgconfig(capi-system-system-settings)
 
 %if "%{MAINLOOP}" == "ecore"
 BuildRequires: pkgconfig(ecore)
index dd71b93ca8e1d533056c046aa6a849c87b1a65bd..fc18178e0d914a7c8f093d261b3b66490972637c 100644 (file)
@@ -18,5 +18,6 @@
        </service-application>
        <privileges>
                <privilege>http://tizen.org/privilege/location</privilege>
+               <privilege>http://tizen.org/privilege/display</privilege>
        </privileges>
 </manifest>
index f1e490887021374e456ac68c30dc00fbf846f77a..c11d976a3047007a74807848d06ffb5160db0896 100644 (file)
 #include <app_control.h>
 #include <appsvc.h>
 #include <app_control_internal.h>
+#include <device/display.h>
 #include <notification.h>
 #include <notification_internal.h>
+#include <runtime_info.h>
+#include <system_settings.h>
 #include <context_trigger_types_internal.h>
 #include <context_trigger.h>
 #include <db_mgr.h>
@@ -1098,6 +1101,11 @@ static void trigger_action_app_control(ctx::json& action)
        bundle_free(appctl_bundle);
        free(str);
        app_control_destroy(app);
+
+       error = device_display_change_state(DISPLAY_STATE_NORMAL);
+       if (error != DEVICE_ERROR_NONE) {
+               _E("Change display state failed(%d)", error);
+       }
 }
 
 static void trigger_action_notification(ctx::json& action, std::string app_id)
@@ -1160,6 +1168,32 @@ static void trigger_action_notification(ctx::json& action, std::string app_id)
                }
        }
 
+       bool silent = true;
+       error = system_settings_get_value_bool(SYSTEM_SETTINGS_KEY_SOUND_SILENT_MODE, &silent);
+       if (error != SYSTEM_SETTINGS_ERROR_NONE) {
+               _E("Get system setting(silent mode) failed(%d)", error);
+       }
+
+       bool vibration = true;
+       error = runtime_info_get_value_bool(RUNTIME_INFO_KEY_VIBRATION_ENABLED, &vibration);
+       if (error != RUNTIME_INFO_ERROR_NONE) {
+               _E("Get runtime info(vibration) failed(%d)", error);
+       }
+
+       if (!silent) {
+           error = notification_set_sound(notification, NOTIFICATION_SOUND_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);
+                       }
+               }
+       }
+
        error = notification_post(notification);
        if (error != NOTIFICATION_ERROR_NONE) {
                _E("Post notification failed(%d)", error);
@@ -1173,6 +1207,11 @@ static void trigger_action_notification(ctx::json& action, std::string app_id)
        if (app) {
                app_control_destroy(app);
        }
+
+       error = device_display_change_state(DISPLAY_STATE_NORMAL);
+       if (error != DEVICE_ERROR_NONE) {
+               _E("Change display state failed(%d)", error);
+       }
 }
 
 static void trigger_action_dbus_call(ctx::json& action)