char *condition = NULL;
char buf[MAX_QUERY_LEN] = { '\0' };
char tmp_query[MAX_QUERY_LEN] = { '\0' };
- static const char query_pkg_disable[] = " AND ai.package IN "
- "(SELECT package FROM package_info WHERE package_disable='false')";
GSList *list;
+ if (!filter)
+ return PMINFO_R_OK;
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);
- *query = strdup(buf);
- return PMINFO_R_OK;
- }
-
for (list = filter->list; list; list = list->next) {
joined |= __get_filter_condition(list->data, uid, &condition, bind_params);
if (condition == NULL)
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);
if (*query == NULL)
return PMINFO_R_ERROR;
pkgmgrinfo_basic_free_application((application_x *)data);
}
-static gint __app_disable_chk_func(gconstpointer data1, gconstpointer data2)
+static gint __disable_chk_func(gconstpointer data1, gconstpointer data2)
{
pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)data1;
+ pkgmgrinfo_appinfo_disable_type *value =
+ (pkgmgrinfo_appinfo_disable_type *)data2;
- if (node->prop == E_PMINFO_APPINFO_PROP_APP_DISABLE)
- return 0;
+ if (value == E_APPINFO_DISABLE_TYPE_PKG)
+ return (node->prop == E_PMINFO_APPINFO_PROP_PKG_DISABLE)
+ ? 0 : 1;
else
- return 1;
+ return (node->prop == E_PMINFO_APPINFO_PROP_APP_DISABLE)
+ ? 0 : 1;
}
-static bool __check_disable_filter_exist(pkgmgrinfo_filter_x *filter)
+static bool __check_disable_filter_exist(pkgmgrinfo_filter_x *filter,
+ pkgmgrinfo_appinfo_disable_type type)
{
GSList *link;
if (filter == NULL)
return false;
- link = g_slist_find_custom(filter->list, NULL, __app_disable_chk_func);
+ link = g_slist_find_custom(filter->list, &type, __disable_chk_func);
if (link)
return true;
return PMINFO_R_ERROR;
}
+ ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_PKG_DISABLE, false);
+ 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;
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 | PMINFO_APPINFO_GET_BASICINFO, list);
if (ret == PMINFO_R_OK && uid != GLOBAL_USER)
return PMINFO_R_ERROR;
}
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
comp_str = __appcomponent_str(component);
if (comp_str) {
return PMINFO_R_ERROR;
if (pkgmgrinfo_appinfo_filter_add_bool(filter,
- PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+ PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_PKG_DISABLE, false)) {
pkgmgrinfo_appinfo_filter_destroy(filter);
return PMINFO_R_ERROR;
}
if (ret != PMINFO_R_OK)
return ret;
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_PKG_DISABLE, false)) {
+ pkgmgrinfo_appinfo_filter_destroy(filter);
+ return PMINFO_R_ERROR;
+ }
+
ret = _appinfo_get_filtered_foreach_appinfo(uid, filter,
PMINFO_APPINFO_GET_ALL, app_func, user_data);
return PMINFO_R_ERROR;
}
+ if (__check_disable_filter_exist(
+ handle, E_APPINFO_DISABLE_TYPE_APP) == false) {
+ if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_DISABLE, false)) {
+ g_hash_table_destroy(list);
+ free(locale);
+ return PMINFO_R_ERROR;
+ }
+ }
+
+ if (__check_disable_filter_exist(
+ handle, E_APPINFO_DISABLE_TYPE_PKG) == false) {
+ if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_PKG_DISABLE, false)) {
+ g_hash_table_destroy(list);
+ free(locale);
+ return PMINFO_R_ERROR;
+ }
+ }
+
ret = _appinfo_get_applications(uid, uid, locale, handle, 0, list);
if (ret == PMINFO_R_OK && uid != GLOBAL_USER)
ret = _appinfo_get_applications(GLOBAL_USER, uid, locale,
return PMINFO_R_EINVAL;
}
+ if (__check_disable_filter_exist(
+ handle, E_APPINFO_DISABLE_TYPE_APP) == false) {
+ if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_APP_DISABLE, false))
+ return PMINFO_R_ERROR;
+ }
+
+ if (__check_disable_filter_exist(
+ handle, E_APPINFO_DISABLE_TYPE_PKG) == false) {
+ if (pkgmgrinfo_appinfo_filter_add_bool(handle,
+ PMINFO_APPINFO_PROP_PKG_DISABLE, false))
+ return PMINFO_R_ERROR;
+ }
+
return _appinfo_get_filtered_foreach_appinfo(uid, handle, PMINFO_APPINFO_GET_ALL, app_cb,
user_data);
}
return PMINFO_R_EINVAL;
}
+ pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_DISABLE, false))
+ return PMINFO_R_ERROR;
+
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_PKG_DISABLE, false))
+ return PMINFO_R_ERROR;
+
return _appinfo_get_filtered_foreach_appinfo(uid, handle, PMINFO_APPINFO_GET_ALL, app_cb,
user_data);
}