DEVICE_NOTIFIER_BATTERY_PRESENT,
DEVICE_NOTIFIER_BATTERY_OVP,
DEVICE_NOTIFIER_BATTERY_CHARGING,
+ DEVICE_NOTIFIER_DISPLAY_LOCK,
DEVICE_NOTIFIER_POWER_RESUME,
DEVICE_NOTIFIER_POWEROFF,
DEVICE_NOTIFIER_POWEROFF_HAPTIC,
{ S_LCDDIM, S_NORMAL }, /* S_NORMAL */
{ S_LCDOFF, S_NORMAL }, /* S_LCDDIM */
{ S_SLEEP, S_NORMAL }, /* S_LCDOFF */
- { S_STANDBY, S_STANDBY }, /* S_STANDBY */
+ { S_SLEEP, S_STANDBY }, /* S_STANDBY */
{ S_LCDOFF, S_NORMAL }, /* S_SLEEP */
{ S_POWEROFF, S_POWEROFF }, /* S_POWEROFF */
};
_SD("[%s] locked by pid %d - process %s holdkeyblock %d\n",
states[state].name, pid, pname, holdkey_block);
set_lock_time(pname, state);
+
+ device_notify(DEVICE_NOTIFIER_DISPLAY_LOCK, (void *)true);
}
static void proc_condition_unlock(PMMsg *data)
_SD("[%s] unlocked by pid %d - process %s\n",
states[state].name, pid, pname);
set_unlock_time(pname, state);
+
+ device_notify(DEVICE_NOTIFIER_DISPLAY_LOCK, (void *)false);
}
static int proc_condition(PMMsg *data)
#include <stdio.h>
#include <stdbool.h>
#include <time.h>
+#include <Ecore.h>
#include "core/common.h"
#include "core/log.h"
#include "core/device-notifier.h"
#define SIGNAL_POST_WAKEUP "PostWakeUp"
#define SIGNAL_EARLY_WAKEUP "EarlyWakeUp"
+static Ecore_Timer *standby_timer;
+
static int change_state(pid_t pid, int type, enum state_t st)
{
int ret;
return -EPERM;
/* do not change to next state if who lock the standby mode */
- check_processes(pm_cur_state);
- if (check_lock_state(pm_cur_state)) {
- _I("S_STANDBY Lock state");
+ check_processes(S_LCDOFF);
+ if (check_lock_state(S_LCDOFF)) {
+ _I("S_LCDOFF Lock state");
return 1;
}
return 0;
}
+static int poweroff_trans(int evt);
+
+static Eina_Bool standby_go_next_state(void *data)
+{
+ int ret;
+
+ if (standby_timer) {
+ ecore_timer_del(standby_timer);
+ standby_timer = NULL;
+ }
+
+ ret = pm_change_internal(INTERNAL_LOCK_SUSPEND, SUSPEND);
+ if (ret < 0) {
+ _E("Failed to change state to S_SUSPEND. Now Power off !!");
+ poweroff_trans(0);
+ }
+
+ return ECORE_CALLBACK_CANCEL;
+}
+
static int standby_action(int timeout)
{
if (pm_cur_state != pm_old_state &&
backlight_ops.off(0);
+ standby_timer = ecore_timer_add(0,
+ standby_go_next_state, NULL);
+ if (!standby_timer)
+ _E("Failed to add timer to go to next state of S_STANDBY");
+
return 0;
}
/* TODO: count InstandOn */
cond = S_LCDON;
- ret = tv_proc_change_state(cond, getpid());
+ ret = tv_proc_change_state(cond, INTERNAL_LOCK_SUSPEND);
if (ret < 0)
_E("Fail to change state to next_state(%s)", states[cond].name);
return 0;
}
+static int display_lock_changed(void *data)
+{
+ bool state = (bool)data;
+
+ if (pm_cur_state != S_STANDBY)
+ return 0;
+
+ if (!state)
+ standby_go_next_state(NULL);
+
+ return 0;
+}
+
static void set_tv_operations(enum state_t st,
char *name,
int (*check) (int curr, int next),
tv_states[i].action);
change_proc_change_state(tv_proc_change_state);
+
+ register_notifier(DEVICE_NOTIFIER_DISPLAY_LOCK, display_lock_changed);
+}
+
+static void __DESTRUCTOR__ state_tv_deinit(void)
+{
+ unregister_notifier(DEVICE_NOTIFIER_DISPLAY_LOCK, display_lock_changed);
}