Merge remote-tracking branch 'rsa/tizen_2.2' into tizen accepted/tizen/20131002.084346 accepted/tizen/20131002.170213 submit/tizen/20131002.075520
authorHoseon LEE <hoseon46.lee@samsung.com>
Tue, 1 Oct 2013 11:05:03 +0000 (20:05 +0900)
committerHoseon LEE <hoseon46.lee@samsung.com>
Tue, 1 Oct 2013 11:05:03 +0000 (20:05 +0900)
[Note] Rebase wrt-installer

Conflicts:
CMakeLists.txt
packaging/wrt-installer.spec
packaging/wrt-preinstall-widgets.service
src/CMakeLists.txt
src/configuration_parser/widget_parser.cpp
src/jobs/widget_install/job_widget_install.cpp
src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/task_database.h
src/jobs/widget_install/task_encrypt_resource.cpp
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_uninstall/task_db_update.cpp

Change-Id: I23162461f3032edf25dc91daa1077ac87ba0b55c

14 files changed:
1  2 
CMakeLists.txt
packaging/wrt-installer.spec
src/CMakeLists.txt
src/configuration_parser/widget_parser.cpp
src/jobs/widget_install/manifest.cpp
src/jobs/widget_install/manifest.h
src/jobs/widget_install/task_database.cpp
src/jobs/widget_install/task_database.h
src/jobs/widget_install/task_encrypt_resource.cpp
src/jobs/widget_install/task_install_ospsvc.cpp
src/jobs/widget_install/task_manifest_file.cpp
src/jobs/widget_install/task_smack.cpp
src/jobs/widget_uninstall/task_db_update.cpp
src/jobs/widget_uninstall/task_uninstall_ospsvc.cpp

