From: junsuk77.oh Date: Tue, 19 Mar 2013 07:03:22 +0000 (+0900) Subject: add new filter key to get installed storage X-Git-Tag: 2.1b_release~10 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c4ea5f030535fc2a353ed34aeaea4aa32953b283;p=framework%2Fappfw%2Fpkgmgr-info.git add new filter key to get installed storage Change-Id: Iea2936ae0d3845b2146780717c6c51b28d1b5132 Signed-off-by: junsuk77.oh --- diff --git a/include/pkgmgr-info-internal.h b/include/pkgmgr-info-internal.h index bd6b10e..f2818e7 100755 --- a/include/pkgmgr-info-internal.h +++ b/include/pkgmgr-info-internal.h @@ -42,6 +42,7 @@ typedef enum _pkgmgrinfo_pkginfo_filter_prop_str { E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE, E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION, E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION, + E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE, E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME, E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_EMAIL, E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF, @@ -54,7 +55,9 @@ typedef enum _pkgmgrinfo_pkginfo_filter_prop_bool { E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE = E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL, E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY, - E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY + E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE, + E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING, + E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING } pkgmgrinfo_pkginfo_filter_prop_bool; /*Integer properties for filtering based on package info*/ diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 6680502..c00fc11 100755 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -327,6 +327,8 @@ typedef enum { #define PMINFO_PKGINFO_PROP_PACKAGE_VERSION "PMINFO_PKGINFO_PROP_PACKAGE_VERSION" /** String property for filtering based on package info*/ #define PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION "PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION" + /** String property for filtering based on package info*/ +#define PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE "PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE" /** String property for filtering based on package info*/ #define PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME" /** String property for filtering based on package info*/ @@ -340,6 +342,10 @@ typedef enum { #define PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD" /** Boolean property for filtering based on package info*/ #define PMINFO_PKGINFO_PROP_PACKAGE_READONLY "PMINFO_PKGINFO_PROP_PACKAGE_READONLY" + /** Boolean property for filtering based on package info*/ +#define PMINFO_PKGINFO_PROP_PACKAGE_UPDATE "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE" + /** Boolean property for filtering based on package info*/ +#define PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING "PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING" /** Integer property for filtering based on package info*/ #define PMINFO_PKGINFO_PROP_PACKAGE_SIZE "PMINFO_PKGINFO_PROP_PACKAGE_SIZE" @@ -1416,6 +1422,45 @@ static int get_pkg_readonly(const char *pkgid) */ int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly); + +/** + * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update) + * @brief This API gets the package 'upate' value from the package ID + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package info handle + * @param[out] update pointer to hold package update value + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @retval PMINFO_R_ERROR internal error + * @pre pkgmgrinfo_pkginfo_get_pkginfo() + * @post pkgmgrinfo_pkginfo_destroy_pkginfo() + * @see pkgmgrinfo_pkginfo_get_pkgid() + * @code +static int get_pkg_update(const char *pkgid) +{ + int ret = 0; + bool update; + pkgmgrinfo_pkginfo_h handle; + ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_pkginfo_is_update(handle, &update); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); + return -1; + } + printf("pkg update: %d\n", update); + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update); + /** * @fn int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible) * @brief This API gets the package 'accessible' value from the package ID diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index cee2476..f6c62bf 100755 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -1,7 +1,7 @@ Name: pkgmgr-info Summary: Packager Manager infomation api for package -Version: 0.0.83 -Release: 2 +Version: 0.0.87 +Release: 1 Group: System/Libraries License: Apache License, Version 2.0 Source0: %{name}-%{version}.tar.gz diff --git a/parser/manifest.xsd.in b/parser/manifest.xsd.in index 5a08c40..fee2ad1 100755 --- a/parser/manifest.xsd.in +++ b/parser/manifest.xsd.in @@ -28,6 +28,7 @@ + diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index c6b8dce..a2e5835 100755 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -224,7 +224,6 @@ static char *__get_parser_plugin(const char *type) FILE *fp = NULL; char buffer[1024] = { 0 }; char temp_path[1024] = { 0 }; - char *lib_path = NULL; char *path = NULL; if (type == NULL) { @@ -345,14 +344,8 @@ static char *__pkgid_to_manifest(const char *pkgid) static int __run_parser_prestep(xmlTextReaderPtr reader, ACTION_TYPE action, const char *pkgid) { - int nLoop = 0; - int pid = 0; - char *parser_cmd = NULL; int ret = -1; const xmlChar *name; - char *lib_path = NULL; - void *lib_handle = NULL; - int (*plugin_install) (xmlDocPtr); DBG("__run_parser_prestep"); @@ -3157,6 +3150,13 @@ static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx) mfx->type = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("type"))); if (xmlTextReaderGetAttribute(reader, XMLCHAR("root_path"))) mfx->root_path = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("root_path"))); + if (xmlTextReaderGetAttribute(reader, XMLCHAR("appsetting"))) { + mfx->appsetting = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("appsetting"))); + if (mfx->appsetting == NULL) + mfx->appsetting = strdup("false"); + } else { + mfx->appsetting = strdup("false"); + } /*Assign default values. If required it will be overwritten in __add_preload_info()*/ mfx->preload = strdup("False"); @@ -3170,6 +3170,8 @@ static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx) val = strndup(buf, PKG_STRING_LEN_MAX - 1); mfx->installed_time = val; + mfx->installed_storage= strdup("installed_internal"); + ret = __start_process(reader, mfx); } else { DBG("No Manifest element found\n"); @@ -3415,8 +3417,6 @@ static int __ps_make_nativeapp_desktop(manifest_x * mfx, bool is_update) mime_x *mi = NULL; uri_x *ui = NULL; subapp_x *sub = NULL; - int ret = -1; - char query[PKG_STRING_LEN_MAX] = {'\0'}; char *operation = NULL; char *mime = NULL; char *uri = NULL; @@ -3496,8 +3496,6 @@ static int __ps_make_nativeapp_desktop(manifest_x * mfx, bool is_update) mime_x *mi = NULL; uri_x *ui = NULL; subapp_x *sub = NULL; - int ret = -1; - char query[PKG_STRING_LEN_MAX] = {'\0'}; char *operation = NULL; char *mime = NULL; char *uri = NULL; @@ -3697,6 +3695,10 @@ API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx) free((void *)mfx->removable); mfx->removable = NULL; } + if (mfx->update) { + free((void *)mfx->update); + mfx->update = NULL; + } if (mfx->type) { free((void *)mfx->type); mfx->type = NULL; @@ -3709,6 +3711,10 @@ API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx) free((void *)mfx->installed_time); mfx->installed_time = NULL; } + if (mfx->installed_storage) { + free((void *)mfx->installed_storage); + mfx->installed_storage = NULL; + } if (mfx->storeclient_id) { free((void *)mfx->storeclient_id); mfx->storeclient_id = NULL; @@ -3725,6 +3731,10 @@ API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx) free((void *)mfx->root_path); mfx->root_path = NULL; } + if (mfx->appsetting) { + free((void *)mfx->appsetting); + mfx->appsetting = NULL; + } /*Free Icon*/ if (mfx->icon) { @@ -3913,6 +3923,8 @@ API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char DBG("parsing manifest for installation: %s\n", manifest); manifest_x *mfx = NULL; int ret = -1; + char roxml_check[PKG_STRING_LEN_MAX] = {'\0'}; + xmlInitParser(); mfx = pkgmgr_parser_process_manifest_xml(manifest); DBG("Parsing Finished\n"); @@ -3922,6 +3934,13 @@ API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char __streamFile(manifest, ACTION_INSTALL, temp, mfx->package); __add_preload_info(mfx, manifest); DBG("Added preload infomation\n"); + + snprintf(roxml_check, PKG_STRING_LEN_MAX, MANIFEST_RO_DIRECTORY "/%s.xml", mfx->package); + if (access(roxml_check, F_OK) == 0) + mfx->update = strdup("true"); + else + mfx->update = strdup("false"); + ret = pkgmgr_parser_insert_manifest_info_in_db(mfx); if (ret == -1) DBG("DB Insert failed\n"); @@ -3976,6 +3995,8 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con __streamFile(manifest, ACTION_UPGRADE, temp, mfx->package); __add_preload_info(mfx, manifest); DBG("Added preload infomation\n"); + + mfx->update = strdup("true"); ret = pkgmgr_parser_update_manifest_info_in_db(mfx); if (ret == -1) DBG("DB Update failed\n"); diff --git a/parser/pkgmgr_parser.h b/parser/pkgmgr_parser.h index a965298..d964af8 100755 --- a/parser/pkgmgr_parser.h +++ b/parser/pkgmgr_parser.h @@ -433,9 +433,12 @@ typedef struct manifest_x { const char *removable; /**< package removable flag*/ const char *preload; /**< package preload flag*/ const char *readonly; /**< package readonly flag*/ + const char *update; /**< package update flag*/ + const char *appsetting; /**< package app setting flag*/ const char *type; /**< package type*/ const char *package_size; /**< package size for external installation*/ const char *installed_time; /**< installed time after finishing of installation*/ + const char *installed_storage; /**< package currently installed storage*/ const char *storeclient_id; /**< id of store client for installed package*/ const char *mainapp_id; /**< app id of main application*/ const char *package_url; /**< app id of main application*/ diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index d82b290..39af2b8 100755 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -51,10 +51,13 @@ char *prev = NULL; "package_removable text DEFAULT 'true', " \ "package_preload text DEFAULT 'false', " \ "package_readonly text DEFAULT 'false', " \ + "package_update text DEFAULT 'false', " \ + "package_appsetting text DEFAULT 'false', " \ "author_name text, " \ "author_email text, " \ "author_href text," \ "installed_time text," \ + "installed_storage text," \ "storeclient_id text," \ "mainapp_id text," \ "package_url text," \ @@ -292,7 +295,6 @@ static int __guestmode_visibility_cb(void *data, int ncols, char **coltxt, char static void __preserve_guestmode_visibility_value(manifest_x *mfx) { - int ret = -1; char *error_message = NULL; char query[MAX_QUERY_LEN] = {'\0'}; snprintf(query, MAX_QUERY_LEN - 1, "select app_id, app_guestmodevisibility from package_app_info where package='%s'", mfx->package); @@ -1685,10 +1687,10 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) } snprintf(query, MAX_QUERY_LEN, "insert into package_info(package, package_type, package_version, install_location, package_size, " \ - "package_removable, package_preload, package_readonly, author_name, author_email, author_href, installed_time, storeclient_id, mainapp_id, package_url, root_path) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\ + "package_removable, package_preload, package_readonly, package_update, package_appsetting, author_name, author_email, author_href, installed_time, installed_storage, storeclient_id, mainapp_id, package_url, root_path) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\ mfx->package, type, mfx->version, mfx->installlocation, mfx->package_size, mfx->removable, mfx->preload, - mfx->readonly, auth_name, auth_email, auth_href, mfx->installed_time, mfx->storeclient_id, mfx->mainapp_id, mfx->package_url, path); + mfx->readonly, mfx->update, mfx->appsetting, auth_name, auth_email, auth_href, mfx->installed_time, mfx->installed_storage, mfx->storeclient_id, mfx->mainapp_id, mfx->package_url, path); ret = __exec_query(query); if (ret == -1) { DBG("Package Info DB Insert Failed\n"); diff --git a/src/pkgmgr-info-internal.c b/src/pkgmgr-info-internal.c index bc399d3..11be661 100755 --- a/src/pkgmgr-info-internal.c +++ b/src/pkgmgr-info-internal.c @@ -36,6 +36,7 @@ static struct _pkginfo_str_map_t pkginfo_str_prop_map[] = { {E_PMINFO_PKGINFO_PROP_PACKAGE_TYPE, PMINFO_PKGINFO_PROP_PACKAGE_TYPE}, {E_PMINFO_PKGINFO_PROP_PACKAGE_VERSION, PMINFO_PKGINFO_PROP_PACKAGE_VERSION}, {E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION,PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION}, + {E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE,PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE}, {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} @@ -58,7 +59,9 @@ struct _pkginfo_bool_map_t { static struct _pkginfo_bool_map_t pkginfo_bool_prop_map[] = { {E_PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE, PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE}, {E_PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD, PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD}, - {E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY, PMINFO_PKGINFO_PROP_PACKAGE_READONLY} + {E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY, PMINFO_PKGINFO_PROP_PACKAGE_READONLY}, + {E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE, PMINFO_PKGINFO_PROP_PACKAGE_UPDATE}, + {E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING, PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING} }; struct _appinfo_str_map_t { diff --git a/src/pkgmgr-info.c b/src/pkgmgr-info.c index e12372a..eadaaf1 100755 --- a/src/pkgmgr-info.c +++ b/src/pkgmgr-info.c @@ -50,6 +50,7 @@ #define PKG_TYPE_STRING_LEN_MAX 128 #define PKG_VERSION_STRING_LEN_MAX 128 #define PKG_VALUE_STRING_LEN_MAX 512 +#define PKG_LOCALE_STRING_LEN_MAX 8 #define PKG_RW_PATH "/opt/usr/apps/" #define PKG_RO_PATH "/usr/apps/" #define BLOCK_SIZE 4096 /*in bytes*/ @@ -179,6 +180,7 @@ typedef struct _pkgmgrinfo_appcontrol_x { typedef int (*sqlite_query_callback)(void *data, int ncols, char **coltxt, char **colname); char *pkgtype = "rpm"; +static char glocale[PKG_LOCALE_STRING_LEN_MAX]; __thread sqlite3 *manifest_db = NULL; __thread sqlite3 *datacontrol_db = NULL; __thread int gflag[9];/*one for each cert type*/ @@ -257,6 +259,9 @@ static void __get_filter_condition(gpointer data, char **condition) case E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALL_LOCATION: snprintf(buf, MAX_QUERY_LEN, "package_info.install_location='%s'", node->value); break; + case E_PMINFO_PKGINFO_PROP_PACKAGE_INSTALLED_STORAGE: + snprintf(buf, MAX_QUERY_LEN, "package_info.installed_storage='%s'", node->value); + break; case E_PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_NAME: snprintf(buf, MAX_QUERY_LEN, "package_info.author_name='%s'", node->value); break; @@ -278,6 +283,12 @@ static void __get_filter_condition(gpointer data, char **condition) case E_PMINFO_PKGINFO_PROP_PACKAGE_READONLY: snprintf(buf, MAX_QUERY_LEN, "package_info.package_readonly IN %s", node->value); break; + case E_PMINFO_PKGINFO_PROP_PACKAGE_UPDATE: + snprintf(buf, MAX_QUERY_LEN, "package_info.package_update IN %s", node->value); + break; + case E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING: + snprintf(buf, MAX_QUERY_LEN, "package_info.package_appsetting IN %s", node->value); + break; case E_PMINFO_APPINFO_PROP_APP_ID: snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_id='%s'", node->value); break; @@ -949,6 +960,16 @@ static int __pkginfo_cb(void *data, int ncols, char **coltxt, char **colname) info->manifest_info->readonly = strdup(coltxt[i]); else info->manifest_info->readonly = NULL; + } else if (strcmp(colname[i], "package_update") == 0 ){ + if (coltxt[i]) + info->manifest_info->update= strdup(coltxt[i]); + else + info->manifest_info->update = NULL; + } else if (strcmp(colname[i], "package_appsetting") == 0 ){ + if (coltxt[i]) + info->manifest_info->appsetting = strdup(coltxt[i]); + else + info->manifest_info->appsetting = NULL; } else if (strcmp(colname[i], "installed_time") == 0 ){ if (coltxt[i]) info->manifest_info->installed_time = strdup(coltxt[i]); @@ -1386,10 +1407,8 @@ static int __appinfo_cb(void *data, int ncols, char **coltxt, char **colname) else info->uiapp_info->type = NULL; } else if (strcmp(colname[i], "app_icon_section") == 0 ) { - if (coltxt[i]){ + if (coltxt[i]) info->uiapp_info->icon->section= strdup(coltxt[i]); - _LOGE("isectt == %s \n",info->uiapp_info->icon->section); - } else info->uiapp_info->icon->section = NULL; } else if (strcmp(colname[i], "app_icon") == 0) { @@ -2089,7 +2108,7 @@ API int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *us ret = PMINFO_R_EINVAL; goto err; } - + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); ret = __open_manifest_db(); if (ret == -1) { _LOGE("Fail to open manifest DB\n"); @@ -2251,6 +2270,7 @@ API int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h * ret = PMINFO_R_EINVAL; goto err; } + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); pkginfo = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x)); if (pkginfo == NULL) { _LOGE("Failed to allocate memory for pkginfo\n"); @@ -2661,18 +2681,11 @@ API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon) info_tmp->tmp_dup= strdup(info_tmp->tmp); *icon = info_tmp->tmp_dup; } else { - char *syslocale = NULL; char *locale = NULL; - char *save = NULL; icon_x *ptr = NULL; - syslocale = vconf_get_str(VCONFKEY_LANGSET); - tryvm_if(syslocale == NULL, ret = PMINFO_R_EINVAL, "current locale is NULL"); - - locale = __convert_system_locale_to_manifest_locale(syslocale); - tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL"); - - save = locale; *icon = NULL; + locale = glocale; + tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL"); pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next) { @@ -2691,15 +2704,6 @@ API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon) } } - if (syslocale) { - free(syslocale); - syslocale = NULL; - } - locale = save; - if (locale) { - free(locale); - locale = NULL; - } } catch: @@ -2736,19 +2740,11 @@ API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label) info_tmp->tmp_dup = strdup(info_tmp->tmp); *label = info_tmp->tmp_dup; } else { - char *syslocale = NULL; char *locale = NULL; - char *save = NULL; label_x *ptr = NULL; - - syslocale = vconf_get_str(VCONFKEY_LANGSET); - tryvm_if(syslocale == NULL, ret = PMINFO_R_EINVAL, "current locale is NULL"); - - locale = __convert_system_locale_to_manifest_locale(syslocale); - tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL"); - - save = locale; *label = NULL; + locale = glocale; + tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL"); pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next) { @@ -2766,16 +2762,6 @@ API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label) } } } - - if (syslocale) { - free(syslocale); - syslocale = NULL; - } - locale = save; - if (locale) { - free(locale); - locale = NULL; - } } catch: @@ -2793,22 +2779,11 @@ API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **d _LOGE("Argument supplied to hold return value is NULL\n"); return PMINFO_R_EINVAL; } - char *syslocale = NULL; char *locale = NULL; - char *save = NULL; description_x *ptr = NULL; - syslocale = vconf_get_str(VCONFKEY_LANGSET); - if (syslocale == NULL) { - _LOGE("current locale is NULL\n"); - return PMINFO_R_EINVAL; - } - locale = __convert_system_locale_to_manifest_locale(syslocale); - if (locale == NULL) { - _LOGE("manifest locale is NULL\n"); - return PMINFO_R_EINVAL; - } - save = locale; *description = NULL; + locale = glocale; + retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL"); pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; for(ptr = info->manifest_info->description; ptr != NULL; ptr = ptr->next) { @@ -2826,15 +2801,6 @@ API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **d } } } - if (syslocale) { - free(syslocale); - syslocale = NULL; - } - locale = save; - if (locale) { - free(locale); - locale = NULL; - } return PMINFO_R_OK; } @@ -2848,22 +2814,11 @@ API int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **a _LOGE("Argument supplied to hold return value is NULL\n"); return PMINFO_R_EINVAL; } - char *syslocale = NULL; char *locale = NULL; - char *save = NULL; author_x *ptr = NULL; - syslocale = vconf_get_str(VCONFKEY_LANGSET); - if (syslocale == NULL) { - _LOGE("current locale is NULL\n"); - return PMINFO_R_EINVAL; - } - locale = __convert_system_locale_to_manifest_locale(syslocale); - if (locale == NULL) { - _LOGE("manifest locale is NULL\n"); - return PMINFO_R_EINVAL; - } - save = locale; *author_name = NULL; + locale = glocale; + retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL"); pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; for(ptr = info->manifest_info->author; ptr != NULL; ptr = ptr->next) { @@ -2881,15 +2836,6 @@ API int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **a } } } - if (syslocale) { - free(syslocale); - syslocale = NULL; - } - locale = save; - if (locale) { - free(locale); - locale = NULL; - } return PMINFO_R_OK; } @@ -2925,7 +2871,6 @@ API int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **a API int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage) { - int ret = -1; char *pkgid; pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid); @@ -3357,8 +3302,6 @@ API int pkgmgrinfo_pkginfo_compare_app_cert_info(const char *lhs_app_id, const c pkgmgr_cert_x *info= NULL; char *lcert = NULL; char *rcert = NULL; - char *lhs_package_id = NULL; - char *rhs_package_id = NULL; int exist = -1; info = (pkgmgr_cert_x *)calloc(1, sizeof(pkgmgr_cert_x)); @@ -3652,6 +3595,25 @@ API int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readon return PMINFO_R_OK; } +API int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update) +{ + retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n"); + retvm_if(update == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n"); + + char *val = NULL; + pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; + val = (char *)info->manifest_info->update; + if (val) { + if (strcasecmp(val, "true") == 0) + *update = 1; + else if (strcasecmp(val, "false") == 0) + *update = 0; + else + *update = 1; + } + return PMINFO_R_OK; +} + API int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle) { if (handle == NULL) { @@ -3810,6 +3772,10 @@ API int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle, val = strndup("internal-only", PKG_STRING_LEN_MAX - 1); else if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL) == 0) val = strndup("prefer-external", PKG_STRING_LEN_MAX - 1); + else if (strcmp(value, "installed_internal") == 0) + val = strndup("installed_internal", PKG_STRING_LEN_MAX - 1); + else if (strcmp(value, "installed_external") == 0) + val = strndup("installed_external", PKG_STRING_LEN_MAX - 1); else val = strndup(value, PKG_STRING_LEN_MAX - 1); if (val == NULL) { @@ -3858,6 +3824,7 @@ API int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int free(syslocale); return PMINFO_R_ERROR; } + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); ret = __open_manifest_db(); if (ret == -1) { _LOGE("Fail to open manifest DB\n"); @@ -3950,6 +3917,7 @@ API int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h ha free(syslocale); return PMINFO_R_ERROR; } + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); ret = __open_manifest_db(); if (ret == -1) { _LOGE("Fail to open manifest DB\n"); @@ -4076,7 +4044,6 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_ retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback pointer is NULL"); retvm_if((component != PMINFO_UI_APP) && (component != PMINFO_SVC_APP) && (component != PMINFO_ALL_APP), PMINFO_R_EINVAL, "Invalid App Component Type"); - char *error_message = NULL; char *syslocale = NULL; char *locale = NULL; int ret = -1; @@ -4097,6 +4064,7 @@ API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_ tryvm_if(locale == NULL, ret = PMINFO_R_EINVAL, "manifest locale is NULL"); /*calloc allinfo*/ + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); allinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x)); tryvm_if(allinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo"); @@ -4349,7 +4317,6 @@ API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, v { retvm_if(app_func == NULL, PMINFO_R_EINVAL, "callback function is NULL"); - char *error_message = NULL; int ret = PMINFO_R_OK; char query[MAX_QUERY_LEN] = {'\0'}; char *syslocale = NULL; @@ -4374,6 +4341,7 @@ API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, v retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB); /*calloc pkginfo*/ + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); pkgmgr_pkginfo_x *info = NULL; info = (pkgmgr_pkginfo_x *)calloc(1, sizeof(pkgmgr_pkginfo_x)); tryvm_if(info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!"); @@ -4530,7 +4498,6 @@ API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h * retvm_if(handle == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL"); pkgmgr_appinfo_x *appinfo = NULL; - char *error_message = NULL; char *syslocale = NULL; char *locale = NULL; int ret = -1; @@ -4562,6 +4529,7 @@ API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h * tryvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL"); /*calloc appinfo*/ + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x)); tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Failed to allocate memory for appinfo"); @@ -4784,23 +4752,12 @@ API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon) _LOGE("Argument supplied to hold return value is NULL\n"); return PMINFO_R_EINVAL; } - char *syslocale = NULL; char *locale = NULL; - char *save = NULL; icon_x *ptr = NULL; icon_x *start = NULL; - syslocale = vconf_get_str(VCONFKEY_LANGSET); - if (syslocale == NULL) { - _LOGE("current locale is NULL\n"); - return PMINFO_R_EINVAL; - } - locale = __convert_system_locale_to_manifest_locale(syslocale); - if (locale == NULL) { - _LOGE("manifest locale is NULL\n"); - return PMINFO_R_EINVAL; - } - save = locale; *icon = NULL; + locale= glocale; + retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL"); pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle; if (info->app_component == PMINFO_UI_APP) start = info->uiapp_info->icon; @@ -4822,15 +4779,6 @@ API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon) } } } - if (syslocale) { - free(syslocale); - syslocale = NULL; - } - locale = save; - if (locale) { - free(locale); - locale = NULL; - } return PMINFO_R_OK; } @@ -4845,24 +4793,12 @@ API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label) _LOGE("Argument supplied to hold return value is NULL\n"); return PMINFO_R_EINVAL; } - char *syslocale = NULL; char *locale = NULL; - char *save = NULL; label_x *ptr = NULL; label_x *start = NULL; - syslocale = vconf_get_str(VCONFKEY_LANGSET); - if (syslocale == NULL) { - _LOGE("current locale is NULL\n"); - return PMINFO_R_EINVAL; - } - locale = __convert_system_locale_to_manifest_locale(syslocale); - if (locale == NULL) { - _LOGE("manifest locale is NULL\n"); - return PMINFO_R_EINVAL; - } - - save = locale; *label = NULL; + locale = glocale; + retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL"); pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle; if (info->app_component == PMINFO_UI_APP) start = info->uiapp_info->label; @@ -4891,15 +4827,6 @@ API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label) } } } - if (syslocale) { - free(syslocale); - syslocale = NULL; - } - locale = save; - if (locale) { - free(locale); - locale = NULL; - } return PMINFO_R_OK; } @@ -5821,6 +5748,7 @@ API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int free(syslocale); return PMINFO_R_ERROR; } + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); ret = __open_manifest_db(); if (ret == -1) { _LOGE("Fail to open manifest DB\n"); @@ -5907,6 +5835,7 @@ API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h ha free(syslocale); return PMINFO_R_ERROR; } + strncpy(glocale, locale, PKG_LOCALE_STRING_LEN_MAX - 1); ret = __open_manifest_db(); if (ret == -1) { _LOGE("Fail to open manifest DB\n"); @@ -6606,7 +6535,6 @@ API int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h ha _LOGE("Argument supplied is NULL\n"); return PMINFO_R_EINVAL; } - int ret = -1; char *error_message = NULL; int exist = -1; char query[MAX_QUERY_LEN] = {'\0'};