bool iteration;
} foreach_context_s;
-typedef struct _retrieval_context_{
+typedef struct _retrieval_context_ {
const char *app_id;
pid_t pid;
bool matched;
{
foreach_context_s* foreach_context = cb_data;
- if (foreach_context == NULL)
- {
+ if (foreach_context == NULL) {
app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
return 0;
}
- if (foreach_context->iteration == true)
- {
+ if (foreach_context->iteration == true) {
app_context_h app_context = NULL;
- if (app_context_create(aul_app_context->appid, aul_app_context->pid, &app_context) == APP_MANAGER_ERROR_NONE)
- {
+ if (app_context_create(aul_app_context->appid, aul_app_context->pid, &app_context) == APP_MANAGER_ERROR_NONE) {
foreach_context->iteration = foreach_context->callback(app_context, foreach_context->user_data);
app_context_destroy(app_context);
}
};
if (callback == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (aul_app_get_running_app_info(app_context_foreach_app_context_cb, &foreach_context) != AUL_R_OK)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
{
retrieval_context_s *retrieval_context = cb_data;
- if (aul_app_context != NULL && retrieval_context != NULL && retrieval_context->matched == false)
- {
- if (!strcmp(aul_app_context->appid, retrieval_context->app_id))
- {
+ if (aul_app_context != NULL && retrieval_context != NULL && retrieval_context->matched == false) {
+ if (!strcmp(aul_app_context->appid, retrieval_context->app_id)) {
retrieval_context->pid = aul_app_context->pid;
retrieval_context->matched = true;
}
};
if (app_id == NULL || app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (aul_app_is_running(app_id) == 0)
- {
return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL);
- }
aul_app_get_running_app_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);
- }
return app_context_create(retrieval_context.app_id, retrieval_context.pid, app_context);
}
char appid[APPID_MAX] = {0, };
if (pid < 0 || app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (aul_app_get_appid_bypid(pid, appid, sizeof(appid)) != AUL_R_OK)
- {
return app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL);
- }
retval = app_context_get_app_context(appid, app_context);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
app_context_h app_context_created;
if (app_id == NULL || pid <= 0 || app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_context_created = calloc(1, sizeof(struct app_context_s));
-
if (app_context_created == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
app_context_created->app_id = strdup(app_id);
-
- if (app_context_created->app_id == NULL)
- {
+ if (app_context_created->app_id == NULL) {
free(app_context_created);
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
}
API int app_context_destroy(app_context_h app_context)
{
if (app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
free(app_context->app_id);
free(app_context);
API int app_context_get_package(app_context_h app_context, char **package)
{
- // TODO: this function must be deprecated
+ /* TODO: this function must be deprecated */
return app_context_get_app_id(app_context, package);
}
char *app_id_dup;
if (app_context == NULL || app_id == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_id_dup = strdup(app_context->app_id);
-
if (app_id_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*app_id = app_id_dup;
API int app_context_get_pid(app_context_h app_context, pid_t *pid)
{
if (app_context == NULL || pid == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
*pid = app_context->pid;
API int app_context_is_terminated(app_context_h app_context, bool *terminated)
{
if (app_context == NULL || terminated == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
- if (aul_app_is_running(app_context->app_id) == 1)
- {
+ if (aul_app_is_running(app_context->app_id) == 1) {
*terminated = false;
- }
- else
- {
+ } else {
char appid[APPID_MAX] = {0, };
if (aul_app_get_appid_bypid(app_context->pid, appid, sizeof(appid)) == AUL_R_OK)
- {
*terminated = false;
- }
else
- {
*terminated = true;
- }
}
return APP_MANAGER_ERROR_NONE;
API int app_context_is_equal(app_context_h lhs, app_context_h rhs, bool *equal)
{
if (lhs == NULL || rhs == NULL || equal == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (!strcmp(lhs->app_id, rhs->app_id) && lhs->pid == rhs->pid)
- {
*equal = true;
- }
else
- {
*equal = false;
- }
return APP_MANAGER_ERROR_NONE;
}
int retval;
if (clone == NULL || app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = app_context_create(app_context->app_id, app_context->pid, clone);
-
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
{
app_context_h app_context_cloned;
- if (app_context_clone(&app_context_cloned, app_context) == APP_MANAGER_ERROR_NONE)
- {
+ if (app_context_clone(&app_context_cloned, app_context) == APP_MANAGER_ERROR_NONE) {
SECURE_LOGI("[%s] app_id(%s), pid(%d)", __FUNCTION__, app_context->app_id, app_context->pid);
- if (event_cb_context != NULL && event_cb_context->pid_table != NULL)
- {
+ if (event_cb_context != NULL && event_cb_context->pid_table != NULL) {
g_hash_table_insert(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context_cloned->pid)), app_context_cloned);
- }
- else
- {
+ } else {
app_context_destroy(app_context_cloned);
app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context");
}
{
app_context_h app_context = data;
- if (app_context != NULL)
- {
+ if (app_context != NULL) {
char *app_id;
int pid;
app_context_get_app_id(app_context, &app_id);
app_context_lock_event_cb_context();
- if (app_context_get_app_context_by_pid(pid, &app_context) == APP_MANAGER_ERROR_NONE)
- {
- if (event_cb_context != NULL && event_cb_context->pid_table != NULL)
- {
+ if (app_context_get_app_context_by_pid(pid, &app_context) == APP_MANAGER_ERROR_NONE) {
+ if (event_cb_context != NULL && event_cb_context->pid_table != NULL) {
g_hash_table_insert(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context->pid)), app_context);
event_cb_context->callback(app_context, APP_CONTEXT_EVENT_LAUNCHED, event_cb_context->user_data);
- }
- else
- {
+ } else {
app_context_destroy(app_context);
app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context");
}
app_context_lock_event_cb_context();
- if (event_cb_context != NULL && event_cb_context->pid_table != NULL)
- {
+ if (event_cb_context != NULL && event_cb_context->pid_table != NULL) {
app_context = g_hash_table_lookup(event_cb_context->pid_table, GINT_TO_POINTER(&lookup_key));
- if (app_context != NULL)
- {
+ if (app_context != NULL) {
event_cb_context->callback(app_context, APP_CONTEXT_EVENT_TERMINATED, event_cb_context->user_data);
g_hash_table_remove(event_cb_context->pid_table, GINT_TO_POINTER(&(app_context->pid)));
}
- }
- else
- {
+ } else {
app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, "invalid callback context");
}
int app_context_set_event_cb(app_manager_app_context_event_cb callback, void *user_data)
{
if (callback == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_context_lock_event_cb_context();
- if (event_cb_context == NULL)
- {
+ if (event_cb_context == NULL) {
event_cb_context = calloc(1, sizeof(event_cb_context_s));
- if (event_cb_context == NULL)
- {
+ if (event_cb_context == NULL) {
app_context_unlock_event_cb_context();
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
}
event_cb_context->pid_table = g_hash_table_new_full(g_int_hash, g_int_equal, NULL, app_context_pid_table_entry_destroyed_cb);
-
- if (event_cb_context->pid_table == NULL)
- {
+ if (event_cb_context->pid_table == NULL) {
free(event_cb_context);
event_cb_context = NULL;
app_context_unlock_event_cb_context();
{
app_context_lock_event_cb_context();
- if (event_cb_context != NULL)
- {
- //aul_listen_app_dead_signal(NULL, NULL);
- //aul_listen_app_launch_signal(NULL, NULL);
+ if (event_cb_context != NULL) {
+ /* aul_listen_app_dead_signal(NULL, NULL); */
+ /* aul_listen_app_launch_signal(NULL, NULL); */
g_hash_table_destroy(event_cb_context->pid_table);
free(event_cb_context);
pkgmgrinfo_appinfo_metadata_filter_h pkg_app_info_metadata_filter;
};
-typedef struct _foreach_context_{
+typedef struct _foreach_context_ {
app_manager_app_info_cb callback;
void *user_data;
} foreach_context_s;
-typedef struct _foreach_metada_context_{
+typedef struct _foreach_metada_context_ {
app_info_metadata_cb callback;
void *user_data;
} foreach_metadata_context_s;
if (property == NULL)
return -1;
- if (strcmp(property, PACKAGE_INFO_PROP_APP_ID)==0)
+ if (strcmp(property, PACKAGE_INFO_PROP_APP_ID) == 0)
*converted_property = PMINFO_APPINFO_PROP_APP_ID;
- else if (strcmp(property, PACKAGE_INFO_PROP_APP_TYPE)==0)
+ else if (strcmp(property, PACKAGE_INFO_PROP_APP_TYPE) == 0)
*converted_property = PMINFO_APPINFO_PROP_APP_TYPE;
- else if (strcmp(property, PACKAGE_INFO_PROP_APP_CATEGORY)==0)
+ else if (strcmp(property, PACKAGE_INFO_PROP_APP_CATEGORY) == 0)
*converted_property = PMINFO_APPINFO_PROP_APP_CATEGORY;
else
if (property == NULL)
return -1;
- if (strcmp(property, PACKAGE_INFO_PROP_APP_NODISPLAY)==0)
+ if (strcmp(property, PACKAGE_INFO_PROP_APP_NODISPLAY) == 0)
*converted_property = PMINFO_APPINFO_PROP_APP_NODISPLAY;
- else if (strcmp(property, PACKAGE_INFO_PROP_APP_TASKMANAGE)==0)
+ else if (strcmp(property, PACKAGE_INFO_PROP_APP_TASKMANAGE) == 0)
*converted_property = PMINFO_APPINFO_PROP_APP_TASKMANAGE;
else
int retval = 0;
char *appid = NULL;
app_info_h info = NULL;
+
info = calloc(1, sizeof(struct app_info_s));
- if (info == NULL) {
+ if (info == NULL)
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
foreach_context_s *foreach_context = user_data;
- if (handle == NULL || foreach_context == NULL)
- {
+ if (handle == NULL || foreach_context == NULL) {
free(info);
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
}
retval = pkgmgrinfo_appinfo_get_appid(handle, &appid);
- if (retval < 0)
- {
+ if (retval < 0) {
free(info);
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
}
foreach_metadata_context_s *foreach_context = user_data;
if (metadata_value == NULL || foreach_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
foreach_context->callback(metadata_key, metadata_value, foreach_context->user_data);
int ret = 0;
bool iteration_next = true;
- if (handle == NULL || foreach_context == NULL)
- {
+ if (handle == NULL || foreach_context == NULL) {
app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
return PMINFO_R_ERROR;
}
return PMINFO_R_ERROR;
}
- if (app_info_create(appid, &app_info) == APP_MANAGER_ERROR_NONE)
- {
+ if (app_info_create(appid, &app_info) == APP_MANAGER_ERROR_NONE) {
iteration_next = foreach_context->callback(app_info, foreach_context->user_data);
app_info_destroy(app_info);
}
if (iteration_next == true)
- {
return PMINFO_R_OK;
- }
else
- {
return PMINFO_R_ERROR;
- }
}
int app_info_foreach_app_info(app_manager_app_info_cb callback, void *user_data)
};
if (callback == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
pkgmgrinfo_appinfo_get_usr_installed_list(app_info_foreach_app_info_cb, getuid(), &foreach_context);
int retval = 0;
char *main_appid = NULL;
- if (app_id == NULL || app_info == NULL) {
+ if (app_id == NULL || app_info == NULL)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
+
info = calloc(1, sizeof(struct app_info_s));
- if (info == NULL) {
+ if (info == NULL)
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_pkginfo_get_usr_pkginfo(app_id, getuid(), &pkginfo);
if (retval < 0) {
}
retval = pkgmgrinfo_pkginfo_get_mainappid(pkginfo, &main_appid);
- if (retval < 0) {
+ if (retval < 0)
app_manager_error(APP_MANAGER_ERROR_NO_SUCH_APP, __FUNCTION__, NULL);
- }
if (pkgmgrinfo_appinfo_get_usr_appinfo(main_appid, getuid(), &appinfo)) {
free(info);
API int app_info_destroy(app_info_h app_info)
{
if (app_info == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
+
if (app_info->app_id) {
free(app_info->app_id);
app_info->app_id = NULL;
}
+
pkgmgrinfo_appinfo_destroy_appinfo(app_info->pkg_app_info);
free(app_info);
return APP_MANAGER_ERROR_NONE;
char *app_id_dup;
if (app_info == NULL || app_id == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_id_dup = strdup(app_info->app_id);
-
if (app_id_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*app_id = app_id_dup;
char *app_exec_dup;
if (app_info == NULL || exec == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
pkgmgrinfo_appinfo_get_exec(app_info->pkg_app_info, &val);
if (val == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_exec_dup = strdup(val);
if (app_exec_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*exec = app_exec_dup;
char *app_label_dup;
if (app_info == NULL || label == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
pkgmgrinfo_appinfo_get_label(app_info->pkg_app_info, &val);
if (val == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_label_dup = strdup(val);
if (app_label_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*label = app_label_dup;
char *app_label_dup;
if (app_id == NULL || locale == NULL || label == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (pkgmgrinfo_appinfo_usr_get_localed_label(app_id, locale, getuid(), &val))
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_label_dup = strdup(val);
if (app_label_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*label = app_label_dup;
free(val);
char *app_icon_dup;
if (app_info == NULL || path == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
pkgmgrinfo_appinfo_get_icon(app_info->pkg_app_info, &val);
if (val == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
app_icon_dup = strdup(val);
if (app_icon_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*path = app_icon_dup;
char *app_package_dup;
if (app_info == NULL || package == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
pkgmgrinfo_appinfo_get_pkgname(app_info->pkg_app_info, &val);
app_package_dup = strdup(val);
if (app_package_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*package = app_package_dup;
char *app_type_dup;
if (app_info == NULL || type == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
pkgmgrinfo_appinfo_get_apptype(app_info->pkg_app_info, &val);
app_type_dup = strdup(val);
if (app_type_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*type = app_type_dup;
int retval = 0;
if (app_info == NULL || callback == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
foreach_metadata_context_s foreach_context = {
.callback = callback,
retval = pkgmgrinfo_appinfo_foreach_metadata(app_info->pkg_app_info, app_info_foreach_app_metadata_cb, &foreach_context);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
bool val;
if (app_info == NULL || nodisplay == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (pkgmgrinfo_appinfo_is_nodisplay(app_info->pkg_app_info, &val) < 0)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
bool val;
if (app_info == NULL || enabled == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (pkgmgrinfo_appinfo_is_enabled(app_info->pkg_app_info, &val) < 0)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
API int app_info_is_equal(app_info_h lhs, app_info_h rhs, bool *equal)
{
if (lhs == NULL || rhs == NULL || equal == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (!strcmp(lhs->app_id, rhs->app_id))
- {
*equal = true;
- }
else
- {
*equal = false;
- }
return APP_MANAGER_ERROR_NONE;
}
bool val;
if (app_info == NULL || onboot == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (pkgmgrinfo_appinfo_is_onboot(app_info->pkg_app_info, &val) < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
*onboot = val;
return APP_MANAGER_ERROR_NONE;
bool val;
if (app_info == NULL || preload == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (pkgmgrinfo_appinfo_is_preload(app_info->pkg_app_info, &val) < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
*preload = val;
return APP_MANAGER_ERROR_NONE;
int retval;
if (clone == NULL || app_info == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = app_info_create(app_info->app_id, clone);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
pkgmgrinfo_appinfo_filter_h filter_h = NULL;
if (handle == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_filter_create(&filter_h);
- if (retval < 0) {
+ if (retval < 0)
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
filter_created = calloc(1, sizeof(struct app_info_filter_s));
- if (filter_created == NULL)
- {
+ if (filter_created == NULL) {
free(filter_h);
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
}
int retval = 0;
if (handle == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_filter_destroy(handle->pkg_app_info_filter);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
free(handle);
return APP_MANAGER_ERROR_NONE;
char *converted_property = NULL;
if ((handle == NULL) || (property == NULL))
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = app_info_convert_bool_property(property, &converted_property);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_filter_add_bool(handle->pkg_app_info_filter, converted_property, value);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
char *converted_property = NULL;
if ((handle == NULL) || (property == NULL))
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = app_info_convert_str_property(property, &converted_property);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_filter_add_string(handle->pkg_app_info_filter, converted_property, value);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
int retval = 0;
if ((handle == NULL) || (count == NULL))
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_filter_count(handle->pkg_app_info_filter, count);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
};
if ((handle == NULL) || (callback == NULL))
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle->pkg_app_info_filter, app_info_foreach_app_filter_cb, &foreach_context, getuid());
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
pkgmgrinfo_appinfo_metadata_filter_h filter_h = NULL;
if (handle == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
filter_created = calloc(1, sizeof(struct app_info_metadata_filter_s));
if (filter_created == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_metadata_filter_create(&filter_h);
if (retval < 0) {
int retval = 0;
if (handle == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_metadata_filter_destroy(handle->pkg_app_info_metadata_filter);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
free(handle);
return APP_MANAGER_ERROR_NONE;
int retval = 0;
if ((handle == NULL) || (key == NULL))
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_metadata_filter_add(handle->pkg_app_info_metadata_filter, key, value);
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
};
if (handle == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (callback == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
retval = pkgmgrinfo_appinfo_usr_metadata_filter_foreach(handle->pkg_app_info_metadata_filter, app_info_foreach_app_filter_cb, &foreach_context, getuid());
if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_IO_ERROR, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
static const char* app_manager_error_to_string(app_manager_error_e error)
{
- switch (error)
- {
+ switch (error) {
case APP_MANAGER_ERROR_NONE:
return "Successful";
-
case APP_MANAGER_ERROR_INVALID_PARAMETER:
return "Invalid parameter";
-
case APP_MANAGER_ERROR_OUT_OF_MEMORY:
return "Out of memory";
-
case APP_MANAGER_ERROR_IO_ERROR:
return "IO error";
-
case APP_MANAGER_ERROR_NO_SUCH_APP:
return "No such application";
-
case APP_MANAGER_ERROR_DB_FAILED:
return "DB error";
-
case APP_MANAGER_ERROR_INVALID_PACKAGE:
return "Invalid package";
-
default:
return "Unknown";
}
int app_manager_error(app_manager_error_e error, const char* function, const char *description)
{
if (description)
- {
LOGE("[%s] %s(0x%08x) : %s", function, app_manager_error_to_string(error), error, description);
- }
else
- {
LOGE("[%s] %s(0x%08x)", function, app_manager_error_to_string(error), error);
- }
return error;
}
int retval = app_context_set_event_cb(callback, user_data);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
else
- {
return APP_MANAGER_ERROR_NONE;
- }
}
API void app_manager_unset_app_context_event_cb(void)
int retval = app_context_foreach_app_context(callback, user_data);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
else
- {
return APP_MANAGER_ERROR_NONE;
- }
}
API int app_manager_get_app_context(const char *app_id, app_context_h *app_context)
int retval = app_context_get_app_context(app_id, app_context);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
else
- {
return APP_MANAGER_ERROR_NONE;
- }
}
API int app_manager_resume_app(app_context_h app_context)
int retval;
if (app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (app_context_get_app_id(app_context, &app_id) != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to get the application ID");
- }
- if (aul_app_is_running(app_id) == 0)
- {
+ if (aul_app_is_running(app_id) == 0) {
free(app_id);
return app_manager_error(APP_MANAGER_ERROR_APP_NO_RUNNING, __FUNCTION__, NULL);
}
retval = aul_resume_app(app_id);
free(app_id);
+
if (retval == AUL_R_EINVAL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
else if (retval == AUL_R_EILLACC)
- {
return app_manager_error(APP_MANAGER_ERROR_PERMISSION_DENIED, __FUNCTION__, NULL);
- }
else if (retval < 0)
- {
return app_manager_error(APP_MANAGER_ERROR_REQUEST_FAILED, __FUNCTION__, NULL);
- }
return APP_MANAGER_ERROR_NONE;
}
retval = app_info_foreach_app_info(callback, user_data);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
else
- {
return APP_MANAGER_ERROR_NONE;
- }
}
API int app_manager_get_app_info(const char *app_id, app_info_h *app_info)
retval = app_info_create(app_id, app_info);
if (retval != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(retval, __FUNCTION__, NULL);
- }
else
- {
return APP_MANAGER_ERROR_NONE;
- }
}
API int app_manager_get_app_id(pid_t pid, char **app_id)
char *app_id_dup = NULL;
if (app_id == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (aul_app_get_appid_bypid(pid, buffer, sizeof(buffer)) != AUL_R_OK)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, "Invalid process ID");
- }
app_id_dup = strdup(buffer);
-
if (app_id_dup == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_OUT_OF_MEMORY, __FUNCTION__, NULL);
- }
*app_id = app_id_dup;
return APP_MANAGER_ERROR_NONE;
-
}
API int app_manager_terminate_app(app_context_h app_context)
pid_t pid = 0;
if (app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
- if (app_context_get_pid(app_context, &pid) != APP_MANAGER_ERROR_NONE) {
+ if (app_context_get_pid(app_context, &pid) != APP_MANAGER_ERROR_NONE)
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to get the process ID");
- }
retval = aul_terminate_pid(pid);
-
- if (retval == AUL_R_EINVAL)
- {
+ if (retval == AUL_R_EINVAL) {
LOGE("[%s] APP_MANAGER_ERROR_INVALID_PARAMETER(0x%08x) : Invalid param", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
return APP_MANAGER_ERROR_INVALID_PARAMETER;
- }
- else if (retval == AUL_R_EILLACC)
- {
+ } else if (retval == AUL_R_EILLACC) {
LOGE("[%s] APP_MANAGER_ERROR_PERMISSION_DENIED(0x%08x) : Permission denied", __FUNCTION__, APP_MANAGER_ERROR_PERMISSION_DENIED);
return APP_MANAGER_ERROR_PERMISSION_DENIED;
- }
- else if (retval < 0)
- {
+ } else if (retval < 0) {
return APP_MANAGER_ERROR_REQUEST_FAILED;
}
pid_t pid = 0;
if (app_context == NULL)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, NULL);
- }
if (app_context_get_pid(app_context, &pid) != APP_MANAGER_ERROR_NONE)
- {
return app_manager_error(APP_MANAGER_ERROR_INVALID_PARAMETER, __FUNCTION__, "failed to get the process ID");
- }
retval = aul_terminate_bgapp_pid(pid);
- if (retval == AUL_R_EINVAL)
- {
+ if (retval == AUL_R_EINVAL) {
LOGE("[%s] APP_MANAGER_ERROR_INVALID_PARAMETER(0x%08x) : Invalid param", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
return APP_MANAGER_ERROR_INVALID_PARAMETER;
- }
- else if (retval == AUL_R_EILLACC)
- {
+ } else if (retval == AUL_R_EILLACC) {
LOGE("[%s] APP_MANAGER_ERROR_PERMISSION_DENIED(0x%08x) : Permission denied", __FUNCTION__, APP_MANAGER_ERROR_PERMISSION_DENIED);
return APP_MANAGER_ERROR_PERMISSION_DENIED;
- }
- else if (retval < 0)
- {
+ } else if (retval < 0) {
return APP_MANAGER_ERROR_REQUEST_FAILED;
}
API int app_manager_is_running(const char *app_id, bool *running)
{
- if (app_id == NULL)
- {
+ if (app_id == NULL) {
LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid package", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
return APP_MANAGER_ERROR_INVALID_PARAMETER;
}
- if (running == NULL)
- {
+ if (running == NULL) {
LOGE("[%s] INVALID_PARAMETER(0x%08x) : invalid output param", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
return APP_MANAGER_ERROR_INVALID_PARAMETER;
}
API int app_manager_open_app(const char *app_id)
{
int retval;
- retval = aul_open_app(app_id);
- if (retval == AUL_R_ERROR)
- {
+ retval = aul_open_app(app_id);
+ if (retval == AUL_R_ERROR) {
LOGE("[%s] APP_MANAGER_ERROR_NO_SUCH_APP(0x%08x) : No such application", __FUNCTION__, APP_MANAGER_ERROR_NO_SUCH_APP);
return APP_MANAGER_ERROR_NO_SUCH_APP;
- }
- else if (retval == AUL_R_EINVAL)
- {
+ } else if (retval == AUL_R_EINVAL) {
LOGE("[%s] APP_MANAGER_ERROR_INVALID_PARAMETER(0x%08x) : Invalid param", __FUNCTION__, APP_MANAGER_ERROR_INVALID_PARAMETER);
return APP_MANAGER_ERROR_INVALID_PARAMETER;
- }
- else if (retval == AUL_R_EILLACC)
- {
+ } else if (retval == AUL_R_EILLACC) {
LOGE("[%s] APP_MANAGER_ERROR_PERMISSION_DENIED(0x%08x) : Permission denied", __FUNCTION__, APP_MANAGER_ERROR_PERMISSION_DENIED);
return APP_MANAGER_ERROR_PERMISSION_DENIED;
- }
- else if (retval < 0)
- {
+ } else if (retval < 0) {
return APP_MANAGER_ERROR_REQUEST_FAILED;
}