display: set vconf key only if the value is changed 64/108964/2
authortaeyoung <ty317.kim@samsung.com>
Fri, 6 Jan 2017 09:36:02 +0000 (18:36 +0900)
committerTaeyoung Kim <ty317.kim@samsung.com>
Fri, 20 Jan 2017 02:43:12 +0000 (18:43 -0800)
Previously, the vconf key could be set with same value.
Thus the display state callback of the capi-system-device
could be called several times with same state.

Now, the vconf key is updated only if the value is changed.
Thus the callback of the api will be called once
for a certain display state.

Change-Id: I35a89dc6a882b58fb86c21a2b8a8b570231db97c
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/display/setting.c

index eacb720..f45c40e 100644 (file)
@@ -125,6 +125,12 @@ int get_usb_status(int *val)
 
 int set_setting_pmstate(int val)
 {
+       static int old = -1;
+
+       if (old == val)
+               return 0;
+       old = val;
+
        display_state_send_system_event(val);
        return vconf_set_int(VCONFKEY_PM_STATE, val);
 }