void bd_get_focussed_app_id(char **app_name);
-void bm_get_name_from_pid(pid_t pid, char **pname);
+void bm_get_name_for_pid(pid_t pid, char **pname);
void bm_data_free(gpointer data);
static int prev_lock = 0;
char *pname = NULL;
+ _INFO("lock [%s], pid [%d]", lock_type, pid);
+
if (g_strcmp0(lock_type, "lcdoff") == 0)
val = 0;
else if (g_strcmp0(lock_type, "lcddim") == 0)
val = 1;
else if (g_strcmp0(lock_type, "lcdon") == 0)
val = 2;
- else
+ else {
+ _DBG("different lock_type - [%s]", lock_type);
return;
+ }
- if (prev_lock == val)
+ if (prev_lock == val) {
+ _DBG("return due to same values");
return;
- else
+ } else {
prev_lock = val;
+ }
+
+ bm_get_name_for_pid(pid, &pname);
- bm_get_name_from_pid(pid, &pname);
+ _DBG("received process name - [%s]", pname);
/* get event object */
event_pool *event = bd_listener_get_event_obj(LISTEN_POWERLOCKUNLOCK_STATE, val, pname);
const gchar *iface, const gchar *signal, GVariant *params, gpointer user_data)
{
ENTER;
+
pid_t pid;
char *lock_type;
unsigned int timeout;
+
g_variant_get(params, "(&sii)", &lock_type, &pid, &timeout);
_INFO(" powerlock value changed =%s Pid=%d, timeout=%d", lock_type, pid, timeout);
const gchar *iface, const gchar *signal, GVariant *params, gpointer user_data)
{
ENTER;
+
pid_t pid;
char *lock_type;
unsigned int timeout;
return;
}
-void bm_get_name_from_pid(pid_t pid, char **pname)
+void bm_get_name_for_pid(pid_t pid, char **pname)
{
_INFO("pid = [%d]", pid);
snprintf(buf, PATH_MAX, "/proc/%d/cmdline", pid);
+ if (access(buf, F_OK) != 0) {
+ _ERR("maybe pid no more exists");
+ return;
+ }
+
fd = open(buf, O_RDONLY);
if (fd < 0) {
_ERR("process(%d) does not exist now.", pid);