#define ASCII(s) (char *)s
#define XMLCHAR(s) (const xmlChar *)s
-//#define METADATA_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/metadata/metadata_parser_list.txt"
#define METADATA_PARSER_LIST SYSCONFDIR "/package-manager/parserlib/metadata/mdparser_list.txt"
#define METADATA_PARSER_NAME "metadataparser:"
*xml_attribute = strdup((const char *)attrib_val);
xmlFree(attrib_val);
} else {
- if (default_value != NULL) {
+ if (default_value != NULL)
*xml_attribute = strdup(default_value);
- }
}
}
mfx->readonly = strdup("False");
mfx->update = strdup("False");
mfx->system = strdup("False");
- mfx->installed_storage= strdup("installed_internal");
+ mfx->installed_storage = strdup("installed_internal");
package = mfx->package;
}
API int __is_admin()
{
uid_t uid = getuid();
- if ((uid_t) 0 == uid )
+ if ((uid_t)0 == uid)
return 1;
else
return 0;
fclose(fp);
if (path == NULL) {
- _LOGE("no matching [%s] [%s]\n", METADATA_PARSER_NAME,type);
+ _LOGE("no matching [%s] [%s]\n", METADATA_PARSER_NAME, type);
return NULL;
}
fclose(fp);
if (path == NULL) {
- _LOGE("no matching [%s] [%s]\n", CATEGORY_PARSER_NAME,type);
+ _LOGE("no matching [%s] [%s]\n", CATEGORY_PARSER_NAME, type);
return NULL;
}
if ((metadata_parser_plugin =
dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
- _LOGE("can not find symbol[%s] \n",ac);
+ _LOGE("can not find symbol[%s] \n", ac);
goto END;
}
if ((category_parser_plugin =
dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
- _LOGE("can not find symbol[%s] \n",ac);
+ _LOGE("can not find symbol[%s] \n", ac);
goto END;
}
value = xmlTextReaderConstValue(reader);
if (value != NULL) {
- if (xmlStrlen(value) > 40) {
+ if (xmlStrlen(value) > 40)
_LOGD(" %.40s...", value);
- } else {
+ else
_LOGD(" %s", value);
- }
}
name = xmlTextReaderConstName(reader);
if (temp == NULL)
return -1;
xmlNode *next_node = NULL;
- while(cur_node != NULL) {
- if ( (strcmp(ASCII(temp->name), ASCII(cur_node->name)) == 0) &&
- (temp->line == cur_node->line) ) {
+ while (cur_node != NULL) {
+ if ((strcmp(ASCII(temp->name), ASCII(cur_node->name)) == 0) &&
+ (temp->line == cur_node->line)) {
break;
- }
- else {
+ } else {
next_node = xmlNextElementSibling(cur_node);
xmlUnlinkNode(cur_node);
xmlFreeNode(cur_node);
return ret;
}
-static int __run_metadata_parser_prestep (manifest_x *mfx, char *md_key, ACTION_TYPE action)
+static int __run_metadata_parser_prestep(manifest_x *mfx, char *md_key, ACTION_TYPE action)
{
int ret = -1;
int tag_exist = 0;
md = (metadata_x *)md_tmp->data;
if (md == NULL)
continue;
- //get glist of metadata key and value combination
+ /* get glist of metadata key and value combination */
memset(buffer, 0x00, 1024);
snprintf(buffer, 1024, "%s/", md_key);
if ((md->key && md->value) && (strncmp(md->key, md_key, strlen(md_key)) == 0) && (strncmp(buffer, md->key, strlen(buffer)) == 0)) {
}
}
- //send glist to parser when tags for metadata plugin parser exist.
+ /* send glist to parser when tags for metadata plugin parser exist. */
if (tag_exist) {
ret = __ps_run_metadata_parser(md_list, md_tag, action, mfx->package, app->appid);
- if (ret < 0){
+ if (ret < 0)
_LOGD("metadata_parser failed[%d] for tag[%s]\n", ret, md_tag);
- }
- else{
+ else
_LOGD("metadata_parser success for tag[%s]\n", md_tag);
- }
}
__metadata_parser_clear_dir_list(md_list);
md_list = NULL;
return ret;
}
-static int __run_category_parser_prestep (manifest_x *mfx, char *category_key, ACTION_TYPE action)
+static int __run_category_parser_prestep(manifest_x *mfx, char *category_key, ACTION_TYPE action)
{
int ret = -1;
int tag_exist = 0;
continue;
for (category_tmp = app->category; category_tmp; category_tmp = category_tmp->next) {
category = (const char *)category_tmp->data;
- //get glist of category key and value combination
+ /* get glist of category key and value combination */
memset(buffer, 0x00, 1024);
snprintf(buffer, 1024, "%s/", category_key);
if ((category) && (strncmp(category, category_key, strlen(category_key)) == 0)) {
}
}
- //send glist to parser when tags for metadata plugin parser exist.
+ /* send glist to parser when tags for metadata plugin parser exist. */
if (tag_exist) {
ret = __ps_run_category_parser(category_list, category_tag, action, mfx->package, app->appid);
if (ret < 0)
}
case XML_READER_TYPE_ELEMENT:
{
- // Elements without closing tag don't receive
+ /* Elements without closing tag don't receive */
const xmlChar *elementName =
xmlTextReaderLocalName(reader);
- if (elementName == NULL) {
+ if (elementName == NULL)
break;
- }
if (strcmp(tag, ASCII(elementName)) == 0) {
_LOGD("find : tag[%s] ACTION_TYPE[%d] pkg[%s]\n", tag, action, pkgid);
}
xmlFreeTextReader(reader);
- if (ret != 0) {
+ if (ret != 0)
_LOGD("%s : failed to parse", filename);
- }
} else {
_LOGD("Unable to open %s", filename);
}
int __ps_process_metadata_parser(manifest_x *mfx, ACTION_TYPE action)
{
- fprintf(stdout,"__ps_process_metadata_parser\n");
+ fprintf(stdout, "__ps_process_metadata_parser\n");
int ret = 0;
FILE *fp = NULL;
char md_key[PKG_STRING_LEN_MAX] = { 0 };
return strdup(icon);
do {
- snprintf(icon_with_path, sizeof(icon_with_path), "%s%s",
- getIconPath(uid, true), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ if (uid == GLOBAL_USER || uid == OWNER_ROOT) {
+ snprintf(icon_with_path, sizeof(icon_with_path),
+ "%s%s", getIconPath(uid, true), icon);
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- snprintf(icon_with_path, sizeof(icon_with_path), "%s%s",
- getIconPath(uid, false), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ snprintf(icon_with_path, sizeof(icon_with_path),
+ "%s%s", getIconPath(uid, false), icon);
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- /* for backward compatibility (.../default/small/...)
- * this should be removed
- */
- snprintf(icon_with_path, sizeof(icon_with_path),
+ /* for backward compatibility (.../default/small/...)
+ * this should be removed
+ */
+ snprintf(icon_with_path, sizeof(icon_with_path),
"%sdefault/small/%s",
getIconPath(uid, true), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- snprintf(icon_with_path, sizeof(icon_with_path),
+ snprintf(icon_with_path, sizeof(icon_with_path),
"%sdefault/small/%s",
getIconPath(uid, false), icon);
- if (access(icon_with_path, F_OK) == 0)
- break;
+ if (access(icon_with_path, F_OK) == 0)
+ break;
- /* If doesn't exist in case of Global app,
- * try to get icon directly into app's directory
- */
- if (uid == GLOBAL_USER || uid == OWNER_ROOT) {
+ /* If doesn't exist in case of Global app,
+ * try to get icon directly into app's directory
+ */
app_path = tzplatform_getenv(TZ_SYS_RO_APP);
snprintf(icon_with_path, sizeof(icon_with_path),
/*check tag : removable*/
} else if (strcmp(ret_result, "removable") == 0) {
ret_result = strtok_r(NULL, delims, &ptr);
- if (strcmp(ret_result, "true") == 0){
+ if (strcmp(ret_result, "true") == 0) {
free((void *)mfx->removable);
mfx->removable = strdup("true");
} else if (strcmp(ret_result, "false") == 0) {
__save_xml_attribute(reader, "on-boot", &application->onboot, "false");
__save_xml_attribute(reader, "splash-screen-display", &application->splash_screen_display, "true");
- application->package= strdup(package);
+ application->package = strdup(package);
/* overwrite some attributes if the app is widgetapp */
if (type == PMINFO_WIDGET_APP || type == PMINFO_WATCH_APP) {
free((void *)application->nodisplay);
application->indicatordisplay = strdup("false");
}
+ /* hw-acceleration values are changed from use-GL/not-use-GL/use-system-setting to on/off/default */
+ if (strcmp(application->hwacceleration, "use-GL") == 0) {
+ free((void *)application->hwacceleration);
+ application->hwacceleration = strdup("on");
+ } else if (strcmp(application->hwacceleration, "not-use-GL") == 0) {
+ free((void *)application->hwacceleration);
+ application->hwacceleration = strdup("off");
+ } else if (strcmp(application->hwacceleration, "use-system-setting") == 0) {
+ free((void *)application->hwacceleration);
+ application->hwacceleration = strdup("default");
+ }
+
depth = xmlTextReaderDepth(reader);
while ((ret = __next_child_element(reader, depth))) {
node = xmlTextReaderConstName(reader);
if (application == NULL)
continue;
ret = appsvc_operation(application->appid, uid);
- if (ret <0)
+ if (ret < 0)
_LOGE("can not operation symbol \n");
}
return mfx;
}
+API int pkgmgr_parser_usr_update_tep(const char *pkgid, const char *tep_path, uid_t uid)
+{
+ return pkgmgr_parser_update_tep_info_in_usr_db(pkgid, tep_path, uid);
+}
+
+API int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_path)
+{
+ return pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
+}
+
DEPRECATED API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
{
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_installation(manifest_x* mfx, const char *manifest) {
+API int pkgmgr_parser_process_manifest_x_for_installation(manifest_x* mfx, const char *manifest)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for installation: %s\n", manifest);
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x* mfx, const char *manifest, uid_t uid) {
+API int pkgmgr_parser_process_usr_manifest_x_for_installation(manifest_x* mfx, const char *manifest, uid_t uid)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for installation: %s\n", manifest);
mfx->csc_path = strdup(csc_path);
}
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
__ps_process_tag_parser(mfx, manifest, ACTION_UPGRADE);
ret = __ps_process_metadata_parser(mfx, ACTION_UPGRADE);
- if (ret == -1){
+ if (ret == -1)
_LOGD("Upgrade metadata parser failed\n");
- }
ret = __ps_process_category_parser(mfx, ACTION_UPGRADE);
if (ret == -1)
_LOGD("Creating category parser failed\n");
mfx->csc_path = strdup(csc_path);
}
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_update_manifest_info_in_usr_db(mfx, uid);
retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
_LOGD("DB Update Success\n");
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest) {
+API int pkgmgr_parser_process_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("pkgmgr_parser_process_manifest_x_for_upgrade parsing manifest for upgradation: %s\n", manifest);
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest, uid_t uid) {
+API int pkgmgr_parser_process_usr_manifest_x_for_upgrade(manifest_x* mfx, const char *manifest, uid_t uid)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD(" pkgmgr_parser_process_usr_manifest_x_for_upgrade parsing manifest for upgradation: %s\n", manifest);
if (ret == -1)
_LOGD("Creating category parser failed\n");
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
if (ret == -1)
_LOGD("DB Delete failed\n");
if (ret == -1)
_LOGD("Creating category parser failed\n");
+ /*Delete from cert table*/
+ ret = pkgmgrinfo_delete_certinfo(mfx->package);
+ if (ret) {
+ _LOGD("Cert Info DB Delete Failed\n");
+ return -1;
+ }
+
ret = pkgmgr_parser_delete_manifest_info_from_usr_db(mfx, uid);
if (ret == -1)
_LOGD("DB Delete failed\n");
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest) {
+API int pkgmgr_parser_process_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for uninstallation: %s\n", manifest);
return PMINFO_R_OK;
}
-API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest, uid_t uid) {
+API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x* mfx, const char *manifest, uid_t uid)
+{
retvm_if(mfx == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
_LOGD("processing manifest_x for uninstallation: %s\n", manifest);