From 2d71a52c3e1887e050260041bb0c33394eed93ce Mon Sep 17 00:00:00 2001 From: lokilee73 Date: Mon, 4 Dec 2017 17:44:51 +0900 Subject: [PATCH] Display: to remove a log for privilege check Change-Id: I4498e24fb94c047b016a70fdc8fd1642ae683939 Signed-off-by: lokilee73 --- src/power.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/power.c b/src/power.c index 6678264..b585325 100755 --- a/src/power.c +++ b/src/power.c @@ -331,10 +331,6 @@ static int lock_state(display_state_e state, unsigned int flag, int timeout_ms) char str_timeout[32]; int ret; - arr[0] = get_state_str(state); - if (!arr[0]) - return -EINVAL; - if (flag & GOTO_STATE_NOW) arr[1] = STR_GOTOSTATENOW; else @@ -347,16 +343,20 @@ static int lock_state(display_state_e state, unsigned int flag, int timeout_ms) else arr[2] = STR_NULL; - snprintf(str_timeout, sizeof(str_timeout), "%d", -1); + snprintf(str_timeout, sizeof(str_timeout), "%d", timeout_ms); arr[3] = str_timeout; + + arr[0] = "privilege check"; + ret = dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_LOCK_STATE, "sssi", arr); if (ret == -EACCES || ret == -ECOMM || ret == -EPERM) return -EACCES; - snprintf(str_timeout, sizeof(str_timeout), "%d", timeout_ms); - arr[3] = str_timeout; + arr[0] = get_state_str(state); + if (!arr[0]) + return -EINVAL; return dbus_method_async_with_reply(DEVICED_BUS_NAME, DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, @@ -381,8 +381,17 @@ static int unlock_state(display_state_e state, unsigned int flag) char *arr[2]; int ret; - arr[0] = ""; - arr[1] = ""; + if (flag == PM_SLEEP_MARGIN) + arr[1] = STR_SLEEP_MARGIN; + else if (flag == PM_RESET_TIMER) + arr[1] = STR_RESET_TIMER; + else if (flag == PM_KEEP_TIMER) + arr[1] = STR_KEEP_TIMER; + else + return -EINVAL; + + arr[0] = "privilege check"; + ret = dbus_method_sync(DEVICED_BUS_NAME, DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_UNLOCK_STATE, "ss", arr); @@ -393,15 +402,6 @@ static int unlock_state(display_state_e state, unsigned int flag) if (!arr[0]) return -EINVAL; - if (flag == PM_SLEEP_MARGIN) - arr[1] = STR_SLEEP_MARGIN; - else if (flag == PM_RESET_TIMER) - arr[1] = STR_RESET_TIMER; - else if (flag == PM_KEEP_TIMER) - arr[1] = STR_KEEP_TIMER; - else - return -EINVAL; - return dbus_method_async_with_reply(DEVICED_BUS_NAME, DEVICED_PATH_DISPLAY, DEVICED_INTERFACE_DISPLAY, METHOD_UNLOCK_STATE, "ss", arr, unlock_cb, -1, NULL); -- 2.7.4