Fix splash screen table
[platform/core/appfw/pkgmgr-info.git] / parser / pkgmgr_parser.c
index dd1788a..1d96d0d 100644 (file)
@@ -51,7 +51,6 @@
 #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:"
 
@@ -100,7 +99,6 @@ static int __start_process(xmlTextReaderPtr reader, manifest_x * mfx, uid_t uid)
 static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx, uid_t uid);
 static void __str_trim(char *input);
 static char *__get_parser_plugin(const char *type);
-static int __ps_run_parser(xmlDocPtr docPtr, const char *tag, ACTION_TYPE action, const char *pkgid);
 API int __is_admin();
 
 static void __save_xml_attribute(xmlTextReaderPtr reader, char *attribute, char **xml_attribute, char *default_value)
@@ -110,9 +108,8 @@ static void __save_xml_attribute(xmlTextReaderPtr reader, char *attribute, char
                *xml_attribute = strdup((const char *)attrib_val);
                xmlFree(attrib_val);
        } else {
-               if (default_value != NULL) {
+               if (default_value != NULL)
                        *xml_attribute = strdup(default_value);
-               }
        }
 }
 
@@ -169,7 +166,7 @@ static void __save_xml_default_value(manifest_x * mfx)
        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;
 }
 
@@ -214,7 +211,7 @@ static void __str_trim(char *input)
 API int __is_admin()
 {
        uid_t uid = getuid();
-       if ((uid_t) 0 == uid )
+       if ((uid_t)0 == uid)
                return 1;
        else
                return 0;
@@ -274,7 +271,7 @@ static char *__get_metadata_parser_plugin(const char *type)
                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;
        }
 
@@ -320,7 +317,7 @@ static char *__get_category_parser_plugin(const char *type)
                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;
        }
 
@@ -444,7 +441,7 @@ static int __ps_run_metadata_parser(GList *md_list, const char *tag,
 
        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;
        }
 
@@ -498,7 +495,7 @@ static int __ps_run_category_parser(GList *category_list, const char *tag,
 
        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;
        }
 
@@ -516,58 +513,6 @@ END:
        return ret;
 }
 
-static int __ps_run_parser(xmlDocPtr docPtr, const char *tag,
-                          ACTION_TYPE action, const char *pkgid)
-{
-       char *lib_path = NULL;
-       void *lib_handle = NULL;
-       int (*plugin_install) (xmlDocPtr, const char *);
-       int ret = -1;
-       char *ac = NULL;
-
-       switch (action) {
-       case ACTION_INSTALL:
-               ac = "PKGMGR_PARSER_PLUGIN_INSTALL";
-               break;
-       case ACTION_UPGRADE:
-               ac = "PKGMGR_PARSER_PLUGIN_UPGRADE";
-               break;
-       case ACTION_UNINSTALL:
-               ac = "PKGMGR_PARSER_PLUGIN_UNINSTALL";
-               break;
-       default:
-               goto END;
-       }
-
-       lib_path = __get_parser_plugin(tag);
-       if (!lib_path) {
-               goto END;
-       }
-
-       if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) {
-               _LOGE("dlopen is failed lib_path[%s]\n", lib_path);
-               goto END;
-       }
-       if ((plugin_install =
-               dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
-               _LOGE("can not find symbol[%s] \n", ac);
-               goto END;
-       }
-
-       ret = plugin_install(docPtr, pkgid);
-       if (ret < 0)
-               _LOGD("[pkgid = %s, libpath = %s plugin fail\n", pkgid, lib_path);
-       else
-               _LOGD("[pkgid = %s, libpath = %s plugin success\n", pkgid, lib_path);
-
-END:
-       if (lib_path)
-               free(lib_path);
-       if (lib_handle)
-               dlclose(lib_handle);
-       return ret;
-}
-
 static void __metadata_parser_clear_dir_list(GList* dir_list)
 {
        GList *list = NULL;
@@ -635,11 +580,10 @@ static int __run_tag_parser_prestep(void *lib_handle, xmlTextReaderPtr reader, A
 
        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);
@@ -662,12 +606,11 @@ static int __run_tag_parser_prestep(void *lib_handle, xmlTextReaderPtr reader, A
        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);
@@ -692,7 +635,7 @@ static int __run_tag_parser_prestep(void *lib_handle, xmlTextReaderPtr reader, A
        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;
@@ -720,7 +663,7 @@ static int __run_metadata_parser_prestep (manifest_x *mfx, char *md_key, ACTION_
                        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)) {
@@ -750,15 +693,13 @@ static int __run_metadata_parser_prestep (manifest_x *mfx, char *md_key, ACTION_
                        }
                }
 
-               //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;
@@ -775,7 +716,7 @@ END:
        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;
@@ -801,7 +742,7 @@ static int __run_category_parser_prestep (manifest_x *mfx, char *category_key, A
                        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)) {
@@ -823,7 +764,7 @@ static int __run_category_parser_prestep (manifest_x *mfx, char *category_key, A
                        }
                }
 
