#include <dlfcn.h>
#include <vconf.h>
-#include <sqlite3.h>
#include <glib.h>
#include <unzip.h>
{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 {
{E_PMINFO_APPINFO_PROP_PKG_DISABLE, PMINFO_APPINFO_PROP_PKG_DISABLE}
};
-inline pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property)
+API pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property)
{
int i = 0;
int max = 0;
return prop;
}
-inline pkgmgrinfo_pkginfo_filter_prop_int _pminfo_pkginfo_convert_to_prop_int(const char *property)
+API pkgmgrinfo_pkginfo_filter_prop_int _pminfo_pkginfo_convert_to_prop_int(const char *property)
{
int i = 0;
int max = 0;
return prop;
}
-inline pkgmgrinfo_pkginfo_filter_prop_bool _pminfo_pkginfo_convert_to_prop_bool(const char *property)
+API pkgmgrinfo_pkginfo_filter_prop_bool _pminfo_pkginfo_convert_to_prop_bool(const char *property)
{
int i = 0;
int max = 0;
return prop;
}
-inline pkgmgrinfo_appinfo_filter_prop_str _pminfo_appinfo_convert_to_prop_str(const char *property)
+API pkgmgrinfo_appinfo_filter_prop_str _pminfo_appinfo_convert_to_prop_str(const char *property)
{
int i = 0;
int max = 0;
return prop;
}
-inline pkgmgrinfo_appinfo_filter_prop_int _pminfo_appinfo_convert_to_prop_int(const char *property)
+API pkgmgrinfo_appinfo_filter_prop_int _pminfo_appinfo_convert_to_prop_int(const char *property)
{
int i = 0;
int max = 0;
return prop;
}
-inline pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property)
+API pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property)
{
int i = 0;
int max = 0;
return prop;
}
-int __get_filter_condition(gpointer data, uid_t uid, char **condition, GList **params)
+void _pkgmgrinfo_node_destroy(pkgmgrinfo_node_x *node)
+{
+ if (node == NULL)
+ return;
+
+ free(node->value);
+ free(node->key);
+ free(node);
+}
+
+API int __get_filter_condition(gpointer data, uid_t uid, char **condition, GList **params)
{
pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x *)data;
char buf[MAX_QUERY_LEN] = {'\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;
return flag;
}
-int __get_metadata_filter_condition(gpointer data, char **condition,
+API int __get_metadata_filter_condition(gpointer data, char **condition,
GList **params)
{
pkgmgrinfo_metadata_node_x *node = (pkgmgrinfo_metadata_node_x *)data;
return E_PMINFO_APPINFO_JOIN_METADATA;
}
-int _add_icon_info_into_list(const char *locale, char *value, GList **icon)
+API int _add_icon_info_into_list(const char *locale, char *value, GList **icon)
{
icon_x *info;
return PMINFO_R_OK;
}
-int _add_label_info_into_list(const char *locale, char *value, GList **label)
+API int _add_label_info_into_list(const char *locale, char *value, GList **label)
{
label_x *info;
return PMINFO_R_OK;
}
-char *_get_system_locale(void)
-{
- char *lang;
- char *locale;
-
- lang = vconf_get_str(VCONFKEY_LANGSET);
- if (lang == NULL) {
- locale = strdup(DEFAULT_LOCALE);
- if (locale == NULL) {
- LOGE("out of memory");
- return NULL;
- }
- return locale;
- }
-
- locale = malloc(sizeof(char) * 6);
- if (locale == NULL) {
- LOGE("out of memory");
- free(lang);
- return NULL;
- }
-
- strncpy(locale, lang, 2);
- locale[2] = '-';
- locale[3] = tolower(lang[3]);
- locale[4] = tolower(lang[4]);
- locale[5] = '\0';
-
- free(lang);
-
- return locale;
-}
-
-int __pkginfo_check_installed_storage(package_x *pkginfo)
+API int __pkginfo_check_installed_storage(package_x *pkginfo)
{
char buf[MAX_QUERY_LEN] = {'\0'};
int ret;
return PMINFO_R_OK;
}
-int __appinfo_check_installed_storage(application_x *appinfo)
+API int __appinfo_check_installed_storage(application_x *appinfo)
{
retvm_if(appinfo->installed_storage == NULL, PMINFO_R_ERROR,
"installed_storage is NULL\n");
return PMINFO_R_OK;
}
-#define BUSY_WAITING_USEC (1000000 / 10 / 2) /* 0.05 sec */
-#define BUSY_WAITING_MAX 100 /* wait for max 5 sec */
-static int __db_busy_handler(void *data, int count)
-{
- if (count < BUSY_WAITING_MAX) {
- usleep(BUSY_WAITING_USEC);
- return 1;
- } else {
- /* sqlite3_prepare_v2 will return SQLITE_BUSY */
- return 0;
- }
-}
-
-int __open_db(const char *path, sqlite3 **db, int flags)
-{
- int ret;
-
- ret = sqlite3_open_v2(path, db, flags, NULL);
- if (ret != SQLITE_OK) {
- sqlite3_close_v2(*db);
- return ret;
- }
-
- ret = sqlite3_busy_handler(*db, __db_busy_handler, NULL);
- if (ret != SQLITE_OK) {
- _LOGE("failed to register busy handler: %s",
- sqlite3_errmsg(*db));
- sqlite3_close_v2(*db);
- return ret;
- }
-
- return ret;
-}
-
struct type_map {
const char *manifest;
const char *type;
};
-struct type_map type_map[] = {
+const struct type_map type_map[] = {
{ "res/wgt/config.xml", "wgt" },
{ "config.xml", "wgt" },
{ "tizen-manifest.xml", "tpk" },
{ NULL, NULL}
};
-char *__get_type_from_path(const char *pkg_path)
+API char *__get_type_from_path(const char *pkg_path)
{
const char *type = NULL;
unzFile uf;
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;
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);
}
-pkg_plugin_set *__load_library(const char *pkg_type)
+API pkg_plugin_set *__load_library(const char *pkg_type)
{
void *library_handle;
pkg_plugin_set *plugin_set;
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;
return plugin_set;
}
- if ((library_handle = dlopen(library_path, RTLD_LAZY)) == NULL) {
+ library_handle = dlopen(library_path, RTLD_LAZY);
+ if (library_handle == NULL) {
_LOGE("dlopen is failed library_path[%s]", library_path);
return NULL;
}
- if ((on_load = dlsym(library_handle, "pkg_plugin_on_load")) == NULL ||
- dlerror() != NULL) {
+ on_load = dlsym(library_handle, "pkg_plugin_on_load");
+ if (on_load == NULL || dlerror() != NULL) {
_LOGE("cannot find symbol");
dlclose(library_handle);
return NULL;
return plugin_set;
}
-void __unload_library(const char *pkg_type)
+API void __unload_library(const char *pkg_type)
{
pkg_plugin_set *plugin_set;