Fixed package id is empty in callback of package manager.
authorSoyoung Kim <sy037.kim@samsung.com>
Tue, 13 Aug 2013 06:57:05 +0000 (15:57 +0900)
committerSoyoung Kim <sy037.kim@samsung.com>
Fri, 16 Aug 2013 05:24:02 +0000 (14:24 +0900)
[Issue#] TTS-1840
[Problem] package is empty in callback of package manager.
please check https://bugs.tizendev.org/jira/browse/TTS-1840

[Cause] signal have been sent before setting package id.
[Solution] signal is sent after set package id.
[SCMRequest] N/A

Change-Id: I24763d3ee499d4789e59828892000f0d29ea4d57

src/jobs/widget_install/job_widget_install.cpp

index e746f01..7af1fb0 100644 (file)
@@ -173,12 +173,6 @@ JobWidgetInstall::JobWidgetInstall(
     m_exceptionCaught(Jobs::Exceptions::Success)
 {
     m_installerContext.mode = m_jobStruct.m_installMode;
-    getInstallerStruct().pkgmgrInterface->sendSignal(
-        PKGMGR_START_KEY,
-        PKGMGR_START_INSTALL);
-    getInstallerStruct().pkgmgrInterface->sendSignal(
-        PKGMGR_PROGRESS_KEY,
-        PKGMGR_START_VALUE);
     ConfigureResult result = prepareInstallation(widgetPath);
 
     if (result == ConfigureResult::Ok) {
@@ -256,6 +250,12 @@ JobWidgetInstall::JobWidgetInstall(
     } else {
         // Installation is not allowed to proceed due to widget update policy
         LogWarning("Configure installation failed!");
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_START_KEY,
+                PKGMGR_START_INSTALL);
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_PROGRESS_KEY,
+                PKGMGR_START_VALUE);
 
         AddTask(new InstallerTaskFail(result));
     }
@@ -313,6 +313,9 @@ ConfigureResult JobWidgetInstall::prepareInstallation(
 
         // Configure installation
         result = ConfigureInstallation(widgetPath, configData, tempDir);
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_PROGRESS_KEY,
+                PKGMGR_START_VALUE);
     }
     Catch(Exceptions::OpenZipFailed)
     {
@@ -499,6 +502,9 @@ ConfigureResult JobWidgetInstall::ConfigureInstallation(
         m_installerContext.isUpdateMode = true;
     }
     Catch(WidgetDAOReadOnly::Exception::WidgetNotExist) {
+        getInstallerStruct().pkgmgrInterface->sendSignal(
+                PKGMGR_START_KEY,
+                PKGMGR_START_INSTALL);
         result = ConfigureResult::Ok;
         m_installerContext.isUpdateMode = false;