XML reader check linefeed on manifest parser submit/tizen_2.2/20130716.173748 submit/tizen_2.2/20130717.015201 submit/tizen_2.2/20130717.053310
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Thu, 11 Jul 2013 01:54:55 +0000 (10:54 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Thu, 11 Jul 2013 01:54:55 +0000 (10:54 +0900)
Change-Id: I93324256c7a7214efbb0885595e349d454dda8df
Signed-off-by: junsuk77.oh <junsuk77.oh@samsung.com>
mdparser_list.txt.in
packaging/pkgmgr-info.spec
parser/pkgmgr_parser.c
parser/pkgmgr_parser_db.c
src/pkgmgr-info.c

index 1d52ae8..eb9e96e 100644 (file)
@@ -1,3 +1,3 @@
 http://developer.samsung.com/tizen/metadata/sticker
-http://developer.samsung.com/tizen/metadata/tts
+http://developer.samsung.com/tizen/metadata/ttsengine
 http://developer.samsung.com/tizen/metadata/downloadable_filters
\ No newline at end of file
index b5cec0b..234747b 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       pkgmgr-info
 Summary:    Packager Manager infomation api for package
-Version:    0.0.127
+Version:    0.0.129
 Release:    1
 Group:      Application Framework/Package Management
 License:    Apache-2.0
index dfe2205..325ced8 100755 (executable)
@@ -47,6 +47,8 @@
 #define MDPARSER_LIST "/usr/etc/package-manager/parserlib/metadata/mdparser_list.txt"
 #define MDPARSER_NAME  "mdparser:"
 
+#define PKG_TAG_LEN_MAX 128
+
 /* operation_type */
 typedef enum {
        ACTION_INSTALL = 0,
@@ -55,6 +57,12 @@ typedef enum {
        ACTION_MAX
 } ACTION_TYPE;
 
+/* plugin process_type */
+typedef enum {
+       PLUGIN_PRE_PROCESS = 0,
+       PLUGIN_POST_PROCESS
+} PLUGIN_PROCESS_TYPE;
+
 typedef struct {
        const char *key;
        const char *value;
@@ -314,10 +322,7 @@ static char *__get_parser_plugin(const char *type)
                __str_trim(buffer);
 
                if ((path = strstr(buffer, PKG_PARSERLIB)) != NULL) {
-                       DBG("[%s]\n", path);
                        path = path + strlen(PKG_PARSERLIB);
-                       DBG("[%s]\n", path);
-
                        break;
                }
 
@@ -374,15 +379,15 @@ static int __ps_run_mdparser(GList *md_list, const char *tag,
 
        if ((mdparser_plugin =
                dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
-               DBGE("can not find symbol \n");
+               DBGE("can not find symbol[%s] \n",ac);
                goto END;
        }
 
        ret = mdparser_plugin(pkgid, appid, md_list);
        if (ret < 0)
-               DBGE("[appid = %s, libpath = %s] plugin fail\n", appid, lib_path);
+               DBG("[appid = %s, libpath = %s plugin fail\n", appid, lib_path);
        else
-               DBGE("[appid = %s, libpath = %s] plugin success\n", appid, lib_path);
+               DBG("[appid = %s, libpath = %s plugin success\n", appid, lib_path);
 
 END:
        if (lib_path)
@@ -426,11 +431,15 @@ static int __ps_run_parser(xmlDocPtr docPtr, const char *tag,
        }
        if ((plugin_install =
                dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
-               DBGE("can not find symbol \n");
+               DBGE("can not find symbol[%s] \n", ac);
                goto END;
        }
 
        ret = plugin_install(docPtr, pkgid);
+       if (ret < 0)
+               DBG("[pkgid = %s, libpath = %s plugin fail\n", pkgid, lib_path);
+       else
+               DBG("[pkgid = %s, libpath = %s plugin success\n", pkgid, lib_path);
 
 END:
        if (lib_path)
@@ -755,12 +764,152 @@ __processNode(xmlTextReaderPtr reader, ACTION_TYPE action, char *const tagv[], c
        }
 }
 
+static void __plugin_send_tag(const char *tag, ACTION_TYPE action, PLUGIN_PROCESS_TYPE process, const char *pkgid)
+{
+       char *lib_path = NULL;
+       void *lib_handle = NULL;
+       int (*plugin_install) (const char *);
+       int ret = -1;
+       char *ac = NULL;
+
+       if (process == PLUGIN_PRE_PROCESS) {
+               switch (action) {
+               case ACTION_INSTALL:
+                       ac = "PKGMGR_PARSER_PLUGIN_PRE_INSTALL";
+                       break;
+               case ACTION_UPGRADE:
+                       ac = "PKGMGR_PARSER_PLUGIN_PRE_UPGRADE";
+                       break;
+               case ACTION_UNINSTALL:
+                       ac = "PKGMGR_PARSER_PLUGIN_PRE_UNINSTALL";
+                       break;
+               default:
+                       goto END;
+               }
+       } else if (process == PLUGIN_POST_PROCESS) {
+               switch (action) {
+               case ACTION_INSTALL:
+                       ac = "PKGMGR_PARSER_PLUGIN_POST_INSTALL";
+                       break;
+               case ACTION_UPGRADE:
+                       ac = "PKGMGR_PARSER_PLUGIN_POST_UPGRADE";
+                       break;
+               case ACTION_UNINSTALL:
+                       ac = "PKGMGR_PARSER_PLUGIN_POST_UNINSTALL";
+                       break;
+               default:
+                       goto END;
+               }
+       } else
+               goto END;
+
+       lib_path = __get_parser_plugin(tag);
+       if (!lib_path) {
+               goto END;
+       }
+
+       if ((lib_handle = dlopen(lib_path, RTLD_LAZY)) == NULL) {
+               DBGE("dlopen is failed lib_path[%s]\n", lib_path);
+               goto END;
+       }
+       if ((plugin_install =
+               dlsym(lib_handle, ac)) == NULL || dlerror() != NULL) {
+               DBGE("can not find symbol[%s] \n", ac);
+               goto END;
+       }
+
+       ret = plugin_install(pkgid);
+       if (ret < 0)
+               DBG("[PLUGIN_PROCESS_TYPE[%d] pkgid=%s, tag=%s plugin fail\n", process, pkgid, tag);
+       else
+               DBG("[PLUGIN_PROCESS_TYPE[%d] pkgid=%s, tag=%s plugin success\n", process, pkgid, tag);
+
+END:
+       if (lib_path)
+               free(lib_path);
+       if (lib_handle)
+               dlclose(lib_handle);
+}
+
+static void
+__plugin_process_tag(char *const tag_list[], ACTION_TYPE action, PLUGIN_PROCESS_TYPE process, const char *pkgid)
+{
+       char *tag = NULL;
+       int i = 0;
+
+       for (tag = tag_list[0]; tag; tag = tag_list[++i])
+               __plugin_send_tag(tag, action, process, pkgid);
+
+}
+
+static void
+__plugin_save_tag(xmlTextReaderPtr reader, char *const tagv[], char *tag_list[])
+{
+       char *tag = NULL;
+       int i = 0;
+       static int pre_cnt=0;
+
+       switch (xmlTextReaderNodeType(reader)) {
+       case XML_READER_TYPE_ELEMENT:
+               {
+                       const xmlChar *elementName = xmlTextReaderLocalName(reader);
+                       if (elementName == NULL) {
+                               break;
+                       }
+                       i = 0;
+                       for (tag = tag_list[0]; tag; tag = tag_list[++i])
+                               if (strcmp(ASCII(elementName), tag) == 0) {
+                                       return;
+                               }
+                       i = 0;
+                       for (tag = tagv[0]; tag; tag = tagv[++i])
+                               if (strcmp(tag, ASCII(elementName)) == 0) {
+                                       tag_list[pre_cnt++] = tag;
+                                       break;
+                               }
+                       break;
+               }
+       default:
+//             DBG("Ignoring Node of Type: %d", xmlTextReaderNodeType(reader));
+               break;
+       }
+}
+
+static void
+__plugin_find_tag(const char *filename, char *const tagv[], char *tag_list[])
+{
+       xmlTextReaderPtr reader;
+       xmlDocPtr docPtr;
+       int ret;
+
+       docPtr = xmlReadFile(filename, NULL, 0);
+       reader = xmlReaderWalker(docPtr);
+       if (reader != NULL) {
+               ret = xmlTextReaderRead(reader);
+               while (ret == 1) {
+                       __plugin_save_tag(reader, tagv, tag_list);
+                       ret = xmlTextReaderRead(reader);
+               }
+               xmlFreeTextReader(reader);
+
+               if (ret != 0) {
+                       DBG("xmlReaderWalker fail");
+               }
+       } else {
+               DBG("xmlReaderWalker fail");
+       }
+}
+
 static void
 __streamFile(const char *filename, ACTION_TYPE action, char *const tagv[], const char *pkgid)
 {
        xmlTextReaderPtr reader;
        xmlDocPtr docPtr;
        int ret;
+       char *tag_list[PKG_TAG_LEN_MAX] = {'\0'};
+
+       __plugin_find_tag(filename, tagv, tag_list);
+       __plugin_process_tag(tag_list, action, PLUGIN_PRE_PROCESS, pkgid);
 
        docPtr = xmlReadFile(filename, NULL, 0);
        reader = xmlReaderWalker(docPtr);
@@ -778,6 +927,8 @@ __streamFile(const char *filename, ACTION_TYPE action, char *const tagv[], const
        } else {
                DBGE("Unable to open %s", filename);
        }
+
+       __plugin_process_tag(tag_list, action, PLUGIN_POST_PROCESS, pkgid);
 }
 
 static int __next_child_element(xmlTextReaderPtr reader, int depth)
@@ -2571,8 +2722,15 @@ static int __ps_process_author(xmlTextReaderPtr reader, author_x *author)
                author->lang = strdup(DEFAULT_LOCALE);
        }
        xmlTextReaderRead(reader);
-       if (xmlTextReaderValue(reader))
+       if (xmlTextReaderValue(reader)) {
+               const char *text  = ASCII(xmlTextReaderValue(reader));
+               if (*text == '\n') {
+                       author->text = NULL;
+                       free((void *)text);
+                       return 0;
+               }
                author->text = ASCII(xmlTextReaderValue(reader));
+       }
        return 0;
 }
 
@@ -2586,8 +2744,15 @@ static int __ps_process_description(xmlTextReaderPtr reader, description_x *desc
                description->lang = strdup(DEFAULT_LOCALE);
        }
        xmlTextReaderRead(reader);
-       if (xmlTextReaderValue(reader))
+       if (xmlTextReaderValue(reader)) {
+               const char *text  = ASCII(xmlTextReaderValue(reader));
+               if (*text == '\n') {
+                       description->text = NULL;
+                       free((void *)text);
+                       return 0;
+               }
                description->text = ASCII(xmlTextReaderValue(reader));
+       }
        return 0;
 }
 
index 01f1ce8..c3a90c7 100755 (executable)
@@ -1960,7 +1960,7 @@ int pkgmgr_parser_check_and_create_db()
        return 0;
 }
 
-int pkgmgr_parser_close_db()
+void pkgmgr_parser_close_db()
 {
        sqlite3_close(pkgmgr_parser_db);
        sqlite3_close(pkgmgr_cert_db);
index b0568ee..763b5f6 100755 (executable)
@@ -1234,134 +1234,182 @@ static int __certinfo_cb(void *data, int ncols, char **coltxt, char **colname)
 
 static int __mini_appinfo_cb(void *data, int ncols, char **coltxt, char **colname)
 {
-       pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
+       pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)data;
        int i = 0;
+       int j = 0;
        uiapplication_x *uiapp = NULL;
-       uiapp = calloc(1, sizeof(uiapplication_x));
-       if (uiapp == NULL) {
-               _LOGE("Out of Memory!!!\n");
-               return -1;
-       }
-
-       LISTADD(info->uiapp_info, uiapp);
-
+       serviceapplication_x *svcapp = NULL;
        for(i = 0; i < ncols; i++)
        {
-               if (strcmp(colname[i], "app_id") == 0) {
-                       /*appid being foreign key, is column in every table
-                       Hence appid gets strduped every time leading to memory leak.
-                       If appid is already set, just continue.*/
-                       if (info->uiapp_info->appid)
-                               continue;
-                       if (coltxt[i])
-                               info->uiapp_info->appid = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->appid = NULL;
-               } else if (strcmp(colname[i], "app_exec") == 0) {
-                       if (coltxt[i])
-                               info->uiapp_info->exec = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->exec = NULL;
-               } else if (strcmp(colname[i], "app_nodisplay") == 0) {
-                       if (coltxt[i])
-                               info->uiapp_info->nodisplay = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->nodisplay = NULL;
-               } else if (strcmp(colname[i], "app_type") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->type = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->type = NULL;
-               } else if (strcmp(colname[i], "app_multiple") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->multiple = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->multiple = NULL;
-               } else if (strcmp(colname[i], "app_taskmanage") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->taskmanage = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->taskmanage = NULL;
-               } else if (strcmp(colname[i], "app_hwacceleration") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->hwacceleration = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->hwacceleration = NULL;
-               } else if (strcmp(colname[i], "app_screenreader") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->screenreader = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->screenreader = NULL;
-               } else if (strcmp(colname[i], "app_enabled") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->enabled= strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->enabled = NULL;
-               } else if (strcmp(colname[i], "app_indicatordisplay") == 0){
-                       if (coltxt[i])
-                               info->uiapp_info->indicatordisplay = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->indicatordisplay = NULL;
-               } else if (strcmp(colname[i], "app_portraitimg") == 0){
-                       if (coltxt[i])
-                               info->uiapp_info->portraitimg = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->portraitimg = NULL;
-               } else if (strcmp(colname[i], "app_landscapeimg") == 0){
-                       if (coltxt[i])
-                               info->uiapp_info->landscapeimg = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->landscapeimg = NULL;
-               } else if (strcmp(colname[i], "app_guestmodevisibility") == 0){
-                       if (coltxt[i])
-                               info->uiapp_info->guestmode_visibility = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->guestmode_visibility = NULL;
-               } else if (strcmp(colname[i], "app_recentimage") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->recentimage = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->recentimage = NULL;
-               } else if (strcmp(colname[i], "app_mainapp") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->mainapp = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->mainapp = NULL;
-               } else if (strcmp(colname[i], "package") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->package = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->package = NULL;
-               } else if (strcmp(colname[i], "app_component") == 0) {
-                       if (coltxt[i])
-                               info->uiapp_info->app_component = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->app_component = NULL;
-               } else if (strcmp(colname[i], "app_permissiontype") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->permission_type = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->permission_type = NULL;
-               } else if (strcmp(colname[i], "component_type") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->component_type = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->component_type = NULL;
-               } else if (strcmp(colname[i], "app_preload") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->preload = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->preload = NULL;
-               } else if (strcmp(colname[i], "app_submode") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->submode = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->submode = NULL;
-               } else if (strcmp(colname[i], "app_submode_mainid") == 0 ) {
-                       if (coltxt[i])
-                               info->uiapp_info->submode_mainid = strdup(coltxt[i]);
-                       else
-                               info->uiapp_info->submode_mainid = NULL;
+               if (strcmp(colname[i], "app_component") == 0) {
+                       if (coltxt[i]) {
+                               if (strcmp(coltxt[i], "uiapp") == 0) {
+                                       uiapp = calloc(1, sizeof(uiapplication_x));
+                                       if (uiapp == NULL) {
+                                               _LOGE("Out of Memory!!!\n");
+                                               return -1;
+                                       }
+                                       LISTADD(info->manifest_info->uiapplication, uiapp);
+                                       for(j = 0; j < ncols; j++)
+                                       {
+                                               if (strcmp(colname[j], "app_id") == 0) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->appid = strdup(coltxt[j]);
+                                               } else if (strcmp(colname[j], "app_exec") == 0) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->exec = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->exec = NULL;
+                                               } else if (strcmp(colname[j], "app_nodisplay") == 0) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->nodisplay = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->nodisplay = NULL;
+                                               } else if (strcmp(colname[j], "app_type") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->type = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->type = NULL;
+                                               } else if (strcmp(colname[j], "app_multiple") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->multiple = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->multiple = NULL;
+                                               } else if (strcmp(colname[j], "app_taskmanage") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->taskmanage = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->taskmanage = NULL;
+                                               } else if (strcmp(colname[j], "app_hwacceleration") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->hwacceleration = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->hwacceleration = NULL;
+                                               } else if (strcmp(colname[j], "app_screenreader") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->screenreader = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->screenreader = NULL;
+                                               } else if (strcmp(colname[j], "app_enabled") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->enabled= strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->enabled = NULL;
+                                               } else if (strcmp(colname[j], "app_indicatordisplay") == 0){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->indicatordisplay = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->indicatordisplay = NULL;
+                                               } else if (strcmp(colname[j], "app_portraitimg") == 0){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->portraitimg = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->portraitimg = NULL;
+                                               } else if (strcmp(colname[j], "app_landscapeimg") == 0){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->landscapeimg = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->landscapeimg = NULL;
+                                               } else if (strcmp(colname[j], "app_guestmodevisibility") == 0){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->guestmode_visibility = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->guestmode_visibility = NULL;
+                                               } else if (strcmp(colname[j], "app_recentimage") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->recentimage = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->recentimage = NULL;
+                                               } else if (strcmp(colname[j], "app_mainapp") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->mainapp = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->mainapp = NULL;
+                                               } else if (strcmp(colname[j], "package") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->package = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->package = NULL;
+                                               } else if (strcmp(colname[j], "app_component") == 0) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->app_component = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->app_component = NULL;
+                                               } else if (strcmp(colname[j], "app_permissiontype") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->permission_type = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->permission_type = NULL;
+                                               } else if (strcmp(colname[j], "component_type") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->component_type = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->component_type = NULL;
+                                               } else if (strcmp(colname[j], "app_preload") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->preload = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->preload = NULL;
+                                               } else if (strcmp(colname[j], "app_submode") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->submode = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->submode = NULL;
+                                               } else if (strcmp(colname[j], "app_submode_mainid") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->uiapplication->submode_mainid = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->uiapplication->submode_mainid = NULL;
+                                               } else
+                                                       continue;
+                                       }
+                               } else {
+                                       svcapp = calloc(1, sizeof(serviceapplication_x));
+                                       if (svcapp == NULL) {
+                                               _LOGE("Out of Memory!!!\n");
+                                               return -1;
+                                       }
+                                       LISTADD(info->manifest_info->serviceapplication, svcapp);
+                                       for(j = 0; j < ncols; j++)
+                                       {
+                                               if (strcmp(colname[j], "app_id") == 0) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->appid = strdup(coltxt[j]);
+                                               } else if (strcmp(colname[j], "app_exec") == 0) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->exec = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->exec = NULL;
+                                               } else if (strcmp(colname[j], "app_type") == 0 ){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->type = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->type = NULL;
+                                               } else if (strcmp(colname[j], "app_onboot") == 0 ){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->onboot = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->onboot = NULL;
+                                               } else if (strcmp(colname[j], "app_autorestart") == 0 ){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->autorestart = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->autorestart = NULL;
+                                               } else if (strcmp(colname[j], "package") == 0 ){
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->package = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->package = NULL;
+                                               } else if (strcmp(colname[j], "app_permissiontype") == 0 ) {
+                                                       if (coltxt[j])
+                                                               info->manifest_info->serviceapplication->permission_type = strdup(coltxt[j]);
+                                                       else
+                                                               info->manifest_info->serviceapplication->permission_type = NULL;
+                                               } else
+                                                       continue;
+                                       }
+                               }
+                       }
                } else
                        continue;
        }
