#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,
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;
__str_trim(buffer);
if ((path = strstr(buffer, PKG_PARSERLIB)) != NULL) {
- DBG("[%s]\n", path);
path = path + strlen(PKG_PARSERLIB);
- DBG("[%s]\n", path);
-
break;
}
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)
}
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)
}
}
+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);
} 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)
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;
}
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;
}
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;
}
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)
free((void *)appinfo->package);
appinfo->package = NULL;
}
+ ret = PMINFO_R_OK;
catch:
sqlite3_close(appinfo_db);
free(appinfo);
appinfo = NULL;
}
- __cleanup_appinfo(info);
+ __cleanup_pkginfo(info);
return ret;
}
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;