Platform version check during wgt installation - fixed
authorTomasz Iwanek <t.iwanek@samsung.com>
Mon, 26 Nov 2012 12:24:29 +0000 (13:24 +0100)
committerGerrit Code Review <gerrit2@kim11>
Wed, 28 Nov 2012 14:22:34 +0000 (23:22 +0900)
m_quiet stays with true value. To get popups run installation
from "my files" menu (e.g. move wgt file to /opt/usr/media/Downloads).

[Issue#] LINUXNGWAP-537
[Feature] Platform version is checked and compared
to required_version from config.xml. If installation
is triggered by pkgmgr, popup with question is shown.
If it is console installation, version check popup is disabled and
installation automatically refused if version not match
[Cause] Compatibility check during installation
needed
[Solution] N/A

[Verification] Build installer. Try to install
widget manual_tests/Tizen_Spec/TC6 from wrt-extra
from console and by pgkmgr (click wgt file from "MyFiles").

Change-Id: I1072ec5368e6bd0f591b9c8cceda6b5b18059665

src/jobs/widget_install/task_widget_config.cpp

index 149f833..5deefb4 100644 (file)
@@ -81,12 +81,12 @@ TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
     AddStep(&TaskWidgetConfig::ProcessBackgroundPageFile);
     AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
     AddStep(&TaskWidgetConfig::StepVerifyFeatures);
+    AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
 
     if (!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet) {
         AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterVerifyFeatures);
         AddStep(&TaskWidgetConfig::StepShowWidgetInfo);
         AddStep(&TaskWidgetConfig::StepCancelWidgetInstallation);
-        AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
         AddStep(&TaskWidgetConfig::StepCancelWidgetInstallationAfterMinVersion);
         AddStep(&TaskWidgetConfig::StepDeletePopupWin);
     }
@@ -426,8 +426,18 @@ void TaskWidgetConfig::StepCheckMinVersionInfo()
     if (!isMinVersionCompatible(
                 m_installContext.widgetConfig.webAppType.appType,
                 m_installContext.widgetConfig.minVersion)) {
-        std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
-        createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
+        if(!GlobalSettings::TestModeEnabled() && !m_installContext.m_quiet)
+        {
+            LogDebug("Platform version to low - launching");
+            std::string label = WIDGET_NOT_COMPATIBLE + QUESTION;
+            createInstallPopup(PopupType::WIDGET_MIN_VERSION, label);
+        }
+        else
+        {
+            LogError("Platform version lower than required -> cancelling installation");
+            ThrowMsg(Exceptions::NotAllowed,
+                    "Platform version does not meet requirements");
+        }
     }
 
     m_installContext.job->UpdateProgress(
@@ -629,13 +639,15 @@ bool TaskWidgetConfig::isMinVersionCompatible(WrtDB::AppType appType,
 
     if (!parseVersionString(version,
                 majorSupported, minorSupported, microSupported)) {
-        LogWarning("Invalid format of WAC version string.");
+        LogWarning("Invalid format of platform version string.");
         return true;
     }
 
     if (majorWidget > majorSupported ||
-            minorWidget > minorSupported ||
-            microWidget > microSupported) {
+            (majorWidget == majorSupported && minorWidget > minorSupported) ||
+            (majorWidget == majorSupported && minorWidget == minorSupported
+                    && microWidget > microSupported))
+    {
         LogInfo("Platform doesn't support this widget.");
         return false;
     }