From 41b38c5e369791882b0164beaa477ee700e25889 Mon Sep 17 00:00:00 2001 From: "kibak.yoon" Date: Wed, 25 May 2016 13:27:26 +0900 Subject: [PATCH] sensord: add power save vconf for syncing with tizen 2.3 - in public, there is no power save vconf key - this patch is only for maintainance Change-Id: I327fd0dfe96a849ef24b344a60aab971228340d5 Signed-off-by: kibak.yoon --- src/client/client.cpp | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/client/client.cpp b/src/client/client.cpp index b9b99c1..e77b1b3 100644 --- a/src/client/client.cpp +++ b/src/client/client.cpp @@ -38,6 +38,10 @@ using std::vector; #define API __attribute__((visibility("default"))) #endif +#ifndef VCONFKEY_SETAPPL_PSMODE +#define VCONFKEY_SETAPPL_PSMODE "db/setting/psmode" +#endif + #define DEFAULT_INTERVAL POLL_10HZ_MS static cmutex lock; @@ -81,6 +85,7 @@ static void set_power_save_state_cb(void) g_power_save_state = get_power_save_state(); _D("power_save_state = [%d]", g_power_save_state); vconf_notify_key_changed(VCONFKEY_PM_STATE, power_save_state_cb, NULL); + vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE, power_save_state_cb, NULL); } } @@ -94,6 +99,7 @@ static void unset_power_save_state_cb(void) if (g_power_save_state_cb_cnt == 0) { _D("Power save callback is unregistered"); vconf_ignore_key_changed(VCONFKEY_PM_STATE, power_save_state_cb); + vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE, power_save_state_cb); } } @@ -113,14 +119,20 @@ void clean_up(void) static int get_power_save_state(void) { + int err; int state = 0; - int pm_state; + int pm_state, ps_state; - vconf_get_int(VCONFKEY_PM_STATE, &pm_state); + err = vconf_get_int(VCONFKEY_PM_STATE, &pm_state); - if (pm_state == VCONFKEY_PM_STATE_LCDOFF) + if (!err && pm_state == VCONFKEY_PM_STATE_LCDOFF) state |= SENSOR_OPTION_ON_IN_SCREEN_OFF; + err = vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &ps_state); + + if (!err && ps_state == SETTING_PSMODE_NORMAL) + state |= SENSOR_OPTION_ON_IN_POWERSAVE_MODE; + return state; } -- 2.7.4