static const char join_metadata[] =
" LEFT OUTER JOIN package_app_app_metadata"
" ON ai.app_id=package_app_app_metadata.app_id ";
+static const char join_appinfo_for_uid[] =
+ " LEFT OUTER JOIN package_app_info_for_uid"
+ " ON ai.app_id=package_app_info_for_uid.app_id ";
static int _get_filtered_query(pkgmgrinfo_filter_x *filter,
- const char *locale, char **query, GList **bind_params)
+ const char *locale, uid_t uid, char **query, GList **bind_params)
{
int joined = 0;
size_t len = 0;
"(SELECT package FROM package_info WHERE package_disable='false')";
GSList *list;
- len += strlen(" WHERE 1=1");
strncat(buf, " WHERE 1=1", MAX_QUERY_LEN - len - 1);
+ len += strlen(" WHERE 1=1");
if (filter == NULL) {
strncat(buf, query_pkg_disable, MAX_QUERY_LEN - len - 1);
}
for (list = filter->list; list; list = list->next) {
- joined |= __get_filter_condition(list->data, &condition, bind_params);
+ joined |= __get_filter_condition(list->data, uid, &condition, bind_params);
if (condition == NULL)
continue;
- len += strlen(" AND ");
strncat(buf, " AND ", MAX_QUERY_LEN - len - 1);
+ len += strlen(" AND ");
+ strncat(buf, condition, sizeof(buf) - len - 1);
len += strlen(condition);
+ free(condition);
+ condition = NULL;
+ }
+
+ if (filter->list_metadata) {
+ strncat(buf, " AND (", MAX_QUERY_LEN - len - 1);
+ len += strlen(" AND (");
+ }
+ for (list = filter->list_metadata; list; list = list->next) {
+ joined |= __get_metadata_filter_condition(list->data,
+ &condition, bind_params);
+ if (condition == NULL)
+ continue;
strncat(buf, condition, sizeof(buf) - len - 1);
+ len += strlen(condition);
free(condition);
condition = NULL;
+
+ strncat(buf, " OR ", MAX_QUERY_LEN - len - 1);
+ len += strlen(" OR ");
+ }
+ if (filter->list_metadata) {
+ strncat(buf, "1=0)", MAX_QUERY_LEN - len - 1);
+ len += strlen("1=0)");
}
if (joined & E_PMINFO_APPINFO_JOIN_LOCALIZED_INFO) {
strncat(tmp_query, join_metadata, MAX_QUERY_LEN - len - 1);
len += strlen(join_metadata);
}
+ if (joined & E_PMINFO_APPINFO_JOIN_APPINFO_FOR_UID) {
+ strncat(tmp_query, join_appinfo_for_uid, MAX_QUERY_LEN - len - 1);
+ len += strlen(join_appinfo_for_uid);
+ }
strncat(tmp_query, buf, MAX_QUERY_LEN - len - 1);
-
len += strlen(buf);
+
strncat(tmp_query, query_pkg_disable, MAX_QUERY_LEN - len - 1);
*query = strdup(tmp_query);
}
-static void __get_splash_screen_display(sqlite3 *db, const char *appid, uid_t uid, char **value)
+static int __get_appinfo_for_uid(sqlite3 *db, application_x *info, uid_t uid)
{
static const char query_raw[] =
- "SELECT is_splash_screen_enabled FROM package_app_info_for_uid "
- "WHERE app_id='%s' AND uid='%d'";
+ "SELECT is_splash_screen_enabled, is_disabled "
+ "FROM package_app_info_for_uid WHERE app_id='%s' AND uid='%d'";
int ret;
char *query;
+ char *is_disabled = NULL;
sqlite3_stmt *stmt;
- query = sqlite3_mprintf(query_raw, appid, uid);
+ query = sqlite3_mprintf(query_raw, info->appid, uid);
if (query == NULL) {
LOGE("out of memory");
- return;
+ return PMINFO_R_ERROR;
}
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
sqlite3_free(query);
if (ret != SQLITE_OK) {
LOGE("sqlite3_prepare_v2() failed: %s", sqlite3_errmsg(db));
- return;
+ return PMINFO_R_ERROR;
}
while (sqlite3_step(stmt) == SQLITE_ROW) {
- if (*value)
- free(*value);
- _save_column_str(stmt, 0, value);
+ if (info->splash_screen_display)
+ free(info->splash_screen_display);
+ _save_column_str(stmt, 0, &info->splash_screen_display);
+ if (strcasecmp(info->is_disabled, "false") == 0) {
+ _save_column_str(stmt, 1, &is_disabled);
+ if (strcasecmp(is_disabled, "true") == 0) {
+ free(info->is_disabled);
+ info->is_disabled = is_disabled;
+ } else {
+ free(is_disabled);
+ }
+ }
}
sqlite3_finalize(stmt);
+ return PMINFO_R_OK;
}
static void __free_applications(gpointer data)
pkgmgrinfo_basic_free_application((application_x *)data);
}
+static gint __app_disable_chk_func(gconstpointer data1, gconstpointer data2)
+{
+ pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)data1;
+
+ if (node->prop == E_PMINFO_APPINFO_PROP_APP_DISABLE)
+ return 0;
+ else
+ return 1;
+}
+
+static bool __check_disable_filter_exist(pkgmgrinfo_filter_x *filter)
+{
+ GSList *link;
+
+ if (filter == NULL)
+ return false;
+
+ link = g_slist_find_custom(filter->list, NULL, __app_disable_chk_func);
+ if (link)
+ return true;
+
+ return false;
+}
+
static int __bind_params(sqlite3_stmt *stmt, GList *params)
{
GList *tmp_list = NULL;
return PMINFO_R_OK;
}
+static bool __check_app_storage_status(pkgmgrinfo_filter_x *tmp_filter)
+{
+ GSList *tmp_list = NULL;
+ pkgmgrinfo_node_x *tmp_node = NULL;
+ int property = -1;
+
+ if (tmp_filter == NULL)
+ return true;
+
+ property = _pminfo_appinfo_convert_to_prop_bool(PMINFO_APPINFO_PROP_APP_CHECK_STORAGE);
+ for (tmp_list = tmp_filter->list; tmp_list != NULL;
+ tmp_list = g_slist_next(tmp_list)) {
+ tmp_node = (pkgmgrinfo_node_x *)tmp_list->data;
+ if (property == tmp_node->prop) {
+ if (strcmp(tmp_node->value, "true") == 0)
+ return true;
+ else
+ return false;
+ }
+ }
+
+ return true;
+}
+
static int _appinfo_get_applications(uid_t db_uid, uid_t uid,
const char *locale, pkgmgrinfo_filter_x *filter, int flag,
GHashTable *applications)
"SELECT DISTINCT ai.app_id, ai.app_component, ai.app_exec, "
"ai.app_nodisplay, ai.app_type, ai.app_onboot, "
"ai.app_multiple, ai.app_autorestart, ai.app_taskmanage, "
- "ai.app_enabled, ai.app_hwacceleration, ai.app_screenreader, "
+ "ai.app_hwacceleration, ai.app_screenreader, "
"ai.app_mainapp, ai.app_recentimage, ai.app_launchcondition, "
"ai.app_indicatordisplay, ai.app_portraitimg, "
"ai.app_landscapeimg, ai.app_guestmodevisibility, "
"ai.app_splash_screen_display, ai.app_tep_name, "
"ai.app_zip_mount_file, ai.component_type, ai.package, "
"ai.app_external_path, ai.app_package_system, ai.app_removable, "
- "ai.app_package_installed_time, ai.app_support_mode";
+ "ai.app_package_installed_time, ai.app_support_mode, "
+ "ai.app_support_ambient, ai.app_setup_appid";
static const char query_label[] =
", COALESCE("
"(SELECT app_label FROM package_app_localized_info WHERE ai.app_id=app_id AND app_locale=?), "
GList *bind_params = NULL;
sqlite3 *db = NULL;
sqlite3_stmt *stmt = NULL;
+ bool is_check_storage = true;
dbpath = getUserPkgParserDBPathUID(db_uid);
if (dbpath == NULL)
return PMINFO_R_ERROR;
- ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
+ ret = __open_db(dbpath, &db, SQLITE_OPEN_READONLY);
if (ret != SQLITE_OK) {
_LOGE("failed to open db: %d", ret);
free(dbpath);
bind_params = g_list_append(bind_params, strdup(locale));
}
- ret = _get_filtered_query(filter, locale, &constraint, &bind_params);
+ is_check_storage = __check_app_storage_status(filter);
+
+ ret = _get_filtered_query(filter, locale, uid, &constraint, &bind_params);
if (ret != PMINFO_R_OK) {
LOGE("Failed to get WHERE clause");
goto catch;
(gconstpointer)info->appid)) {
free(info->appid);
free(info);
+ info = NULL;
continue;
}
_save_column_str(stmt, idx++, &info->component);
_save_column_str(stmt, idx++, &info->multiple);
_save_column_str(stmt, idx++, &info->autorestart);
_save_column_str(stmt, idx++, &info->taskmanage);
- _save_column_str(stmt, idx++, &info->enabled);
_save_column_str(stmt, idx++, &info->hwacceleration);
_save_column_str(stmt, idx++, &info->screenreader);
_save_column_str(stmt, idx++, &info->mainapp);
_save_column_str(stmt, idx++, &info->removable);
_save_column_str(stmt, idx++, &info->package_installed_time);
_save_column_str(stmt, idx++, &info->support_mode);
+ _save_column_str(stmt, idx++, &info->support_ambient);
+ _save_column_str(stmt, idx++, &info->setup_appid);
info->for_all_users =
- strdup((uid != GLOBAL_USER) ? "false" : "true");
-
- if (db_uid == GLOBAL_USER)
- __get_splash_screen_display(db, info->appid, db_uid,
- &info->splash_screen_display);
+ strdup((db_uid != GLOBAL_USER) ? "false" : "true");
+
+ if (db_uid == GLOBAL_USER) {
+ ret = __get_appinfo_for_uid(db, info, uid);
+ if (ret != PMINFO_R_OK) {
+ LOGI("Failed to get appinfo for given uid[%d]", (int)uid);
+ pkgmgrinfo_basic_free_application(info);
+ info = NULL;
+ continue;
+ }
+ }
info->background_category = __get_background_category(
bg_category_str);
}
}
- if (__appinfo_check_installed_storage(info) != PMINFO_R_OK) {
+ if (is_check_storage &&
+ __appinfo_check_installed_storage(info) != PMINFO_R_OK) {
ret = PMINFO_R_ERROR;
pkgmgrinfo_basic_free_application(info);
info = NULL;
return ret;
}
-API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid,
- pkgmgrinfo_appinfo_h *handle)
+static int _pkgmgrinfo_get_appinfo(const char *appid, uid_t uid,
+ pkgmgrinfo_appinfo_filter_h filter, pkgmgrinfo_appinfo_h *handle)
{
int ret;
char *locale;
GHashTable *list;
- pkgmgrinfo_appinfo_filter_h filter;
pkgmgr_appinfo_x *info;
- if (appid == NULL || handle == NULL) {
- LOGE("invalid parameter");
- return PMINFO_R_EINVAL;
+ if (appid == NULL || filter == NULL || handle == NULL) {
+ LOGE("invalid parameter");
+ return PMINFO_R_EINVAL;
}
locale = _get_system_locale();
if (locale == NULL)
return PMINFO_R_ERROR;
- ret = pkgmgrinfo_appinfo_filter_create(&filter);
- if (ret != PMINFO_R_OK) {
- free(locale);
- return ret;
- }
-
- ret = pkgmgrinfo_appinfo_filter_add_string(filter,
- PMINFO_APPINFO_PROP_APP_ID, appid);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_filter_destroy(filter);
- free(locale);
- return PMINFO_R_ERROR;
- }
-
- ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
- PMINFO_APPINFO_PROP_APP_DISABLE, true);
- if (ret != PMINFO_R_OK) {
- pkgmgrinfo_appinfo_filter_destroy(filter);
- free(locale);
- return PMINFO_R_ERROR;
- }
-
list = g_hash_table_new(g_str_hash, g_str_equal);
if (list == NULL) {
- pkgmgrinfo_appinfo_filter_destroy(filter);
free(locale);
return PMINFO_R_ERROR;
}
ret = _appinfo_get_applications(uid, uid, locale, filter,
PMINFO_APPINFO_GET_ALL, list);
if (!g_hash_table_size(list) && uid != GLOBAL_USER)
- ret = _appinfo_get_applications(GLOBAL_USER, uid, locale,
- filter, PMINFO_APPINFO_GET_ALL, list);
-
- pkgmgrinfo_appinfo_filter_destroy(filter);
- if (ret != PMINFO_R_OK) {
- g_hash_table_destroy(list);
- free(locale);
- return ret;
- }
+ ret = _appinfo_get_applications(GLOBAL_USER, uid, locale, filter,
+ PMINFO_APPINFO_GET_ALL, list);
if (!g_hash_table_size(list)) {
- _LOGI("Appinfo for [%s] is not existed for user [%d]",
+ _LOGI("appinfo for [%s] is not existed for user [%d]",
appid, uid);
g_hash_table_destroy(list);
free(locale);
info = calloc(1, sizeof(pkgmgr_appinfo_x));
if (info == NULL) {
_LOGE("out of memory");
+ g_hash_table_destroy(list);
free(locale);
return PMINFO_R_ERROR;
}
return ret;
}
+API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid,
+ pkgmgrinfo_appinfo_h *handle)
+{
+ int ret;
+ pkgmgrinfo_appinfo_filter_h filter;
+
+ if (appid == NULL || handle == NULL) {
+ LOGE("invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
+ ret = pkgmgrinfo_appinfo_filter_create(&filter);
+ if (ret != PMINFO_R_OK)
+ return ret;
+
+ ret = pkgmgrinfo_appinfo_filter_add_string(filter,
+ PMINFO_APPINFO_PROP_APP_ID, appid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
+ ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_DISABLE, true);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
+ ret = _pkgmgrinfo_get_appinfo(appid, uid, filter, handle);
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+
+ return ret;
+}
+
API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
{
return pkgmgrinfo_appinfo_get_usr_disabled_appinfo(appid, _getuid(), handle);
pkgmgrinfo_appinfo_h *handle)
{
int ret;
- char *locale;
- GHashTable *list;
pkgmgrinfo_appinfo_filter_h filter;
- pkgmgr_appinfo_x *info;
if (appid == NULL || handle == NULL) {
LOGE("invalid parameter");
return PMINFO_R_EINVAL;
}
- locale = _get_system_locale();
- if (locale == NULL)
- return PMINFO_R_ERROR;
-
ret = pkgmgrinfo_appinfo_filter_create(&filter);
- if (ret != PMINFO_R_OK) {
- free(locale);
+ if (ret != PMINFO_R_OK)
return ret;
- }
ret = pkgmgrinfo_appinfo_filter_add_string(filter,
PMINFO_APPINFO_PROP_APP_ID, appid);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
- free(locale);
return PMINFO_R_ERROR;
}
PMINFO_APPINFO_PROP_APP_DISABLE, false);
if (ret != PMINFO_R_OK) {
pkgmgrinfo_appinfo_filter_destroy(filter);
- free(locale);
return PMINFO_R_ERROR;
}
- list = g_hash_table_new(g_str_hash, g_str_equal);
- if (list == NULL) {
- pkgmgrinfo_appinfo_filter_destroy(filter);
- free(locale);
- return PMINFO_R_ERROR;
- }
+ ret = _pkgmgrinfo_get_appinfo(appid, uid, filter, handle);
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return ret;
+}
- ret = _appinfo_get_applications(uid, uid, locale, filter,
- PMINFO_APPINFO_GET_ALL, list);
- if (!g_hash_table_size(list) && uid != GLOBAL_USER)
- ret = _appinfo_get_applications(GLOBAL_USER, uid, locale,
- filter, PMINFO_APPINFO_GET_ALL, list);
+API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+{
+ return pkgmgrinfo_appinfo_get_usr_appinfo(appid, _getuid(), handle);
+}
- pkgmgrinfo_appinfo_filter_destroy(filter);
- if (ret != PMINFO_R_OK) {
- g_hash_table_destroy(list);
- free(locale);
- return ret;
- }
+API int pkgmgrinfo_appinfo_get_usr_all_appinfo(const char *appid, uid_t uid,
+ pkgmgrinfo_appinfo_h *handle)
+{
+ int ret;
+ pkgmgrinfo_appinfo_filter_h filter;
- if (!g_hash_table_size(list)) {
- _LOGI("Appinfo for [%s] is not existed for user [%d]", appid, uid);
- g_hash_table_destroy(list);
- free(locale);
- return PMINFO_R_ENOENT;
+ if (appid == NULL || handle == NULL) {
+ LOGE("invalid parameter");
+ return PMINFO_R_EINVAL;
}
- info = calloc(1, sizeof(pkgmgr_appinfo_x));
- if (info == NULL) {
- _LOGE("out of memory");
- free(locale);
+ ret = pkgmgrinfo_appinfo_filter_create(&filter);
+ if (ret != PMINFO_R_OK)
+ return ret;
+
+ ret = pkgmgrinfo_appinfo_filter_add_string(filter,
+ PMINFO_APPINFO_PROP_APP_ID, appid);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
return PMINFO_R_ERROR;
}
- info->app_info = (application_x *)g_hash_table_lookup(list, appid);
- info->locale = locale;
- info->package = strdup(info->app_info->package);
-
- /* just free list only */
- g_hash_table_destroy(list);
+ ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_CHECK_STORAGE, false);
+ if (ret != PMINFO_R_OK) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
- *handle = info;
+ ret = _pkgmgrinfo_get_appinfo(appid, uid, filter, handle);
+ pkgmgrinfo_appinfo_filter_destroy(filter);
return ret;
}
-API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
+API int pkgmgrinfo_appinfo_get_all_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
{
- return pkgmgrinfo_appinfo_get_usr_appinfo(appid, _getuid(), handle);
+ return pkgmgrinfo_appinfo_get_usr_all_appinfo(appid, _getuid(), handle);
}
static gpointer __copy_str(gconstpointer src, gpointer data)
app_info->multiple = strdup(data->multiple);
if (data->taskmanage != NULL)
app_info->taskmanage = strdup(data->taskmanage);
- if (data->enabled != NULL)
- app_info->enabled = strdup(data->enabled);
if (data->type != NULL)
app_info->type = strdup(data->type);
if (data->categories != NULL)
return PMINFO_R_ERROR;
}
+ if (__check_disable_filter_exist(filter) == false) {
+ pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_DISABLE, false);
+ }
+
ret = _appinfo_get_applications(uid, uid, locale, filter, flag, list);
if (ret == PMINFO_R_OK && uid != GLOBAL_USER)
ret = _appinfo_get_applications(GLOBAL_USER, uid, locale,
return PMINFO_R_ERROR;
}
- if (uid == GLOBAL_USER) {
- if (pkgmgrinfo_appinfo_filter_add_int(filter,
- PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER,
- (int)getuid())) {
- pkgmgrinfo_appinfo_filter_destroy(filter);
- return PMINFO_R_ERROR;
- }
- }
-
comp_str = __appcomponent_str(component);
if (comp_str) {
return PMINFO_R_ERROR;
}
- if (uid == GLOBAL_USER) {
- if (pkgmgrinfo_appinfo_filter_add_int(filter,
- PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER,
- (int)getuid())) {
- pkgmgrinfo_appinfo_filter_destroy(filter);
- return PMINFO_R_ERROR;
- }
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_CHECK_STORAGE, false)) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
}
ret = _appinfo_get_filtered_foreach_appinfo(uid, filter, flag, app_func,
_getuid(), flag, user_data);
}
-API int pkgmgrinfo_appinfo_get_usr_install_list(pkgmgrinfo_app_list_cb app_func,
- uid_t uid, void *user_data)
-{
- return pkgmgrinfo_appinfo_get_usr_installed_list_full(app_func,
- uid, PMINFO_APPINFO_GET_ALL, user_data);
-}
-
-API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func,
- void *user_data)
-{
- return pkgmgrinfo_appinfo_get_usr_installed_list_full(app_func,
- _getuid(), PMINFO_APPINFO_GET_ALL, user_data);
-}
-
API int pkgmgrinfo_appinfo_get_usr_installed_list(
pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data)
{
+ int ret;
+ pkgmgrinfo_appinfo_filter_h filter;
+
if (app_func == NULL) {
LOGE("invalid parameter");
return PMINFO_R_EINVAL;
}
- return _appinfo_get_filtered_foreach_appinfo(uid, NULL,
+ /* create an empty filter */
+ ret = pkgmgrinfo_appinfo_filter_create(&filter);
+ if (ret != PMINFO_R_OK)
+ return ret;
+
+ ret = _appinfo_get_filtered_foreach_appinfo(uid, filter,
PMINFO_APPINFO_GET_ALL, app_func, user_data);
+
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+
+ return ret;
}
API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func,
goto err;
}
- if (sqlite3_open_v2(parser_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
+ if (__open_db(parser_db, &db, SQLITE_OPEN_READONLY) != SQLITE_OK) {
_LOGE("DB open fail\n");
free(parser_db);
goto err;
retvm_if(enabled == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
- if (info->app_info == NULL || info->app_info->enabled == NULL)
+ if (info->app_info == NULL || info->app_info->is_disabled == NULL)
return PMINFO_R_ERROR;
- *enabled = _get_bool_value(info->app_info->enabled);
+ *enabled = !_get_bool_value(info->app_info->is_disabled);
return PMINFO_R_OK;
}
return PMINFO_R_OK;
}
+API int pkgmgrinfo_appinfo_get_setup_appid(pkgmgrinfo_appinfo_h handle, char **setup_appid)
+{
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info == NULL || setup_appid == NULL) {
+ _LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (info->app_info == NULL || info->app_info->setup_appid == NULL)
+ return PMINFO_R_ERROR;
+
+ *setup_appid = info->app_info->setup_appid;
+ return PMINFO_R_OK;
+}
+
+API int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle,
+ bool *support_ambient)
+{
+ pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
+
+ if (info == NULL || support_ambient == NULL) {
+ _LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
+ if (info->app_info == NULL || info->app_info->support_ambient == NULL)
+ return PMINFO_R_ERROR;
+
+ *support_ambient = _get_bool_value(info->app_info->support_ambient);
+
+ return PMINFO_R_OK;
+}
+
API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
{
retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
pkgmgrinfo_appinfo_metadata_filter_h handle,
const char *key, const char *value)
{
- int ret;
-
- ret = pkgmgrinfo_appinfo_filter_add_string(handle,
- PMINFO_APPINFO_PROP_APP_METADATA_KEY, key);
- if (ret != PMINFO_R_OK)
- return ret;
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
+ pkgmgrinfo_metadata_node_x *node;
/* value can be NULL.
* In that case all apps with specified key should be displayed
*/
- if (value && strlen(value)) {
- ret = pkgmgrinfo_appinfo_filter_add_string(handle,
- PMINFO_APPINFO_PROP_APP_METADATA_VALUE, value);
- if (ret != PMINFO_R_OK)
- return ret;
+ if (key == NULL) {
+ LOGE("invalid parameter");
+ return PMINFO_R_EINVAL;
}
+ node = calloc(1, sizeof(pkgmgrinfo_metadata_node_x));
+ if (node == NULL) {
+ LOGE("out of memory");
+ return PMINFO_R_ERROR;
+ }
+
+ node->key = strdup(key);
+ if (value && strlen(value))
+ node->value = strdup(value);
+
+ filter->list_metadata = g_slist_append(filter->list_metadata,
+ (gpointer)node);
+
return PMINFO_R_OK;
}