delete opt desktop file during preload updated
authorjunsuk77.oh <junsuk77.oh@samsung.com>
Thu, 23 May 2013 03:03:01 +0000 (12:03 +0900)
committerjunsuk77.oh <junsuk77.oh@samsung.com>
Thu, 23 May 2013 03:03:01 +0000 (12:03 +0900)
Change-Id: Ic2264d03f275227b380dbf09f18d8c39a1743af4
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
src/pkgmgr-info.c

index 5bca15a..183fedc 100755 (executable)
@@ -1,6 +1,6 @@
 Name:       pkgmgr-info
 Summary:    Packager Manager infomation api for package
-Version:    0.0.111
+Version:    0.0.114
 Release:    1
 Group:      Application Framework/Package Management
 License:    Apache-2.0
index a817cbb..5d71090 100755 (executable)
   <xs:element name="privilege">
   </xs:element>
   <xs:element name="font">
-    <xs:complexType>
-      <xs:sequence>
-        <xs:element ref="packages:label"/>
-        <xs:element ref="packages:icon"/>
-      </xs:sequence>
-    </xs:complexType>
   </xs:element>
   <xs:element name="label">
     <xs:complexType mixed="true">
index 4ced588..eb73e69 100755 (executable)
@@ -2458,6 +2458,7 @@ static int __ps_process_uiapplication(xmlTextReaderPtr reader, uiapplication_x *
                                free((void *)uiapplication->appid);
                        uiapplication->appid = newappid;
                }
+               uiapplication->package= strdup(package);
        }
        if (xmlTextReaderGetAttribute(reader, XMLCHAR("exec")))
                uiapplication->exec = ASCII(xmlTextReaderGetAttribute(reader, XMLCHAR("exec")));
@@ -3823,6 +3824,24 @@ static int __add_preload_info(manifest_x * mfx, const char *manifest)
        return 0;
 }
 
+static int __check_preload_updated(manifest_x * mfx, const char *manifest)
+{
+       char filepath[PKG_STRING_LEN_MAX] = "";
+       int ret = 0;
+       uiapplication_x *uiapplication = mfx->uiapplication;
+
+       if(strstr(manifest, MANIFEST_RO_PREFIX)) {
+/* if preload app is updated, then remove previous desktop file on RW*/
+               for(; uiapplication; uiapplication=uiapplication->next) {
+                               snprintf(filepath, sizeof(filepath),"%s%s.desktop", DESKTOP_RW_PATH, uiapplication->appid);
+                       ret = remove(filepath);
+                       if (ret <0)
+                               return -1;
+               }
+
+               return 0;
+       }
+}
 
 API void pkgmgr_parser_free_manifest_xml(manifest_x *mfx)
 {
@@ -4162,6 +4181,7 @@ API int pkgmgr_parser_parse_manifest_for_upgrade(const char *manifest, char *con
        __streamFile(manifest, ACTION_UPGRADE, temp, mfx->package);
        __add_preload_info(mfx, manifest);
        DBG("Added preload infomation\n");
+       __check_preload_updated(mfx, manifest);
 
        ret = pkgmgrinfo_pkginfo_get_pkginfo(mfx->package, &handle);
        if (ret != PMINFO_R_OK)
index ea3e382..5348ddb 100755 (executable)
@@ -632,7 +632,6 @@ static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata)
        char *icon = NULL;
        char query[MAX_QUERY_LEN] = {'\0'};
 
-       manifest_x *mfx = (manifest_x *)userdata;
        uiapplication_x *up = (uiapplication_x*)userdata;
        label_x *lbl = up->label;
        icon_x *icn = up->icon;
@@ -652,11 +651,14 @@ static void __insert_uiapplication_locale_info(gpointer data, gpointer userdata)
        if (strcasecmp(up->mainapp, "true")==0) {
                sqlite3_snprintf(MAX_QUERY_LEN, query, "insert into package_localized_info(package, package_locale, " \
                        "package_label, package_icon, package_description, package_license, package_author) values " \
-                       "('%q', '%q', '%q', '%q', '%q', '%q', '%q')", mfx->package, (char*)data,
+                       "('%q', '%q', '%q', '%q', '%q', '%q', '%q')", up->package, (char*)data,
                        label, icon, NULL, NULL, NULL);
                ret = __exec_query_no_msg(query);
-               if (ret == -1)
-                       DBG("Package locale info inserted before.\n");
+               if (ret == -1) {
+                       snprintf(query, MAX_QUERY_LEN,
+                               "update package_localized_info set  package_label='%s', package_icon='%s' where package='%s' and package_locale='%s'", label, icon, up->package, (char*)data);
+                       __exec_query_no_msg(query);
+               }
        }
 }
 
