force to set dim brightness by application 22/14722/1
authorjy910.yun <jy910.yun@samsung.com>
Wed, 17 Apr 2013 09:22:04 +0000 (18:22 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Fri, 10 Jan 2014 09:38:05 +0000 (10:38 +0100)
0 is Dim state, it is promissed btw system f/w and kernel side.

Change-Id: I5284e7a6088541e9fccd1465dcaed7843a92c513
Signed-off-by: jy910.yun <jy910.yun@samsung.com>
src/shared/display.c

index 0c5e2a4..872451c 100644 (file)
@@ -31,7 +31,8 @@
 #include "dd-display.h"
 
 #define DISPLAY_MAX_BRIGHTNESS  100
-#define DISPLAY_MIN_BRIGHTNESS  0
+#define DISPLAY_MIN_BRIGHTNESS  1
+#define DISPLAY_DIM_BRIGHTNESS  0
 
 #define SOCK_PATH                      "/tmp/pm_sock"
 #define SHIFT_UNLOCK                   4
@@ -88,7 +89,13 @@ API int display_set_brightness_with_setting(int val)
        if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brt_state) != 0) {
                _E("Failed to get VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT value");
                errno = EPERM;
-               return -1;
+               return -errno;
+       }
+
+       if (val == DISPLAY_DIM_BRIGHTNESS) {
+               _D("application can not set this value(DIM VALUE:%d)", val);
+               errno = EPERM;
+               return -errno;
        }
 
        if (auto_brt_state == SETTING_BRIGHTNESS_AUTOMATIC_ON) {
@@ -119,7 +126,13 @@ API int display_set_brightness(int val)
        if (vconf_get_int(VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT, &auto_brt_state) != 0) {
                _E("Failed to get VCONFKEY_SETAPPL_BRIGHTNESS_AUTOMATIC_INT value");
                errno = EPERM;
-               return -1;
+               return -errno;
+       }
+
+       if (val == DISPLAY_DIM_BRIGHTNESS) {
+               _D("application can not set this value(DIM VALUE:%d)", val);
+               errno = EPERM;
+               return -errno;
        }
 
        vconf_set_int(VCONFKEY_PM_CUSTOM_BRIGHTNESS_STATUS, VCONFKEY_PM_CUSTOM_BRIGHTNESS_ON);