summaryrefslogtreecommitdiff
path: root/lock-mgr/src/lockd-process-mgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'lock-mgr/src/lockd-process-mgr.c')
-rwxr-xr-xlock-mgr/src/lockd-process-mgr.c69
1 files changed, 21 insertions, 48 deletions
diff --git a/lock-mgr/src/lockd-process-mgr.c b/lock-mgr/src/lockd-process-mgr.c
index f227d72..179fced 100755
--- a/lock-mgr/src/lockd-process-mgr.c
+++ b/lock-mgr/src/lockd-process-mgr.c
@@ -1,22 +1,17 @@
/*
- * starter
+ * Copyright 2012 Samsung Electronics Co., Ltd
*
- * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
- *
- * Contact: Seungtaek Chung <seungtaek.chung@samsung.com>, Mi-Ju Lee <miju52.lee@samsung.com>, Xi Zhichan <zhichan.xi@samsung.com>
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Flora License, Version 1.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.tizenopensource.org/license
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- *
*/
#include <vconf.h>
@@ -26,10 +21,10 @@
#include "lockd-debug.h"
#include "lockd-process-mgr.h"
+#include "starter-vconf.h"
-#define VCONFKEY_LOCKP_PKG_NAME "db/lockscreen/pkgname"
#define LOCKD_DEFAULT_PKG_NAME "org.tizen.draglock"
-#define LOCKD_PHONE_LOCK_PKG_NAME "org.tizen.phone-lock"
+#define LOCKD_DEFAULT_LOCKSCREEN "org.tizen.draglock"
#define RETRY_MAXCOUNT 30
#define RELAUNCH_INTERVAL 100*1000
@@ -37,7 +32,7 @@ static char *_lockd_process_mgr_get_pkgname(void)
{
char *pkgname = NULL;
- pkgname = vconf_get_str(VCONFKEY_LOCKP_PKG_NAME);
+ pkgname = vconf_get_str(VCONF_PRIVATE_LOCKSCREEN_PKGNAME);
LOCKD_DBG("pkg name is %s", pkgname);
@@ -48,7 +43,7 @@ static char *_lockd_process_mgr_get_pkgname(void)
return pkgname;
}
-int lockd_process_mgr_restart_lock(int phone_lock_state)
+int lockd_process_mgr_restart_lock(void)
{
char *lock_app_path = NULL;
int pid;
@@ -58,10 +53,7 @@ int lockd_process_mgr_restart_lock(int phone_lock_state)
b = bundle_create();
- if (phone_lock_state)
- bundle_add(b, "mode", "lock");
- else
- bundle_add(b, "mode", "normal");
+ bundle_add(b, "mode", "normal");
pid = aul_launch_app(lock_app_path, b);
@@ -75,8 +67,7 @@ int lockd_process_mgr_restart_lock(int phone_lock_state)
}
int
-lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *),
- int phone_lock_state)
+lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *))
{
char *lock_app_path = NULL;
int pid;
@@ -86,10 +77,7 @@ lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *),
b = bundle_create();
- if (phone_lock_state)
- bundle_add(b, "mode", "lock");
- else
- bundle_add(b, "mode", "normal");
+ bundle_add(b, "mode", "normal");
int i;
for (i=0; i<RETRY_MAXCOUNT; i++)
@@ -101,6 +89,15 @@ lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *),
if (pid == AUL_R_ECOMM) {
LOCKD_DBG("Relaunch lock application [%d]times", i);
usleep(RELAUNCH_INTERVAL);
+ } else if (pid == AUL_R_ERROR) {
+ LOCKD_DBG("launch[%s] is failed, launch default lock screen", lock_app_path);
+ pid = aul_launch_app(LOCKD_DEFAULT_LOCKSCREEN, b);
+ if (pid >0) {
+ aul_listen_app_dead_signal(dead_cb, data);
+ if (b)
+ bundle_free(b);
+ return pid;
+ }
} else {
/* set listen and dead signal */
aul_listen_app_dead_signal(dead_cb, data);
@@ -113,25 +110,6 @@ lockd_process_mgr_start_lock(void *data, int (*dead_cb) (int, void *),
return pid;
}
-int lockd_process_mgr_start_phone_lock(void)
-{
- int pid = 0;
- bundle *b = NULL;
-
- b = bundle_create();
-
- bundle_add(b, "pwlock_type", "running_lock");
- bundle_add(b, "window_type", "alpha");
-
- pid = aul_launch_app(LOCKD_PHONE_LOCK_PKG_NAME, b);
- LOCKD_DBG("aul_launch_app(%s, b), pid = %d", LOCKD_PHONE_LOCK_PKG_NAME,
- pid);
- if (b)
- bundle_free(b);
-
- return pid;
-}
-
void
lockd_process_mgr_terminate_lock_app(int lock_app_pid, int state)
{
@@ -147,20 +125,15 @@ lockd_process_mgr_terminate_lock_app(int lock_app_pid, int state)
}
}
-void lockd_process_mgr_terminate_phone_lock(int phone_lock_pid)
-{
- LOCKD_DBG("Terminate Phone Lock(pid : %d)", phone_lock_pid);
- aul_terminate_pid(phone_lock_pid);
-}
-
int lockd_process_mgr_check_lock(int pid)
{
char buf[128];
LOCKD_DBG("%s, %d", __func__, __LINE__);
+
if (aul_app_get_pkgname_bypid(pid, buf, sizeof(buf)) < 0) {
LOCKD_DBG("no such pkg by pid %d\n", pid);
} else {
- LOCKD_DBG("lock screen pkgname = %s, pid = %d\n", buf, pid);
+ LOCKD_DBG("app pkgname = %s, pid = %d\n", buf, pid);
if (aul_app_is_running(buf) == TRUE) {
LOCKD_DBG("%s [pid = %d] is running\n", buf, pid);
return TRUE;