uid_t uid;
GSList *list;
GSList *list_metadata;
+ bool cache_flag; /* flag for pkginfo-server used to make cache */
} pkgmgrinfo_filter_x;
typedef struct _pkgmgrinfo_node_x {
if (!filter)
return PMINFO_R_OK;
- if (g_slist_length(filter->list) == 0) {
+ if (filter->cache_flag) {
joined = E_PMINFO_APPINFO_JOIN_LOCALIZED_INFO |
E_PMINFO_APPINFO_JOIN_CATEGORY |
E_PMINFO_APPINFO_JOIN_APP_CONTROL |
if (tmp_filter == nullptr)
return true;
+ if (tmp_filter->cache_flag)
+ return false;
+
property = _pminfo_appinfo_convert_to_prop_bool(
PMINFO_APPINFO_PROP_APP_CHECK_STORAGE);
for (tmp_list = tmp_filter->list; tmp_list != nullptr;
namespace pkgmgr_server {
namespace internal {
+API bool check_app_storage_status(pkgmgrinfo_filter_x* tmp_filter) {
+ return ::__check_app_storage_status(tmp_filter);
+}
+
API int appinfo_internal_filter_get_list(sqlite3* db,
pkgmgrinfo_appinfo_filter_h filter, uid_t db_uid, uid_t uid,
const char* locale,
}
pkgmgrinfo_filter_x tmp_filter = { 0, };
+ tmp_filter.cache_flag = true;
int ret = pkginfo_internal_filter_get_list(db, &tmp_filter, uid_,
locale.c_str(), list);
if (ret == PMINFO_R_OK) {
if (map_it == pkg_map_.end())
return ret;
+ if (__check_package_storage_status(filter)) {
+ if (pkgmgrinfo_pkginfo_filter_add_bool(filter,
+ PMINFO_PKGINFO_PROP_PACKAGE_CHECK_STORAGE, true) != PMINFO_R_OK) {
+ LOG(ERROR) << "Fail to add check storage value to filter";
+ return {};
+ }
+ }
+
for (auto& info : map_it->second) {
bool pass = true;
for (auto* it = filter->list; it != nullptr; it = g_slist_next(it)) {
if (map_it == app_map_.end())
return ret;
+ if (pkgmgr_server::internal::check_app_storage_status(filter)) {
+ if (pkgmgrinfo_appinfo_filter_add_bool(filter,
+ PMINFO_APPINFO_PROP_APP_CHECK_STORAGE, true) != PMINFO_R_OK) {
+ LOG(ERROR) << "Fail to add check storage value to filter";
+ return {};
+ }
+ }
+
for (auto& info : map_it->second) {
bool pass = true;
for (auto* it = filter->list; it != nullptr; it = g_slist_next(it)) {
namespace database {
bool CheckStorageAppFilterChecker::CheckFilter(pkgmgrinfo_node_x* node,
- application_x* info) {
- return true;
+ application_x* info) {
+ return (node->value == nullptr || strcasecmp(node->value, "true") != 0 ||
+ __appinfo_check_installed_storage(info) == PMINFO_R_OK);
}
} // namespace database
if (!filter)
return PMINFO_R_OK;
- if (g_slist_length(filter->list) == 0) {
+ if (filter->cache_flag) {
joined = E_PMINFO_PKGINFO_JOIN_LOCALIZED_INFO |
E_PMINFO_PKGINFO_JOIN_PRIVILEGE_INFO |
E_PMINFO_PKGINFO_JOIN_RES_INFO;
return PMINFO_R_OK;
}
-static bool __check_package_storage_status(pkgmgrinfo_filter_x *tmp_filter)
+bool __check_package_storage_status(pkgmgrinfo_filter_x *tmp_filter)
{
GSList *tmp_list = NULL;
pkgmgrinfo_node_x *tmp_node = NULL;
int property = -1;
+ if (tmp_filter->cache_flag)
+ return false;
+
property = _pminfo_pkginfo_convert_to_prop_bool(
PMINFO_PKGINFO_PROP_PACKAGE_CHECK_STORAGE);
for (tmp_list = tmp_filter->list; tmp_list != NULL;
#include <sqlite3.h>
#include "pkgmgr_parser.h"
+#include "pkgmgrinfo_private.h"
#include "pkgmgrinfo_type.h"
#include "pkgmgr-info.h"
#ifdef __cplusplus
int execute_write_queries(sqlite3 *db, GList *queries, GList *params_list);
int pkginfo_internal_filter_get_depends_on(sqlite3 *db, const char *pkgid, GList **list);
+bool __check_package_storage_status(pkgmgrinfo_filter_x *tmp_filter);
void _save_column_int(sqlite3_stmt *stmt, int idx, int *i);
void _save_column_str(sqlite3_stmt *stmt, int idx, char **str);
namespace pkgmgr_server {
namespace internal {
+extern API bool check_app_storage_status(pkgmgrinfo_filter_x* tmp_filter);
+
extern API int appinfo_internal_filter_get_list(sqlite3* db,
pkgmgrinfo_appinfo_filter_h filter, uid_t db_uid, uid_t uid,
const char* locale,