From: junsuk77.oh Date: Wed, 8 May 2013 01:34:41 +0000 (+0900) Subject: merge master branch X-Git-Tag: submit/tizen_2.1/20130514.054738~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=27b5c4b731dc90dabbf5fadc998d7e9c02b49731;p=framework%2Fappfw%2Fpkgmgr-info.git merge master branch fix ug icon path to find a real icon add smack rule for pkgmgr db check manifest tag for updating during installation fix pkg label query excution Change-Id: Id18dda958843b5f4b7d76ee67746170a1316e049 Signed-off-by: junsuk77.oh --- diff --git a/include/pkgmgr-info-internal.h b/include/pkgmgr-info-internal.h index ed5c46b..4bf38fb 100755 --- a/include/pkgmgr-info-internal.h +++ b/include/pkgmgr-info-internal.h @@ -54,7 +54,8 @@ typedef enum _pkgmgrinfo_pkginfo_filter_prop_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 + E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING, + E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL = E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING } pkgmgrinfo_pkginfo_filter_prop_bool; /*Integer properties for filtering based on package info*/ @@ -88,7 +89,8 @@ typedef enum _pkgmgrinfo_appinfo_filter_prop_bool { E_PMINFO_APPINFO_PROP_APP_ONBOOT, E_PMINFO_APPINFO_PROP_APP_AUTORESTART, E_PMINFO_APPINFO_PROP_APP_TASKMANAGE, - E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_TASKMANAGE + E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION, + E_PMINFO_APPINFO_PROP_APP_MAX_BOOL = E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION } pkgmgrinfo_appinfo_filter_prop_bool; /*Integer properties for filtering based on app info*/ @@ -98,6 +100,15 @@ typedef enum _pkgmgrinfo_appinfo_filter_prop_int { E_PMINFO_APPINFO_PROP_APP_MAX_INT = E_PMINFO_APPINFO_PROP_APP_MIN_INT } pkgmgrinfo_appinfo_filter_prop_int; +/*Integer properties for filtering based on app info*/ +typedef enum _pkgmgrinfo_pkginfo_filter_prop_range { + /*Currently No Fields*/ + E_PMINFO_PKGINFO_PROP_RANGE_MIN_INT = 701, + E_PMINFO_PKGINFO_PROP_RANGE_BASIC, + E_PMINFO_PKGINFO_PROP_RANGE_MAX_INT = E_PMINFO_PKGINFO_PROP_RANGE_BASIC +} pkgmgrinfo_pkginfo_filter_prop_range; + + pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property); pkgmgrinfo_pkginfo_filter_prop_int _pminfo_pkginfo_convert_to_prop_int(const char *property); pkgmgrinfo_pkginfo_filter_prop_bool _pminfo_pkginfo_convert_to_prop_bool(const char *property); @@ -106,4 +117,6 @@ pkgmgrinfo_appinfo_filter_prop_str _pminfo_appinfo_convert_to_prop_str(const cha pkgmgrinfo_appinfo_filter_prop_int _pminfo_appinfo_convert_to_prop_int(const char *property); pkgmgrinfo_appinfo_filter_prop_bool _pminfo_appinfo_convert_to_prop_bool(const char *property); +pkgmgrinfo_pkginfo_filter_prop_range _pminfo_pkginfo_convert_to_prop_range(const char *property); + #endif /* __PKGMGR_INFO_INTERNAL_H__ */ diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 53ca65e..a3f57de 100755 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -368,6 +368,8 @@ typedef enum { #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" + /** Boolean property for filtering based on package info*/ +#define PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING "PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING" /** Integer property for filtering based on package info*/ #define PMINFO_PKGINFO_PROP_PACKAGE_SIZE "PMINFO_PKGINFO_PROP_PACKAGE_SIZE" @@ -403,6 +405,12 @@ typedef enum { #define PMINFO_APPINFO_PROP_APP_AUTORESTART "PMINFO_APPINFO_PROP_APP_AUTORESTART" /** Boolean property for filtering based on app info*/ #define PMINFO_APPINFO_PROP_APP_TASKMANAGE "PMINFO_APPINFO_PROP_APP_TASKMANAGE" + /** Boolean property for filtering based on app info*/ +#define PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION "PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION" + + /** will be updated*/ + /** string property for filtering based on pkg info*/ +#define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC" /** * @fn int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data) diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index f141ce2..48e0f85 100755 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -1,6 +1,6 @@ Name: pkgmgr-info Summary: Packager Manager infomation api for package -Version: 0.0.102 +Version: 0.0.106 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 @@ -49,9 +49,20 @@ make %{?jobs:-j%jobs} %install %make_install -%post -p /sbin/ldconfig +%post + +mkdir -p /opt/usr/apps/tmp +chown 5100:5100 /opt/usr/apps/tmp +chmod 771 /opt/usr/apps/tmp +chsmack -a '*' /opt/usr/apps/tmp +chsmack -t /opt/usr/apps/tmp + +touch /opt/usr/apps/tmp/pkgmgr_tmp.txt + +chsmack -a 'pkgmgr::db' /opt/usr/apps/tmp/pkgmgr_tmp.txt + +%postun -%postun -p /sbin/ldconfig %files %manifest pkgmgr-info.manifest diff --git a/parser/manifest.xsd.in b/parser/manifest.xsd.in index 21cf197..4f94b27 100755 --- a/parser/manifest.xsd.in +++ b/parser/manifest.xsd.in @@ -32,6 +32,7 @@ + @@ -139,6 +140,7 @@ + diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index f553ec5..252a6f5 100755 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -1225,6 +1225,10 @@ static void __ps_free_uiapplication(uiapplication_x *uiapplication) free((void *)uiapplication->package); uiapplication->package = NULL; } + if (uiapplication->launchcondition) { + free((void *)uiapplication->launchcondition); + uiapplication->launchcondition = NULL; + } /*Free Label*/ if (uiapplication->label) { label_x *label = uiapplication->label; @@ -2127,6 +2131,8 @@ __get_icon_with_path(const char* icon) if (access(icon_with_path, R_OK) == 0) break; snprintf(icon_with_path, len, "/usr/apps/%s/res/icons/default/small/%s", package, icon); if (access(icon_with_path, R_OK) == 0) break; + snprintf(icon_with_path, len, "/usr/ug/res/images/%s/%s", package, icon); + if (access(icon_with_path, R_OK) == 0) break; } while (0); free(theme); @@ -2144,6 +2150,54 @@ __get_icon_with_path(const char* icon) } } +static void __ps_process_tag(manifest_x * mfx, char *const tagv[]) +{ + int i = 0; + char delims[] = "="; + char *ret_result = NULL; + char *tag = NULL; + + if (tagv == NULL) + return; + + for (tag = strdup(tagv[0]); tag != NULL; ) { + ret_result = strtok(tag, delims); + + /*check tag : preload */ + if (strcmp(ret_result, "preload") == 0) { + ret_result = strtok(NULL, delims); + if (strcmp(ret_result, "true") == 0) { + free((void *)mfx->preload); + mfx->preload = strdup("true"); + } else if (strcmp(ret_result, "false") == 0) { + free((void *)mfx->preload); + mfx->preload = strdup("false"); + } + /*check tag : removable*/ + } else if (strcmp(ret_result, "removable") == 0) { + ret_result = strtok(NULL, delims); + if (strcmp(ret_result, "true") == 0){ + free((void *)mfx->removable); + mfx->removable = strdup("true"); + } else if (strcmp(ret_result, "false") == 0) { + free((void *)mfx->removable); + mfx->removable = strdup("false"); + } + /*check tag : not matched*/ + } else + DBG("tag process [%s]is not defined\n", ret_result); + + free(tag); + + /*check next value*/ + if (tagv[++i] != NULL) + tag = strdup(tagv[i]); + else { + DBG("tag process success...\n"); + return; + } + } +} static int __ps_process_icon(xmlTextReaderPtr reader, icon_x *icon) { @@ -2444,6 +2498,14 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x * } else { uiapplication->mainapp = strdup("false"); } + if (xmlTextReaderGetAttribute(reader, XMLCHAR("launchcondition"))) { + uiapplication->launchcondition = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("launchcondition"))); + if (uiapplication->launchcondition == NULL) + uiapplication->launchcondition = strdup("false"); + } else { + uiapplication->launchcondition = strdup("false"); + } + if (xmlTextReaderGetAttribute(reader, XMLCHAR("indicatordisplay"))) { uiapplication->indicatordisplay = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("indicatordisplay"))); if (uiapplication->indicatordisplay == NULL) @@ -3159,6 +3221,13 @@ static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx) } if (xmlTextReaderGetAttribute(reader, XMLCHAR("storeclient-id"))) mfx->storeclient_id= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("storeclient-id"))); + if (xmlTextReaderGetAttribute(reader, XMLCHAR("nodisplay-setting"))) { + mfx->nodisplay_setting = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("nodisplay-setting"))); + if (mfx->nodisplay_setting == NULL) + mfx->nodisplay_setting = strdup("false"); + } else { + mfx->nodisplay_setting = strdup("false"); + } /*Assign default values. If required it will be overwritten in __add_preload_info()*/ mfx->preload = strdup("False"); @@ -3767,6 +3836,10 @@ API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx) free((void *)mfx->appsetting); mfx->appsetting = NULL; } + if (mfx->nodisplay_setting) { + free((void *)mfx->nodisplay_setting); + mfx->nodisplay_setting = NULL; + } /*Free Icon*/ if (mfx->icon) { @@ -3970,6 +4043,8 @@ API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char else mfx->update = strdup("false"); + __ps_process_tag(mfx, tagv); + ret = pkgmgr_parser_insert_manifest_info_in_db(mfx); if (ret == -1) DBG("DB Insert failed\n"); diff --git a/parser/pkgmgr_parser.h b/parser/pkgmgr_parser.h index 58cbe1a..a6b8369 100755 --- a/parser/pkgmgr_parser.h +++ b/parser/pkgmgr_parser.h @@ -367,6 +367,7 @@ typedef struct uiapplication_x { const char *mainapp; const char *package; const char *recentimage; + const char *launchcondition; const char *indicatordisplay; const char *portraitimg; const char *landscapeimg; @@ -455,6 +456,7 @@ typedef struct manifest_x { const char *mainapp_id; /**< app id of main application*/ const char *package_url; /**< app id of main application*/ const char *root_path; /**< package root path*/ + const char *nodisplay_setting; /**< package no display setting menu*/ struct icon_x *icon; /**< package icon*/ struct label_x *label; /**< package label*/ struct author_x *author; /**< package author*/ diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index 94dd8ec..c7d692e 100755 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -54,6 +54,7 @@ char *prev = NULL; "package_readonly text DEFAULT 'false', " \ "package_update text DEFAULT 'false', " \ "package_appsetting text DEFAULT 'false', " \ + "package_nodisplay text DEFAULT 'false', " \ "author_name text, " \ "author_email text, " \ "author_href text," \ @@ -99,6 +100,7 @@ char *prev = NULL; "app_hwacceleration text DEFAULT 'use-system-setting', " \ "app_mainapp text, " \ "app_recentimage text, " \ + "app_launchcondition text, " \ "app_indicatordisplay text DEFAULT 'true', " \ "app_portraitimg text, " \ "app_landscapeimg text, " \ @@ -369,6 +371,19 @@ static int __exec_query(char *query) sqlite3_free(error_message); return 0; } + +static int __exec_query_no_msg(char *query) +{ + char *error_message = NULL; + if (SQLITE_OK != + sqlite3_exec(pkgmgr_parser_db, query, NULL, NULL, &error_message)) { + sqlite3_free(error_message); + return -1; + } + sqlite3_free(error_message); + return 0; +} + static GList *__create_locale_list(GList *locale, label_x *lbl, license_x *lcn, icon_x *icn, description_x *dcn, author_x *ath) { @@ -600,9 +615,9 @@ static void __insert_pkglocale_info(gpointer data, gpointer userdata) __extract_data(data, lbl, lcn, icn, dcn, ath, &label, &license, &icon, &description, &author); if (!label && !description && !icon && !license && !author) return; - snprintf(query, MAX_QUERY_LEN, "insert into package_localized_info(package, package_locale, " \ + sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_localized_info(package, package_locale, " \ "package_label, package_icon, package_description, package_license, package_author) values " \ - "('%s', '%s', '%s', '%s', '%s', '%s', '%s')", mfx->package, (char*)data, + "('%q', '%q', '%q', '%q', '%q', '%q', '%q')", mfx->package, (char*)data, label, icon, description, license, author); ret = __exec_query(query); if (ret == -1) @@ -616,6 +631,7 @@ static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata) char *icon = NULL; char query[MAX_QUERY_LEN] = {'\0'}; + manifest_x *mfx = (manifest_x *)userdata; uiapplication_x *up = (uiapplication_x*)userdata; label_x *lbl = up->label; icon_x *icn = up->icon; @@ -631,6 +647,16 @@ static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata) if (ret == -1) DBG("Package UiApp Localized Info DB Insert failed\n"); + /*insert ui app locale info to pkg locale to get mainapp data */ + if (strcasecmp(up->mainapp, "true")==0) { + sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_localized_info(package, package_locale, " \ + "package_label, package_icon, package_description, package_license, package_author) values " \ + "('%q', '%q', '%q', '%q', '%q', '%q', '%q')", mfx->package, (char*)data, + label, icon, NULL, NULL, NULL); + ret = __exec_query_no_msg(query); + if (ret == -1) + DBG("Package locale info inserted before.\n"); + } } static void __insert_uiapplication_icon_section_info(gpointer data, gpointer userdata) @@ -775,10 +801,10 @@ static int __insert_uiapplication_info(manifest_x *mfx) { snprintf(query, MAX_QUERY_LEN, "insert into package_app_info(app_id, app_component, app_exec, app_nodisplay, app_type, app_onboot, " \ - "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_mainapp , app_recentimage, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, package) " \ - "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\ + "app_multiple, app_autorestart, app_taskmanage, app_enabled, app_hwacceleration, app_mainapp , app_recentimage, app_launchcondition, app_indicatordisplay, app_portraitimg, app_landscapeimg, app_guestmodevisibility, package) " \ + "values('%s', '%s', '%s', '%s', '%s', '%s','%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')",\ up->appid, "uiapp", up->exec, up->nodisplay, up->type, "\0", up->multiple, - "\0", up->taskmanage, up->enabled, up->hwacceleration,up->mainapp, up->recentimage, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, mfx->package); + "\0", up->taskmanage, up->enabled, up->hwacceleration,up->mainapp, up->recentimage, up->launchcondition, up->indicatordisplay, up->portraitimg, up->landscapeimg, up->guestmode_visibility, mfx->package); ret = __exec_query(query); if (ret == -1) { DBG("Package UiApp Info DB Insert Failed\n"); @@ -1478,10 +1504,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, 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')",\ + "package_removable, package_preload, package_readonly, package_update, package_appsetting, package_nodisplay, 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', '%s')",\ mfx->package, type, mfx->version, mfx->installlocation, mfx->package_size, mfx->removable, mfx->preload, - 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); + mfx->readonly, mfx->update, mfx->appsetting, mfx->nodisplay_setting, 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"); @@ -1524,6 +1550,10 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) pvs = pvs->next; } + ret = __insert_ui_mainapp_info(mfx); + if (ret == -1) + return -1; + /*Insert the package locale and app locale info */ pkglocale = __create_locale_list(pkglocale, lbl, lcn, icn, dcn, ath); g_list_foreach(pkglocale, __trimfunc1, NULL); @@ -1611,9 +1641,6 @@ static int __insert_manifest_info_in_db(manifest_x *mfx) ret = __insert_uiapplication_info(mfx); if (ret == -1) return -1; - ret = __insert_ui_mainapp_info(mfx); - if (ret == -1) - return -1; ret = __insert_serviceapplication_info(mfx); if (ret == -1) return -1; diff --git a/src/pkgmgr-info-internal.c b/src/pkgmgr-info-internal.c index 11be661..512fe27 100755 --- a/src/pkgmgr-info-internal.c +++ b/src/pkgmgr-info-internal.c @@ -61,7 +61,8 @@ static struct _pkginfo_bool_map_t pkginfo_bool_prop_map[] = { {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_UPDATE, PMINFO_PKGINFO_PROP_PACKAGE_UPDATE}, - {E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING, PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING} + {E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING, PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING}, + {E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING, PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING} }; struct _appinfo_str_map_t { @@ -101,7 +102,8 @@ static struct _appinfo_bool_map_t appinfo_bool_prop_map[] = { {E_PMINFO_APPINFO_PROP_APP_MULTIPLE, PMINFO_APPINFO_PROP_APP_MULTIPLE}, {E_PMINFO_APPINFO_PROP_APP_ONBOOT, PMINFO_APPINFO_PROP_APP_ONBOOT}, {E_PMINFO_APPINFO_PROP_APP_AUTORESTART, PMINFO_APPINFO_PROP_APP_AUTORESTART}, - {E_PMINFO_APPINFO_PROP_APP_TASKMANAGE, PMINFO_APPINFO_PROP_APP_TASKMANAGE} + {E_PMINFO_APPINFO_PROP_APP_TASKMANAGE, PMINFO_APPINFO_PROP_APP_TASKMANAGE}, + {E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION, PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION} }; inline pkgmgrinfo_pkginfo_filter_prop_str _pminfo_pkginfo_convert_to_prop_str(const char *property) diff --git a/src/pkgmgr-info.c b/src/pkgmgr-info.c index 6377ec9..35b9a6a 100755 --- a/src/pkgmgr-info.c +++ b/src/pkgmgr-info.c @@ -314,6 +314,10 @@ static void __get_filter_condition(gpointer data, char **condition) case E_PMINFO_PKGINFO_PROP_PACKAGE_APPSETTING: snprintf(buf, MAX_QUERY_LEN, "package_info.package_appsetting IN %s", node->value); break; + case E_PMINFO_PKGINFO_PROP_PACKAGE_NODISPLAY_SETTING: + snprintf(buf, MAX_QUERY_LEN, "package_info.package_nodisplay 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; @@ -363,6 +367,9 @@ static void __get_filter_condition(gpointer data, char **condition) case E_PMINFO_APPINFO_PROP_APP_HWACCELERATION: snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_hwacceleration='%s'", node->value); break; + case E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION: + snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition='%s'", node->value); + break; default: _LOGE("Invalid Property Type\n"); *condition = NULL; @@ -2357,58 +2364,32 @@ API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon) { retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL"); retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL"); - - pkgmgr_pkginfo_x *info_tmp = (pkgmgr_pkginfo_x *)handle; - pkgmgrinfo_appinfo_h apphandle; - bool ismainapp = 0; int ret = PMINFO_R_OK; - ret = pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle); - retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_appinfo fail"); - - ret = pkgmgrinfo_appinfo_is_mainapp(apphandle, &ismainapp); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_is_mainapp fail"); - - if (ismainapp){ - ret = pkgmgrinfo_appinfo_get_icon(apphandle, &info_tmp->tmp); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_icon fail"); - tryvm_if(info_tmp->tmp == NULL, ret = PMINFO_R_EINVAL, "icon is NULL"); - - if (info_tmp->tmp_dup){ - free((void *)info_tmp->tmp_dup); - info_tmp->tmp_dup = NULL; - } + char *locale = NULL; + icon_x *ptr = NULL; + *icon = NULL; + locale = glocale; + retvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL"); - info_tmp->tmp_dup= strdup(info_tmp->tmp); - *icon = info_tmp->tmp_dup; - } else { - char *locale = NULL; - icon_x *ptr = NULL; - *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) - { - if (ptr->lang) { - if (strcmp(ptr->lang, locale) == 0) { - *icon = (char *)ptr->text; - if (strcasecmp(*icon, "(null)") == 0) { - locale = DEFAULT_LOCALE; - continue; - } else - break; - } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) { - *icon = (char *)ptr->text; + pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; + for(ptr = info->manifest_info->icon; ptr != NULL; ptr = ptr->next) + { + if (ptr->lang) { + if (strcmp(ptr->lang, locale) == 0) { + *icon = (char *)ptr->text; + if (strcasecmp(*icon, "(null)") == 0) { + locale = DEFAULT_LOCALE; + continue; + } else break; - } + } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) { + *icon = (char *)ptr->text; + break; } } - } -catch: - pkgmgrinfo_appinfo_destroy_appinfo(apphandle); return ret; } @@ -2416,57 +2397,32 @@ API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label) { retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL"); retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL"); - - pkgmgr_pkginfo_x *info_tmp = (pkgmgr_pkginfo_x *)handle; - pkgmgrinfo_appinfo_h apphandle; - bool ismainapp = 0; int ret = PMINFO_R_OK; - ret = pkgmgrinfo_appinfo_get_appinfo(info_tmp->manifest_info->mainapp_id, &apphandle); - retvm_if(ret < 0, PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_appinfo fail"); - - ret = pkgmgrinfo_appinfo_is_mainapp(apphandle, &ismainapp); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_is_mainapp fail"); - - if (ismainapp){ - ret = pkgmgrinfo_appinfo_get_label(apphandle, &info_tmp->tmp); - tryvm_if(ret < 0, ret = PMINFO_R_ERROR, "pkgmgrinfo_appinfo_get_label fail"); - tryvm_if(info_tmp->tmp == NULL, ret = PMINFO_R_EINVAL, "label is NULL"); - - if (info_tmp->tmp_dup){ - free((void *)info_tmp->tmp_dup); - info_tmp->tmp_dup = NULL; - } + char *locale = NULL; + label_x *ptr = NULL; + *label = NULL; + locale = glocale; + retvm_if(locale == NULL, ret = PMINFO_R_ERROR, "manifest locale is NULL"); - info_tmp->tmp_dup = strdup(info_tmp->tmp); - *label = info_tmp->tmp_dup; - } else { - char *locale = NULL; - label_x *ptr = NULL; - *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) - { - if (ptr->lang) { - if (strcmp(ptr->lang, locale) == 0) { - *label = (char *)ptr->text; - if (strcasecmp(*label, "(null)") == 0) { - locale = DEFAULT_LOCALE; - continue; - } else - break; - } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) { - *label = (char *)ptr->text; + pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle; + for(ptr = info->manifest_info->label; ptr != NULL; ptr = ptr->next) + { + if (ptr->lang) { + if (strcmp(ptr->lang, locale) == 0) { + *label = (char *)ptr->text; + if (strcasecmp(*label, "(null)") == 0) { + locale = DEFAULT_LOCALE; + continue; + } else break; - } + } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) { + *label = (char *)ptr->text; + break; } } } -catch: - pkgmgrinfo_appinfo_destroy_appinfo(apphandle); return ret; } @@ -4568,7 +4524,7 @@ API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char val = (char *)ptr->section; if (strcmp(val, "preview") == 0) - *preview_img = (char *)info->uiapp_info->image->text; + *preview_img = (char *)ptr->text; break; }