return pid;
}
-int _display_lock_state(char *state, char *flag, unsigned int timeout)
+void _display_lock_state(char *state, char *flag, unsigned int timeout)
{
GDBusMessage *msg = NULL;
GDBusMessage *reply = NULL;
GVariant *body = NULL;
- int ret = ALARMMGR_RESULT_SUCCESS;
int val = -1;
+ LOGD("Lock the display not to enter LCD OFF");
+
msg = g_dbus_message_new_method_call(
DEVICED_BUS_NAME,
DEVICED_PATH_DISPLAY,
if (!msg) {
LOGE("g_dbus_message_new_method_call() is failed. (%s:%s-%s)",
DEVICED_BUS_NAME, DEVICED_INTERFACE_DISPLAY, DEVICED_LOCK_STATE);
- return ERR_ALARM_SYSTEM_FAIL;
+ return;
}
g_dbus_message_set_body(
if (!reply) {
LOGE("No reply.\
g_dbus_connection_send_message_with_reply_sync() is failed.");
- ret = ERR_ALARM_SYSTEM_FAIL;
} else {
body = g_dbus_message_get_body(reply);
if (!body) {
LOGE("g_dbus_message_get_body() is failed.");
- ret = ERR_ALARM_SYSTEM_FAIL;
} else {
g_variant_get(body, "(i)", &val);
if (val != 0) {
LOGE("Failed to lock display");
- ret = ERR_ALARM_SYSTEM_FAIL;
} else {
LOGD("Lock LCD OFF is successfully done");
}
g_object_unref(msg);
if (reply)
g_object_unref(reply);
-
- return ret;
}
-int _display_unlock_state(char *state, char *flag)
+void _display_unlock_state(char *state, char *flag)
{
GDBusMessage *msg = NULL;
GDBusMessage *reply = NULL;
GVariant *body = NULL;
- int ret = ALARMMGR_RESULT_SUCCESS;
int val = -1;
+ LOGD("Unlock the display from LCD OFF");
+
msg = g_dbus_message_new_method_call(
DEVICED_BUS_NAME,
DEVICED_PATH_DISPLAY,
if (!msg) {
LOGE("g_dbus_message_new_method_call() is failed. (%s:%s-%s)",
DEVICED_BUS_NAME, DEVICED_INTERFACE_DISPLAY, DEVICED_UNLOCK_STATE);
- return ERR_ALARM_SYSTEM_FAIL;
+ return;
}
g_dbus_message_set_body(msg, g_variant_new("(ss)", state, flag));
if (!reply) {
LOGE("No reply.\
g_dbus_connection_send_message_with_reply_sync() is failed.");
- ret = ERR_ALARM_SYSTEM_FAIL;
} else {
body = g_dbus_message_get_body(reply);
if (!body) {
LOGE("g_dbus_message_get_body() is failed.");
- ret = ERR_ALARM_SYSTEM_FAIL;
} else {
g_variant_get(body, "(i)", &val);
if (val != 0) {
LOGE("Failed to unlock display");
- ret = ERR_ALARM_SYSTEM_FAIL;
} else {
LOGD("Unlock LCD OFF is successfully done");
}
g_object_unref(msg);
if (reply)
g_object_unref(reply);
-
- return ret;
}
static void handle_method_call(GDBusConnection *connection,
if (db_path)
free(db_path);
} else if (g_strcmp0(method_name, "alarm_set_rtc_time") == 0) {
+ _display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0);
ret = alarm_manager_alarm_set_rtc_time(parameters);
g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret));
+ _display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN);
} else if (g_strcmp0(method_name, "alarm_set_time") == 0) {
+ _display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0);
ret = alarm_manager_alarm_set_time(parameters, pid);
g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret));
+ _display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN);
} else if (g_strcmp0(method_name, "alarm_set_time_with_propagation_delay") == 0) {
+ _display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0);
ret = alarm_manager_alarm_set_time_with_propagation_delay(parameters, pid);
g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret));
+ _display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN);
} else if (g_strcmp0(method_name, "alarm_set_timezone") == 0) {
+ _display_lock_state(DEVICED_LCD_OFF, DEVICED_STAY_CUR_STATE, 0);
ret = alarm_manager_alarm_set_timezone(parameters);
g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret));
+ _display_unlock_state(DEVICED_LCD_OFF, DEVICED_SLEEP_MARGIN);
} else if (g_strcmp0(method_name, "alarm_set_global") == 0) {
ret = alarm_manager_alarm_set_global(parameters, uid);
g_dbus_method_invocation_return_value(invoc, g_variant_new("(i)", ret));