app_state_e app_state;
bool is_sub_app;
bool matched;
+ const char *instance_id;
} retrieval_context_s;
static app_manager_app_context_status_cb _status_cb;
app_state_e app_state;
if (aul_app_context != NULL && retrieval_context != NULL && retrieval_context->matched == false) {
- if (!strcmp(aul_app_context->appid, retrieval_context->app_id)) {
+ if (retrieval_context->instance_id &&
+ !strcmp(aul_app_context->instance_id, retrieval_context->instance_id) &&
+ !strcmp(aul_app_context->appid, retrieval_context->app_id)) {
+ app_state = app_context_get_app_status(aul_app_context->status);
+
+ retrieval_context->pid = aul_app_context->pid;
+ retrieval_context->pkg_id = strdup(aul_app_context->pkgid);
+ retrieval_context->app_state = app_state;
+ if (aul_app_context->is_sub_app)
+ retrieval_context->is_sub_app = true;
+ retrieval_context->matched = true;
+ } else if (retrieval_context->instance_id == NULL &&
+ !strcmp(aul_app_context->appid, retrieval_context->app_id)) {
app_state = app_context_get_app_status(aul_app_context->status);
retrieval_context->pid = aul_app_context->pid;
.pkg_id = NULL,
.app_state = APP_STATE_UNDEFINED,
.is_sub_app = false,
- .matched = false
+ .matched = false,
+ .instance_id = NULL
};
if (app_id == NULL || app_context == NULL)
return ret;
}
+int app_context_get_app_context_by_instance_id(const char *app_id, const char *instance_id, app_context_h *app_context)
+{
+ int ret;
+ retrieval_context_s retrieval_context = {
+ .app_id = app_id,
+ .pid = 0,
+ .pkg_id = NULL,
+ .app_state = APP_STATE_UNDEFINED,
+ .is_sub_app = false,
+ .matched = false,
+ .instance_id = instance_id
+ };
+
+ if (app_id == NULL || instance_id == NULL || app_context == NULL)
+ return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
+
+ aul_app_get_running_app_instance_info(app_context_retrieve_app_context, &retrieval_context);
+ if (retrieval_context.matched == false)
+ return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL);
+
+ ret = app_context_create(retrieval_context.app_id,
+ retrieval_context.pid,
+ retrieval_context.pkg_id,
+ retrieval_context.app_state,
+ retrieval_context.is_sub_app,
+ app_context);
+ free(retrieval_context.pkg_id);
+
+ return ret;
+}