fixed checking condition of decyprtion for preload and download.
authorSoyoung Kim <sy037.kim@samsung.com>
Tue, 15 Oct 2013 06:56:00 +0000 (15:56 +0900)
committerSoo-Hyun Choi <sh9.choi@samsung.com>
Wed, 23 Oct 2013 14:35:25 +0000 (23:35 +0900)
[Issue#] N/A
[Problem] can't decrypt resource when launch encypted prealod app.
[Cause] there was wrong condition about checking preload or download.
[Solution]
Change checking condition to using package manager api.
(pkgmgrinfo_pkginfo_is_preload and pkgmgrinfo_pkginfo_is_update)
[SCMRequest] N/A

Change-Id: Icf4037160795c1ae5a69bf01f6313e3170b3b263

packaging/wrt.spec
src/view/webkit/injected-bundle/CMakeLists.txt
src/view/webkit/injected-bundle/injected_bundle_decryption_support.cpp

index 014273e..fc21315 100644 (file)
@@ -65,6 +65,7 @@ Requires(post): /sbin/ldconfig
 Requires(postun): /sbin/ldconfig
 BuildRequires:  pkgconfig(libsmack)
 BuildRequires:  pkgconfig(efl-assist)
+BuildRequires:  pkgconfig(pkgmgr-info)
 BuildRequires:  libss-client-devel
 BuildRequires:  gettext
 BuildRequires:  edje-tools
index 099c9ef..949bd0b 100644 (file)
@@ -30,6 +30,7 @@ PKG_CHECK_MODULES(INJECTED_BUNDLE_DEP
     libpcrecpp
     wrt-plugins-ipc-message
     wrt-dispatch-event
+    pkgmgr-info
     REQUIRED
 )
 
index fd98bc7..6a62357 100644 (file)
 #include <dpl/assert.h>
 #include <dpl/string.h>
 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
-#include <dpl/wrt-dao-ro/global_config.h>
 #include <dpl/utils/mime_type_utils.h>
 
 #include <dpl/log/secure_log.h>
+#include <pkgmgr-info.h>
 
 namespace InjectedBundle {
 namespace {
@@ -173,6 +173,7 @@ class DecryptionSupportImplementation
     void initialize(WrtDB::TizenAppId appId)
     {
         _D("called");
+        m_initialized = true;
 
         m_appId = appId;
         WrtDB::WidgetDAOReadOnly dao(m_appId);
@@ -183,15 +184,28 @@ class DecryptionSupportImplementation
         }
         m_pkgId = dao.getTzPkgId();
 
-        std::string installedPath =
-            DPL::ToUTF8String(*dao.getWidgetInstalledPath());
-        std::string preloadPath(WrtDB::GlobalConfig::GetUserPreloadedWidgetPath());
-        if (0 == installedPath.compare(0, preloadPath.length(), preloadPath)) {
+        bool isPreload = false;
+        bool isUpdate = false;
+        pkgmgrinfo_pkginfo_h handle = NULL;
+        std::string tzPkgId = DPL::ToUTF8String(dao.getTizenPkgId());
+
+        if (PMINFO_R_OK != pkgmgrinfo_pkginfo_get_pkginfo(tzPkgId.c_str(), &handle)) {
+            _E("Can't get package information : %s", tzPkgId.c_str());
+            return;
+        }
+        if (PMINFO_R_OK != pkgmgrinfo_pkginfo_is_preload(handle, &isPreload)) {
+            _E("Can't get package information : %s", tzPkgId.c_str());
+            return;
+        }
+        if (PMINFO_R_OK != pkgmgrinfo_pkginfo_is_update(handle, &isUpdate)) {
+            _E("Can't get package information : %s", tzPkgId.c_str());
+            return;
+        }
+
+        if (isPreload && !isUpdate) {
             m_isPreload = true;
             _D("preload application");
         }
-
-        m_initialized = true;
     }
 
     void deinitialize(void)