@@ -4114,40 +4162,60 @@ API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, voi
 
        int ret = PMINFO_R_OK;
        char query[MAX_QUERY_LEN] = {'\0'};
-       pkgmgr_appinfo_x *info = NULL;
        pkgmgr_appinfo_x *appinfo = NULL;
        uiapplication_x *ptr1 = NULL;
+       serviceapplication_x *ptr2 = NULL;
        sqlite3 *appinfo_db = NULL;
 
        /*open db*/
        ret = db_util_open_with_options(MANIFEST_DB, &appinfo_db, SQLITE_OPEN_READONLY, NULL);
        retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
 
-       /*calloc appinfo*/
-       info = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
+       /*calloc pkginfo*/
+       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!!!");
 
-       /*calloc uiapplication_x*/
-       info->uiapp_info= (uiapplication_x *)calloc(1, sizeof(uiapplication_x));
-       tryvm_if(info->uiapp_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
+       /*calloc manifest_info*/
+       info->manifest_info = (manifest_x *)calloc(1, sizeof(manifest_x));
+       tryvm_if(info->manifest_info == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
 
        /*calloc appinfo*/
        appinfo = (pkgmgr_appinfo_x *)calloc(1, sizeof(pkgmgr_appinfo_x));
        tryvm_if(appinfo == NULL, ret = PMINFO_R_ERROR, "Out of Memory!!!");
 
-       /*query package_app_info*/
        snprintf(query, MAX_QUERY_LEN, "select * from package_app_info");
        ret = __exec_db_query(appinfo_db, query, __mini_appinfo_cb, (void *)info);
        tryvm_if(ret == -1, ret = PMINFO_R_ERROR, "App Info DB Information retrieval failed");
 
-       LISTHEAD(info->uiapp_info, ptr1);
+       if (info->manifest_info->uiapplication) {
+               LISTHEAD(info->manifest_info->uiapplication, ptr1);
+               info->manifest_info->uiapplication = ptr1;
+       }
+       if (info->manifest_info->serviceapplication) {
+               LISTHEAD(info->manifest_info->serviceapplication, ptr2);
+               info->manifest_info->serviceapplication = ptr2;
+       }
 
-       /*call back*/
-       for(ptr1 = ptr1->next ; ptr1 ; ptr1 = ptr1->next)
+       /*UI Apps*/
+       for(ptr1 = info->manifest_info->uiapplication; ptr1; ptr1 = ptr1->next)
        {
-               appinfo->uiapp_info= ptr1;
-               appinfo->package = strdup(ptr1->package);
                appinfo->app_component = PMINFO_UI_APP;
+               appinfo->package = strdup(ptr1->package);
+               appinfo->uiapp_info = ptr1;
+
+               ret = app_func((void *)appinfo, user_data);
+               if (ret < 0)
+                       break;
+               free((void *)appinfo->package);
+               appinfo->package = NULL;
+       }
+       /*Service Apps*/
+       for(ptr2 = info->manifest_info->serviceapplication; ptr2; ptr2 = ptr2->next)
+       {
+               appinfo->app_component = PMINFO_SVC_APP;
+               appinfo->package = strdup(ptr2->package);
+               appinfo->svcapp_info = ptr2;
 
                ret = app_func((void *)appinfo, user_data);
                if (ret < 0)
@@ -4155,6 +4223,7 @@ API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, voi
                free((void *)appinfo->package);
                appinfo->package = NULL;
        }
+       ret = PMINFO_R_OK;
 
 catch:
        sqlite3_close(appinfo_db);
@@ -4163,7 +4232,7 @@ catch:
                free(appinfo);
                appinfo = NULL;
        }
-       __cleanup_appinfo(info);
+       __cleanup_pkginfo(info);
        return ret;
 }
 
@@ -4875,7 +4944,12 @@ API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h  handle, pkg
        char *val = NULL;
        pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
 
-       val = info->uiapp_info->permission_type;
+       if (info->app_component == PMINFO_UI_APP)
+               val = info->uiapp_info->permission_type;
+       else if (info->app_component == PMINFO_SVC_APP)
+               val = info->svcapp_info->permission_type;
+       else
+               return PMINFO_R_ERROR;
 
        if (strcmp(val, "signature") == 0)
                *permission = PMINFO_PERMISSION_SIGNATURE;