-               //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)
@@ -855,12 +796,11 @@ static void __process_tag(void *lib_handle, xmlTextReaderPtr reader, ACTION_TYPE
                }
        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);
@@ -983,9 +923,8 @@ int __ps_process_tag_parser(manifest_x *mfx, const char *filename, ACTION_TYPE a
                        }
                        xmlFreeTextReader(reader);
 
-                       if (ret != 0) {
+                       if (ret != 0)
                                _LOGD("%s : failed to parse", filename);
-                       }
                } else {
                        _LOGD("Unable to open %s", filename);
                }
@@ -1006,7 +945,7 @@ int __ps_process_tag_parser(manifest_x *mfx, const char *filename, ACTION_TYPE a
 
 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 };
@@ -1406,35 +1345,35 @@ static char *__get_icon_with_path(const char *icon, uid_t uid)
                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),
@@ -1507,7 +1446,7 @@ static void __ps_process_tag(manifest_x * mfx, char *const tagv[])
                /*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) {
@@ -1602,6 +1541,7 @@ static int __ps_process_splashscreen(xmlTextReaderPtr reader, splashscreen_x *sp
        __save_xml_attribute(reader, "orientation", &splashscreen->orientation, NULL);
        __save_xml_attribute(reader, "indicator-display", &splashscreen->indicatordisplay, NULL);
        __save_xml_attribute(reader, "app-control-operation", &splashscreen->operation, NULL);
+       __save_xml_attribute(reader, "color-depth", &splashscreen->color_depth, NULL);
        return 0;
 }
 
@@ -1677,8 +1617,9 @@ static int __ps_process_application(xmlTextReaderPtr reader, application_x *appl
        __save_xml_attribute(reader, "ui-gadget", &application->ui_gadget, "false");
        __save_xml_attribute(reader, "auto-restart", &application->autorestart, "false");
        __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);
@@ -1693,6 +1634,18 @@ static int __ps_process_application(xmlTextReaderPtr reader, application_x *appl
                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);
@@ -1979,7 +1932,7 @@ static int __ps_remove_appsvc_db(manifest_x *mfx, uid_t uid)
                if (application == NULL)
                        continue;
                ret = appsvc_operation(application->appid, uid);
-               if (ret <0)
+               if (ret < 0)
                        _LOGE("can not operation  symbol \n");
        }
 
@@ -2003,25 +1956,12 @@ static int __check_preload_updated(manifest_x * mfx, const char *manifest, uid_t
        return 0;
 }
 
-API int pkgmgr_parser_create_desktop_file(manifest_x *mfx)
-{
-       /* desktop file is no longer used */
-        return 0;
-}
-
-API int pkgmgr_parser_create_usr_desktop_file(manifest_x *mfx, uid_t uid)
-{
-       /* desktop file is no longer used */
-        return 0;
-}
-
-
 API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
 {
        pkgmgrinfo_basic_free_package((package_x *)mfx);
 }
 
-API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
+DEPRECATED API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
 {
        _LOGD("parsing start pkgmgr_parser_process_manifest_xml\n");
        xmlTextReaderPtr reader;
@@ -2049,7 +1989,7 @@ API manifest_x *pkgmgr_parser_process_manifest_xml(const char *manifest)
 }
 
 
-API manifest_x *pkgmgr_parser_usr_process_manifest_xml(const char *manifest, uid_t uid)
+DEPRECATED API manifest_x *pkgmgr_parser_usr_process_manifest_xml(const char *manifest, uid_t uid)
 {
        _LOGD("parsing start pkgmgr_parser_usr_process_manifest_xml\n");
        xmlTextReaderPtr reader;
@@ -2086,7 +2026,7 @@ API int pkgmgr_parser_update_tep(const char *pkgid, const char *tep_path)
        return pkgmgr_parser_update_tep_info_in_db(pkgid, tep_path);
 }
 
