{E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME, PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME},
{E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL, PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL},
{E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF, PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF},
- {E_PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE}
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE, PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE},
+ {E_PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE, PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE}
};
struct _pkginfo_int_map_t {
snprintf(buf, sizeof(buf), "pi.package_support_disable=? COLLATE NOCASE");
break;
case E_PMINFO_PKGINFO_PROP_PACKAGE_DISABLE:
- snprintf(buf, sizeof(buf), "pi.package_disable=? COLLATE NOCASE");
- break;
+ return 0;
case E_PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM:
snprintf(buf, sizeof(buf), "pi.package_system=? COLLATE NOCASE");
break;
-
+ case E_PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE:
+ if (node->value == NULL || strlen(node->value) == 0) {
+ *condition = strdup("package_res_info.res_type IS NOT NULL COLLATE NOCASE");
+ if (*condition == NULL) {
+ _LOGE("out of memeory");
+ return 0;
+ }
+ return E_PMINFO_PKGINFO_JOIN_RES_INFO;
+ } else {
+ snprintf(buf, sizeof(buf), "package_res_info.res_type=? COLLATE NOCASE");
+ flag = E_PMINFO_PKGINFO_JOIN_RES_INFO;
+ break;
+ }
case E_PMINFO_APPINFO_PROP_APP_ID:
snprintf(buf, sizeof(buf), "ai.app_id=?");
break;
snprintf(buf, sizeof(buf), "ai.app_ui_gadget=? COLLATE NOCASE");
break;
case E_PMINFO_APPINFO_PROP_APP_DISABLE:
- if (strcasecmp(node->value, "true") == 0)
- snprintf(buf, MAX_QUERY_LEN, "(ai.app_disable=? COLLATE NOCASE " \
- "OR ui.is_disabled='true' COLLATE NOCASE)");
- else
- snprintf(buf, MAX_QUERY_LEN, "(ai.app_disable=? COLLATE NOCASE " \
- "AND (ui.is_disabled='false' COLLATE NOCASE " \
- "OR ui.is_disabled IS NULL))");
+ return 0;
break;
case E_PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE:
snprintf(buf, MAX_QUERY_LEN, "ai.app_support_disable=? COLLATE NOCASE");
break;
case E_PMINFO_APPINFO_PROP_PKG_DISABLE:
- snprintf(buf, MAX_QUERY_LEN,
- "ai.package IN (SELECT package FROM " \
- "package_info WHERE package_disable=?)");
+ return 0;
break;
case E_PMINFO_APPINFO_PROP_APP_SUPPORT_MODE:
snprintf(buf, sizeof(buf), "ai.app_support_mode=?");
return flag;
}
+API int __get_pkg_metadata_filter_condition(gpointer data, char **condition,
+ GList **params)
+{
+ pkgmgrinfo_metadata_node_x *node = (pkgmgrinfo_metadata_node_x *)data;
+ char buf[MAX_QUERY_LEN];
+
+ snprintf(buf, sizeof(buf), "(package_metadata.md_key=?");
+ if (node->value)
+ strncat(buf, " AND package_metadata.md_value=?",
+ sizeof(buf) - strlen(buf) - 1);
+ strncat(buf, ")", sizeof(buf) - strlen(buf) - 1);
+
+ *condition = strdup(buf);
+ *params = g_list_append(*params, strdup(node->key));
+ if (node->value)
+ *params = g_list_append(*params, strdup(node->value));
+
+ return E_PMINFO_PKGINFO_JOIN_METADATA;
+}
+
API int __get_metadata_filter_condition(gpointer data, char **condition,
GList **params)
{
return strdup(type);
}
-static const char *__get_library_path(const char *pkg_type)
+static void __get_library_path(const char *pkg_type, const char **path)
{
- char buf[64];
- const char *path;
+ char buf[PATH_MAX];
snprintf(buf, sizeof(buf), "package-manager/backendlib/lib%s.so",
pkg_type);
- path = tzplatform_mkpath(TZ_SYS_RO_ETC, buf);
- return path;
+ *path = tzplatform_mkpath(TZ_SYS_RO_ETC, buf);
}
API pkg_plugin_set *__load_library(const char *pkg_type)
bool (*on_load)(pkg_plugin_set *plugin);
const char *library_path;
- library_path = __get_library_path(pkg_type);
+ __get_library_path(pkg_type, &library_path);
if (library_path == NULL) {
_LOGE("cannot get library path for %s", pkg_type);
return NULL;