[Release] wrt-installer_0.1.114
[framework/web/wrt-installer.git] / src / jobs / widget_install / task_ace_check.cpp
index b8e4c70..72628c4 100644 (file)
@@ -42,10 +42,12 @@ TaskAceCheck::TaskAceCheck(InstallerContext& context) :
     DPL::TaskDecl<TaskAceCheck>(this),
     m_context(context)
 {
+    AddStep(&TaskAceCheck::StartStep);
     AddStep(&TaskAceCheck::StepPrepareForAce);
     AddStep(&TaskAceCheck::StepAceCheck);
     AddStep(&TaskAceCheck::StepProcessAceResponse);
     AddStep(&TaskAceCheck::StepCheckAceResponse);
+    AddStep(&TaskAceCheck::EndStep);
 }
 
 void TaskAceCheck::StepPrepareForAce()
@@ -60,25 +62,23 @@ void TaskAceCheck::StepPrepareForAce()
 void TaskAceCheck::StepAceCheck()
 {
     WrtDB::WidgetDAO dao(m_context.widgetConfig.tzAppid);
-    LogInfo("StepAceCheck!");
+    LogDebug("StepAceCheck!");
     // This widget does not use any device cap
     if (m_context.featureLogic->isDone()) {
         return;
     }
 
-    LogInfo("StepAceCheck!");
+    LogDebug("StepAceCheck!");
     DPL::String deviceCap = m_context.featureLogic->getDevice();
 
-    LogInfo("StepAceCheck!");
-    LogInfo("DevCap is : " << deviceCap);
+    LogDebug("StepAceCheck!");
+    LogDebug("DevCap is : " << deviceCap);
 
     std::string devCapStr = DPL::ToUTF8String(deviceCap);
     ace_policy_result_t policyResult = ACE_DENY;
 
     //TODO: remove dao.getHandle()
-    if (m_context.job->getInstallerStruct().m_installMode
-            == InstallMode::INSTALL_MODE_PRELOAD)
-    {
+    if (m_context.mode.installTime == InstallMode::InstallTime::PRELOAD) {
         LogDebug("This widget is prealoaded. So ace check will be skiped");
         policyResult = ACE_PERMIT;
     } else {
@@ -92,7 +92,7 @@ void TaskAceCheck::StepAceCheck()
         }
     }
 
-    LogInfo("PolicyResult is : " << static_cast<int>(policyResult));
+    LogDebug("PolicyResult is : " << static_cast<int>(policyResult));
     m_context.staticPermittedDevCaps.insert(std::make_pair(deviceCap,
                                                            policyResult ==
                                                            ACE_PERMIT));
@@ -109,18 +109,18 @@ void TaskAceCheck::StepProcessAceResponse()
         return;
     }
 
-    LogInfo("StepProcessAceResponse");
+    LogDebug("StepProcessAceResponse");
     m_context.featureLogic->next();
 
     // No device caps left to process
     if (m_context.featureLogic->isDone()) {
-        LogInfo("All responses has been received from ACE.");
+        LogDebug("All responses has been received from ACE.");
         // Data to convert to C API
         std::vector<std::string> devCaps;
         std::vector<bool> devCapsSmack;
         // Saving static dev cap permissions
         FOREACH(cap, m_context.staticPermittedDevCaps) {
-            LogInfo("staticPermittedDevCaps : " << cap->first
+            LogDebug("staticPermittedDevCaps : " << cap->first
                                                 << " smack: " << cap->second);
             std::string devCapStr = DPL::ToUTF8String(cap->first);
             devCaps.push_back(devCapStr);
@@ -178,26 +178,26 @@ void TaskAceCheck::StepProcessAceResponse()
         return;
     }
 
-    LogInfo("Next device cap.");
+    LogDebug("Next device cap.");
     // Process next device cap
     SwitchToStep(&TaskAceCheck::StepAceCheck);
 }
 
 void TaskAceCheck::StepCheckAceResponse()
 {
-    LogInfo("Checking ACE response");
+    LogDebug("Checking ACE response");
     if (m_context.featureLogic->isRejected()) {
         LogError("Installation failure. Some devCap was not accepted by ACE.");
         ThrowMsg(
-            Exceptions::AceCheckFailed,
+            Exceptions::PrivilegeLevelViolation,
             "Instalation failure. "
             "Some deviceCap was not accepted by ACE.");
     }
-    LogInfo("Updating \"feature reject status\" in database!");
+    LogDebug("Updating \"feature reject status\" in database!");
     auto it = m_context.featureLogic->resultBegin();
     auto end = m_context.featureLogic->resultEnd();
     for (; it != end; ++it) {
-        LogInfo(
+        LogDebug(
             "  |-  Feature: " << it->name << " has reject status: " <<
             it->rejected);
         if (it->rejected) {
@@ -205,11 +205,21 @@ void TaskAceCheck::StepCheckAceResponse()
             dao.updateFeatureRejectStatus(*it);
         }
     }
-    LogInfo("Installation continues...");
+    LogDebug("Installation continues...");
+}
 
+void TaskAceCheck::StartStep()
+{
+    LogDebug("--------- <TaskAceCheck> : START ----------");
+}
+
+void TaskAceCheck::EndStep()
+{
     m_context.job->UpdateProgress(
         InstallerContext::INSTALL_ACE_CHECK,
         "Widget Access Control Check Finished");
+
+    LogDebug("--------- <TaskAceCheck> : END ----------");
 }
 } //namespace WidgetInstall
 } //namespace Jobs