-API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char *const tagv[])
+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");
        _LOGD("parsing manifest for installation: %s\n", manifest);
@@ -2122,7 +2062,8 @@ API int pkgmgr_parser_parse_manifest_for_installation(const char *manifest, char
 
        return PMINFO_R_OK;
 }
-API int pkgmgr_parser_parse_usr_manifest_for_installation(const char *manifest, uid_t uid, char *const tagv[])
+
+DEPRECATED API int pkgmgr_parser_parse_usr_manifest_for_installation(const char *manifest, uid_t uid, char *const tagv[])
 {
        retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
        _LOGD("parsing manifest for installation: %s\n", manifest);
@@ -2157,39 +2098,35 @@ API int pkgmgr_parser_parse_usr_manifest_for_installation(const char *manifest,
        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);
        int ret = -1;
 
-       xmlInitParser();
-
-       _LOGD("Added preload infomation\n");
-
        ret = pkgmgr_parser_insert_manifest_info_in_db(mfx);
        retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
        _LOGD("DB Insert Success\n");
-       xmlCleanupParser();
 
        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);
        int ret = -1;
 
-       xmlInitParser();
        ret = pkgmgr_parser_insert_manifest_info_in_usr_db(mfx, uid);
        retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
        _LOGD("DB Insert Success\n");
-       xmlCleanupParser();
+
        return PMINFO_R_OK;
 }
 
-API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
+DEPRECATED API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *const tagv[])
 {
        retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
        _LOGD("pkgmgr_parser_parse_manifest_for_upgrade  parsing manifest for upgradation: %s\n", manifest);
@@ -2237,6 +2174,13 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con
                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");
 
@@ -2244,9 +2188,8 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con
 
        __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");
@@ -2258,7 +2201,7 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con
        return PMINFO_R_OK;
 }
 
-API int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t uid, char *const tagv[])
+DEPRECATED API int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t uid, char *const tagv[])
 {
        retvm_if(manifest == NULL, PMINFO_R_ERROR, "argument supplied is NULL");
        _LOGD(" pkgmgr_parser_parse_usr_manifest_for_upgrade parsing manifest for upgradation: %s\n", manifest);
@@ -2306,6 +2249,13 @@ API int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t
                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");
@@ -2325,66 +2275,30 @@ API int pkgmgr_parser_parse_usr_manifest_for_upgrade(const char *manifest, uid_t
        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);
        int ret = -1;
-       bool system = false;
-       char *csc_path = NULL;
-       pkgmgrinfo_pkginfo_h handle = NULL;
-
-       xmlInitParser();
-
-       ret = pkgmgrinfo_pkginfo_get_pkginfo(mfx->package, &handle);
-       if (ret != PMINFO_R_OK)
-               _LOGD("pkgmgrinfo_pkginfo_get_pkginfo failed\n");
-
-       ret = pkgmgrinfo_pkginfo_is_system(handle, &system);
-       if (ret != PMINFO_R_OK)
-               _LOGD("pkgmgrinfo_pkginfo_is_system failed\n");
-       if (system) {
-               free((void *)mfx->system);
-               mfx->system = strdup("true");
-       }
-
-       ret = pkgmgrinfo_pkginfo_get_csc_path(handle, &csc_path);
-       if (ret != PMINFO_R_OK)
-               _LOGD("pkgmgrinfo_pkginfo_get_csc_path failed\n");
-
-       if (csc_path != NULL) {
-               if (mfx->csc_path)
-                       free((void *)mfx->csc_path);
-               mfx->csc_path = strdup(csc_path);
-       }
 
        ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
        retvm_if(ret == PMINFO_R_ERROR, PMINFO_R_ERROR, "DB Insert failed");
        _LOGD("DB Update Success\n");
-       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
-       xmlCleanupParser();
 
        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);
        int ret = -1;
-       pkgmgrinfo_pkginfo_h handle = NULL;
-
-       xmlInitParser();
-
-       ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(mfx->package, uid, &handle);
-       if (ret != PMINFO_R_OK)
-               _LOGD("pkgmgrinfo_pkginfo_get_pkginfo failed\n");
 
        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");
