remove appsvc db during uninstall 2.1b_release accepted/tizen_2.1/20130425.035436 submit/tizen_2.1/20130424.230857
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Wed, 17 Apr 2013 04:34:33 +0000 (13:34 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Wed, 17 Apr 2013 08:27:39 +0000 (17:27 +0900)
Change-Id: I30181c35a030fd13f844d2c7e610b363b596da2d
Signed-off-by: junsuk77.oh <junsuk77.oh@samsung.com>
packaging/pkgmgr-info.spec
parser/manifest.xsd.in
parser/pkgmgr_parser.c
parser/pkgmgr_parser_db.c

index a85037a..f141ce2 100755 (executable)
@@ -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
index d0630cc..21cf197 100755 (executable)
@@ -24,6 +24,7 @@
                  <xs:element ref="packages:ime"/>
         </xs:choice>
       </xs:sequence>
+         <xs:attribute name="storeclient-id" type="xs:string"/>
       <xs:attribute name="install-location" type="packages:InstallLocationType"/>
       <xs:attribute name="package" use="required" type="xs:string"/>
       <xs:attribute name="type" type="packages:PackageType"/>
index 0b24766..f553ec5 100755 (executable)
@@ -33,7 +33,6 @@
 #include <libxml/xmlschemas.h>
 #include <vconf.h>
 
-
 #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();
index 4f9d10b..94dd8ec 100755 (executable)
@@ -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) {