From 28d47bcc0c5bd581f96686e2d3cbdb8e60aa56c5 Mon Sep 17 00:00:00 2001 From: junkyu han Date: Thu, 6 Apr 2017 15:03:20 +0900 Subject: [PATCH] Process ODE Change-Id: I24a6c0f174d8f9e44fa1487622aaa2cce300530e --- CMakeLists.txt | 1 + include/mobile/starter.h | 7 ++++ packaging/starter.spec | 1 + src/mobile/lock_mgr.c | 19 +++++++++ src/mobile/starter.c | 103 +++++++++++++++++++++++++++-------------------- src/process_mgr.c | 3 -- 6 files changed, 88 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 427877b..7e7d58f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,7 @@ pkg_check_modules(pkgs REQUIRED efl-extension liblazymount libsystemd-daemon + ode ) ELSEIF("${TIZEN_PROFILE_NAME}" STREQUAL "WEARABLE") diff --git a/include/mobile/starter.h b/include/mobile/starter.h index a9700c2..b973b9d 100644 --- a/include/mobile/starter.h +++ b/include/mobile/starter.h @@ -24,4 +24,11 @@ struct appdata { int lcd_status; }; +enum ODE_PROCESS { + BEFORE_LOCKSCREEN = 0, + AFTER_LOCKSCREEN, +}; + +int starter_execute_ode_process(int booting_state); + #endif /* __STARTER_H__ */ diff --git a/packaging/starter.spec b/packaging/starter.spec index 5bb5290..94087ff 100644 --- a/packaging/starter.spec +++ b/packaging/starter.spec @@ -29,6 +29,7 @@ BuildRequires: pkgconfig(capi-system-info) BuildRequires: pkgconfig(efl-extension) BuildRequires: pkgconfig(liblazymount) BuildRequires: pkgconfig(libsystemd-daemon) +BuildRequires: pkgconfig(ode) BuildRequires: pkgconfig(rua) BuildRequires: pkgconfig(feedback) diff --git a/src/mobile/lock_mgr.c b/src/mobile/lock_mgr.c index 2fdd201..691632b 100644 --- a/src/mobile/lock_mgr.c +++ b/src/mobile/lock_mgr.c @@ -31,6 +31,7 @@ #include #include #include +#include #include "lock_mgr.h" #include "package_mgr.h" @@ -39,6 +40,8 @@ #include "dbus_util.h" #include "util.h" #include "status.h" +#include "home_mgr.h" +#include "starter.h" #define SYSTEM_INFO_KEY_NETWORK_TELEPHONY "http://tizen.org/feature/network.telephony" @@ -240,9 +243,25 @@ static void _other_lockscreen_unlock(void) void lock_mgr_unlock(void) { + int ret = 0; + int booting_completed = 0; int lock_type = status_active_get()->setappl_screen_lock_type_int; _D("lock type(%d)", lock_type); + ret = vconf_get_int(VCONFKEY_STARTER_SEQUENCE, &booting_completed); + if (ret != 0) { + _E("Failed to get VCONFKEY STARTER SEQUENCE"); + return; + } + + if (!booting_completed) { + ret = starter_execute_ode_process(AFTER_LOCKSCREEN); + if (!ret) { + _E("Failed to execute ode process"); + return; + } + } + lock_mgr_idle_lock_state_set(VCONFKEY_IDLE_UNLOCK); lock_mgr_sound_play(LOCK_SOUND_UNLOCK); s_lock_mgr.lock_pid = 0; diff --git a/src/mobile/starter.c b/src/mobile/starter.c index 9173a7b..6ef1918 100755 --- a/src/mobile/starter.c +++ b/src/mobile/starter.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -42,9 +43,6 @@ #include "hw_key.h" #include "dbus_util.h" -#define APPID_SYS_LOCK "org.tizen.sys-lock" - - static void _set_starter_sequence(int val) { vconf_set_int(VCONFKEY_STARTER_SEQUENCE, val); @@ -185,16 +183,13 @@ static void _mount_and_launch_apps(void) */ ret = do_mount_user(); if (ret != 0) { - _E("Failed to do mount [/opt] area"); + _E("Failed to mount [/opt] area"); return; } - /* - * Wait user data partition mount - */ ret = wait_mount_user(); if (ret != 0) { - _E("Failed to wait mount [/opt] area"); + _E("Failed to wait mount for [/opt] area"); return; } @@ -217,31 +212,10 @@ static void _mount_and_launch_apps(void) -static void _sys_lock_status_changed_cb(void *data, DBusMessage *msg) -{ - int is_unlock = 0; - - is_unlock = dbus_message_is_signal(msg, SYS_LOCK_INTERFACE_UNLOCK, SYS_LOCK_MEMBER_UNLOCK); - - _D("sys-lock signal is received. unlock state(%d).", is_unlock); - - if (is_unlock) { - _mount_and_launch_apps(); - - /* - * Send DBus signal to terminate sys-lock - */ - dbus_util_send_sys_lock_teminate_signal(); - } -} - - - static void _init(struct appdata *ad) { struct sigaction act; char err_buf[128] = { 0, }; - int is_lazy_mount = 0; int ret = 0; memset(&act, 0x00, sizeof(struct sigaction)); @@ -281,20 +255,9 @@ static void _init(struct appdata *ad) */ _set_starter_sequence(0); - is_lazy_mount = get_need_ui_for_lazy_mount(); - _D("Lazy mount : %d", is_lazy_mount); - if (is_lazy_mount) { - /* - * Launch Sys-lock - */ - process_mgr_must_launch(APPID_SYS_LOCK, NULL, NULL, NULL, NULL); - - /* - * Register sys-lock status changed cb - */ - dbus_util_receive_sys_lock_status(_sys_lock_status_changed_cb, NULL); - } else { - _mount_and_launch_apps(); + ret = starter_execute_ode_process(BEFORE_LOCKSCREEN); + if (!ret) { + _E("Failed to execute ode process"); } aul_listen_app_dead_signal(_check_dead_signal, NULL); @@ -338,3 +301,57 @@ int main(int argc, char *argv[]) return 0; } + + + +static void _mount_complete_cb(void *user_data) +{ + _D("Mount is successfully completed"); +} + + + +int starter_execute_ode_process(int booting_state) +{ + _D("This call is before or after Lockscreen: %d", booting_state); + int ret = ODE_ERROR_NONE; + int ode_state = 0; + + ret = ode_internal_encryption_get_state(&ode_state); + if (ret != ODE_ERROR_NONE) { + _E("Failed to get ODE state, ret: %d", ret); + return 0; + } + + if (booting_state == BEFORE_LOCKSCREEN) { + if (ode_state == ODE_STATE_ENCRYPTED) { + lock_mgr_init(); + + ret = ode_internal_encryption_set_mount_event_cb(_mount_complete_cb, NULL); + if (ret != ODE_ERROR_NONE) { + _E("Failed to set mount event cb"); + } + } else { + _mount_and_launch_apps(); + } + } else if (booting_state == AFTER_LOCKSCREEN) { + if (ode_state == ODE_STATE_ENCRYPTED) { + _D("ODE state is: %d, and we should mount at this time", ode_state); + + ret = ode_internal_encryption_mount(); + if (ret != ODE_ERROR_NONE) { + _E("Failed to mount"); + return 0; + } + + sd_notify(0, "READY=1"); + home_mgr_init(NULL); + + vconf_set_int(VCONFKEY_STARTER_SEQUENCE, 1); + } else { + _D("ODE state is: %d, Do nothing"); + } + } + + return 1; +} diff --git a/src/process_mgr.c b/src/process_mgr.c index f83184f..1a242c8 100644 --- a/src/process_mgr.c +++ b/src/process_mgr.c @@ -478,6 +478,3 @@ int process_mgr_validate_call(int pid) return FALSE; } - - - -- 2.7.4