diff --cc CMakeLists.txt
@@@ -40,11 -40,8 +40,13 @@@ OPTION(MULTIPROCESS_SERVICE_SUPPORT "Pr
  OPTION(MULTIPROCESS_SERVICE_SUPPORT_INLINE "Process per service - inline mode support" OFF)
  OPTION(CSP_SUPPORT "Support for csp policy" ON)
  OPTION(ALLOW_NAVIGATION_SUPPORT "Support for allow-navigation" ON)
 +OPTION(SMACK "Enable smack support" ON)
 +OPTION(DECRYPT_SUPPORT "Enable appmanager capabilities" ON)
 +IF(DECRYPT_SUPPORT)
 +    ADD_DEFINITIONS("-DDECRYPT")
 +ENDIF(DECRYPT_SUPPORT)
+ OPTION(SCHEMA_VALIDATION_SUPPORT "Support for XML schema validation" OFF)
  ############################# compiler flags ##################################
  
  SET(CMAKE_C_FLAGS_PROFILING    "-O2")
@@@ -92,10 -93,8 +98,10 @@@ ADD_DEFINITIONS("-Wextra"
  ADD_DEFINITIONS("-Wno-variadic-macros") # Inhibit variadic macros warnings (needed for ORM)
  ADD_DEFINITIONS("-Wno-deprecated")      # No warnings about deprecated features
  ADD_DEFINITIONS("-std=c++0x")           # accept C++11x standard
 -ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")  # enable smack
 +IF(SMACK)
-     ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")
++    ADD_DEFINITIONS("-DWRT_SMACK_ENABLED")  # enable smack
 +ENDIF(SMACK)
+ ADD_DEFINITIONS("-DWRT_INSTALLER_LOG")  # enable installer log
  
  ############################# Targets names ###################################
  
@@@ -1,14 -1,12 +1,14 @@@
 -#git:framework/web/wrt-installer
 +%bcond_with livebox
 +%bcond_with decrypt
  Name:       wrt-installer
  Summary:    Installer for tizen Webruntime
- Version:    0.1.58.2
+ Version:    0.1.128
  Release:    1
  Group:      Development/Libraries
 -License:    Apache License, Version 2.0
 -URL:        N/A
 +License:    Apache-2.0
  Source0:    %{name}-%{version}.tar.gz
 +Source100:  wrt-preinstall-widgets.service
 +Source1001:   wrt-installer.manifest
  BuildRequires:  cmake
  BuildRequires:  edje-tools
  BuildRequires:  pkgconfig(appsvc)
@@@ -37,19 -37,14 +39,16 @@@ BuildRequires:  pkgconfig(utilX
  BuildRequires:  pkgconfig(wrt-plugins-types)
  BuildRequires:  pkgconfig(tapi)
  BuildRequires:  pkgconfig(shortcut)
- BuildRequires:  pkgconfig(dpl-encryption)
  BuildRequires:  pkgconfig(capi-appfw-app-manager)
  BuildRequires:  pkgconfig(app2sd)
 +%if %{with livebox}
  BuildRequires:  pkgconfig(web-provider)
 +%endif
  BuildRequires:  pkgconfig(libprivilege-control)
  BuildRequires:  pkgconfig(libsmack)
- %if %{with decrypt}
- BuildRequires:  pkgconfig(osp-appfw)
- BuildRequires:  osp-appfw-internal-devel
- Requires: osp-appfw
- %endif
+ BuildRequires:  libss-client-devel
+ Requires: libss-client
+ Requires: osp-installer
  Requires: xmlsec1
  
  %description
@@@ -65,22 -59,16 +64,27 @@@ cp %{SOURCE1001} 
  %endif
  
  %build
+ %if 0%{?tizen_build_binary_release_type_eng}
+ export CFLAGS="$CFLAGS -DTIZEN_ENGINEER_MODE"
+ export CXXFLAGS="$CXXFLAGS -DTIZEN_ENGINEER_MODE"
+ export FFLAGS="$FFLAGS -DTIZEN_ENGINEER_MODE"
+ %endif
  
 -export LDFLAGS+="-Wl,--rpath=/usr/lib -Wl,--hash-style=both -Wl,--as-needed"
 +export LDFLAGS+="-Wl,--rpath=%{_libdir} -Wl,--hash-style=both -Wl,--as-needed"
  LDFLAGS="$LDFLAGS"
  
 -cmake . -DCMAKE_INSTALL_PREFIX=/usr \
 +%cmake . -DCMAKE_INSTALL_PREFIX=/usr \
 +%if %{with livebox}
 +        -DLIVEBOX_SUPPORT=On \
 +%else
 +        -DLIVEBOX_SUPPORT=Off \
 +%endif
 +%if %{with decrypt}
 +         -DDECRYPT_SUPPORT=On \
 +%else
 +         -DDECRYPT_SUPPORT=Off \
 +%endif
 +        -DSMACK=Off \
          -DDPL_LOG=ON \
          -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
          %{?WITH_TESTS:-DWITH_TESTS=%WITH_TESTS}
@@@ -112,8 -88,17 +104,16 @@@ rm -rf %{buildroot
  chmod +s /usr/bin/wrt-installer
  
  #symlink for package manager
- ln -sf /usr/bin/wrt-installer /etc/package-manager/backend/wgt
+ %define pkg_manager_backend_path "/usr/etc/package-manager/backend"
+ ln -sf /usr/bin/wrt-installer %{pkg_manager_backend_path}/wgt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/Wgt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/wGt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/wgT
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/WGt
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/wGT
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/WgT
+ ln -sf %{pkg_manager_backend_path}/wgt %{pkg_manager_backend_path}/WGT
  
 -
  #for booting recovery
  mkdir -p /opt/share/widget/temp_info
  
@@@ -123,15 -108,11 +123,12 @@@ mkdir -p /opt/share/icons/default/smal
  %postun -p /sbin/ldconfig
  
  %files
 -%manifest wrt-installer.manifest
 +%manifest %{name}.manifest
  %attr(755,root,root) %{_bindir}/wrt-installer
- /etc/package-manager/backendlib/libwgt.so
- %{_datadir}/license/%{name}
 +%{_unitdir}/graphical.target.wants/wrt-preinstall-widgets.service
- %{_unitdir}/wrt-preinstall-widgets.service
- /usr/bin/wrt_preinstall_widgets.sh
- %dir /opt/share/packages
- %dir /opt/usr/apps/.preinstallWidgets
+ /usr/etc/package-manager/backendlib/libwgt.so
+ %attr(644,root,root) /usr/etc/wrt-installer/*.xsd
+ %{_datadir}/license/%{name}
  %if %{with_tests}
      %attr(755,root,root) %{_bindir}/wrt-installer-tests-*
      /opt/share/widget/tests/installer/widgets/*
Simple merge
@@@ -1905,9 -2017,78 +2019,80 @@@ class AppWidgetParser : public ElementP
  
      virtual void Verify()
      {
 +#ifdef LIVEBOX
+         if (m_liveboxId.empty()) {
+             ThrowMsg(Exception::ParseError,
+                  "app-widget element must have id attribute");
+         }
+         else
+         {
+             pcrecpp::RE re(REGEXP_ID_STRING.c_str());
+             if (!re.FullMatch(DPL::ToUTF8String(m_liveboxId)))
+             {
+                 ThrowMsg(Exception::ParseError,
+                      "invalid format of app-widget id attribute");
+             }
+         }
+         if (m_primary.empty())
+         {
+             ThrowMsg(Exception::ParseError,
+                  "app-widget element must have primary attribute");
+         } else if (CheckIfNotTrueNorFalse(m_primary))
+         {
+             ThrowMsg(Exception::ParseError,
+                 "auto-launch attribute of app-widget element should be true or false - ignoring");
+         }
+         if (!m_autoLaunch.empty() &&
+                 CheckIfNotTrueNorFalse(m_autoLaunch))
+         {
+             ThrowMsg(Exception::ParseError,
+                 "auto-launch attribute of app-widget element should be true or false - ignoring");
+         }
+         if (!m_updatePeriod.empty())
+         {
+             char * endptr;
+             errno = 0;
+             std::string tempStr = DPL::ToUTF8String(m_updatePeriod);
+             //set standard locale to fix decimal point mark - '.'
+             std::string currentLocale = setlocale(LC_NUMERIC, NULL);
+             if (NULL == setlocale(LC_NUMERIC, "C"))
+                 _W("Failed to change locale to \"C\"");
+             double updatePeriod = strtod(tempStr.c_str(), &endptr);
+             //go back to previous locale
+             if (NULL == setlocale(LC_NUMERIC, currentLocale.c_str()))
+                 _W("Failed to set previous locale");
+             if ((errno == ERANGE && (updatePeriod == -HUGE_VAL || updatePeriod == HUGE_VAL))
+                     || *endptr != '\0') {
+                 ThrowMsg(Exception::ParseError,
+                     "update-period attribute of app-widget element should be a number - ignoring. current value: " << m_updatePeriod);
+             } else if (updatePeriod < 1800.0) {
+                 _D("update-period attribute of app-widget element shouldn't be less than 1800.0 - changed to 1800 from value: %ls", m_updatePeriod.c_str());
+                 m_updatePeriod = L"1800.0";
+             }
+         }
+         if (m_autoLaunch.empty()) {
+             m_autoLaunch = L"false";
+         }
+         if(m_livebox.m_label.empty()) {
+             ThrowMsg(Exception::ParseError,
+                 "box-label element of app-widget element not found - ignoring");
+         }
+         if(!m_boxContentFound) {
+             ThrowMsg(Exception::ParseError,
+                 "box-content element of app-widget element not found - ignoring");
+         }
          m_livebox.m_liveboxId = m_liveboxId;
 +#endif
          m_livebox.m_primary = m_primary;
          m_livebox.m_autoLaunch = m_autoLaunch;
          m_livebox.m_updatePeriod = m_updatePeriod;
      }
  
    private:
+     static std::string REGEXP_ID_STRING;
      ConfigParserData& m_data;
      ConfigParserData::LiveboxInfo m_livebox;
 +#ifdef LIVEBOX
      DPL::String m_liveboxId;
 +#endif
      DPL::String m_primary;
      DPL::String m_autoLaunch;
      DPL::String m_updatePeriod;
Simple merge
Simple merge
  #include <widget_install/job_widget_install.h>
  #include <widget_install/widget_install_errors.h>
  #include <widget_install/widget_install_context.h>
 +#ifdef LIVEBOX
  #include <web_provider_livebox_info.h>
 +#endif
  #include <dpl/wrt-dao-rw/widget_dao.h>
- #include <dpl/wrt-dao-ro/vconf_config.h>
  #include <dpl/foreach.h>
  #include <dpl/utils/wrt_utility.h>
- #include <dpl/log/log.h>
  #include <dpl/assert.h>
  #include <wrt-commons/security-origin-dao/security_origin_dao.h>
+ #include <wrt-commons/widget-interface-dao/widget_interface_dao.h>
+ #include <dpl/wrt-dao-ro/global_config.h>
  #include <dpl/wrt-dao-ro/widget_dao_types.h>
  #include <string>
  #include <sstream>
@@@ -62,13 -62,14 +64,16 @@@ TaskDatabase::TaskDatabase(InstallerCon
      AddStep(&TaskDatabase::StepWrtDBInsert);
      AddStep(&TaskDatabase::StepAceDBInsert);
      AddStep(&TaskDatabase::StepSecurityOriginDBInsert);
+     AddStep(&TaskDatabase::StepWidgetInterfaceDBInsert);
      AddStep(&TaskDatabase::StepRemoveExternalFiles);
-     AddStep(&TaskDatabase::StepCreateVconf);
 +#ifdef LIVEBOX
      AddStep(&TaskDatabase::StepLiveboxDBInsert);
 +#endif
+     AddStep(&TaskDatabase::EndStep);
      AddAbortStep(&TaskDatabase::StepAbortDBInsert);
      AddAbortStep(&TaskDatabase::StepAbortAceDBInsert);
+     AddAbortStep(&TaskDatabase::StepAbortWidgetInterfaceDBInsert);
  }
  
  void TaskDatabase::StepWrtDBInsert()
@@@ -321,12 -311,37 +315,38 @@@ void TaskDatabase::StepAbortAceDBInsert
  
      if (!AceApi::registerAceWidgetFromDB(m_handleToRemove))
      {
-         LogError("ace database restore failed");
+         _E("ace database restore failed");
+     }
+     _D("Ace data inserted");
+ }
+ void TaskDatabase::StepAbortWidgetInterfaceDBInsert()
+ {
+     _D("[DB Update Task] Widget interface Aborting...");
+     using namespace WidgetInterfaceDB;
+     using namespace WrtDB;
+     DbWidgetHandle handle =
+         WidgetDAOReadOnly::getHandle(m_context.widgetConfig.tzAppid);
+     std::string dbPath = WidgetInterfaceDAO::databaseFileName(handle);
+     // remove database
+     if (remove(dbPath.c_str()) != 0) {
+         _W("Fail to remove");
+     }
+     // rollback database
+     if (m_context.isUpdateMode) {
+         std::string backupDbPath = dbPath;
+         backupDbPath += GlobalConfig::GetBackupDatabaseSuffix();
+         _D("\"%s\" to \"%s\"", dbPath.c_str(), backupDbPath.c_str());
+         if (0 != std::rename(backupDbPath.c_str(), dbPath.c_str())) {
+             _W("Fail to rollback");
+         }
      }
-     LogDebug("Ace data inserted");
  }
  
 +#ifdef LIVEBOX
  void TaskDatabase::StepLiveboxDBInsert()
  {
      if (m_context.widgetConfig.configInfo.m_livebox.size() <= 0) {
                  autoLaunch, mouseEvent, pdFastOpen);
      }
  }
 +#endif // LIVEBOX
+ void TaskDatabase::StartStep()
+ {
+     _D("--------- <TaskDatabase> : START ----------");
+ }
+ void TaskDatabase::EndStep()
+ {
+     _D("--------- <TaskDatabase> : END ----------");
+ }
  } //namespace WidgetInstall
  } //namespace Jobs
@@@ -49,13 -49,16 +49,17 @@@ class TaskDatabase 
      void StepWrtDBInsert();
      void StepAceDBInsert();
      void StepSecurityOriginDBInsert();
+     void StepWidgetInterfaceDBInsert();
      void StepRemoveExternalFiles();
-     void StepCreateVconf();
 +#ifdef LIVEBOX
      void StepLiveboxDBInsert();
 -
 +#endif
      void StepAbortDBInsert();
      void StepAbortAceDBInsert();
+     void StepAbortWidgetInterfaceDBInsert();
+     void StartStep();
+     void EndStep();
  
    public:
      TaskDatabase(InstallerContext& context);
@@@ -168,64 -161,19 +161,21 @@@ void writeBytes(unsigned char* buffer, 
          }
      } while ((bytesWritten != bytesToWrite) && (EINTR == errno));
  }
 +#ifdef DECRYPT
  
- /*
-  * get encrypted string from trustzone
- */
- Tizen::Base::ByteBuffer* EncryptChunkByTrustZone(
-         Tizen::Base::ByteBuffer* appInfo,
-         const unsigned char *plainBuffer,
-         int pBufSize)
- {
-     using namespace Tizen::Base;
-     if(!initWebApp)
-     {
-         char* pAppId = null;
-         pAppId = (char*)calloc(appInfo->GetRemaining()+1, 1);
-         memcpy(pAppId, appInfo->GetPointer(), appInfo->GetRemaining());
-         InitWebAppInfo(pAppId, "");
-         free (pAppId);
-         initWebApp = true;
-     }
-     Tizen::Security::Crypto::_TrustZoneService* pInstance;
-     pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-     ByteBuffer pBuf;
-     pBuf.Construct(pBufSize);
-     const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
-     if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
-         LogDebug("Couldnot set pBuf");
-         return NULL;
-     }
-     pBuf.Flip();
-     return pInstance->_TrustZoneService::EncryptN(*appInfo, pBuf);
- }
- Tizen::Base::ByteBuffer* TEST_dec(
-         Tizen::Base::ByteBuffer* appInfo,
-         const unsigned char *plainBuffer,
-         int pBufSize)
+ int ssmEncrypt(InstallMode::RootPath rootPath, std::string pkgId, const char*
+         inChunk, int inBytes, char** outChunk, int *outBytes)
  {
-     using namespace Tizen::Base;
-     Tizen::Security::Crypto::_TrustZoneService* pInstance;
-     pInstance = Tizen::Security::Crypto::_TrustZoneService::GetInstance();
-     ByteBuffer pBuf;
-     pBuf.Construct(pBufSize);
-     const byte *pByte = reinterpret_cast<const byte*>(plainBuffer);
-     if (pBuf.SetArray(pByte, 0, pBufSize) != E_SUCCESS) {
-         LogDebug("Couldnot set pBuf");
-         return NULL;
+     if (rootPath == InstallMode::RootPath::RO) {
+         return ssm_encrypt_preloaded_application(inChunk, inBytes,
+                 outChunk, outBytes);
+     } else {
+         return ssm_encrypt(pkgId.c_str(), pkgId.length(),
+                 inChunk, inBytes,
+                 outChunk, outBytes);
      }
-     pBuf.Flip();
-     return pInstance->_TrustZoneService::DecryptN(*appInfo, pBuf);
  }
 +#endif
  }
  
  namespace Jobs {
@@@ -234,12 -182,10 +184,13 @@@ TaskEncryptResource::TaskEncryptResourc
      DPL::TaskDecl<TaskEncryptResource>(this),
      m_context(context)
  {
+     AddStep(&TaskEncryptResource::StartStep);
 +#ifdef DECRYPT
      AddStep(&TaskEncryptResource::StepEncryptResource);
 +#endif
+     AddStep(&TaskEncryptResource::EndStep);
  }
 +#ifdef DECRYPT
  
  void TaskEncryptResource::StepEncryptResource()
  {
@@@ -408,6 -331,19 +336,20 @@@ void TaskEncryptResource::EncryptFile(c
  
      m_context.widgetConfig.encryptedFiles.insert(fileInfo);
  }
 +#endif
+ void TaskEncryptResource::StartStep()
+ {
+     _D("--------- <TaskEncryptResource> : START ----------");
+ }
+ void TaskEncryptResource::EndStep()
+ {
+     m_context.job->UpdateProgress(
+             InstallerContext::INSTALL_ECRYPTION_FILES,
+             "Ecrypt resource files");
+     _D("--------- <TaskEncryptResource> : END ----------");
+ }
  } //namespace WidgetInstall
  } //namespace Jobs
  #include <widget_install/job_widget_install.h>
  #include <widget_install/widget_install_errors.h>
  #include <widget_install/widget_install_context.h>
 +#ifdef LIVEBOX
  #include <web_provider_livebox_info.h>
  #include <web_provider_plugin_info.h>
 +#endif
  #include <dpl/wrt-dao-ro/global_config.h>
- #include <dpl/log/log.h>
+ #include <dpl/wrt-dao-ro/config_parser_data.h>
  #include <dpl/file_input.h>
  #include <dpl/errno_string.h>
  #include <dpl/file_output.h>
@@@ -113,26 -115,16 +117,20 @@@ TaskManifestFile::TaskManifestFile(Inst
          // for widget update.
          AddStep(&TaskManifestFile::stepBackupIconFiles);
          AddStep(&TaskManifestFile::stepCopyIconFiles);
 +#ifdef LIVEBOX
          AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
 +#endif
          AddStep(&TaskManifestFile::stepCreateExecFile);
          AddStep(&TaskManifestFile::stepGenerateManifest);
-         AddStep(&TaskManifestFile::stepParseUpgradedManifest);
-         AddStep(&TaskManifestFile::stepUpdateFinalize);
  
          AddAbortStep(&TaskManifestFile::stepAbortIconFiles);
      } else {
          AddStep(&TaskManifestFile::stepCopyIconFiles);
 +#ifdef LIVEBOX
          AddStep(&TaskManifestFile::stepCopyLiveboxFiles);
 +#endif
          AddStep(&TaskManifestFile::stepCreateExecFile);
          AddStep(&TaskManifestFile::stepGenerateManifest);
-         AddStep(&TaskManifestFile::stepParseManifest);
-         AddStep(&TaskManifestFile::stepFinalize);
-         AddAbortStep(&TaskManifestFile::stepAbortParseManifest);
      }
  }
  
@@@ -312,10 -301,9 +307,10 @@@ void TaskManifestFile::stepCopyIconFile
          "Widget iconfile copy Finished");
  }
  
 +#ifdef LIVEBOX
  void TaskManifestFile::stepCopyLiveboxFiles()
  {
-     LogDebug("Copy Livebox Files");
+     _D("Copy Livebox Files");
  
      using namespace WrtDB;
      ConfigParserData &data = m_context.widgetConfig.configInfo;
          InstallerContext::INSTALL_COPY_LIVEBOX_FILES,
          "Livebox files copy Finished");
  }
 +#endif // LIVEBOX
  
