--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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
+ *
+ * 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.
+ */
+
+#ifndef __LAUNCHPAD_PLUGIN_H__
+#define __LAUNCHPAD_PLUGIN_H__
+
+#include <bundle.h>
+
+int _launchpad_plugin_prepare_app(const char *app_id, bundle *kb);
+
+#endif /* __LAUNCHPAD_PLUGIN_H__ */
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.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
+ *
+ * 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.
+ */
+
+#define _GNU_SOURCE
+#include <dlfcn.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+#include "launchpad_plugin.h"
+#include "log_private.h"
+
+#define PATH_LAUNCHPAD_PLUGIN "/usr/share/aul/plugin/liblaunchpad-plugin.so"
+#define TAG_LAUNCHPAD_PLUGIN_PREPARE_APP "LAUNCHPAD_PLUGIN_PREPARE_APP"
+
+int _launchpad_plugin_prepare_app(const char *app_id, bundle *kb)
+{
+ void *handle;
+ int (*prepare_app)(const char *, bundle *);
+ int ret;
+
+ ret = access(PATH_LAUNCHPAD_PLUGIN, F_OK);
+ if (ret != 0) {
+ _D("plugin module does not exist. errno(%d)", errno);
+ return 0;
+ }
+
+ handle = dlopen(PATH_LAUNCHPAD_PLUGIN, RTLD_LAZY | RTLD_LOCAL);
+ if (!handle) {
+ _W("Failed to open plugin so. error(%s)", dlerror());
+ return 0;
+ }
+
+ prepare_app = dlsym(handle, TAG_LAUNCHPAD_PLUGIN_PREPARE_APP);
+ if (!prepare_app) {
+ _W("Failed to load %s", TAG_LAUNCHPAD_PLUGIN_PREPARE_APP);
+ return 0;
+ }
+
+ _W("LAUNCHPAD_PLUGIN_PREPARE_APP ++");
+ ret = prepare_app(app_id, kb);
+ _W("LAUNCHPAD_PLUGIN_PREPARE_APP --");
+ if (ret != 0)
+ return -1;
+
+ return 0;
+}
ADD_EXECUTABLE(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_SOURCE_FILES})
IF(_TIZEN_FEATURE_PRELINK)
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_PKGS_LDFLAGS} "-lm")
+TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_PKGS_LDFLAGS} "-lm -ldl")
ELSE(_TIZEN_FEATURE_PRELINK)
-TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_PKGS_LDFLAGS} "-pie -lm")
+TARGET_LINK_LIBRARIES(${LAUNCHPAD_PROCESS_POOL} ${LAUNCHPAD_PROCESS_POOL_PKGS_LDFLAGS} "-pie -lm -ldl")
ENDIF(_TIZEN_FEATURE_PRELINK)
SET_TARGET_PROPERTIES(${LAUNCHPAD_PROCESS_POOL} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS_pool})
#include "launchpad_inotify.h"
#include "launchpad_io_channel.h"
#include "launchpad_memory_monitor.h"
+#include "launchpad_plugin.h"
#include "launchpad_proc.h"
#include "launchpad_signal.h"
#include "launchpad_types.h"
/* TODO : should be add to check permission in the kernel*/
setsid();
+ ret = _launchpad_plugin_prepare_app(appid, kb);
+ if (ret < 0) {
+ _E("_launchpad_plugin_prepare_app() is failed. error(%d)", ret);
+ return PAD_ERR_FAILED;
+ }
+
ret = _enable_external_pkg(kb, menu_info->pkgid,
menu_info->global ? GLOBAL_USER : getuid());
if (ret < 0)
#include "launchpad.h"
#include "launchpad_common.h"
+#include "launchpad_plugin.h"
#include "launchpad_types.h"
#include "preexec.h"
__preexec_run(pkg_type, appid, app_path);
+ ret = _launchpad_plugin_prepare_app(appid, kb);
+ if (ret != 0) {
+ _E("_launchpad_plugin_prepare_app() is failed. error(%d)", ret);
+ return -1;
+ }
+
ret = _enable_external_pkg(kb, pkgid, global ? GLOBAL_USER : getuid());
if (ret < 0)
return -1;