From 20e85dc9b91090f2a0fa20318775f2d0195ead35 Mon Sep 17 00:00:00 2001 From: "junsuk77.oh" Date: Wed, 17 Apr 2013 13:34:33 +0900 Subject: [PATCH] remove appsvc db during uninstall Change-Id: I30181c35a030fd13f844d2c7e610b363b596da2d Signed-off-by: junsuk77.oh --- packaging/pkgmgr-info.spec | 4 ++-- parser/manifest.xsd.in | 1 + parser/pkgmgr_parser.c | 49 ++++++++++++++++++++++++++++++++++++++++++---- parser/pkgmgr_parser_db.c | 4 ++++ 4 files changed, 52 insertions(+), 6 deletions(-) diff --git a/packaging/pkgmgr-info.spec b/packaging/pkgmgr-info.spec index a85037a..f141ce2 100755 --- a/packaging/pkgmgr-info.spec +++ b/packaging/pkgmgr-info.spec @@ -1,6 +1,6 @@ Name: pkgmgr-info Summary: Packager Manager infomation api for package -Version: 0.0.100 +Version: 0.0.102 Release: 1 Group: Application Framework/Package Management License: Apache-2.0 @@ -10,7 +10,7 @@ BuildRequires: pkgconfig(dlog) BuildRequires: pkgconfig(vconf) BuildRequires: pkgconfig(sqlite3) BuildRequires: pkgconfig(db-util) -BuildRequires: pkgconfig(libxml-2.0) +BuildRequires:pkgconfig(libxml-2.0) %description Packager Manager infomation api for packaging diff --git a/parser/manifest.xsd.in b/parser/manifest.xsd.in index d0630cc..21cf197 100755 --- a/parser/manifest.xsd.in +++ b/parser/manifest.xsd.in @@ -24,6 +24,7 @@ + diff --git a/parser/pkgmgr_parser.c b/parser/pkgmgr_parser.c index 0b24766..f553ec5 100755 --- a/parser/pkgmgr_parser.c +++ b/parser/pkgmgr_parser.c @@ -33,7 +33,6 @@ #include #include - #include "pkgmgr_parser.h" #include "pkgmgr_parser_internal.h" #include "pkgmgr_parser_db.h" @@ -3158,6 +3157,8 @@ static int __process_manifest(xmlTextReaderPtr reader, manifest_x * mfx) } else { mfx->appsetting = strdup("false"); } + if (xmlTextReaderGetAttribute(reader, XMLCHAR("storeclient-id"))) + mfx->storeclient_id= ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("storeclient-id"))); /*Assign default values. If required it will be overwritten in __add_preload_info()*/ mfx->preload = strdup("False"); @@ -3581,11 +3582,12 @@ static int __ps_remove_nativeapp_desktop(manifest_x *mfx) { char filepath[PKG_STRING_LEN_MAX] = ""; int ret = 0; + uiapplication_x *uiapplication = mfx->uiapplication; - for(; mfx->uiapplication; mfx->uiapplication=mfx->uiapplication->next) { - snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, mfx->uiapplication->appid); + for(; uiapplication; uiapplication=uiapplication->next) { + snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid); - __ail_change_info(AIL_REMOVE, mfx->uiapplication->appid); + __ail_change_info(AIL_REMOVE, uiapplication->appid); ret = remove(filepath); if (ret <0) @@ -3595,6 +3597,39 @@ static int __ps_remove_nativeapp_desktop(manifest_x *mfx) return 0; } +#define LIBAPPSVC_PATH "/usr/lib/libappsvc.so.0" + +static int __ps_remove_appsvc_db(manifest_x *mfx) +{ + void *lib_handle = NULL; + int (*appsvc_operation) (const char *); + int ret = 0; + uiapplication_x *uiapplication = mfx->uiapplication; + + if ((lib_handle = dlopen(LIBAPPSVC_PATH, RTLD_LAZY)) == NULL) { + DBGE("dlopen is failed LIBAIL_PATH[%s]\n", LIBAPPSVC_PATH); + goto END; + } + + if ((appsvc_operation = + dlsym(lib_handle, "appsvc_unset_defapp")) == NULL || dlerror() != NULL) { + DBGE("can not find symbol \n"); + goto END; + } + + for(; uiapplication; uiapplication=uiapplication->next) { + ret = appsvc_operation(uiapplication->appid); + if (ret <0) + DBGE("can not operation symbol \n"); + } + +END: + if (lib_handle) + dlclose(lib_handle); + + return ret; +} + #define MANIFEST_RO_PREFIX "/usr/share/packages/" #define PRELOAD_PACKAGE_LIST "/usr/etc/package-manager/preload/preload_list.txt" static int __add_preload_info(manifest_x * mfx, const char *manifest) @@ -4042,6 +4077,12 @@ API int pkgmgr_parser_parse_manifest_for_uninstallation(const char *manifest, ch else DBG("Removing desktop file Success\n"); + ret = __ps_remove_appsvc_db(mfx); + if (ret == -1) + DBG("Removing appsvc_db failed\n"); + else + DBG("Removing appsvc_db Success\n"); + pkgmgr_parser_free_manifest_xml(mfx); DBG("Free Done\n"); xmlCleanupParser(); diff --git a/parser/pkgmgr_parser_db.c b/parser/pkgmgr_parser_db.c index 4f9d10b..94dd8ec 100755 --- a/parser/pkgmgr_parser_db.c +++ b/parser/pkgmgr_parser_db.c @@ -302,6 +302,10 @@ static int __guestmode_visibility_cb(void *data, int ncols, char **coltxt, char status = strdup(coltxt[i]); } } + if (appid == NULL) { + DBG("app id is NULL\n"); + return -1; + } /*update guest mode visibility*/ for (; uiapp != NULL; uiapp = uiapp->next) { if (strcmp(uiapp->appid, appid) == 0) { -- 2.7.4