From 0530cbf149705bc5d0fc97f653d66031dd904652 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 14 Nov 2017 18:38:09 +0900 Subject: [PATCH 01/16] Release version 0.3.8 Changes: - Fix the slot management - Set the environments before calling launch callback - Fix default loader script Change-Id: I2247a51f3a3f386238b4dc7d157b9d8fa2e8a022 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 1d046ee..d930ae7 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.7 +Version: 0.3.8 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 9280262f8443640ba941c7ba7f2ab6f518fcc494 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Thu, 23 Nov 2017 20:32:31 +0900 Subject: [PATCH 02/16] Fix signal number LAUNCHPAD_LAUNCH_SIGNAL was changed to 83. Change-Id: I780702616985e1f688bc09a7980c6bf1e0202e89 Signed-off-by: Hwankyu Jhun --- inc/launchpad_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h index 90bb662..b7c0096 100644 --- a/inc/launchpad_common.h +++ b/inc/launchpad_common.h @@ -48,7 +48,7 @@ #define PAD_CMD_DEMAND 14 #define PAD_CMD_PING 15 -#define LAUNCHPAD_LAUNCH_SIGNAL 85 +#define LAUNCHPAD_LAUNCH_SIGNAL 83 #define LAUNCHPAD_DEAD_SIGNAL 61 #define APP_STARTUP_SIGNAL 89 -- 2.7.4 From 4d5a27064b5711a5f60e4249dbcf74456e43b85c Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Fri, 24 Nov 2017 08:12:36 +0900 Subject: [PATCH 03/16] Release version 0.3.9 Changes: - Fix signal number Change-Id: I4d9b2c3b8a3ed1f9b29be2afb3112bb0b9156ad7 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index d930ae7..4b767f1 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.8 +Version: 0.3.9 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 38d6d7e7e07a0e3c55e03f53cfab6c674c903c9d Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 5 Dec 2017 09:10:09 +0900 Subject: [PATCH 04/16] Add voice control elm initialization Change-Id: I037d8eda4f049cb1aa6468c453477dcc7bf16ca5 Signed-off-by: Hwankyu Jhun --- CMakeLists.txt | 1 + packaging/launchpad.spec | 1 + src/launchpad_loader.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1e1b618..aedaa17 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ PKG_CHECK_MODULES(${this_target_loader} REQUIRED vconf buxton2 libsystemd + voice-control-elm ) FOREACH(flag ${${this_target_loader}_CFLAGS}) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 4b767f1..a80ab6b 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -24,6 +24,7 @@ BuildRequires: pkgconfig(ttrace) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(libcap) BuildRequires: pkgconfig(tanchor) +BuildRequires: pkgconfig(voice-control-elm) Requires(post): /sbin/ldconfig Requires(post): /usr/bin/systemctl diff --git a/src/launchpad_loader.c b/src/launchpad_loader.c index 6ec1d36..6ad6284 100644 --- a/src/launchpad_loader.c +++ b/src/launchpad_loader.c @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include "launchpad_common.h" #include "launchpad.h" @@ -48,6 +50,7 @@ static Evas_Object *__win; static Evas_Object *__bg; static Evas_Object *__conform; static int __type; +static bool __vc_elm_initialized; enum loader_type { TYPE_COMMON, @@ -141,6 +144,46 @@ static void __fini_window(void) } } +static void __vc_vtauto_changed_cb(keynode_t *key, void *data) +{ + const char *name; + int vt_automode; + + name = vconf_keynode_get_name(key); + if (!name || strcmp(name, VCONFKEY_VC_VOICE_TOUCH_AUTOMODE) != 0) + return; + + vt_automode = vconf_keynode_get_bool(key); + if (vt_automode) { + if (!__vc_elm_initialized) { + vc_elm_initialize(); + __vc_elm_initialized = true; + } + vc_elm_set_auto_register_mode(2, 0); + } else { + vc_elm_deinitialize(); + __vc_elm_initialized = false; + } +} + +static void __vc_elm_init(void) +{ + int vt_automode = 0; + + vconf_notify_key_changed(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, + __vc_vtauto_changed_cb, NULL); + vconf_get_bool(VCONFKEY_VC_VOICE_TOUCH_AUTOMODE, &vt_automode); + if (vt_automode) { + if (!__vc_elm_initialized) { + vc_elm_initialize(); + __vc_elm_initialized = true; + } + vc_elm_set_auto_register_mode(2, 0); + } + + setenv("VC_ELM_INIT", "1", 1); +} + static void __preload_lib(bundle *b) { void *handle = NULL; @@ -215,6 +258,8 @@ static void __loader_create_cb(bundle *extra, int type, void *user_data) break; } + __vc_elm_init(); + ret = vconf_get_int(VCONFKEY_SETAPPL_APP_HW_ACCELERATION, &__sys_hwacc); if (ret != VCONF_OK) { _E("Failed to get vconf int: %s", @@ -351,6 +396,7 @@ do_exec: setenv("LD_LIBRARY_PATH", libdir, 1); free(libdir); unsetenv("AUL_LOADER_INIT"); + unsetenv("VC_ELM_INIT"); if (execv(argv[LOADER_ARG_PATH], argv) < 0) { SECURE_LOGE("execv() failed for file: \"%s\", " \ "error: %d (%s)", argv[LOADER_ARG_PATH], errno, -- 2.7.4 From 03a1b50981c8ef6fe589adb4ac9c820e5d30ae92 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 5 Dec 2017 11:25:59 +0900 Subject: [PATCH 05/16] Release version 0.3.10 Changes: - Add voice control elm initialization Change-Id: I57688bc6d13770bf4a91b9ccf9476077f20e9de3 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index a80ab6b..436c942 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.9 +Version: 0.3.10 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 16fca897db653f8c962bafb9cb90d2ef5ff88d67 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 18 Dec 2017 09:54:32 +0900 Subject: [PATCH 06/16] Wait mountpoints before executing an application Change-Id: I810a297ecf966ead6f49aa42954413f7eba73946 Signed-off-by: Hwankyu Jhun --- CMakeLists.txt | 1 + inc/key.h | 1 + inc/launchpad_common.h | 2 + src/launchpad.c | 4 ++ src/launchpad_common.c | 112 +++++++++++++++++++++++++++++++++++++++++++++++++ src/launchpad_lib.c | 12 +++++- 6 files changed, 130 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index aedaa17..d6f77ec 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,7 @@ PKG_CHECK_MODULES(${this_target_loader} REQUIRED buxton2 libsystemd voice-control-elm + gio-2.0 ) FOREACH(flag ${${this_target_loader}_CFLAGS}) diff --git a/inc/key.h b/inc/key.h index 2628999..fcce5bb 100644 --- a/inc/key.h +++ b/inc/key.h @@ -44,6 +44,7 @@ extern "C" { #define AUL_K_ORG_CALLER_PID "__AUL_ORG_CALLER_PID__" #define AUL_K_HIGHPRIORITY "__AUL_HIGHPRIORITY__" #define AUL_K_IS_GLOBAL "__AUL_IS_GLOBAL__" +#define AUL_K_TEP_PATH "_AUL_TEP_PATH_" #ifdef __cplusplus } diff --git a/inc/launchpad_common.h b/inc/launchpad_common.h index b7c0096..dcfcac6 100644 --- a/inc/launchpad_common.h +++ b/inc/launchpad_common.h @@ -59,6 +59,7 @@ #define _E(fmt, arg...) LOGE(fmt, ##arg) #define _D(fmt, arg...) LOGD(fmt, ##arg) #define _W(fmt, arg...) LOGW(fmt, ##arg) +#define _I(fmt, arg...) LOGI(fmt, ##arg) #define FREE_AND_NULL(x) do { \ if (x) { \ @@ -123,6 +124,7 @@ int _close_all_fds(void); void _get_cpu_idle(unsigned long long *total, unsigned long long *idle); int _setup_stdio(const char *ident); int _set_priority(int prio); +int _wait_tep_mount(bundle *b); #endif /* __LAUNCHPAD_COMMON_H__ */ diff --git a/src/launchpad.c b/src/launchpad.c index 5e66ce0..7e79a65 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -777,6 +777,10 @@ static int __prepare_exec(const char *appid, const char *app_path, /* SET ENVIROMENT*/ _set_env(menu_info, kb); + ret = _wait_tep_mount(kb); + if (ret < 0) + return PAD_ERR_FAILED; + return 0; } diff --git a/src/launchpad_common.c b/src/launchpad_common.c index e6123b5..ab93f12 100644 --- a/src/launchpad_common.c +++ b/src/launchpad_common.c @@ -37,6 +37,8 @@ #include #include #include +#include +#include #include "launchpad_common.h" #include "key.h" @@ -50,6 +52,12 @@ #define AUL_PKT_HEADER_SIZE (sizeof(int) + sizeof(int) + sizeof(int)) #define PATH_AMD_SOCK "/run/aul/daemons/.amd-sock" #define PATH_DEV_NULL "/dev/null" +#define MAX_TEP_IS_MOUNT_RETRY_CNT 100 + +#define TEP_BUS_NAME "org.tizen.system.deviced" +#define TEP_OBJECT_PATH "/Org/Tizen/System/DeviceD/Tzip" +#define TEP_INTERFACE_NAME "org.tizen.system.deviced.Tzip" +#define TEP_IS_MOUNTED_METHOD "IsMounted" static int __read_proc(const char *path, char *buf, int size) { @@ -895,3 +903,107 @@ int _set_priority(int prio) return r; } + +static int __is_tep_mount_done(const char *tep_path) +{ + GError *err = NULL; + GDBusConnection *conn; + GDBusMessage *msg = NULL; + GDBusMessage *reply = NULL; + GVariant *body; + int ret = -1; + + conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err); + if (!conn) { + _E("g_bus_get_sync() is failed. %s", err->message); + goto end; + } + + msg = g_dbus_message_new_method_call(TEP_BUS_NAME, + TEP_OBJECT_PATH, + TEP_INTERFACE_NAME, + TEP_IS_MOUNTED_METHOD); + if (!msg) { + _E("g_dbus_message_new_method_call() is failed. %s", + err->message); + goto end; + } + g_dbus_message_set_body(msg, g_variant_new("(s)", tep_path)); + + reply = g_dbus_connection_send_message_with_reply_sync(conn, + msg, + G_DBUS_SEND_MESSAGE_FLAGS_NONE, + 500, + NULL, + NULL, + &err); + if (!reply) { + _E("Failed to send message with reply. %s", err->message); + goto end; + } + + body = g_dbus_message_get_body(reply); + if (!body) { + _E("Failed to get message body."); + goto end; + } + + g_variant_get(body, "(i)", &ret); + +end: + if (msg) + g_object_unref(msg); + if (reply) + g_object_unref(reply); + if (conn) + g_object_unref(conn); + + g_clear_error(&err); + + return ret; +} + +static int __check_tep_mount(const char *tep_path) +{ + int r; + int cnt = 0; + + if (!tep_path) + return 0; + + while (cnt < MAX_TEP_IS_MOUNT_RETRY_CNT) { + r = __is_tep_mount_done(tep_path); + if (r == 1) + break; + usleep(50 * 1000); + cnt++; + } + + if (r != 1) { + _E("Not able to mount within 5 sec: %s", tep_path); + return -1; + } + + return 0; +} + +int _wait_tep_mount(bundle *b) +{ + int r; + int i; + int len = 0; + const char **tep_paths; + + tep_paths = bundle_get_str_array(b, AUL_K_TEP_PATH, &len); + if (!tep_paths) + return 0; + + for (i = 0; i < len; ++i) { + r = __check_tep_mount(tep_paths[i]); + if (r < 0) + return -1; + } + + _I("Mount has been done."); + return 0; +} diff --git a/src/launchpad_lib.c b/src/launchpad_lib.c index c476fb9..b7a910f 100644 --- a/src/launchpad_lib.c +++ b/src/launchpad_lib.c @@ -55,7 +55,8 @@ static void __at_exit_to_release_bundle(void) } static int __prepare_exec(const char *appid, const char *app_path, - const char *pkg_type, int type, const char* pkgid, bool global) + const char *pkg_type, int type, const char* pkgid, + bool global, bundle *kb) { const char *file_name = NULL; char process_name[AUL_PR_NAME] = { 0, }; @@ -130,6 +131,10 @@ static int __prepare_exec(const char *appid, const char *app_path, snprintf(process_name, AUL_PR_NAME, "%s", file_name); prctl(PR_SET_NAME, process_name); + ret = _wait_tep_mount(kb); + if (ret < 0) + return -1; + return 0; } @@ -138,8 +143,11 @@ static int __default_launch_cb(bundle *kb, const char *appid, const char *pkgid, const char *pkg_type, int loader_type, bool global) { char err_str[MAX_LOCAL_BUFSZ] = { 0, }; + int r; - if (__prepare_exec(appid, app_path, pkg_type, loader_type, pkgid, global) < 0) { + r = __prepare_exec(appid, app_path, pkg_type, loader_type, pkgid, + global, kb); + if (r < 0) { _E("__candidate_process_prepare_exec() failed"); if (access(app_path, F_OK | R_OK)) { SECURE_LOGE("access() failed for file: \"%s\", " \ -- 2.7.4 From 6d69fc920b546b4d3a54c4404a0db381c28b800a Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 18 Dec 2017 18:56:36 +0900 Subject: [PATCH 07/16] Fix tep path definition Change-Id: I229790ee990e4bbaee077c27021555d5847c6c82 Signed-off-by: Hwankyu Jhun --- inc/key.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/key.h b/inc/key.h index fcce5bb..9900b6e 100644 --- a/inc/key.h +++ b/inc/key.h @@ -44,7 +44,7 @@ extern "C" { #define AUL_K_ORG_CALLER_PID "__AUL_ORG_CALLER_PID__" #define AUL_K_HIGHPRIORITY "__AUL_HIGHPRIORITY__" #define AUL_K_IS_GLOBAL "__AUL_IS_GLOBAL__" -#define AUL_K_TEP_PATH "_AUL_TEP_PATH_" +#define AUL_K_TEP_PATH "__AUL_TEP_PATH__" #ifdef __cplusplus } -- 2.7.4 From 3c849a9c06cf1f4915af06cd8bb5fa8bdc542347 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Mon, 18 Dec 2017 19:44:06 +0900 Subject: [PATCH 08/16] Release version 0.3.11 Changes: - Wait mountpoints before executing an application - Fix tep path definition Change-Id: I86f32f51009de27812448a2c082250083bc777ff Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 436c942..52d7364 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.10 +Version: 0.3.11 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From d2d47b8dc2b8972e6bd1f83410b4983450ce6099 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 20 Dec 2017 07:15:50 +0900 Subject: [PATCH 09/16] Revert "Remove wayland env set that no longer required" This reverts commit fe93ddfe7aa636bb84adf004f1a8fbf4c046ecbf. Change-Id: I69129f1608dbd81ed2c001da7f168992a651275f --- inc/key.h | 2 ++ src/launchpad_common.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/inc/key.h b/inc/key.h index 9900b6e..7401ace 100644 --- a/inc/key.h +++ b/inc/key.h @@ -37,6 +37,8 @@ extern "C" { #define AUL_K_LOADER_ID "__AUL_LOADER_ID__" #define AUL_K_LOADER_PATH "__AUL_LOADER_PATH__" #define AUL_K_LOADER_EXTRA "__AUL_LOADER_EXTRA__" +#define AUL_K_WAYLAND_DISPLAY "__AUL_WAYLAND_DISPLAY__" +#define AUL_K_WAYLAND_WORKING_DIR "__AUL_WAYLAND_WORKING_DIR__" #define AUL_K_ROOT_PATH "__AUL_ROOT_PATH__" #define AUL_K_API_VERSION "__AUL_API_VERSION__" #define AUL_K_LOADER_NAME "__AUL_LOADER_NAME__" diff --git a/src/launchpad_common.c b/src/launchpad_common.c index ab93f12..f2272b5 100644 --- a/src/launchpad_common.c +++ b/src/launchpad_common.c @@ -687,6 +687,14 @@ void _set_env(appinfo_t *menu_info, bundle *kb) if (menu_info->app_type != NULL) setenv("RUNTIME_TYPE", menu_info->app_type, 1); + str = bundle_get_val(kb, AUL_K_WAYLAND_DISPLAY); + if (str != NULL) + setenv("WAYLAND_DISPLAY", str, 1); + + str = bundle_get_val(kb, AUL_K_WAYLAND_WORKING_DIR); + if (str != NULL) + setenv("XDG_RUNTIME_DIR", str, 1); + str = bundle_get_val(kb, AUL_K_API_VERSION); if (str != NULL) setenv("TIZEN_API_VERSION", str, 1); -- 2.7.4 From 0f2c0974600ad2f04e10f89c0fd06df9238111e2 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 20 Dec 2017 11:16:44 +0900 Subject: [PATCH 10/16] Release version 0.3.12 Changes: - Revert "Remove wayland env set that no longer required" Change-Id: Ie1b03ca27556a0e0424bf7e63a28e59fd34876b7 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 52d7364..5358085 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.11 +Version: 0.3.12 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 304dfdfb1bfc83592f3ec7de2c4c21e86e23c936 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 9 Jan 2018 17:39:59 +0900 Subject: [PATCH 11/16] Remove setting capabilities The capabilities are set by the set_capability script. Change-Id: I69b7f69daeb1af12351cba028de220f15c6bea48 Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 5358085..33e25f3 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -110,11 +110,7 @@ ln -sf ../launchpad-process-pool.service %{buildroot}%{_unitdir_user}/basic.targ %{_unitdir_user}/launchpad-process-pool.socket %{_unitdir_user}/sockets.target.wants/launchpad-process-pool.socket %{_unitdir_user}/basic.target.wants/launchpad-process-pool.service -%if 0%{?tizen_feature_priority_change} || 0%{?tizen_feature_loader_priority} -%caps(cap_mac_admin,cap_dac_override,cap_setgid,cap_sys_admin,cap_sys_nice=ei) %{_bindir}/launchpad-process-pool -%else -%caps(cap_mac_admin,cap_dac_override,cap_setgid,cap_sys_admin=ei) %{_bindir}/launchpad-process-pool -%endif +%{_bindir}/launchpad-process-pool %attr(0644,root,root) %{_libdir}/liblaunchpad.so.* %files devel @@ -126,8 +122,4 @@ ln -sf ../launchpad-process-pool.service %{buildroot}%{_unitdir_user}/basic.targ %manifest %{name}.manifest %license LICENSE %{_prefix}/share/aul/default.loader -%if 0%{?tizen_feature_priority_change} || 0%{?tizen_feature_loader_priority} -%caps(cap_setgid,cap_sys_admin,cap_sys_nice=ei) %{_bindir}/launchpad-loader -%else -%caps(cap_setgid,cap_sys_admin=ei) %{_bindir}/launchpad-loader -%endif +%{_bindir}/launchpad-loader -- 2.7.4 From 75105f9683e2f4665edc7c73fd2f3775caec05d4 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 10 Jan 2018 08:58:13 +0900 Subject: [PATCH 12/16] Release version 0.3.13 Changes: - Remove setting capabilities Change-Id: Iddd53f0cf1a39282fa776f1629c653235a71f92b Signed-off-by: Hwankyu Jhun --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 33e25f3..10a5700 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.12 +Version: 0.3.13 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 38e9524a303fed2373c4b48258ebefe4fd9c83a1 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Wed, 10 Jan 2018 14:33:55 +0900 Subject: [PATCH 13/16] Cleanup security context after application termination. security_manager_prepare_app() and security_manager_cleanup_app() are a pair of functions to setup/clean security context of application. Each application is launched in a separate mount namespace and linked to this namespace. Such design allows to change privacy privilege status at app runtime. After application termination this link should be removed. Change-Id: I96bb6b88d3822d736e2985c750ec5697165abef2 Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/src/launchpad.c b/src/launchpad.c index 7e79a65..31e6841 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -113,6 +113,7 @@ static int user_slot_offset; static GList *candidate_slot_list; static app_labels_monitor *label_monitor; static GList *launcher_info_list; +static GHashTable *__pid_table; static candidate_process_context_t *__add_slot(int type, int loader_id, int caller_pid, const char *loader_path, const char *extra, @@ -1050,6 +1051,7 @@ static gboolean __handle_sigchild(gpointer data) int fd = lc->gpollfd->fd; struct signalfd_siginfo siginfo; ssize_t s; + char *appid; do { s = read(fd, &siginfo, sizeof(struct signalfd_siginfo)); @@ -1060,6 +1062,15 @@ static gboolean __handle_sigchild(gpointer data) break; _signal_process_sigchld(&siginfo); + + appid = g_hash_table_lookup(__pid_table, + GINT_TO_POINTER(siginfo.ssi_pid)); + if (appid) { + security_manager_cleanup_app(appid, siginfo.ssi_uid); + g_hash_table_remove(__pid_table, + GINT_TO_POINTER(siginfo.ssi_pid)); + } + cpc = __find_slot_from_pid(siginfo.ssi_pid); if (cpc != NULL) { __reset_slot(cpc); @@ -1501,8 +1512,11 @@ end: if (clifd != -1) close(clifd); - if (pid > 0) + if (pid > 0) { _signal_send_app_launch_signal(pid, menu_info->appid); + g_hash_table_insert(__pid_table, GINT_TO_POINTER(pid), + strdup(menu_info->appid)); + } if (menu_info != NULL) _appinfo_free(menu_info); @@ -1863,11 +1877,21 @@ static int __before_loop(int argc, char **argv) if (ret < 0) _W("Failed to send cmd(%d) to amd", LAUNCHPAD_LAUNCH_SIGNAL); + __pid_table = g_hash_table_new_full(g_direct_hash, g_direct_equal, + NULL, free); + if (!__pid_table) { + _E("Failed to create pid table"); + return -1; + } + return 0; } static void __after_loop(void) { + if (__pid_table) + g_hash_table_destroy(__pid_table); + if (_send_cmd_to_amd(LAUNCHPAD_DEAD_SIGNAL) < 0) _W("Failed to send cmd(%d) to amd", LAUNCHPAD_DEAD_SIGNAL); -- 2.7.4 From 376a3cf6692d5a2f2c87e831951c583fbf2ab277 Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Thu, 18 Jan 2018 14:07:16 +0900 Subject: [PATCH 14/16] Add printing log for dlopen failure Change-Id: I1d49786c392fea93933a50495015bfac97f04230 Signed-off-by: Semun Lee --- src/launchpad_loader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/launchpad_loader.c b/src/launchpad_loader.c index 6ad6284..8e75181 100644 --- a/src/launchpad_loader.c +++ b/src/launchpad_loader.c @@ -202,6 +202,10 @@ static void __preload_lib(bundle *b) for (i = 0; i < len; i++) { handle = dlopen(so_array[i], RTLD_NOW | RTLD_NODELETE); _D("preload %s# - handle : %p", so_array[i], handle); + if (!handle) { + _E("failed to load: %s, err: %s", + so_array[i], dlerror()); + } } } -- 2.7.4 From 12d808b2432aa1a0fbe11be22572665ad78c0597 Mon Sep 17 00:00:00 2001 From: Semun Lee Date: Thu, 18 Jan 2018 16:01:31 +0900 Subject: [PATCH 15/16] Release version 0.3.14 Changes: - Cleanup security context after application termination. - Add printing log for dlopen failure Change-Id: Ie2a072de6ffde678902eab33d43adcfd4b47156e Signed-off-by: Semun Lee --- packaging/launchpad.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packaging/launchpad.spec b/packaging/launchpad.spec index 10a5700..3ed4bbe 100644 --- a/packaging/launchpad.spec +++ b/packaging/launchpad.spec @@ -1,6 +1,6 @@ Name: launchpad Summary: Launchpad for launching applications -Version: 0.3.13 +Version: 0.3.14 Release: 1 Group: Application Framework/Daemons License: Apache-2.0 -- 2.7.4 From 3c79952d53697807181ad65ec0863adabde98831 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 23 Jan 2018 09:01:26 +0900 Subject: [PATCH 16/16] Fix a bug about infinite loop Change-Id: Id95750d4921462fce6dbd6120b122bc1d9752d0f Signed-off-by: Hwankyu Jhun --- src/launchpad.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/launchpad.c b/src/launchpad.c index 31e6841..6497113 100755 --- a/src/launchpad.c +++ b/src/launchpad.c @@ -1202,8 +1202,10 @@ static int __add_idle_checker(int detection_method, GList *cur) continue; } - if (detection_method == EVENT_BOOTING && !cpc->on_boot) + if (detection_method == EVENT_BOOTING && !cpc->on_boot) { + iter = g_list_next(iter); continue; + } if (cpc->pid == CANDIDATE_NONE && (detection_method == EVENT_BOOTING || -- 2.7.4