buxton2
libsystemd
voice-control-elm
+ gio-2.0
)
FOREACH(flag ${${this_target_loader}_CFLAGS})
#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
}
#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) { \
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__ */
/* SET ENVIROMENT*/
_set_env(menu_info, kb);
+ ret = _wait_tep_mount(kb);
+ if (ret < 0)
+ return PAD_ERR_FAILED;
+
return 0;
}
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/personality.h>
+#include <glib.h>
+#include <gio/gio.h>
#include "launchpad_common.h"
#include "key.h"
#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)
{
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;
+}
}
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, };
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;
}
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\", " \