Update wrt-installer_0.0.52
authorjihoon.chung <jihoon.chung@samsung.com>
Thu, 23 Aug 2012 23:29:15 +0000 (08:29 +0900)
committerjihoon.chung <jihoon.chung@samsung.com>
Thu, 23 Aug 2012 23:29:15 +0000 (08:29 +0900)
13 files changed:
debian/changelog
packaging/wrt-installer.spec
src/CMakeLists.txt
src/configuration_parser/WidgetConfigurationManager.cpp
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_ace_check.cpp
src/jobs/widget_install/task_certify.cpp
src/jobs/widget_install/task_db_update.cpp
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_manifest_file.h
src/jobs/widget_install/task_widget_config.cpp
src/jobs/widget_install/widget_install_context.h
src/pkg-manager/backendlib.cpp

index dd41db1..c5bc347 100644 (file)
@@ -1,3 +1,14 @@
+wrt-installer (0.0.52) unstable; urgency=low
+
+  * [Engine] Support execution of backend library on multiple threads
+  * [Installer] Code cleanup - desktop file
+  * [Engine] bugfix of browser installation and support shortcut for webapp from browser
+
+  * Git : slp/pkgs/w/wrt-installer
+  * Tag : wrt-installer_0.0.52
+
+ -- Jihoon Chung <jihoon.chung@samsung.com>  Thu, 23 Aug 2012 16:26:22 +0900
+
 wrt-installer (0.0.51) unstable; urgency=low
 
   * Fix for typo in help message
@@ -6,6 +17,7 @@ wrt-installer (0.0.51) unstable; urgency=low
 
   * Git : slp/pkgs/w/wrt-installer
   * Tag : wrt-installer_0.0.51
+
  -- Jihoon Chung <jihoon.chung@samsung.com>  Mon, 13 Aug 2012 16:09:11 +0900
 
 wrt-installer (0.0.50) unstable; urgency=low
index e58d596..7ccdfbe 100644 (file)
@@ -1,7 +1,7 @@
-#sbs-git:slp/pkgs/w/wrt-installer wrt-installer 0.0.51
+#sbs-git:slp/pkgs/w/wrt-installer wrt-installer 0.0.52
 Name:       wrt-installer
 Summary:    Installer for tizen Webruntime
-Version:    0.0.51
+Version:    0.0.52
 Release:    1
 Group:      Development/Libraries
 License:    Apache License, Version 2.0
@@ -34,6 +34,7 @@ BuildRequires:  pkgconfig(cert-svc)
 BuildRequires:  pkgconfig(utilX)
 BuildRequires:  pkgconfig(wrt-plugins-types)
 BuildRequires:  pkgconfig(tapi)
+BuildRequires:  pkgconfig(shortcut)
 
 %description
 Description: Wrt Installer for Tizen apps and Wac apps
index 9880190..42f35a5 100755 (executable)
@@ -118,6 +118,7 @@ PKG_CHECK_MODULES(INSTALLER_STATIC_DEP
     pkgmgr-installer
     pkgmgr-parser
     tapi
+    shortcut
     REQUIRED
     )
 
index 1373329..54b458c 100644 (file)
@@ -58,83 +58,111 @@ bool WidgetConfigurationManager::locateAndParseConfigurationFile(
         return false;
     }
 
-    //TODO: use DPL::String in the caller to this function too.
-    DPL::String currentPath = DPL::FromUTF8String(_currentPath);
+    ConfigParserData& configInfo = pWidgetConfigInfo.configInfo;
 
-    if (currentPath.empty() || baseFolder.empty()) {
-        *pErrCode = WRT_ERR_INVALID_ARG;
-        return false;
-    }
+    // check if this installation from browser, or not.
+    size_t pos = _currentPath.rfind("/");
+    std::ostringstream infoPath;
+    infoPath << _currentPath.substr(pos+1);
 
-    //TODO: rewrite this madness
-    char cfgAbsPath[MAX_WIDGET_PATH_SIZE + 1] = { 0 };
-    DIR* dir = NULL;
-    struct dirent* ptr = NULL;
+    ParserRunner parser;
     std::string language = "";
 