@@ -754,17 +756,11 @@ static int __insert_ui_mainapp_info(manifest_x *mfx)
        }
 
        if (mfx->mainapp_id == NULL){
-               if (mfx->uiapplication
-               && mfx->uiapplication->appid) {
-                       snprintf(query, MAX_QUERY_LEN,
-                       "update package_app_info set app_mainapp='true' where app_id='%s'", mfx->uiapplication->appid);
-               } else if (mfx->serviceapplication
-                       && mfx->serviceapplication->appid) {
-                       snprintf(query, MAX_QUERY_LEN,
-                        "update package_app_info set app_mainapp='true' where app_id='%s'", mfx->serviceapplication->appid);
-                } else {
+               if (mfx->uiapplication && mfx->uiapplication->appid) {
+                       snprintf(query, MAX_QUERY_LEN, "update package_app_info set app_mainapp='true' where app_id='%s'", mfx->uiapplication->appid);
+               } else {
                        DBG("Not valid appid\n");
-                        return -1;
+                       return -1;
                }
 
                ret = __exec_query(query);
@@ -772,12 +768,11 @@ static int __insert_ui_mainapp_info(manifest_x *mfx)
                        DBG("Package UiApp Info DB Insert Failed\n");
                        return -1;
                }
-                if (mfx->uiapplication && mfx->uiapplication->appid)
-                        mfx->mainapp_id = strdup(mfx->uiapplication->appid);
-                else if (mfx->serviceapplication && mfx->serviceapplication->appid)
-                        mfx->mainapp_id = strdup(mfx->serviceapplication->appid);
 
-}
+               free((void *)mfx->uiapplication->mainapp);
+               mfx->uiapplication->mainapp= strdup("true");
+               mfx->mainapp_id = strdup(mfx->uiapplication->appid);
+       }
 
        memset(query, '\0', MAX_QUERY_LEN);
        snprintf(query, MAX_QUERY_LEN,
index 4da9f59..81848d4 100755 (executable)
@@ -367,7 +367,7 @@ static void __get_filter_condition(gpointer data, char **condition)
                snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_hwacceleration='%s'", node->value);
                break;
        case E_PMINFO_APPINFO_PROP_APP_LAUNCHCONDITION:
-               snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition='%s'", node->value);
+               snprintf(buf, MAX_QUERY_LEN, "package_app_info.app_launchcondition IN %s", node->value);
                break;
        default:
                _LOGE("Invalid Property Type\n");
@@ -4049,10 +4049,7 @@ API int pkgmgrinfo_appinfo_get_install_list(pkgmgrinfo_app_list_cb app_func, voi
        {
                appinfo->uiapp_info= ptr1;
                appinfo->package = strdup(ptr1->package);
-               if (strcmp(ptr1->app_component, "uiapp") == 0)
-                       appinfo->app_component = PMINFO_UI_APP;
-               else
-                       appinfo->app_component = PMINFO_SVC_APP;
+               appinfo->app_component = PMINFO_UI_APP;
 
                ret = app_func((void *)appinfo, user_data);
                if (ret < 0)