change to check condition of preload web app.
authorSoyoung Kim <sy037.kim@samsung.com>
Mon, 24 Jun 2013 04:49:35 +0000 (13:49 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Mon, 24 Jun 2013 04:58:03 +0000 (13:58 +0900)
[Issue#] N/A
[Problem] N/A
[Cause] N/A
[Solution] using package manager api to check preload web app.
[SCMRequest] N/A

Change-Id: I009bdf89fc051178101380b2c6e68fc9fbf7afe9

src/wrt-installer/wrt-installer.cpp

index 4db1ad4..13ddfe8 100644 (file)
@@ -78,19 +78,6 @@ struct PluginInstallerData
     void* wrtInstaller;
     std::string pluginPath;
 };
-
-bool checkInitializeToPreload(std::string pkgid)
-{
-    std::string RoManifest = "/usr/share/packages/" + pkgid + ".xml";
-    std::string RwManifest = "/opt/share/packages/" + pkgid + ".xml";
-
-    if (access(RwManifest.c_str(), F_OK) == 0 &&
-            access(RoManifest.c_str(), F_OK) == 0) {
-        LogDebug("This web app need to down update");
-        return true;
-    }
-    return false;
-}
 } // namespace anonymous
 
 WrtInstaller::WrtInstaller(int argc, char **argv) :
@@ -529,16 +516,26 @@ void WrtInstaller::uninstallPkgNameStep()
 {
     LogDebug("Uninstalling widget ...");
     LogDebug("Package name : " << m_name);
+    pkgmgr_pkginfo_h handle;
+    int ret = -1;
+    bool preload = false;
+
+    if (0 == pkgmgr_pkginfo_get_pkginfo(m_name.c_str(), &handle)) {
+        if (pkgmgr_pkginfo_is_preload(handle, &preload) < 0) {
+            LogError("Can't get package information : " << m_name);
+        }
+    }
 
-    if (!checkInitializeToPreload(m_name)) {
+    if (preload) {
+        LogDebug("This web app need to initialize preload app");
         wrt_uninstall_widget(m_name.c_str(), this,
-                &staticWrtStatusCallback,
+                &staticWrtInitializeToPreloadCallback,
                 (m_installByPkgmgr)
                 ? &staticWrtUninstallProgressCallback : NULL,
                 pkgmgrSignalInterface);
     } else {
         wrt_uninstall_widget(m_name.c_str(), this,
-                &staticWrtInitializeToPreloadCallback,
+                &staticWrtStatusCallback,
                 (m_installByPkgmgr)
                 ? &staticWrtUninstallProgressCallback : NULL,
                 pkgmgrSignalInterface);