*
*/
int aul_unset_default_app_by_operation(const char *app_id);
+
+/**
+ * @par Description:
+ * This API launches application with the given bundle asynchronously.
+ * If the application is not running or a multiple-instance one, this API launches with the given bundle.
+ * If the application is running, this API sends a RESET event to the App.
+ * While the application is running, if the application cannot receive the RESET event,
+ * this API returns a general error(AUL_R_ERROR).\n
+ * @par Purpose:
+ * This API is for caller.
+ * This API's purpose is to launch/reset application with given bundle.
+ * @par Typical use case:
+ * If you know the target application's pkgname and bundle types,
+ * you can use this API to launch/reset the application.
+ *
+ * @param[in] pkgname package name to be run as callee
+ * @param[in] kb bundle to be passed to callee
+ * @return 0 if success, negative value(<0) if fail
+ * @retval AUL_R_OK - success
+ * @retval AUL_R_EINVAL - invaild package name
+ * @retval AUL_R_ECOM - internal AUL IPC error
+ * @retval AUL_R_ERROR - general error
+ *
+ * @remark
+ * This API is only available in User Session.
+ * This API doesn't check whether the callee application is executed successfully.
+ */
+int aul_launch_app_async(const char *appid, bundle *kb);
+
+/**
+ * @par Description:
+ * This API launches application with the given bundle asynchronously.
+ * If the application is not running or a multiple-instance one, this API launches with the given bundle.
+ * If the application is running, this API sends a RESET event to the App.
+ * While the application is running, if the application cannot receive the RESET event,
+ * this API returns a general error(AUL_R_ERROR).\n
+ * @par Purpose:
+ * This API is for caller.
+ * This API's purpose is to launch/reset application with given bundle.
+ * @par Typical use case:
+ * If you know the target application's pkgname and bundle types,
+ * you can use this API to launch/reset the application.
+ *
+ * @param[in] pkgname package name to be run as callee
+ * @param[in] kb bundle to be passed to callee
+ * @param[in] uid User ID
+ * @return 0 if success, negative value(<0) if fail
+ * @retval AUL_R_OK - success
+ * @retval AUL_R_EINVAL - invaild package name
+ * @retval AUL_R_ECOM - internal AUL IPC error
+ * @retval AUL_R_ERROR - general error
+ *
+ * @remark
+ * This API is only available in System Session.
+ * This API doesn't check whether the callee application is executed successfully.
+ */
+int aul_launch_app_async_for_uid(const char *appid, bundle *kb, uid_t uid);
+
#ifdef __cplusplus
}
#endif
APP_ALL_RUNNING_INFO,
APP_SET_APP_CONTROL_DEFAULT_APP,
APP_UNSET_APP_CONTROL_DEFAULT_APP,
+ APP_START_ASYNC,
APP_CMD_MAX
};
return res;
}
+static int __send_cmd_async_for_uid_opt(int pid, uid_t uid,
+ int cmd, bundle *kb, int opt)
+{
+ int res;
+
+ res = aul_sock_send_bundle_async(pid, uid, cmd, kb,
+ opt | AUL_SOCK_NOREPLY);
+ if (res > 0) {
+ close(res);
+ res = 0;
+ } else {
+ res = __get_aul_error(res);
+ }
+
+ return res;
+}
+
/**
* @brief encode kb and send it to 'pid'
* @param[in] pid receiver's pid
return __send_cmd_for_uid_opt(pid, uid, cmd, kb, AUL_SOCK_QUEUE);
}
+API int app_send_cmd_with_queue_noreply_for_uid(int pid, uid_t uid,
+ int cmd, bundle *kb)
+{
+ return __send_cmd_async_for_uid_opt(pid, uid, cmd, kb, AUL_SOCK_QUEUE);
+}
+
API int app_send_cmd_with_noreply(int pid, int cmd, bundle *kb)
{
int res;
switch (cmd) {
case APP_START:
case APP_START_RES:
+ case APP_START_ASYNC:
b = bundle_dup(kb);
ret = __app_launch_local(b);
break;
bundle_add(kb, AUL_K_APPID, appid);
__set_stime(kb);
- ret = app_send_cmd_with_queue_for_uid(AUL_UTIL_PID, uid, cmd, kb);
+
+ if (cmd == APP_START_ASYNC)
+ ret = app_send_cmd_with_queue_noreply_for_uid(AUL_UTIL_PID, uid, cmd, kb);
+ else
+ ret = app_send_cmd_with_queue_for_uid(AUL_UTIL_PID, uid, cmd, kb);
_D("launch request result : %d", ret);
if (ret == AUL_R_LOCAL) {
switch (cmd) {
case APP_START:
case APP_START_RES:
+ case APP_START_ASYNC:
b = bundle_dup(kb);
ret = __app_launch_local(b);
break;
switch (pkt->cmd) {
case APP_START: /* run in callee */
case APP_START_RES:
+ case APP_START_ASYNC:
app_start(kbundle);
break;
return ret;
}
+
+API int aul_launch_app_async(const char *appid, bundle *kb)
+{
+ int ret;
+
+ if (appid == NULL)
+ return AUL_R_EINVAL;
+
+ ret = app_request_to_launchpad(APP_START_ASYNC, appid, kb);
+ return ret;
+}
+
+API int aul_launch_app_async_for_uid(const char *appid, bundle *kb, uid_t uid)
+{
+ int ret;
+ char buf[MAX_PID_STR_BUFSZ];
+
+ if (appid == NULL)
+ return AUL_R_EINVAL;
+ snprintf(buf, sizeof(buf), "%d", uid);
+ bundle_add(kb, AUL_K_TARGET_UID, buf);
+
+ ret = app_request_to_launchpad_for_uid(APP_START_ASYNC, appid, kb, uid);
+ return ret;
+}
return 0;
}
+int launch_async_test()
+{
+ static int num = 0;
+ int ret = 0;
+ bundle *kb = NULL;
+
+ kb = create_internal_bundle(3);
+ if (kb == NULL)
+ return -1;
+
+ printf("[aul_launch_app_async %d test] %s \n", num++, gargv[2]);
+
+ ret = aul_launch_app_async(gargv[2], kb);
+
+ if (kb) {
+ bundle_free(kb);
+ kb = NULL;
+ }
+ return ret;
+}
+
+int launch_async_test_for_uid()
+{
+ static int num = 0;
+ int ret = 0;
+ bundle *kb = NULL;
+
+ kb = create_internal_bundle(3);
+ if (kb == NULL)
+ return -1;
+
+ printf("[aul_launch_app_async_for_uid %d test] %s \n", num++, gargv[2]);
+
+ ret = aul_launch_app_async_for_uid(gargv[2], kb, atoi(gargv[3]));
+
+ if (kb) {
+ bundle_free(kb);
+ kb = NULL;
+ }
+ return ret;
+}
/*
static int set_pkg_func()
"[usage] get_status_pid <pid>"},
{"get_pid", get_pid, "aul_app_get_pid test",
"[usage] get_pid <appid>"},
+ {"launch_async", launch_async_test, "aul_launch_app_async test",
+ "[usage] launch_async <appid> <key1> <val1> <key2> <val2> ..."},
+ {"launch_async_for_uid", launch_async_test_for_uid, "aul_launch_app_async_for_uid test",
+ "[usage] launch_async_for_uid <appid> <uid> <key1> <val1> <key2> <val2> ..."},
};
int callfunc(char *testname)