-       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
-       xmlCleanupParser();
 
        return PMINFO_R_OK;
 }
@@ -2412,6 +2326,13 @@ API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, ch
        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");
@@ -2449,6 +2370,13 @@ API int pkgmgr_parser_parse_usr_manifest_for_uninstallation(const char *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_usr_db(mfx, uid);
        if (ret == -1)
                _LOGD("DB Delete failed\n");
@@ -2468,30 +2396,29 @@ API int pkgmgr_parser_parse_usr_manifest_for_uninstallation(const char *manifest
        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);
 
        int ret = -1;
-       xmlInitParser();
        ret = pkgmgr_parser_delete_manifest_info_from_db(mfx);
        if (ret == -1)
                _LOGD("DB Delete failed\n");
        else
                _LOGD("DB Delete Success\n");
-       xmlCleanupParser();
 
        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);
 
        int ret = -1;
-       xmlInitParser();
 
        ret = pkgmgr_parser_delete_manifest_info_from_usr_db(mfx, uid);
        if (ret == -1)
@@ -2504,38 +2431,11 @@ API int pkgmgr_parser_process_usr_manifest_x_for_uninstallation(manifest_x* mfx,
                _LOGD("Removing appsvc_db failed\n");
        else
                _LOGD("Removing appsvc_db Success\n");
-       xmlCleanupParser();
 
        return PMINFO_R_OK;
 }
 
-API int pkgmgr_parser_parse_manifest_for_preload()
-{
-       return pkgmgr_parser_update_preload_info_in_db();
-}
-
-API int pkgmgr_parser_parse_usr_manifest_for_preload(uid_t uid)
-{
-       return pkgmgr_parser_update_preload_info_in_usr_db(uid);
-}
-
-API int pkgmgr_parser_run_parser_for_installation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
-{
-       return __ps_run_parser(docPtr, tag, ACTION_INSTALL, pkgid);
-}
-
-API int pkgmgr_parser_run_parser_for_upgrade(xmlDocPtr docPtr, const char *tag, const char *pkgid)
-{
-       return __ps_run_parser(docPtr, tag, ACTION_UPGRADE, pkgid);
-}
-
-API int pkgmgr_parser_run_parser_for_uninstallation(xmlDocPtr docPtr, const char *tag, const char *pkgid)
-{
-       return __ps_run_parser(docPtr, tag, ACTION_UNINSTALL, pkgid);
-}
-
 #define SCHEMA_FILE SYSCONFDIR "/package-manager/preload/manifest.xsd"
-#if 1
 API int pkgmgr_parser_check_manifest_validation(const char *manifest)
 {
        if (manifest == NULL) {
@@ -2576,55 +2476,3 @@ API int pkgmgr_parser_check_manifest_validation(const char *manifest)
        return PMINFO_R_OK;
 }
 
-#else
-API int pkgmgr_parser_check_manifest_validation(const char *manifest)
-{
-       int err = 0;
-       int status = 0;
-       pid_t pid;
-
-       pid = fork();
-
-       switch (pid) {
-       case -1:
-               _LOGE("fork failed\n");
-               return -1;
-       case 0:
-               /* child */
-               {
-                       int dev_null_fd = open ("/dev/null", O_RDWR);
-                       if (dev_null_fd >= 0)
-                       {
-                               dup2 (dev_null_fd, 0);/*stdin*/
-                               dup2 (dev_null_fd, 1);/*stdout*/
-                               dup2 (dev_null_fd, 2);/*stderr*/
-                       }
-
-                       if (execl("/usr/bin/xmllint", "xmllint", manifest, "--schema",
-                               SCHEMA_FILE, NULL) < 0) {
-                               _LOGE("execl error\n");
-                       }
-
-                       _exit(100);
-               }
-       default:
-               /* parent */
-               break;
-       }
-
-       while ((err = waitpid(pid, &status, WNOHANG)) != pid) {
-               if (err < 0) {
-                       if (errno == EINTR)
-                               continue;
-                       _LOGE("waitpid failed\n");
-                       return -1;
-               }
-       }
-
-
-       if(WIFEXITED(status) && !WEXITSTATUS(status))
-               return 0;
-       else
-               return -1;
-}
-#endif