2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 * @file job_widget_install.cpp
18 * @author Radoslaw Wicik r.wicik@samsung.com
19 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
21 * @brief Implementation file for main installer task
25 #include <dpl/noncopyable.h>
26 #include <dpl/abstract_waitable_input_adapter.h>
27 #include <dpl/abstract_waitable_output_adapter.h>
28 #include <dpl/zip_input.h>
29 #include <dpl/binary_queue.h>
31 #include <dpl/assert.h>
32 #include <dpl/sstream.h>
33 #include <dpl/wrt-dao-ro/common_dao_types.h>
34 #include "root_parser.h"
35 #include "widget_parser.h"
36 #include "parser_runner.h"
37 #include <widget_install/job_widget_install.h>
38 #include <widget_install/task_unzip.h>
39 #include <widget_install/task_certify.h>
40 #include <widget_install/task_widget_config.h>
41 #include <widget_install/task_file_manipulation.h>
42 #include <widget_install/task_ace_check.h>
43 #include <widget_install/task_smack.h>
44 #include <widget_install/task_manifest_file.h>
45 #include <widget_install/task_private_storage.h>
46 #include <widget_install/task_prepare_files.h>
47 #include <widget_install/task_recovery.h>
48 #include <widget_install/task_install_ospsvc.h>
49 #include <widget_install/task_update_files.h>
50 #include <widget_install/task_database.h>
51 #include <widget_install/task_remove_backup.h>
52 #include <widget_install/task_encrypt_resource.h>
53 #include <widget_install/task_certificates.h>
56 #include <widget_install/task_livebox_conf.h>
58 #include <widget_install/task_plugins_copy.h>
60 #include <widget_install/widget_install_errors.h>
61 #include <widget_install/widget_install_context.h>
68 #include <dpl/wrt-dao-ro/widget_dao_read_only.h>
69 #include <dpl/wrt-dao-ro/global_config.h>
70 #include <dpl/wrt-dao-rw/global_dao.h> // TODO remove
71 #include <dpl/localization/w3c_file_localization.h>
72 #include <libiriwrapper.h>
73 #include <pkg-manager/pkgmgr_signal.h>
74 #include <app_manager.h>
76 using namespace WrtDB;
78 namespace // anonymous
80 const char * const CONFIG_XML = "config.xml";
81 const char * const WITH_OSP_XML = "res/wgt/config.xml";
83 //allowed: a-z, A-Z, 0-9
84 const char* REG_TIZENID_PATTERN = "^[a-zA-Z0-9]{10}$";
85 const int MAX_TIZENID_LENGTH = 10;
87 static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
88 static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
90 class InstallerTaskFail :
91 public DPL::TaskDecl<InstallerTaskFail>
99 ThrowMsg(Jobs::WidgetInstall::Exceptions::Deferred,
100 "Widget installation or update deferred!");
102 ThrowMsg(Jobs::WidgetInstall::Exceptions::NotAllowed,
103 "Widget installation or update not allowed!");
108 InstallerTaskFail(bool deferred) :
109 DPL::TaskDecl<InstallerTaskFail>(this),
112 AddStep(&InstallerTaskFail::StepFail);
116 const std::string XML_EXTENSION = ".xml";
118 bool hasExtension(const std::string& filename, const std::string& extension) {
119 LogDebug("Looking for extension " << extension << " in: " << filename);
120 size_t fileLen = filename.length();
121 size_t extLen = extension.length();
122 if (fileLen < extLen) {
123 LogError("Filename " << filename << " is shorter than extension "
127 return (0 == filename.compare(fileLen-extLen, extLen, extension));
129 } // namespace anonymous
132 namespace WidgetInstall {
133 JobWidgetInstall::JobWidgetInstall(std::string const &widgetPath,
134 const WidgetInstallationStruct &installerStruct) :
136 JobContextBase<WidgetInstallationStruct>(installerStruct),
137 m_exceptionCaught(Exceptions::Success)
139 // Check installation type (config.xml or widget.wgt)
140 bool browserRequest = hasExtension(widgetPath, XML_EXTENSION);
142 LogInfo("Hosted app installation: " << browserRequest);
145 gettimeofday(&tv, NULL);
146 srand(time(NULL) + tv.tv_usec);
147 WrtDB::DbWidgetHandle handle;
149 handle = rand() % INT_MAX + 1;
150 LogInfo("Random widget handle: " << handle);
151 } while (WidgetDAOReadOnly::isWidgetInstalled(handle));
153 m_installerContext.widgetHandle = handle; //TODO: mvoe to wrt-commons (ace_widget_handle_t not int needed)
154 m_installerContext.m_quiet = m_jobStruct.m_quiet;
158 m_installerContext.widgetConfig.pType = checkPackageType(widgetPath);
162 m_installerContext.widgetConfig.pType = WrtDB::PKG_TYPE_TIZEN_WEBAPP;
164 LogDebug("widgetPath:" << widgetPath);
166 ConfigParserData configData = getWidgetDataFromXML(widgetPath, browserRequest,
167 m_installerContext.widgetConfig.pType);
168 WidgetUpdateInfo update = detectWidgetUpdate(configData);
169 bool needEncryption = detectResourceEncryption(configData);
171 // Configure installation
172 ConfigureResult result = ConfigureInstallation(widgetPath, configData,
173 update, browserRequest);
175 if (result == ConfigureResult::Ok) {
176 LogInfo("Configure installation succeeded");
178 AddTask(new TaskRecovery(m_installerContext));
180 // Create installation tasks
181 if (!m_installerContext.locations->browserRequest()) {
182 AddTask(new TaskUnzip(m_installerContext));
184 AddTask(new TaskWidgetConfig(m_installerContext));
185 if (m_installerContext.locations->browserRequest()) {
186 AddTask(new TaskPrepareFiles(m_installerContext));
188 AddTask(new TaskCertify(m_installerContext));
189 if (needEncryption) {
190 AddTask(new TaskEncryptResource(m_installerContext));
192 AddTask(new TaskDatabase(m_installerContext)); //TODO: this should belast task (or almost)
193 AddTask(new TaskFileManipulation(m_installerContext));
194 // TODO: Update progress information for this task
196 AddTask(new TaskPrivateStorage(m_installerContext));
197 AddTask(new TaskAceCheck(m_installerContext));
198 //This is sort of quick solution, because ACE verdicts are based upon
199 //data from DAO (DB). So AceCheck for now has to be AFTER DbUpdate
201 AddTask(new TaskSmack(m_installerContext));
203 AddTask(new TaskManifestFile(m_installerContext));
204 AddTask(new TaskCertificates(m_installerContext));
205 if (m_installerContext.widgetConfig.pType ==
206 PKG_TYPE_TIZEN_WITHSVCAPP) {
207 AddTask(new TaskInstallOspsvc(m_installerContext));
210 AddTask(new TaskLiveboxConf(m_installerContext));
212 AddTask(new TaskPluginsCopy(m_installerContext));
213 } else if (result == ConfigureResult::Updated) {
214 LogInfo("Configure installation updated");
215 LogInfo("Widget Update");
217 if (!m_installerContext.locations->browserRequest()) {
218 AddTask(new TaskUnzip(m_installerContext));
220 AddTask(new TaskWidgetConfig(m_installerContext));
221 if (m_installerContext.locations->browserRequest()) {
222 AddTask(new TaskPrepareFiles(m_installerContext));
225 AddTask(new TaskCertify(m_installerContext));
226 AddTask(new TaskUpdateFiles(m_installerContext));
227 AddTask(new TaskDatabase(m_installerContext)); //TODO: this should belast task (or almost)
229 /* TODO : To backup file, save md5 values */
230 AddTask(new TaskAceCheck(m_installerContext));
231 AddTask(new TaskSmack(m_installerContext));
233 AddTask(new TaskManifestFile(m_installerContext));
234 AddTask(new TaskRemoveBackupFiles(m_installerContext));
235 if (m_installerContext.widgetConfig.pType ==
236 PKG_TYPE_TIZEN_WITHSVCAPP) {
237 AddTask(new TaskInstallOspsvc(m_installerContext));
240 AddTask(new TaskLiveboxConf(m_installerContext));
242 AddTask(new TaskPluginsCopy(m_installerContext));
243 } else if (result == ConfigureResult::Deferred) {
244 // Installation is deferred
245 LogInfo("Configure installation deferred");
247 AddTask(new InstallerTaskFail(true));
248 } else if (result == ConfigureResult::Failed) {
249 // Installation is not allowed to proceed due to widget update policy
250 LogWarning("Configure installation failed!");
252 AddTask(new InstallerTaskFail(false));
254 Assert(false && "Invalid configure result!");
258 std::string JobWidgetInstall::generateTizenId() {
259 std::string allowed("0123456789"
260 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
261 "abcdefghijklmnopqrstuvwxyz");
263 tizenId.resize(MAX_TIZENID_LENGTH);
264 for (int i = 0; i < MAX_TIZENID_LENGTH; ++i) {
265 tizenId[i] = allowed[rand() % allowed.length()];
270 bool JobWidgetInstall::setTizenId(
271 const WrtDB::ConfigParserData &configInfo, ConfigureResult result)
273 Assert(!!m_installerContext.widgetHandle
274 && "Widget Handle should be initialized");
277 regcomp(®, REG_TIZENID_PATTERN, REG_NOSUB | REG_EXTENDED);
279 if(!!configInfo.tizenId) {
280 LogDebug("Setting tizenId provided in config.xml: " << configInfo.tizenId);
281 if ((regexec(®, DPL::ToUTF8String(*(configInfo.tizenId)).c_str(),
282 static_cast<size_t>(0), NULL, 0) != REG_NOERROR) ||
283 (stat((std::string(GlobalConfig::GetUserInstalledWidgetPath()) + "/"
284 + DPL::ToUTF8String(*(configInfo.tizenId))).c_str(), &dirStat) == 0))
286 //it is true when tizenId does not fit REG_TIZENID_PATTERN
287 LogError("tizen_id provided but not proper.");
291 m_installerContext.widgetConfig.pkgname = configInfo.tizenId;
294 std::string tizenId = generateTizenId();
296 // only for installation, not for update
297 if (result == ConfigureResult::Ok) {
298 //check if there is package with same name and if generate different name
299 std::string path = GlobalConfig::GetUserInstalledWidgetPath();
302 std::ostringstream newPath;
303 newPath << path << tizenId;
305 LogDebug("Checking if tizen id is unique");
307 if (stat(newPath.str().c_str(), &dirStat) == 0) {
308 //path exist, chose another one
309 tizenId = generateTizenId();
311 newPath << path << tizenId;
317 m_installerContext.widgetConfig.pkgname =
318 DPL::FromUTF8String(tizenId);
320 LogInfo("tizen_id name was generated by WRT: " << tizenId);
324 LogInfo("Tizen Id : " << m_installerContext.widgetConfig.pkgname);
325 LogInfo("W3C Widget GUID : " << m_installerContext.widgetConfig.guid);
329 DPL::Optional<WidgetHandle> JobWidgetInstall::getNewWidgetHandle() const
331 return m_installerContext.widgetHandle;
334 DPL::OptionalString JobWidgetInstall::getNewTizenId() const
336 return m_installerContext.widgetConfig.pkgname;
339 void JobWidgetInstall::configureWidgetLocation(const std::string & widgetPath, bool browserRequest)
341 m_installerContext.locations = WidgetLocation(DPL::ToUTF8String(*m_installerContext.widgetConfig.pkgname),
342 widgetPath, browserRequest, m_installerContext.widgetConfig.pType);
344 LogInfo("widgetSource " << widgetPath);
347 JobWidgetInstall::ConfigureResult JobWidgetInstall::ConfigureInstallation(
348 const std::string &widgetSource,
349 const WrtDB::ConfigParserData &configData,
350 const WidgetUpdateInfo &update,
354 "Widget install/update: incoming guid = '" <<
355 update.incomingGUID << "'");
357 "Widget install/update: incoming version = '" <<
358 update.incomingVersion << "'");
361 WidgetUpdateMode::Type updateTypeCheckBit;
362 bool isUpdate = false;
363 JobWidgetInstall::ConfigureResult ret = ConfigureResult::Ok;
365 if (update.existingWidgetInfo.isExist == false) {
366 LogInfo("Widget info does not exist");
367 updateTypeCheckBit = WidgetUpdateMode::NotInstalled;
369 LogInfo("Widget info exists. Handle: " <<
370 update.existingWidgetInfo.existingHandle);
372 DPL::OptionalString pkgname =
373 WidgetDAOReadOnly(update.existingWidgetInfo.existingHandle).getPkgname();
375 if(pkgname.IsNull()) {
376 LogInfo("But package name doesn't exist");
377 return ConfigureResult::Failed;
380 LogInfo("Widget model exists. package name: " << pkgname);
382 // Check running state
383 int retval = APP_MANAGER_ERROR_NONE;
384 bool isRunning = false;
385 retval = app_manager_is_running(DPL::ToUTF8String(*pkgname).c_str(), &isRunning);
386 if (APP_MANAGER_ERROR_NONE != retval) {
387 LogError("Fail to get running state");
388 return ConfigureResult::Failed;
391 if (true == isRunning) {
392 // Must be deferred when update in progress
393 if (m_jobStruct.updateMode == WidgetUpdateMode::PolicyWac) {
395 "Widget is already running. Policy is update according to WAC");
397 return ConfigureResult::Deferred;
400 "Widget is already running. Policy is not update according to WAC");
401 LogInfo("Installation aborted: " << widgetSource);
403 return ConfigureResult::Failed;
407 m_installerContext.widgetConfig.pkgname = pkgname;
408 OptionalWidgetVersion existingVersion;
409 existingVersion = update.existingWidgetInfo.existingVersion;
410 OptionalWidgetVersion incomingVersion = update.incomingVersion;
412 updateTypeCheckBit = CalcWidgetUpdatePolicy(existingVersion,
415 if ((m_jobStruct.updateMode & updateTypeCheckBit) > 0) {
416 LogInfo("Whether widget policy allow proceed ok");
417 ret = ConfigureResult::Updated;
420 return ConfigureResult::Failed;
423 if (!setTizenId(configData, ret)) {
424 return ConfigureResult::Failed;
426 using namespace PackageManager;
427 LogInfo("WidgetHandle: " << m_installerContext.widgetHandle);
428 LogInfo("Tizen Id: " << m_installerContext.widgetConfig.pkgname);
430 configureWidgetLocation(widgetSource, browserRequest);
432 // send start signal of pkgmgr
433 PkgmgrSignalSingleton::Instance().setPkgname(
435 *m_installerContext.widgetConfig.pkgname));
436 PkgmgrSignalSingleton::Instance().sendSignal(
438 PKGMGR_START_INSTALL);
441 // Init installer context
442 m_installerContext.installStep = InstallerContext::INSTALL_START;
443 m_installerContext.job = this;
444 m_installerContext.existingWidgetInfo = update.existingWidgetInfo;
445 m_installerContext.widgetConfig.shareHref = std::string();
451 WidgetUpdateMode::Type JobWidgetInstall::CalcWidgetUpdatePolicy(
452 const OptionalWidgetVersion &existingVersion,
453 const OptionalWidgetVersion &incomingVersion) const
455 // Widget is installed, check versions
456 if (!existingVersion && !incomingVersion) {
457 return WidgetUpdateMode::ExistingVersionEqual;
458 } else if (!existingVersion && !!incomingVersion) {
459 return WidgetUpdateMode::ExistingVersionNewer;
460 } else if (!!existingVersion && !incomingVersion) {
461 return WidgetUpdateMode::ExistingVersionOlder;
463 LogInfo("Existing widget: version = '" << *existingVersion << "'");
465 if (!existingVersion->IsWac() && !incomingVersion->IsWac()) {
466 return WidgetUpdateMode::BothVersionsNotStd;
467 } else if (!existingVersion->IsWac()) {
468 return WidgetUpdateMode::ExistingVersionNotStd;
469 } else if (!incomingVersion->IsWac()) {
470 return WidgetUpdateMode::IncomingVersionNotStd;
472 // Both versions are WAC-comparable. Do compare.
473 if (*incomingVersion == *existingVersion) {
474 return WidgetUpdateMode::ExistingVersionEqual;
475 } else if (*incomingVersion > *existingVersion) {
476 return WidgetUpdateMode::ExistingVersionOlder;
478 return WidgetUpdateMode::ExistingVersionNewer;
484 ConfigParserData JobWidgetInstall::getWidgetDataFromXML(
485 const std::string &widgetSource,
486 bool fromBrowser, WrtDB::PkgType isOspsvc)
492 ConfigParserData configInfo;
495 parser.Parse(widgetSource,
497 new RootParser<WidgetParser>(configInfo,
498 DPL::FromUTF32String(
503 std::unique_ptr<DPL::ZipInput> zipFile(
504 new DPL::ZipInput(widgetSource));
506 std::unique_ptr<DPL::ZipInput::File> configFile;
508 // Open config.xml file
509 if (isOspsvc == PKG_TYPE_TIZEN_WITHSVCAPP) {
510 configFile.reset(zipFile->OpenFile(WITH_OSP_XML));
512 configFile.reset(zipFile->OpenFile(CONFIG_XML));
516 DPL::BinaryQueue buffer;
517 DPL::AbstractWaitableInputAdapter inputAdapter(configFile.get());
518 DPL::AbstractWaitableOutputAdapter outputAdapter(&buffer);
519 DPL::Copy(&inputAdapter, &outputAdapter);
520 parser.Parse(&buffer,
522 new RootParser<WidgetParser>(configInfo,
523 DPL::FromUTF32String(
529 Catch(DPL::ZipInput::Exception::OpenFailed)
531 LogError("Failed to open widget package");
532 return ConfigParserData();
534 Catch(DPL::ZipInput::Exception::OpenFileFailed)
536 LogError("Failed to open config.xml file");
537 return ConfigParserData();
539 Catch(DPL::CopyFailed)
541 LogError("Failed to extract config.xml file");
542 return ConfigParserData();
544 Catch(ElementParser::Exception::ParseError)
546 LogError("Failed to parse config.xml file");
547 return ConfigParserData();
551 WidgetUpdateInfo JobWidgetInstall::detectWidgetUpdate(
552 const ConfigParserData &configInfo)
554 LogInfo("Checking up widget package for config.xml...");
556 DPL::OptionalString widgetGUID;
557 OptionalWidgetVersion widgetVersion;
560 widgetGUID = configInfo.widget_id;
562 if (widgetGUID.IsNull()) {
563 LogWarning("Installed widget has no GUID");
564 return WidgetUpdateInfo();
567 LogDebug("Installed widget GUID: " << *widgetGUID);
569 // Locate widget ID with this GUID
570 // Incoming widget version
571 if (!configInfo.version.IsNull()) {
573 DPL::Optional<WidgetVersion>(
574 WidgetVersion(*configInfo.version));
579 // Search widget handle by GUID
580 WidgetDAOReadOnly dao(widgetGUID);
581 return WidgetUpdateInfo(
584 WidgetUpdateInfo::ExistingWidgetInfo(
585 dao.getHandle(), dao.getVersion()));
587 Catch(WidgetDAOReadOnly::Exception::WidgetNotExist)
589 // GUID isn't installed
590 return WidgetUpdateInfo(
593 WidgetUpdateInfo::ExistingWidgetInfo());
597 void JobWidgetInstall::SendProgress()
599 using namespace PackageManager;
600 if (GetProgressFlag() != false) {
601 if (getInstallerStruct().progressCallback != NULL) {
602 // send progress signal of pkgmgr
603 std::ostringstream percent;
604 percent << static_cast<int>(GetProgressPercent());
605 PkgmgrSignalSingleton::Instance().sendSignal(
609 LogDebug("Call widget install progressCallbak");
610 getInstallerStruct().progressCallback(getInstallerStruct().userParam,
611 GetProgressPercent(),GetProgressDescription());
616 void JobWidgetInstall::SendFinishedSuccess()
618 using namespace PackageManager;
619 // TODO : sync should move to separate task.
622 // remove widget install information file
623 unlink(m_installerContext.installInfo.c_str());
626 JobWidgetInstall::displayWidgetInfo();
628 DPL::OptionalString tizenId = getNewTizenId();
630 // send signal of pkgmgr
631 PkgmgrSignalSingleton::Instance().sendSignal(
635 LogDebug("Call widget install successfinishedCallback");
636 getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
637 tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), Exceptions::Success);
640 void JobWidgetInstall::SendFinishedFailure()
642 using namespace PackageManager;
643 // remove widget install information file
644 unlink(m_installerContext.installInfo.c_str());
646 LogError("Error in installation step: " << m_exceptionCaught);
647 LogError("Message: " << m_exceptionMessage);
648 DPL::OptionalString tizenId = getNewTizenId();
650 LogDebug("Call widget install failure finishedCallback");
652 // send signal of pkgmgr
653 PkgmgrSignalSingleton::Instance().sendSignal(
657 getInstallerStruct().finishedCallback(getInstallerStruct().userParam,
658 tizenId.IsNull() ? "" : DPL::ToUTF8String(*tizenId), m_exceptionCaught);
661 void JobWidgetInstall::SaveExceptionData(const Jobs::JobExceptionBase &e)
663 m_exceptionCaught = static_cast<Exceptions::Type>(e.getParam());
664 m_exceptionMessage = e.GetMessage();
667 void JobWidgetInstall::displayWidgetInfo()
669 DPL::Optional<WidgetHandle> handle = getNewWidgetHandle();
672 WidgetDAOReadOnly dao(*handle);
674 std::ostringstream out;
675 WidgetLocalizedInfo localizedInfo =
676 W3CFileLocalization::getLocalizedInfo(*handle);
679 "===================================== INSTALLED WIDGET INFO ========="\
680 "============================";
681 out << std::endl << "Name: " << localizedInfo.name;
682 out << std::endl << "PkgName: " << dao.getPkgname();
683 WidgetSize size = dao.getPreferredSize();
684 out << std::endl << "Width: " << size.width;
685 out << std::endl << "Height: " << size.height;
686 out << std::endl << "Start File: " <<
687 W3CFileLocalization::getStartFile(*handle);
688 out << std::endl << "Version: " << dao.getVersion();
689 out << std::endl << "Licence: " <<
690 localizedInfo.license;
691 out << std::endl << "Licence Href: " <<
692 localizedInfo.licenseHref;
693 out << std::endl << "Description: " <<
694 localizedInfo.description;
695 out << std::endl << "Widget Id: " << dao.getGUID();
696 out << std::endl << "Widget recognized: " << dao.isRecognized();
697 out << std::endl << "Widget wac signed: " << dao.isWacSigned();
698 out << std::endl << "Widget distributor signed: " <<
699 dao.isDistributorSigned();
700 out << std::endl << "Widget trusted: " << dao.isTrusted();
702 OptionalWidgetIcon icon = W3CFileLocalization::getIcon(*handle);
703 DPL::OptionalString iconSrc =
704 !!icon ? icon->src : DPL::OptionalString::Null;
705 out << std::endl << "Icon: " << iconSrc;
707 out << std::endl << "Preferences:";
709 PropertyDAOReadOnly::WidgetPreferenceList list = dao.getPropertyList();
712 out << std::endl << " Key: " <<
714 out << std::endl << " Readonly: " <<
719 out << std::endl << "Features:";
721 WidgetFeatureSet list = dao.getFeaturesList();
724 out << std::endl << " Name: " << it->name;
725 out << std::endl << " Required: " << it->required;
726 out << std::endl << " Params:";
735 WrtDB::PackagingType JobWidgetInstall::checkPackageType(
736 const std::string &widgetSource)
738 using namespace WrtDB;
740 PackagingType pType = PKG_TYPE_UNKNOWN;
741 std::unique_ptr<DPL::ZipInput> zipFile;
746 zipFile.reset(new DPL::ZipInput(widgetSource));
749 Catch(DPL::ZipInput::Exception::OpenFailed)
751 LogError("Failed to open widget package");
752 return PKG_TYPE_UNKNOWN;
757 // Open config.xml file in package root
758 std::unique_ptr<DPL::ZipInput::File> configFile(
759 zipFile->OpenFile(CONFIG_XML));
760 pType = PKG_TYPE_TIZEN_WEBAPP;
762 Catch(DPL::ZipInput::Exception::OpenFileFailed)
764 LogWarning("Could not find ./config.xml");
769 // Open config.xml file in package root
770 std::unique_ptr<DPL::ZipInput::File> configFile(
771 zipFile->OpenFile(WITH_OSP_XML));
772 if (pType == PKG_TYPE_TIZEN_WEBAPP) {
773 LogWarning("Two config.xml's found. Application type is unknown.");
774 return PKG_TYPE_UNKNOWN;
777 pType = PKG_TYPE_TIZEN_WITHSVCAPP;
779 Catch(DPL::ZipInput::Exception::OpenFileFailed)
781 LogWarning("Could not find ./res/wgt/config.xml");
784 if (pType == PKG_TYPE_UNKNOWN) {
785 LogWarning("config.xml not found. Application type is unknown.");
790 bool JobWidgetInstall::detectResourceEncryption(const WrtDB::ConfigParserData &configData)
792 FOREACH(it, configData.settingsList)
794 if (it->m_name == SETTING_VALUE_ENCRYPTION &&
795 it->m_value == SETTING_VALUE_ENCRYPTION_ENABLE) {
796 LogDebug("resource need encryption");
803 } //namespace WidgetInstall