+ void TaskManifestFile::copyDynamicBoxFile(const std::string& sourceFile,
+                                           const std::string& targetFile)
+ {
+     Try
+     {
+         DPL::FileInput input(sourceFile);
+         DPL::FileOutput output(targetFile);
+         DPL::Copy(&input, &output);
+     }
+     Catch(DPL::Exception)
+     {
+         _E("Copying Dynamic Box File Failed. %s to %s", sourceFile.c_str(), targetFile.c_str());
+         ReThrowMsg(Exceptions::DynamicBoxFailed, "Dynamic Box File Copy Failed.");
+     }
+ }
+ bool TaskManifestFile::addBoxUiApplication(Manifest& manifest)
+ {
+     UiApplication uiApp;
+     std::string postfix = ".d-box";
+     static bool isAdded = false;
+     Try
+     {
+         if (isAdded) {
+             _D("UiApplication for d-box is already added");
+             return false;
+         }
+         uiApp.setNodisplay(true);
+         uiApp.setTaskmanage(false);
+         uiApp.setMultiple(false);
+         setWidgetName(manifest, uiApp);
+         setWidgetIcons(uiApp);
+         // appid for box is like [webapp id].d-box
+         setWidgetIds(manifest, uiApp, postfix);
+         // executable path for box is like [app path]/bin/[webapp id].d-box
+         setWidgetExecPath(uiApp, postfix);
+         manifest.addUiApplication(uiApp);
+         isAdded = true;
+         return true;
+     }
+     Catch(DPL::Exception)
+     {
+         _E("Adding UiApplication on xml is failed.");
+         isAdded = false;
+         return false;
+     }
+ }
  void TaskManifestFile::stepBackupIconFiles()
  {
-     LogDebug("Backup Icon Files");
+     _D("Backup Icon Files");
  
      backup_dir << m_context.locations->getBackupDir() << "/";
  
@@@ -1041,28 -1034,23 +1046,24 @@@ void TaskManifestFile::setMetadata(UiAp
      }
  }
  
