#define AUL_K_RUA_ARG "__K_RUA_ARG"
/** AUL public key - To support rua add */
#define AUL_K_RUA_TIME "__K_RUA_TIME"
-
+/** AUL public bundle value */
+#define AUL_K_RUA_INSTANCE_ID "__K_RUA_INSTANCE_ID"
+/** AUL public bundle value */
+#define AUL_K_RUA_INSTANCE_NAME "__K_RUA_INSTANCE_NAME"
+/** AUL public bundle value */
+#define AUL_K_RUA_ICON "__K_RUA_ICON"
+/** AUL public bundle value */
+#define AUL_K_RUA_URI "__K_RUA_URI"
/** AUL internal private key */
#define AUL_K_PKG_NAME "__AUL_PKG_NAME__"
#define AUL_K_STATUS "__AUL_STATUS__"
/** AUL internal private key */
#define AUL_K_IS_SUBAPP "__AUL_IS_SUBAPP__"
+/** AUL internal private key */
+#define AUL_K_INSTANCE_ID "__AUL_INSTANCE_ID__"
/**
* @brief This is callback function for aul_launch_init
char *pkgid; /**< package id */
int status; /**< app's status */
int is_sub_app; /**< state whether sub app of app group */
+ char *instance_id;
} aul_app_info;
/**
* In general, this API is used by task manager appllication. (running application list viewer)
*
* @param[in] iter_fn iterator function
- * @param[in] data user-supplied data for iter_fn
+ * @param[in] user_data user-supplied data for iter_fn
* @return 0 if success, negative value(<0) if fail
* @retval AUL_R_OK - success
* @retval AUL_R_ERROR - internal error
* Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
* This API is only available in User Session.
*/
-int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
+int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn, void *user_data);
/**
* @par Description:
* In general, this API is used by task manager appllication. (running application list viewer)
*
* @param[in] iter_fn iterator function
- * @param[in] data user-supplied data for iter_fn
+ * @param[in] user_data user-supplied data for iter_fn
* @param[in] uid User ID
* @return 0 if success, negative value(<0) if fail
* @retval AUL_R_OK - success
* Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
* This API is only available to System user.
*/
-int aul_app_get_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *data, uid_t uid);
+int aul_app_get_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *user_data, uid_t uid);
/**
* @par Description:
* In general, this API is used by task manager application. (running application list viewer)
*
* @param[in] iter_fn iterator function
- * @param[in] data user-supplied data for iter_fn
+ * @param[in] user_data user-supplied data for iter_fn
* @return 0 if success, negative value(<0) if fail
* @retval AUL_R_OK - success
* @retval AUL_R_ERROR - internal error
* Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
* This API is only available in User Session.
*/
-int aul_app_get_all_running_app_info(aul_app_info_iter_fn iter_fn, void *data);
+int aul_app_get_all_running_app_info(aul_app_info_iter_fn iter_fn, void *user_data);
/**
* @par Description:
* In general, this API is used by task manager application. (running application list viewer)
*
* @param[in] iter_fn iterator function
- * @param[in] data user-supplied data for iter_fn
+ * @param[in] user_data user-supplied data for iter_fn
* @param[in] uid User ID
* @return 0 if success, negative value(<0) if fail
* @retval AUL_R_OK - success
* Or, If you want to get all window list, you must iterate XWindows by using XWindow APIs
* This API is only available to System user.
*/
-int aul_app_get_all_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *data, uid_t uid);
+int aul_app_get_all_running_app_info_for_uid(aul_app_info_iter_fn iter_fn, void *user_data, uid_t uid);
/**
* @par Description:
*/
int aul_widget_instance_get_content(const char *widget_id, const char *instance_id, char **content);
+/**
+ * @par Description:
+ * Gets running application instance info
+ * This API calls the iter_fn with the aul_app_info when running app instance info is found.
+ *
+ * @param[in] iter_fn iterative function
+ * @param[in] user_data User data
+ * @return 0 if success, negative value(<0) if fail
+ * @retval AUL_R_OK Successful
+ * @retval AUL_R_ERROR General error
+ * @retval AUL_R_EINVAL Invalid parameter
+ */
+int aul_app_get_running_app_instance_info(aul_app_info_iter_fn iter_fn,
+ void *user_data);
+int aul_app_get_running_app_instance_info_for_uid(aul_app_info_iter_fn iter_fn,
+ void *user_data, uid_t uid);
+
#ifdef __cplusplus
}
#endif
ADD_SCREEN_VIEWER = 83,
REMOVE_SCREEN_VIEWER = 84,
LAUNCHPAD_LAUNCH_SIGNAL = 85,
+ APP_RUNNING_INSTANCE_INFO = 86,
APP_CMD_MAX
};
const char *appid, const char *allowed_appid, void *data),
const char *appid, uid_t uid, void *user_data);
+/**
+ * @par Description:
+ * Gets the instance ID.
+ *
+ * @param[in] b Bundle object
+ *
+ * @return Pointer for application id string if success, NULL if fail
+ */
+const char *aul_svc_get_instance_id(bundle *b);
+
+/**
+ * @par Description:
+ * Sets the instance ID.
+ *
+ * @param[in] b Bundle object
+ * @param[in] instance ID Instance ID
+ *
+ * @return 0 if success, negative value(<0) if fail
+ */
+int aul_svc_set_instance_id(bundle *b, const char *instance_id);
+
#ifdef __cplusplus
}
#endif
-
-
#include "aul_error.h"
typedef struct _internal_param_t {
- aul_app_info_iter_fn enum_fn;
- void *user_param;
+ aul_app_info_iter_fn iter_fn;
+ void *user_data;
} internal_param_t;
static const char *__appid = NULL;
info.appid = (char *)bundle_get_val(b, AUL_K_APPID);
info.app_path = (char *)bundle_get_val(b, AUL_K_EXEC);
info.pkgid = (char *)bundle_get_val(b, AUL_K_PKGID);
+ info.instance_id = (char *)bundle_get_val(b, AUL_K_INSTANCE_ID);
val = bundle_get_val(b, AUL_K_STATUS);
if (val == NULL) {
info.is_sub_app = atoi(val);
info.pkg_name = info.appid;
- param->enum_fn(&info, param->user_param);
+ param->iter_fn(&info, param->user_data);
bundle_free(b);
}
-API int aul_app_get_running_app_info(aul_app_info_iter_fn enum_fn,
- void *user_param)
-{
- return aul_app_get_running_app_info_for_uid(enum_fn,
- user_param, getuid());;
-}
-
-API int aul_app_get_running_app_info_for_uid(aul_app_info_iter_fn enum_fn,
- void *user_param, uid_t uid)
+static int __get_running_app_info(int cmd, aul_app_info_iter_fn iter_fn,
+ void *user_data, uid_t uid)
{
int ret;
int fd;
bundle *b;
char buf[MAX_PID_STR_BUFSZ];
- internal_param_t param = {
- enum_fn,
- user_param
- };
+ internal_param_t param = {iter_fn, user_data};
- if (enum_fn == NULL)
+ if (iter_fn == NULL)
return AUL_R_EINVAL;
b = bundle_create();
snprintf(buf, sizeof(buf), "%d", uid);
bundle_add(b, AUL_K_TARGET_UID, buf);
- fd = aul_sock_send_bundle(AUL_UTIL_PID, uid, APP_RUNNING_INFO,
- b, AUL_SOCK_ASYNC);
+ fd = aul_sock_send_bundle(AUL_UTIL_PID, uid, cmd, b, AUL_SOCK_ASYNC);
bundle_free(b);
if (fd < 0)
return aul_error_convert(fd);
return AUL_R_OK;
}
-API int aul_app_get_all_running_app_info(aul_app_info_iter_fn enum_fn,
- void *user_param)
+API int aul_app_get_running_app_info(aul_app_info_iter_fn iter_fn,
+ void *user_data)
{
- return aul_app_get_all_running_app_info_for_uid(enum_fn,
- user_param, getuid());
+ return aul_app_get_running_app_info_for_uid(iter_fn,
+ user_data, getuid());
}
-API int aul_app_get_all_running_app_info_for_uid(aul_app_info_iter_fn enum_fn,
- void *user_param, uid_t uid)
+API int aul_app_get_running_app_info_for_uid(aul_app_info_iter_fn iter_fn,
+ void *user_data, uid_t uid)
{
- int ret;
- int fd;
- bundle *b;
- char buf[MAX_PID_STR_BUFSZ];
- internal_param_t param = {
- enum_fn,
- user_param
- };
-
- if (enum_fn == NULL)
- return AUL_R_EINVAL;
-
- b = bundle_create();
- if (b == NULL) {
- _E("out of memory");
- return AUL_R_ERROR;
- }
+ return __get_running_app_info(APP_RUNNING_INFO, iter_fn,
+ user_data, uid);
+}
- snprintf(buf, sizeof(buf), "%d", uid);
- bundle_add(b, AUL_K_TARGET_UID, buf);
+API int aul_app_get_all_running_app_info(aul_app_info_iter_fn iter_fn,
+ void *user_data)
+{
+ return aul_app_get_all_running_app_info_for_uid(iter_fn,
+ user_data, getuid());
+}
- fd = aul_sock_send_bundle(AUL_UTIL_PID, uid, APP_ALL_RUNNING_INFO,
- b, AUL_SOCK_ASYNC);
- bundle_free(b);
- if (fd < 0)
- return aul_error_convert(fd);
+API int aul_app_get_all_running_app_info_for_uid(aul_app_info_iter_fn iter_fn,
+ void *user_data, uid_t uid)
+{
+ return __get_running_app_info(APP_ALL_RUNNING_INFO, iter_fn,
+ user_data, uid);
+}
- ret = aul_sock_recv_pkt_with_cb(fd, __running_app_info_cb, ¶m);
- if (ret < 0)
- return aul_error_convert(ret);
+API int aul_app_get_running_app_instance_info(aul_app_info_iter_fn iter_fn,
+ void *user_data)
+{
+ return aul_app_get_running_app_instance_info_for_uid(iter_fn,
+ user_data, getuid());
+}
- return AUL_R_OK;
+API int aul_app_get_running_app_instance_info_for_uid(
+ aul_app_info_iter_fn iter_fn, void *user_data, uid_t uid)
+{
+ return __get_running_app_info(APP_RUNNING_INSTANCE_INFO, iter_fn,
+ user_data, uid);
}
API void aul_set_preinit_appid(const char *appid)
return AUL_SVC_RET_OK;
}
+
+API const char *aul_svc_get_instance_id(bundle *b)
+{
+ return bundle_get_val(b, AUL_K_INSTANCE_ID);
+}
+
+API int aul_svc_set_instance_id(bundle *b, const char *instance_id)
+{
+ if (b == NULL || instance_id == NULL) {
+ _E("Invalid parameter");
+ return AUL_SVC_RET_EINVAL;
+ }
+
+ return __set_bundle(b, AUL_K_INSTANCE_ID, instance_id);
+}