/**
* @brief Sends an application launch request before amd ready.
- * @since_tizen 10.0
+ * @since_tizen 9.0
* @details This is fast version of aul_launch_app().
* This is functionally similar to the app_launcher -f option.
* @param[in] appid application name to be run as callee
int aul_launch_app_fast_for_uid(const char *appid, bundle *bundle, uid_t uid);
+
+/**
+ * @brief Sends an application launch request without resinfo before amd ready.
+ * @since_tizen 9.0
+ * @details This is fast version of aul_launch_app().
+ * This is functionally similar to the app_launcher -f option.
+ * @param[in] appid application name to be run as callee
+ * @param[in] kb bundle to be passed to callee
+ * @return callee's pid if success, negative value(<0) if fail
+ * @retval AUL_R_OK - success
+ * @retval AUL_R_EINVAL - invaild application name
+ * @retval AUL_R_ECOM - internal AUL IPC error
+ * @retval AUL_R_ERROR - general error
+ * @remarks This function is only for App Framework internally.
+ */
+int aul_launch_app_fast_without_resinfo(const char *appid, bundle *bundle);
+
+int aul_launch_app_fast_without_resinfo_for_uid(const char *appid, bundle *bundle, uid_t uid);
+
#ifdef __cplusplus
}
#endif
return gles;
}
-bool SetAppinfoForLaunchpad(bundle* kb, std::string_view appid, uid_t uid) {
+bool SetAppinfoForLaunchpad(bundle* kb, std::string_view appid, uid_t uid, bool res_info = true) {
char *pkgid = nullptr;
char *exec = nullptr;
char *apptype = nullptr;
bundle_add(kb, AUL_K_FAST_LAUNCH, "true");
aul_svc_set_loader_id(kb, PAD_LOADER_ID_DIRECT);
- SetResInfo(handle, uid, kb);
+ if (res_info)
+ SetResInfo(handle, uid, kb);
+
return true;
}
return pid;
}
+
+
+extern "C" int aul_launch_app_fast_without_resinfo(const char* appid, bundle* bundle) {
+ return aul_launch_app_fast_without_resinfo_for_uid(appid, bundle, getuid());
+}
+
+extern "C" int aul_launch_app_fast_without_resinfo_for_uid(const char *appid,
+ bundle* bundle, uid_t uid) {
+ if (appid == nullptr) {
+ _E("Invalid parameter");
+ return AUL_R_EINVAL;
+ }
+
+ if (access(kAmdReadyPath, F_OK) == 0) {
+ bundle_del(bundle, AUL_K_FAST_LAUNCH);
+ return aul_launch_app_for_uid(appid, bundle, uid);
+ }
+
+ _W("without resinfo");
+ if (!SetAppinfoForLaunchpad(bundle, appid, uid, false)) {
+ _E("Failed to set appinfo. appid: %s, uid: %u", appid, uid);
+ return AUL_R_ERROR;
+ }
+
+ std::string socket_path = "/run/aul/daemons/" + std::to_string(uid) + "/" +
+ kLaunchpadProcessPoolSock;
+
+ int retry_count = 0;
+ while (access(socket_path.c_str(), F_OK) != 0) {
+ usleep(100 * 1000);
+ if (++retry_count > 100) {
+ _E("%s is not created. appid: %s, uid: %u", socket_path.c_str(), appid,
+ uid);
+ break;
+ }
+ }
+
+ int fd = aul_sock_create_launchpad_client_without_timeout(
+ kLaunchpadProcessPoolSock, uid);
+ if (fd < 0) {
+ _E("Failed to create client socket. appid: %s, error: %d", appid, fd);
+ return AUL_R_ERROR;
+ }
+
+ pid_t pid = aul_sock_send_bundle_with_fd(fd, 0, bundle, AUL_SOCK_NONE);
+ if (pid <= 0) {
+ _E("Failed to send request. appid: %s, error: %d", appid, pid);
+ return AUL_R_ERROR;
+ }
+
+ return pid;
+}
bool web_debug;
bool sync;
bool amd_ready;
+ bool resinfo;
};
enum command_e {
OPT_DEBUG,
OPT_WEB_DEBUG,
OPT_USER,
+ OPT_RESINFO,
OPT_MAX,
};
.description = "Specify the user ID",
.arg_description = "USER ID"
},
+ {
+ .long_name = "resinfo",
+ .short_name = 'R',
+ .flags = 0,
+ .arg = G_OPTION_ARG_NONE,
+ .arg_data = &opt[OPT_RESINFO],
+ .description = "Enable resinfo feature, Use only for fast launch",
+ .arg_description = NULL
+ },
{
NULL
}
static int __cmd_fast_start_run(struct launch_arg *arg)
{
- arg->pid = aul_launch_app_fast_for_uid(arg->appid, arg->b, arg->uid);
+ if (arg->resinfo)
+ arg->pid = aul_launch_app_fast_for_uid(arg->appid, arg->b, arg->uid);
+ else
+ arg->pid = aul_launch_app_fast_without_resinfo_for_uid(arg->appid, arg->b, arg->uid);
if (arg->pid <= 0) {
fprintf(stderr, "... launch failed\n");
return -1;
launch_arg->debug = GPOINTER_TO_INT(opt[OPT_DEBUG]);
launch_arg->web_debug = GPOINTER_TO_INT(opt[OPT_WEB_DEBUG]);
+ launch_arg->resinfo = GPOINTER_TO_INT(opt[OPT_RESINFO]);
launch_arg->b = __create_bundle(argc, argv);
if (launch_arg->b) {
val = bundle_get_val(launch_arg->b, "__LAUNCH_APP_MODE__");