- void TaskManifestFile::stepAbortParseManifest()
++#ifdef LIVEBOX
+ void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
  {
-     LogError("[Parse Manifest] Abroting....");
-     int code = pkgmgr_parser_parse_manifest_for_uninstallation(
-             DPL::ToUTF8String(manifest_file).c_str(), NULL);
+     ConfigParserData::LiveboxList& liveboxList =
+         m_context.widgetConfig.configInfo.m_livebox;
  
-     if (0 != code) {
-         LogWarning("Manifest parser error: " << code);
-         ThrowMsg(Exceptions::ManifestInvalid, "Parser returncode: " << code);
+     if (liveboxList.empty()) {
+         _D("no livebox");
+         return;
      }
-     int ret = unlink(DPL::ToUTF8String(manifest_file).c_str());
-     if (0 != ret) {
-         LogWarning("No manifest file found: " << manifest_file);
+     if (!addBoxUiApplication(manifest)) {
+         _D("error during adding UiApplication for d-box");
+         return;
      }
- }
  
- #ifdef LIVEBOX
- void TaskManifestFile::setLiveBoxInfo(Manifest& manifest)
- {
-     FOREACH(it, m_context.widgetConfig.configInfo.m_livebox) {
-         LogInfo("setLiveBoxInfo");
+     FOREACH(it, liveboxList) {
+         _D("setLiveBoxInfo");
          LiveBoxInfo liveBox;
          DPL::Optional<WrtDB::ConfigParserData::LiveboxInfo> ConfigInfo = *it;
          DPL::String appid = m_context.widgetConfig.tzAppid;
@@@ -246,30 -224,24 +224,25 @@@ void TaskSmack::StepAbortSmack(
  #endif
  }
  
- void TaskSmack::SetEndofInstallation()
- {
-     m_context.job->UpdateProgress(
-         InstallerContext::INSTALL_END,
-         "End installation");
- }
  bool TaskSmack::setLabelForSharedDir(const char* pkgId)
  {
-     /* shared directory */
-     if (PC_OPERATION_SUCCESS != app_label_dir("*",
-                 m_context.locations->getSharedRootDir().c_str())) {
-         return false;
 +#ifdef WRT_SMACK_LABEL
+     /* /shared directory */
+     if (PC_OPERATION_SUCCESS != perm_app_setup_path(pkgId,
+                 m_context.locations->getSharedRootDir().c_str(),
+                 APP_PATH_ANY_LABEL, "_")) {
+         _W("Add label to %s", m_context.locations->getUserDataRootDir().c_str());
      }
  
-     /* shared/res directory */
-     if (PC_OPERATION_SUCCESS != app_label_dir("_",
-                 m_context.locations->getSharedResourceDir().c_str())) {
-         return false;
+     /* /shared/res directory */
+     if (PC_OPERATION_SUCCESS != perm_app_setup_path(pkgId,
+                 m_context.locations->getSharedResourceDir().c_str(),
+                 APP_PATH_ANY_LABEL, "_")) {
+         _W("Add label to %s", m_context.locations->getSharedResourceDir().c_str());
      }
  
-     /* shared/trusted directory */
-     CertificatePtr rootCert = m_context.wacSecurity.getAuthorCertificatePtr();
+     /* /shared/trusted directory */
+     CertificatePtr rootCert = m_context.widgetSecurity.getAuthorCertificatePtr();
      if (rootCert.Get() != NULL) {
          ValidationCore::Crypto::Hash::SHA1 sha1;
          sha1.Append(rootCert->getDER());
          }
      }
  
-     /* shared/data directory */
-     std::string dataLabel = std::string(pkgId) + "_shareddata";
-     TizenPkgIdList pkgList = WidgetDAOReadOnly::getTizenPkgidList();
-     const char** pList = new (std::nothrow) const char*[pkgList.size() + 1];
-     int index = 0;
-     FOREACH(app, pkgList) {
-         std::string id = DPL::ToUTF8String(*app);
-         char *pId = new char[id.size() + 1];
-         snprintf(pId, id.length() + 1, "%s", id.c_str());
-         pList[index++] = pId;
+     /* /shared/data directory */
+     if (PC_OPERATION_SUCCESS != perm_app_setup_path(pkgId,
+                 m_context.locations->getSharedDataDir().c_str(),
+                 APP_PATH_PUBLIC_RO)) {
+         _W("Add label to %s", m_context.locations->getSharedDataDir().c_str());
      }
  
-     pList[index] = NULL;
-     if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
-                 dataLabel.c_str(),
-                 m_context.locations->getSharedDataDir().c_str())) {
-         freeList(pList);
-         return false;
-     }
-     if (PC_OPERATION_SUCCESS != add_shared_dir_readers(dataLabel.c_str(), pList)) {
-         freeList(pList);
-         return false;
-     }
-     if (PC_OPERATION_SUCCESS != app_label_shared_dir(pkgId,
-                 "*",
-                 m_context.locations->getSharedDataDir().c_str())) {
-         freeList(pList);
-         return false;
-     }
-     freeList(pList);
 +#endif
      return true;
  }
+ void TaskSmack::StartStep()
+ {
+     _D("--------- <TaskSmack> : START ----------");
+ }
+ void TaskSmack::EndStep()
+ {
+     _D("--------- <TaskSmack> : END ----------");
+ }
  } //namespace WidgetInstall
  } //namespace Jobs
@@@ -39,10 -41,11 +43,13 @@@ TaskDbUpdate::TaskDbUpdate(UninstallerC
      DPL::TaskDecl<TaskDbUpdate>(this),
      m_context(context)
  {
+     AddStep(&TaskDbUpdate::StartStep);
+     AddStep(&TaskDbUpdate::StepRemoveExternalLocations);
      AddStep(&TaskDbUpdate::StepDbUpdate);
 +#ifdef LIVEBOX
      AddStep(&TaskDbUpdate::StepLiveboxDBDelete);
 +#endif
+     AddStep(&TaskDbUpdate::EndStep);
  }
  
  TaskDbUpdate::~TaskDbUpdate()
@@@ -68,24 -71,66 +75,68 @@@ void TaskDbUpdate::StepDbUpdate(
          ReThrowMsg(Exceptions::DatabaseFailure,
                     "Failed to handle StepDbUpdate!");
      }
-     m_context.job->UpdateProgress(
-         UninstallerContext::UNINSTALL_DB_UPDATE,
-         "Widget DB Update Finished");
  }
  
 +#ifdef LIVEBOX
  void TaskDbUpdate::StepLiveboxDBDelete()
  {
      int ret =
          web_provider_livebox_delete_by_app_id(m_context.tzAppid.c_str());
  
      if (ret < 0) {
-         LogDebug("failed to delete box info");
+         _D("failed to delete box info");
      } else {
-         LogInfo("delete box info: " << m_context.tzAppid);
+         _D("delete box info: %s", m_context.tzAppid.c_str());
      }
  }
 +#endif // LIVEBOX
+ void TaskDbUpdate::StepRemoveExternalLocations()
+ {
+     if (!m_context.removeAbnormal) {
+         WidgetDAO dao(DPL::FromUTF8String(m_context.tzAppid));
+         _D("Removing external locations:");
+         WrtDB::ExternalLocationList externalPaths = dao.getWidgetExternalLocations();
+         FOREACH(file, externalPaths)
+         {
+             DPL::Utils::Path path(*file);
+             if(path.Exists()){
+                 if(path.IsFile()){
+                     _D("  -> %s", path.Fullpath().c_str());
+                     Try{
+                         DPL::Utils::Remove(path);
+                     }Catch(DPL::Utils::Path::BaseException){
+                         _E("Failed to remove the file: %s", path.Fullpath().c_str());
+                     }
+                 } else if (path.IsDir()){
+                     _D("  -> %s", path.Fullpath().c_str());
+                     Try{
+                         DPL::Utils::Remove(path);
+                     }Catch(DPL::Utils::Path::BaseException){
+                         Throw(Jobs::WidgetUninstall::TaskDbUpdate::
+                                 Exception::RemoveFilesFailed);
+                     }
+                 }
+             }else{
+                 _W("  -> %s(no such a path)", path.Fullpath().c_str());
+             }
+         }
+         dao.unregisterAllExternalLocations();
+     }
+ }
+ void TaskDbUpdate::StartStep()
+ {
+     _D("--------- <TaskDbUpdate> : START ----------");
+ }
+ void TaskDbUpdate::EndStep()
+ {
+     m_context.job->UpdateProgress(
+         UninstallerContext::UNINSTALL_DB_UPDATE,
+         "Widget DB Update Finished");
+     _D("--------- <TaskDbUpdate> : END ----------");
+ }
  } //namespace WidgetUninstall
  } //namespace Jobs