-    dir = opendir(_currentPath.c_str());
-    if (dir == NULL) {
-        *pErrCode = WRT_ERR_UNKNOWN;
-        return false;
-    }
+    if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) {
+        // in case of general installation using wgt archive
+        //TODO: use DPL::String in the caller to this function too.
+        DPL::String currentPath = DPL::FromUTF8String(_currentPath);
 
-    ConfigParserData& configInfo = pWidgetConfigInfo.configInfo;
+        if (currentPath.empty() || baseFolder.empty()) {
+            *pErrCode = WRT_ERR_INVALID_ARG;
+            return false;
+        }
 
-    //TODO why don't we use fopen here
-    bool has_config_xml = false;
-    errno = 0;
-    while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
-        if (ptr->d_type == DT_REG) {
-            if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
-                _WrtUtilSetAbsolutePath(cfgAbsPath,
-                                        _currentPath.c_str(), ptr->d_name);
-                //Parse widget configuration file
-                LogDebug("Found config: " << cfgAbsPath);
-                ParserRunner parser;
-
-                Try
-                {
-                    parser.Parse(cfgAbsPath, ElementParserPtr(new
-                                                              RootParser<
-                                                                  WidgetParser>(
-                                                                  configInfo,
-                                                                  DPL
-                                                                      ::
-                                                                      FromUTF32String(
-                                                                      L"widget"))));
-                }
-                Catch(ElementParser::Exception::Base)
-                {
-                    LogDebug("Invalid widget configuration file!");
-                    //                    _rethrown_exception.Dump();
-                    *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-                    closedir(dir);
-                    return false;
-                }
+        //TODO: rewrite this madness
+        char cfgAbsPath[MAX_WIDGET_PATH_SIZE + 1] = { 0 };
+        DIR* dir = NULL;
+        struct dirent* ptr = NULL;
 
-                //
-                //                WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance();
-                //                if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
-                //                    LogDebug("Invalid widget configuration file!");
-                //                    *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-                //                    closedir(dir);
-                //                    return false;
-                //                }
-
-                has_config_xml = true;
-                break;
+        dir = opendir(_currentPath.c_str());
+        if (dir == NULL) {
+            *pErrCode = WRT_ERR_UNKNOWN;
+            return false;
+        }
+
+        //TODO why don't we use fopen here
+        bool has_config_xml = false;
+        errno = 0;
+        while ((ptr = readdir(dir)) != NULL) { //Find configuration file, based on its name
+            if (ptr->d_type == DT_REG) {
+                if (!strcmp(ptr->d_name, WRT_WIDGET_CONFIG_FILE_NAME)) {
+                    _WrtUtilSetAbsolutePath(cfgAbsPath,
+                                            _currentPath.c_str(), ptr->d_name);
+                    //Parse widget configuration file
+                    LogDebug("Found config: " << cfgAbsPath);
+
+                    Try
+                    {
+                        parser.Parse(cfgAbsPath, ElementParserPtr(new
+                                                                  RootParser<
+                                                                      WidgetParser>(
+                                                                      configInfo,
+                                                                      DPL
+                                                                          ::
+                                                                          FromUTF32String(
+                                                                          L"widget"))));
+                    }
+                    Catch(ElementParser::Exception::Base)
+                    {
+                        LogDebug("Invalid widget configuration file!");
+                        //                    _rethrown_exception.Dump();
+                        *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+                        closedir(dir);
+                        return false;
+                    }
+
+                    //
+                    //                WidgetConfigurationParser & parser = WidgetConfigurationParserSingleton::Instance();
+                    //                if (!parser.parseConfigurationFile(cfgAbsPath, configInfo, baseFolder.c_str(), pWidgetConfigInfo.signature_type)) {
+                    //                    LogDebug("Invalid widget configuration file!");
+                    //                    *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+                    //                    closedir(dir);
+                    //                    return false;
+                    //                }
+
+                    has_config_xml = true;
+                    break;
+                }
             }
         }
-    }
-    closedir(dir);
+        closedir(dir);
 
-    //We must have config.xml so leaveing if we doesn't
-    if (!has_config_xml) {
-        LogDebug("Invalid archive");
-        *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
-        return false;
+        //We must have config.xml so leaveing if we doesn't
+        if (!has_config_xml) {
+            LogDebug("Invalid archive");
+            *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+            return false;
+        }
+    } else {
+        // in case of browser installation
+        Try
+        {
+            parser.Parse(_currentPath, ElementParserPtr(new
+                                                      RootParser<
+                                                          WidgetParser>(
+                                                          configInfo,
+                                                          DPL::FromUTF32String(
+                                                              L"widget"))));
+        }
+        Catch(ElementParser::Exception::Base)
+        {
+            LogDebug("Invalid widget configuration file!");
+            //                    _rethrown_exception.Dump();
+            *pErrCode = WRT_WM_ERR_INVALID_ARCHIVE;
+            return false;
+        }
     }
 
+
     char *tmp_language;
     if (!_WrtUtilStringToLower(baseFolder.c_str(), &tmp_language)) {
         *pErrCode = WRT_ERR_UNKNOWN;
index 459c9aa..9dc31b0 100755 (executable)
@@ -126,8 +126,9 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
     m_exceptionCaught(Exceptions::Success)
 {
     // Check installation type (config.xml or widget.wgt)
-    bool fromBrowser = hasExtension(widgetPath, XML_EXTENSION);
-    LogInfo("Hosted app installation: " << fromBrowser);
+    m_installerContext.browserRequest = hasExtension(widgetPath, XML_EXTENSION);
+
+    LogInfo("Hosted app installation: " << m_installerContext.browserRequest);
 
     struct timeval tv;
     gettimeofday(&tv, NULL);
@@ -143,13 +144,15 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
 
     m_installerContext.widgetConfig.pType = checkPackageType(widgetPath);
 
-    ConfigParserData configData = getWidgetDataFromXML(widgetPath, fromBrowser,
+    ConfigParserData configData = getWidgetDataFromXML(widgetPath,
+            m_installerContext.browserRequest,
             m_installerContext.widgetConfig.pType);
     WidgetUpdateInfo update = detectWidgetUpdate(configData);
 
 
     // Configure installation
-    ConfigureResult result = ConfigureInstallation(widgetPath, fromBrowser, update);
+    ConfigureResult result = ConfigureInstallation(widgetPath,
+            m_installerContext.browserRequest, update);
     if (!setTizenId(configData)) {
         result = ConfigureResult::Failed;
     } else {
@@ -172,7 +175,7 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
         AddTask(new TaskRecovery(m_installerContext));
 
         // Create installation tasks
-        if (!fromBrowser) {
+        if (!m_installerContext.browserRequest) {
             AddTask(new TaskUnzip(m_installerContext));
         }
         AddTask(new TaskWidgetConfig(m_installerContext));
@@ -196,7 +199,7 @@ JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
         LogInfo("Configure installation updated");
         LogInfo("Widget Update");
 
-        if (!fromBrowser) {
+        if (!m_installerContext.browserRequest) {
             AddTask(new TaskUnzip(m_installerContext));
         }
         AddTask(new TaskWidgetConfig(m_installerContext));
index 1a86237..3962441 100644 (file)
@@ -95,6 +95,10 @@ void TaskAceCheck::StepAceCheck()
 
 void TaskAceCheck::StepProcessAceResponse()
 {
+    if (m_context.browserRequest) {
+        return;
+    }
+
     LogInfo("StepProcessAceResponse");
     m_context.featureLogic->next();
 
index a492f5b..2c2e7b5 100755 (executable)
@@ -173,7 +173,7 @@ void TaskCertify::processAuthorSignature(const SignatureData &data)
 
 void TaskCertify::stepSignature()
 {
-    Assert(!m_contextData.tempWidgetRoot.empty());
+    LogInfo("enter");
 
     std::string widgetPath = m_contextData.tempWidgetRoot + "/";
 
index 30679a6..99fb5e7 100644 (file)
@@ -173,9 +173,11 @@ void TaskDbUpdate::StepRenamePath()
                     "Error occurs during removing existing folder");
         }
 
-        if (rename(m_context.tempWidgetRoot.c_str(), instDir.str().c_str()) < 0) {
-            ThrowMsg(Exceptions::UnknownError,
-                    "Error occurs during renaming widget folder");
+        if (!m_context.browserRequest) {
+            if (rename(m_context.tempWidgetRoot.c_str(), instDir.str().c_str()) < 0) {
+                ThrowMsg(Exceptions::UnknownError,
+                        "Error occurs during renaming widget folder");
+            }
         }
     }
 
index 593c326..1d925c9 100644 (file)
@@ -24,8 +24,9 @@
 #include <string>
 #include <dpl/assert.h>
 #include <dirent.h>
-#include<fstream>
+#include <fstream>
 #include <ail.h>
+#include <shortcut/shortcut.h>
 
 //WRT INCLUDES
 #include <widget_install/task_manifest_file.h>
@@ -47,6 +48,8 @@
 #include <libxml_utils.h>
 #include <pkgmgr/pkgmgr_parser.h>
 
+#define DEFAULT_ICON_NAME   "icon.png"
+
 using namespace WrtDB;
 
 namespace {
@@ -99,22 +102,22 @@ TaskManifestFile::TaskManifestFile(InstallerContext &inCont) :
 {
     if (false == m_context.existingWidgetInfo.isExist) {
         AddStep(&TaskManifestFile::stepCopyIconFiles);
-        //AddStep(&TaskManifestFile::stepCreateDesktopFile);
+        AddStep(&TaskManifestFile::stepCreateExecFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
         AddStep(&TaskManifestFile::stepParseManifest);
-        AddStep(&TaskManifestFile::stepCreateExecFile);
+        if (m_context.browserRequest) {
+            AddStep(&TaskManifestFile::stepCreateShortcut);
+        }
         AddStep(&TaskManifestFile::stepFinalize);
     } else {
     // for widget update.
         AddStep(&TaskManifestFile::stepBackupIconFiles);
         AddStep(&TaskManifestFile::stepCopyIconFiles);
-        //AddStep(&TaskManifestFile::stepUpdateDesktopFile);
         AddStep(&TaskManifestFile::stepGenerateManifest);
         AddStep(&TaskManifestFile::stepParseUpgradedManifest);
         AddStep(&TaskManifestFile::stepUpdateFinalize);
 
         AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
-        //AddAbortStep(&TaskManifestFile::stepAbortDesktopFile);
     }
 }
 
@@ -122,32 +125,6 @@ TaskManifestFile::~TaskManifestFile()
 {
 }
 
-
-void TaskManifestFile::stepCreateDesktopFile()
-{
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    desktop_name << pkgname << ".desktop";
-    desktop_file << "/tmp/" << desktop_name.str();
-    LogInfo("desktop file : " << desktop_file.str());
-    std::ofstream file(desktop_file.str().c_str());
-
-    saveWidgetType(file);
-    saveWidgetExecPath(file);
-    saveWidgetName(file);
-    saveWidgetIcons(file);
-    saveWidgetVersion(file);
-    saveWidgetOtherInfo(file);
-    saveAppServiceInfo(file);
-
-    file.close();
-
-    moveDesktopFile();
-
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_CREATE_DESKTOP,
-        "Widget Desktop Creation Finished");
-}
-
 void TaskManifestFile::stepCreateExecFile()
 {
     //ln -s /usr/bin/wrt-client {widget-handle}
@@ -180,11 +157,12 @@ void TaskManifestFile::stepCopyIconFiles()
     if (pkgname.IsNull()) {
         ThrowMsg(Exceptions::InternalError, "No Package name exists.");
     }
-
     Assert(!!m_context.widgetHandle);
+
     WidgetDAOReadOnly dao(*m_context.widgetHandle);
     WidgetDAOReadOnly::WidgetLocalizedIconList locList = dao.getLocalizedIconList();
     WidgetDAOReadOnly::WidgetIconList list = dao.getIconList();
+
     FOREACH(it, locList)
     {
         DPL::String i = it->widgetLocale;
@@ -201,18 +179,27 @@ void TaskManifestFile::stepCopyIconFiles()
         std::ostringstream targetFile;
 
         if (!!src) {
-            sourceFile << GlobalConfig::GetUserInstalledWidgetPath() << "/";
-            sourceFile << pkgname << "/";
-            sourceFile << GlobalConfig::GetWidgetSrcPath() << "/";
-
-            targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
+            if (m_context.browserRequest) {
+                size_t pos = m_context.widgetSource.rfind("/");
+                sourceFile << m_context.widgetSource.substr(0, pos+1);
+            } else {
+                sourceFile << GlobalConfig::GetUserInstalledWidgetPath() << "/";
+                sourceFile << pkgname << "/";
+                sourceFile << GlobalConfig::GetWidgetSrcPath() << "/";
+            }
 
             if (!i.empty()) {
                 sourceFile << "locales/" << i << "/";
             }
+
             sourceFile << *src;
+
+            targetFile << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
             targetFile << getIconTargetFilename(i);
 
+            if (m_context.browserRequest) {
+                m_context.installedIconPath = targetFile.str();
+            }
         } else {
             //Use WRT default (not from the widget) only if widget default (not
             // localized) doesn't exist.
@@ -269,49 +256,49 @@ void TaskManifestFile::stepCopyIconFiles()
         "Widget iconfile copy Finished");
 }
 
-void TaskManifestFile::stepBackupIconFiles()
+void TaskManifestFile::stepCreateShortcut()
 {
-    LogDebug("Backup Icon Files");
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    desktop_name << pkgname << ".desktop";
+    LogInfo("create shortcut");
 
-    desktop_file << GlobalConfig::GetUserWidgetDesktopPath() << "/";
-    desktop_file << desktop_name.str();
+    WidgetDAOReadOnly dao(*m_context.widgetHandle);
+    LanguageTagsList languageTags(dao.getLanguageTags());
+    DPL::OptionalString name; 
+    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
 
-    backup_dir << GlobalConfig::GetUserInstalledWidgetPath();
-    backup_dir << "/" << m_context.widgetConfig.pkgname;
-    backup_dir << "/" << "backup" << "/";
+    FOREACH(i, languageTags)
+    {
+        name = dao.getLocalizedInfo(*i).name;
+        if (!name.IsNull()) {
+            LogInfo("found name: " << DPL::ToUTF8String(*name).c_str());
+            break;
+        }
+    }
 
-    backupIconFiles();
+    add_to_home_shortcut(DPL::ToUTF8String(*pkgname).c_str(),
+                         DPL::ToUTF8String(*name).c_str(),
+                         LAUNCH_BY_PACKAGE,
+                         DPL::ToUTF8String(*name).c_str(),
+                         m_context.installedIconPath.c_str(),
+                         NULL, NULL);
 
     m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_BACKUP_ICONFILE,
-        "New Widget icon file backup Finished");
+        InstallerContext::INSTALL_CREATE_SHORTCUT,
+        "shortcut creation Finished");
 }
 
-
-void TaskManifestFile::stepUpdateDesktopFile()
+void TaskManifestFile::stepBackupIconFiles()
 {
-    LogDebug("Update Desktop File");
-    backupDesktopFile();
-
-    std::ofstream file(desktop_file.str().c_str(), std::ios::trunc);
-
-    saveWidgetType(file);
-    saveWidgetExecPath(file);
-    saveWidgetName(file);
-    saveWidgetIcons(file);
-    saveWidgetVersion(file);
-    saveWidgetOtherInfo(file);
-    saveAppServiceInfo(file);
+    LogDebug("Backup Icon Files");
 
-    file.close();
+    backup_dir << GlobalConfig::GetUserInstalledWidgetPath();
+    backup_dir << "/" << m_context.widgetConfig.pkgname;
+    backup_dir << "/" << "backup" << "/";
 
-    updateAilInfo();
+    backupIconFiles();
 
     m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_UPDATE_DESKTOP,
-        "New Widget desktop file update Finished");
+        InstallerContext::INSTALL_BACKUP_ICONFILE,
+        "New Widget icon file backup Finished");
 }
 
 void TaskManifestFile::stepAbortIconFiles()
@@ -368,221 +355,6 @@ void TaskManifestFile::stepUpdateFinalize()
     LogDebug("Finished Update Desktopfile");
 }
 
-void TaskManifestFile::stepAbortDesktopFile()
-{
-    LogDebug("Abort desktop backup ");
-
-    std::ifstream backupFile(bp_desktop_file.str().c_str());
-    std::ofstream file(desktop_file.str().c_str(), std::ios::trunc);
-
-    while(!backupFile.eof()) {
-        char contents[256] = {0, };
-
-        backupFile.getline(contents, sizeof(contents));
-        file << contents << std::endl;
-    }
-    backupFile.close();
-    file.close();
-
-    updateAilInfo();
-
-    m_context.job->UpdateProgress(
-        InstallerContext::INSTALL_UPDATE_DESKTOP,
-        "New Widget desktop file update Finished");
-}
-
-void TaskManifestFile::moveDesktopFile()
-{
-    std::ostringstream destFile;
-    destFile << GlobalConfig::GetUserWidgetDesktopPath() << "/";
-    destFile << desktop_name.str();
-    LogInfo("cp " << desktop_file.str() << " " << destFile.str());
-    Try
-    {
-        DPL::FileInput input(desktop_file.str());
-        DPL::FileOutput output(destFile.str());
-        DPL::Copy(&input, &output);
-    }
-
-    Catch(DPL::FileInput::Exception::Base)
-    {
-        // Error while opening or closing source file
-        //        ReThrowMsg(InstallerException::CopyIconFailed,
-        //                   desktop_file.str());
-        LogError(
-            "Creating Desktop File Failed. Widget's icon will not be available"\
-            "from Main Screen");
-    }
-
-    Catch(DPL::FileOutput::Exception::Base)
-    {
-        // Error while opening or closing target file
-        //        ReThrowMsg(InstallerException::CopyIconFailed,
-        //                   destFile.str());
-        LogError(
-            "Creating Desktop File Failed. Widget's icon will not be available"\
-            "from Main Screen");
-    }
-
-    Catch(DPL::CopyFailed)
-    {
-        // Error while copying
-        //        ReThrowMsg(InstallerException::CopyIconFailed,
-        //                   destFile.str());
-        LogError(
-            "Creating Desktop File Failed. Widget's icon will not be available"\
-            "from Main Screen");
-    }
-
-    updateAilInfo();
-
-    //removing temp file
-    unlink(desktop_file.str().c_str());
-}
-
-void TaskManifestFile::saveWidgetType(std::ofstream &file)
-{
-    file << "Type=" << "Application" << std::endl;
-}
-
-void TaskManifestFile::saveWidgetExecPath(std::ofstream &file)
-{
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
-
-    file << "Exec=";
-    file << GlobalConfig::GetUserInstalledWidgetPath() << "/";
-    file << pkgname << "/";
-    file << GlobalConfig::GetUserWidgetExecPath() << "/";
-    file << m_context.widgetHandle << std::endl;
-}
-
-void TaskManifestFile::saveWidgetVersion(std::ofstream &file)
-{
-    DPL::OptionalString widget_version = m_context.widgetConfig.version;
-    file << "Version=" << widget_version << std::endl;
-}
-
-void TaskManifestFile::saveWidgetName(std::ofstream &file)
-{
-    Assert(!!m_context.widgetHandle);
-    WidgetDAOReadOnly dao(*m_context.widgetHandle);
-    LanguageTagsList languageTags(dao.getLanguageTags());
-    bool defaultNameSaved = false;
-    auto generateWidgetName = [&] (const DPL::OptionalString& tag,
-                                   const DPL::OptionalString& language)
-    {
-        DPL::OptionalString name = dao.getLocalizedInfo(*language).name;
-        if (!!name) {
-            if (!!tag)
-            {
-                saveLocalizedKey(file, L"Name", *tag);
-            }
-            else
-            {
-                file << "Name=";
-                defaultNameSaved = true;
-            }
-            file << *name;
-            file << std::endl;
-        }
-    };
-
-    FOREACH(i, languageTags)
-    {
-        DPL::OptionalString tag = getLangTag(*i);// translate en -> en_US etc
-        if (tag.IsNull()) { tag = *i; }
-
-        generateWidgetName(tag, *i);
-
-    }
-    DPL::OptionalString defaultLocale = dao.getDefaultlocale();
-    if (!!defaultLocale && !defaultNameSaved)
-    {
-        generateWidgetName(DPL::OptionalString::Null, *defaultLocale);
-    }
-}
-
-void TaskManifestFile::saveWidgetIcons(std::ofstream &file)
-{
-    DPL::OptionalString pkgname = m_context.widgetConfig.pkgname;
-    if (pkgname.IsNull()) {
-        ThrowMsg(Exceptions::InternalError, "No Package name exists.");
-    }
-
-    //TODO this file will need to be updated when user locale preferences
-    //changes.
-    Assert(!!m_context.widgetHandle);
-    WidgetDAOReadOnly dao(*m_context.widgetHandle);
-
-    WidgetDAOReadOnly::WidgetLocalizedIconList locList = dao.getLocalizedIconList();
-    WidgetDAOReadOnly::WidgetIconList list = dao.getIconList();
-
-    LanguageTagsList languageTags(dao.getLanguageTags());
-    bool defaultIconSaved = false;
-
-
-    auto generateWidgetIcon = [&] (const DPL::OptionalString& tag,
-                                   const DPL::String& language,
-                                   int iconId)
-    {
-        if (!!tag)
-        {
-            saveLocalizedKey(file, L"Icon", *tag);
-        }
-        else
-        {
-            file << "Icon=";
-            defaultIconSaved = true;
-        }
-
-        DPL::OptionalString src;
-        FOREACH(icon, list)
-        {
-            if (icon->iconId == iconId) {
-                src = icon->iconSrc;
-            }
-        }
-        if (!!src) {
-            //If menuscreen need use absolute path of widget's icon, comment out
-            //the following lines.
-
-            file << GlobalConfig::GetUserWidgetDesktopIconPath() << "/";
-            file << getIconTargetFilename(language) << std::endl;
-        }
-    };
-
-    FOREACH(it, locList)
-    {
-        DPL::String i = it->widgetLocale;
-        DPL::OptionalString tag = getLangTag(i); // translate en -> en_US etc
-        if (tag.IsNull()) { tag = i; }
-
-        generateWidgetIcon(tag, i, it->iconId);
-
-    }
-    DPL::OptionalString defaultLocale = dao.getDefaultlocale();
-    if (!!defaultLocale && !defaultIconSaved)
-    {
-        int iconId = -1;
-        FOREACH(it, locList)
-        {
-            if (it->widgetLocale == *defaultLocale)
-            {
-                iconId = it->iconId;
-            }
-        }
-        if (-1 != iconId)
-        {
-            generateWidgetIcon(DPL::OptionalString::Null,
-                               DPL::String(),
-                               iconId);
-        }
-    }
-}
-
 DPL::String TaskManifestFile::getIconTargetFilename(
         const DPL::String& languageTag) const
 {
@@ -611,63 +383,6 @@ DPL::String TaskManifestFile::getIconTargetFilename(
     return filename.str();
 }
 
-void TaskManifestFile::saveWidgetOtherInfo(std::ofstream &file)
-{
-    DPL::Optional<DPL::String> widgetID = m_context.widgetConfig.guid;
-
-    //    /* network */
-    //    strncat(desktop, format_network, strlen(format_network));
-    //    //TODO -- get the network value from the widget
-    //    strncat(desktop, "True", 4);
-    //    strncat(desktop, line, strlen(line));
-
-    /* Comment */
-    file << "Comment=Widget application" << std::endl;
-
-    /* bg_schedule */
-    //file << "BG_SCHEDULE=True" << std::endl;
-
-    /* visible */
-    file << "nodisplay=FALSE" << std::endl;
-
-    file << "X-TIZEN-PackageType=wgt" << std::endl;
-    if (!widgetID.IsNull()) {
-        file << "X-TIZEN-PackageID=" << DPL::ToUTF8String(*widgetID).c_str() << std::endl;
-    }
-}
-
-void TaskManifestFile::saveAppServiceInfo(std::ofstream &file)
-{
-    Assert(!!m_context.widgetHandle);
-    WidgetDAOReadOnly dao(*m_context.widgetHandle);
-    WidgetApplicationServiceList appServiceList;
-    dao.getAppServiceList(appServiceList);
-
-    if (appServiceList.empty()) {
-        LogInfo("Widget doesn't contain application service");
-        return;
-    }
-
-    // x-tizen-svc=http://tizen.org/appsvc/operation/pick|NULL|image;
-    file << "X-TIZEN-SVC=";
-    FOREACH(it, appServiceList) {
-        if (appServiceList.begin() != it) {
-            file << ";";
-        }
-        file << DPL::ToUTF8String(it->operation).c_str() << "|";
-        if (it->scheme.empty()) {
-            file << "NULL" << "|";
-        } else {
-            file << DPL::ToUTF8String(it->scheme).c_str() << "|";
-        }
-        if (it->mime.empty()) {
-            file << "NULL";
-        } else {
-            file << DPL::ToUTF8String(it->mime).c_str();
-        }
-    }
-}
-
 void TaskManifestFile::stepFinalize()
 {
     LogInfo("Finished ManifestFile step");
@@ -767,40 +482,6 @@ void TaskManifestFile::backupIconFiles()
     }
 }
 
-void TaskManifestFile::backupDesktopFile()
-{
-    LogInfo("Backup Desktop File");
-
-    std::ostringstream b_desktop_dir;
-    b_desktop_dir << backup_dir.str() <<  "desktop";
-
-    LogDebug("Create desktop file backup folder : " << b_desktop_dir.str());
-    _WrtMakeDir(b_desktop_dir.str().c_str(), 0755, WRT_FILEUTILS_RECUR);
-
-    bp_desktop_file << b_desktop_dir.str() << "/" << desktop_name.str();
-
-    Try
-    {
-        DPL::FileInput input(desktop_file.str());
-        DPL::FileOutput output(bp_desktop_file.str());
-        DPL::Copy(&input, &output);
-    }
-
-    Catch(DPL::FileInput::Exception::Base)
-    {
-        ReThrowMsg(Exceptions::BackupFailed, desktop_file.str());
-    }
-
-    Catch(DPL::FileOutput::Exception::Base)
-    {
-        ReThrowMsg(Exceptions::BackupFailed, bp_desktop_file.str());
-    }
-    Catch(DPL::CopyFailed)
-    {
-        ReThrowMsg(Exceptions::BackupFailed, bp_desktop_file.str());
-    }
-}
-
 void TaskManifestFile::getFileList(const char* path,
         std::list<std::string> &list)
 {
index 109812b..c93cf54 100644 (file)
@@ -61,26 +61,21 @@ class TaskManifestFile :
 
     //TODO stepAbort
     //steps
-    void stepCreateDesktopFile();
     void stepCreateExecFile();
     void stepFinalize();
     void stepCopyIconFiles();
+    void stepCreateShortcut();
     void stepGenerateManifest();
     void stepParseManifest();
     void stepParseUpgradedManifest();
 
     //For widget update
     void stepBackupIconFiles();
-    void stepUpdateDesktopFile();
     void stepUpdateFinalize();
 
     void stepAbortIconFiles();
-    void stepAbortDesktopFile();
 
     //private data
-    std::ostringstream desktop_name;
-    std::ostringstream desktop_file;
-    std::ostringstream bp_desktop_file;
     std::list<std::string> icon_list;
     std::ostringstream backup_dir;
     xmlTextWriterPtr writer;
@@ -88,14 +83,6 @@ class TaskManifestFile :
     DPL::String manifest_file;
 
     //private methods
-    void moveDesktopFile();
-    void saveWidgetType(std::ofstream &file);
-    void saveWidgetExecPath(std::ofstream &file);
-    void saveWidgetName(std::ofstream &file);
-    void saveWidgetIcons(std::ofstream &file);
-    void saveWidgetVersion(std::ofstream &file);
-    void saveWidgetOtherInfo(std::ofstream &file);
-    void saveAppServiceInfo(std::ofstream &file);
     void updateAilInfo();
 
     void writeManifest(const DPL::String & path);
@@ -113,7 +100,6 @@ class TaskManifestFile :
     void generateWidgetIcon(UiApplication & uiApp, const DPL::OptionalString& tag, const DPL::String& language, int iconId, const WrtDB::WidgetDAOReadOnly::WidgetIconList & list, bool & defaultIconSaved);
 
     //for widget update
-    void backupDesktopFile();
     void backupIconFiles();
     void getFileList(const char* path, std::list<std::string> &list);
 
index de2109f..c86edaf 100755 (executable)
@@ -80,9 +80,17 @@ void TaskWidgetConfig::StepProcessConfigurationFile()
 {
     Try
     {
+        std::string path;
+        LogInfo("path: " << m_installContext.tempWidgetRoot);
+        if (m_installContext.browserRequest) {
+            path = m_installContext.widgetSource;
+        } else {
+            path = m_installContext.tempWidgetRoot;
+        }
+
         WidgetConfigurationManagerSingleton::Instance().processFile(
-                m_installContext.tempWidgetRoot,
-                m_installContext.widgetConfig);
+            path,
+            m_installContext.widgetConfig);
     }
     Catch(WidgetConfigurationManager::Exception::ProcessFailed)
     {
@@ -283,6 +291,7 @@ void TaskWidgetConfig::ProcessLocalizedIcons()
 
 void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
 {
+    LogInfo("enter");
     bool isAnyIconValid = false;
     //In case a default filename is passed as custom filename in config.xml, we
     //need to keep a set of already processed filenames to avoid icon duplication
@@ -305,8 +314,18 @@ void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
         }
 
         DPL::String relativePath = pathPrefix + icon.src;
-        DPL::String absolutePath = DPL::FromUTF8String(
-                m_installContext.tempWidgetRoot) + L"/" + relativePath;
+        DPL::String absolutePath;
+
+        if (m_installContext.browserRequest) {
+            // in case of browser installation
+            size_t pos = m_installContext.widgetSource.rfind("/");
+            absolutePath = DPL::FromUTF8String(
+                            m_installContext.widgetSource.substr(0, pos));
+        } else {
+            absolutePath = DPL::FromUTF8String(
+                            m_installContext.tempWidgetRoot);
+        }
+        absolutePath += L"/" + relativePath;
 
         if (FileUtils::FileExists(absolutePath)) {
             DPL::String type = MimeTypeUtils::identifyFileMimeType(absolutePath);
index 8fe594a..086735c 100755 (executable)
@@ -70,10 +70,11 @@ struct InstallerContext
         INSTALL_ACE_CHECK,
         INSTALL_SMACK_ENABLE,
         INSTALL_BACKUP_ICONFILE,                         /* For Update */
-        INSTALL_CREATE_MANIFEST,
         INSTALL_COPY_ICONFILE,
-        INSTALL_CREATE_DESKTOP,
         INSTALL_CREATE_EXECFILE,
+        INSTALL_CREATE_MANIFEST,
+        INSTALL_CREATE_DESKTOP,
+        INSTALL_CREATE_SHORTCUT,
         INSTALL_INSTALL_OSPSVC,
 
         INSTALL_UPDATE_DESKTOP = INSTALL_CREATE_DESKTOP, /* For Update */
@@ -93,6 +94,8 @@ struct InstallerContext
     // Installation state variables
     std::string widgetSource;           ///< Source widget zip file/widget url
     std::string tempWidgetPath;           ///< Unpacked widget temporary path
+    bool browserRequest;                ///< Browser Request
+    std::string installedIconPath;                ///< Installed icon path
     WrtDB::WidgetRegisterInfo widgetConfig;      ///< WidgetConfigInfo
     DPL::Optional<WrtDB::DbWidgetHandle> widgetHandle;
     Jobs::WidgetInstall::WacSecurity wacSecurity;///< Widget Domain information.
index a9ac170..372ffbd 100644 (file)
@@ -50,22 +50,6 @@ extern "C"
 {
 #endif
 
-class DatabaseConnection
-{
-  public:
-    void AttachDatabase()
-    {
-        WrtDB::WrtDatabase::attachToThreadRO();
-    }
-
-    void DetachDatabase()
-    {
-        WrtDB::WrtDatabase::detachFromThread();
-    }
-};
-
-static DPL::ScopedPtr<DatabaseConnection> g_databaseConnection;
-
 static void pkg_native_plugin_on_unload();
 static int pkg_plugin_app_is_installed(const char *pkg_name);
 static int pkg_plugin_get_installed_apps_list(const char *category,
@@ -75,22 +59,6 @@ static int pkg_plugin_get_app_detail_info(const char *pkg_name,
 static int pkg_plugin_get_app_detail_info_from_package(const char *pkg_path,
         package_manager_pkg_detail_info_t *pkg_detail_info);
 
-static int is_connected()
-{
-    if (NULL == g_databaseConnection) {
-        Try {
-            g_databaseConnection.Reset(new DatabaseConnection());
-            g_databaseConnection->AttachDatabase();
-        }
-        Catch (DPL::DB::SqlConnection::Exception::Base) {
-            LogDebug("Fail to connect DB");
-            return FALSE;
-        }
-    }
-
-    return TRUE;
-}
-
 static void pkg_native_plugin_on_unload()
 {
     LogDebug("pkg_native_plugin_unload() is called");
@@ -100,23 +68,17 @@ static int pkg_plugin_app_is_installed(const char *pkg_name)
 {
     LogDebug("pkg_plugin_app_is_installed() is called");
 
-    if (FALSE == is_connected()) {
-        LogError("Fail DB Connect");
-        return FALSE;
-    }
+    WrtDB::WrtDatabase::attachToThreadRO();
 
-    Try {
-        if (WidgetDAOReadOnly::isWidgetInstalled(
-                DPL::FromUTF8String(pkg_name))) {
-            return TRUE;
-        }
-    } Catch(DPL::DB::SqlConnection::Exception::Base) {
-        LogDebug("Databas Error");
+    bool result = WidgetDAOReadOnly::isWidgetInstalled(
+                    DPL::FromUTF8String(pkg_name));
+    WrtDB::WrtDatabase::detachFromThread();
+
+    if (result) {
+        return TRUE;
+    } else {
         return FALSE;
     }
-
-    LogDebug("Widget Not Found");
-    return FALSE;
 }
 
 static int pkg_plugin_get_installed_apps_list(const char * /*category*/,
@@ -127,55 +89,48 @@ static int pkg_plugin_get_installed_apps_list(const char * /*category*/,
     package_manager_pkg_info_t *pkg_list = NULL;
     package_manager_pkg_info_t *pkg_last = NULL;
 
-    Try {
-        if (FALSE == is_connected()) {
-            LogError("Fail DB Connect");
+
+    WrtDB::WrtDatabase::attachToThreadRO();
+    WidgetHandleList hndlList = WidgetDAOReadOnly::getHandleList();
+    *count = 0;
+
+    FOREACH(iterator, hndlList) {
+        package_manager_pkg_info_t *pkg_info =
+            static_cast<package_manager_pkg_info_t*>
+            (malloc(sizeof(package_manager_pkg_info_t)));
+        if (NULL == pkg_info) {
+            LogError("Error in malloc");
             return FALSE;
         }
 
-        WidgetHandleList hndlList = WidgetDAOReadOnly::getHandleList();
-        *count = 0;
-
-        FOREACH(iterator, hndlList) {
-            package_manager_pkg_info_t *pkg_info =
-                static_cast<package_manager_pkg_info_t*>
-                (malloc(sizeof(package_manager_pkg_info_t)));
-            if (NULL == pkg_info) {
-                LogError("Error in malloc");
-                return FALSE;
-            }
-
-            if (NULL == pkg_list) {
-                pkg_list = pkg_info;
-                pkg_last = pkg_info;
-            } else {
-                pkg_last->next = pkg_info;
-            }
-
-            WidgetDAOReadOnly widget(*iterator);
-            DPL::Optional<DPL::String> pkgname = widget.getPkgname();
-            strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
-            if(!pkgname.IsNull()) {
-                snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s",
-                        DPL::ToUTF8String(*pkgname).c_str());
-            }
-
-            DPL::Optional<DPL::String> version = widget.getVersion();
-            if (!version.IsNull()) {
-                strncpy(pkg_info->version,
-                        DPL::ToUTF8String(*version).c_str(),
-                        PKG_VERSION_STRING_LEN_MAX);
-            }
-
-            (*count)++;
+        if (NULL == pkg_list) {
+            pkg_list = pkg_info;
             pkg_last = pkg_info;
+        } else {
+            pkg_last->next = pkg_info;
         }
-        *list = pkg_list;
-    }
-    Catch (WidgetDAOReadOnly::Exception::DatabaseError) {
-        LogError("Database Error");
-        return FALSE;
+
+        WidgetDAOReadOnly widget(*iterator);
+        DPL::Optional<DPL::String> pkgname = widget.getPkgname();
+        strncpy(pkg_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
+        if(!pkgname.IsNull()) {
+            snprintf(pkg_info->pkg_name, PKG_NAME_STRING_LEN_MAX, "%s",
+                    DPL::ToUTF8String(*pkgname).c_str());
+        }
+
+        DPL::Optional<DPL::String> version = widget.getVersion();
+        if (!version.IsNull()) {
+            strncpy(pkg_info->version,
+                    DPL::ToUTF8String(*version).c_str(),
+                    PKG_VERSION_STRING_LEN_MAX);
+        }
+
+        (*count)++;
+        pkg_last = pkg_info;
     }
+    *list = pkg_list;
+    WrtDB::WrtDatabase::detachFromThread();
+
     return TRUE;
 }
 
@@ -184,73 +139,66 @@ static int pkg_plugin_get_app_detail_info(const char *pkg_name,
 {
     LogDebug("pkg_plugin_get_app_detail_info() is called");
 
-    Try {
-        if (FALSE == is_connected()) {
-            LogError("Fail DB Connect");
-            return FALSE;
-        }
-
-        int handle = WidgetDAOReadOnly::getHandle(
-                        DPL::FromUTF8String(pkg_name));
-        WidgetDAOReadOnly widget(handle);
 
-        DPL::Optional<DPL::String> version = widget.getVersion();
-        DPL::Optional<DPL::String> id = widget.getGUID();
-        DPL::Optional<DPL::String> locale = widget.getDefaultlocale();
+    WrtDB::WrtDatabase::attachToThreadRO();
+    int handle = WidgetDAOReadOnly::getHandle(
+                    DPL::FromUTF8String(pkg_name));
+    WidgetDAOReadOnly widget(handle);
 
-        if (!version.IsNull()) {
-            strncpy(pkg_detail_info->version,
-                    DPL::ToUTF8String(*version).c_str(),
-                    PKG_VERSION_STRING_LEN_MAX);
-        }
-        snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%d",
-               handle);
-        WidgetLocalizedInfo localizedInfo;
-
-        if (locale.IsNull()) {
-            LogError("is NULL");
-            DPL::String languageTag(L"");
-            localizedInfo = widget.getLocalizedInfo(languageTag);
-        } else {
-            localizedInfo = widget.getLocalizedInfo(*locale);
-        }
-        DPL::Optional<DPL::String> desc(localizedInfo.description);
+    DPL::Optional<DPL::String> version = widget.getVersion();
+    DPL::Optional<DPL::String> id = widget.getGUID();
+    DPL::Optional<DPL::String> locale = widget.getDefaultlocale();
 
-        if (!desc.IsNull()) {
-            strncpy(pkg_detail_info->pkg_description,
-                    DPL::ToUTF8String(*desc).c_str(),
-                    PKG_VALUE_STRING_LEN_MAX);
-        }
-        strncpy(pkg_detail_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
-        strncpy(pkg_detail_info->pkg_name, pkg_name, PKG_NAME_STRING_LEN_MAX);
-
-        /* set installed time */
-        pkg_detail_info->installed_time = widget.getInstallTime();
-
-        /* set Widget size */
-        DPL::String pkgName = DPL::FromUTF8String(pkg_name);
-        std::string installPath = WidgetConfig::GetWidgetBasePath(pkgName);
-        std::string persistentPath =
-            WidgetConfig::GetWidgetPersistentStoragePath(pkgName);
-        std::string tempPath =
-            WidgetConfig::GetWidgetTemporaryStoragePath(pkgName);
-        installPath += "/";
-        tempPath += "/";
-        persistentPath += "/";
-
-        size_t installedSize = Utils::getFolderSize(installPath);
-        size_t persistentSize = Utils::getFolderSize(persistentPath);
-        size_t appSize = installedSize - persistentSize;
-        size_t dataSize = persistentSize + Utils::getFolderSize(tempPath);
-
-        pkg_detail_info->installed_size = GET_DIRECTORY_SIZE_KB(installedSize);
-        pkg_detail_info->app_size = GET_DIRECTORY_SIZE_KB(appSize);
-        pkg_detail_info->data_size = GET_DIRECTORY_SIZE_KB(dataSize);
+    if (!version.IsNull()) {
+        strncpy(pkg_detail_info->version,
+                DPL::ToUTF8String(*version).c_str(),
+                PKG_VERSION_STRING_LEN_MAX);
     }
-    Catch (WidgetDAOReadOnly::Exception::DatabaseError) {
-        LogError("Database Error");
-        return FALSE;
+    snprintf(pkg_detail_info->optional_id, PKG_NAME_STRING_LEN_MAX, "%d",
+           handle);
+    WidgetLocalizedInfo localizedInfo;
+
+    if (locale.IsNull()) {
+        LogError("is NULL");
+        DPL::String languageTag(L"");
+        localizedInfo = widget.getLocalizedInfo(languageTag);
+    } else {
+        localizedInfo = widget.getLocalizedInfo(*locale);
+    }
+    DPL::Optional<DPL::String> desc(localizedInfo.description);
+
+    if (!desc.IsNull()) {
+        strncpy(pkg_detail_info->pkg_description,
+                DPL::ToUTF8String(*desc).c_str(),
+                PKG_VALUE_STRING_LEN_MAX);
     }
+    strncpy(pkg_detail_info->pkg_type, "wgt", PKG_TYPE_STRING_LEN_MAX);
+    strncpy(pkg_detail_info->pkg_name, pkg_name, PKG_NAME_STRING_LEN_MAX);
+
+    /* set installed time */
+    pkg_detail_info->installed_time = widget.getInstallTime();
+
+    /* set Widget size */
+    DPL::String pkgName = DPL::FromUTF8String(pkg_name);
+    std::string installPath = WidgetConfig::GetWidgetBasePath(pkgName);
+    std::string persistentPath =
+        WidgetConfig::GetWidgetPersistentStoragePath(pkgName);
+    std::string tempPath =
+        WidgetConfig::GetWidgetTemporaryStoragePath(pkgName);
+    installPath += "/";
+    tempPath += "/";
+    persistentPath += "/";
+
+    size_t installedSize = Utils::getFolderSize(installPath);
+    size_t persistentSize = Utils::getFolderSize(persistentPath);
+    size_t appSize = installedSize - persistentSize;
+    size_t dataSize = persistentSize + Utils::getFolderSize(tempPath);
+
+    pkg_detail_info->installed_size = GET_DIRECTORY_SIZE_KB(installedSize);
+    pkg_detail_info->app_size = GET_DIRECTORY_SIZE_KB(appSize);
+    pkg_detail_info->data_size = GET_DIRECTORY_SIZE_KB(dataSize);
+
+    WrtDB::WrtDatabase::detachFromThread();
     return TRUE;
 }