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 task_widget_config.cpp
18 * @author Przemyslaw Dobrowolski (p.dobrowolsk@samsung.com)
20 * @brief Implementation file for installer task widget config
29 #include <dpl/errno_string.h>
30 #include <dpl/foreach.h>
31 #include <dpl/localization/w3c_file_localization.h>
32 #include <dpl/singleton_impl.h>
33 #include <dpl/utils/mime_type_utils.h>
34 #include <dpl/utils/wrt_global_settings.h>
35 #include <dpl/utils/wrt_utility.h>
36 #include <dpl/wrt-dao-ro/global_config.h>
37 #include <dpl/wrt-dao-ro/config_parser_data.h>
38 #include <dpl/wrt-dao-rw/feature_dao.h>
40 #include <libiriwrapper.h>
41 #include <parser_runner.h>
42 #include <root_parser.h>
44 #include <widget_install/job_widget_install.h>
45 #include <widget_install/task_widget_config.h>
46 #include <widget_install/widget_install_context.h>
47 #include <widget_install/widget_install_errors.h>
48 #include <widget_parser.h>
49 #include <web_provider_plugin_info.h>
50 #include <web_provider_livebox_info.h>
53 namespace { // anonymous
54 const DPL::String BR = DPL::FromUTF8String("<br>");
55 const std::string WIDGET_NOT_COMPATIBLE = "This widget is "
56 "not compatible with WRT.<br><br>";
57 const std::string QUESTION = "Do you want to install it anyway?";
59 const char *const DEFAULT_LANGUAGE = "default";
61 const char *const WRT_WIDGET_CONFIG_FILE_NAME = "config.xml";
63 const std::string WINDGET_INSTALL_NETWORK_ACCESS = "network access";
65 const char WRT_WIDGETS_XML_SCHEMA[] = "/usr/etc/wrt-installer/widgets.xsd";
69 namespace WidgetInstall {
71 TaskWidgetConfig::TaskWidgetConfig(InstallerContext& installContext) :
72 DPL::TaskDecl<TaskWidgetConfig>(this),
73 m_installContext(installContext)
75 AddStep(&TaskWidgetConfig::StepProcessConfigurationFile);
76 AddStep(&TaskWidgetConfig::ReadLocaleFolders);
77 AddStep(&TaskWidgetConfig::ProcessLocalizedStartFiles);
78 AddStep(&TaskWidgetConfig::ProcessBackgroundPageFile);
79 AddStep(&TaskWidgetConfig::ProcessLocalizedIcons);
80 AddStep(&TaskWidgetConfig::ProcessWidgetInstalledPath);
81 AddStep(&TaskWidgetConfig::ProcessAppControlInfo);
82 AddStep(&TaskWidgetConfig::ProcessSecurityModel);
83 AddStep(&TaskWidgetConfig::StepVerifyFeatures);
84 AddStep(&TaskWidgetConfig::StepCheckMinVersionInfo);
87 void TaskWidgetConfig::StepProcessConfigurationFile()
91 std::string path = m_installContext.locations->getConfigurationDir();
92 LogDebug("path: " << path);
94 processFile(path, m_installContext.widgetConfig);
96 Catch(Exception::ConfigParseFailed)
98 LogError("Parsing failed.");
99 ReThrow(Exceptions::WidgetConfigFileInvalid);
102 m_installContext.job->UpdateProgress(
103 InstallerContext::INSTALL_WIDGET_CONFIG1,
104 "Parse elements of configuration file and save them");
107 void TaskWidgetConfig::ReadLocaleFolders()
109 LogDebug("Reading locale");
110 //Adding default locale
111 m_localeFolders.insert(L"");
113 std::string localePath =
114 m_installContext.locations->getConfigurationDir() + "/locales";
115 DIR* localeDir = opendir(localePath.c_str());
117 LogDebug("No /locales directory in the widget package.");
121 struct stat statStruct;
122 struct dirent dirent;
123 struct dirent *result;
126 for (return_code = readdir_r(localeDir, &dirent, &result);
127 result != NULL && return_code == 0;
128 return_code = readdir_r(localeDir, &dirent, &result))
130 DPL::String dirName = DPL::FromUTF8String(dirent.d_name);
131 std::string absoluteDirName = localePath + "/";
132 absoluteDirName += dirent.d_name;
134 if (stat(absoluteDirName.c_str(), &statStruct) != 0) {
135 LogError("stat() failed with " << DPL::GetErrnoString());
139 if (S_ISDIR(statStruct.st_mode)) {
140 //Yes, we ignore current, parent & hidden directories
141 if (dirName[0] != L'.') {
142 LogDebug("Adding locale directory \"" << dirName << "\"");
143 m_localeFolders.insert(dirName);
148 if (return_code != 0 || errno != 0) {
149 LogError("readdir_r() failed with " << DPL::GetErrnoString());
152 if (-1 == TEMP_FAILURE_RETRY(closedir(localeDir))) {
153 LogError("Failed to close dir: " << localePath << " with error: "
154 << DPL::GetErrnoString());
158 void TaskWidgetConfig::ProcessLocalizedStartFiles()
160 typedef DPL::String S;
162 m_installContext.widgetConfig.configInfo.startFile,
163 m_installContext.widgetConfig.configInfo.
164 startFileContentType,
165 m_installContext.widgetConfig.configInfo.startFileEncoding,
167 ProcessStartFile(S(L"index.htm"), S(L"text/html"));
168 ProcessStartFile(S(L"index.html"), S(L"text/html"));
169 ProcessStartFile(S(L"index.svg"), S(L"image/svg+xml"));
170 ProcessStartFile(S(L"index.xhtml"), S(L"application/xhtml+xml"));
171 ProcessStartFile(S(L"index.xht"), S(L"application/xhtml+xml"));
172 // TODO: we need better check if in current locales widget is valid
173 FOREACH(it, m_installContext.widgetConfig.localizationData.startFiles) {
174 if (it->propertiesForLocales.size() > 0) {
178 ThrowMsg(Exceptions::InvalidStartFile,
179 "The Widget has no valid start file");
182 void TaskWidgetConfig::ProcessStartFile(const DPL::OptionalString& path,
183 const DPL::OptionalString& type,
184 const DPL::OptionalString& encoding,
185 bool typeForcedInConfig)
187 using namespace WrtDB;
190 WidgetRegisterInfo::LocalizedStartFile startFileData;
191 startFileData.path = *path;
193 FOREACH(i, m_localeFolders) {
194 DPL::String pathPrefix = *i;
195 if (!pathPrefix.empty()) {
196 pathPrefix = L"locales/" + pathPrefix + L"/";
199 DPL::String relativePath = pathPrefix + *path;
200 DPL::String absolutePath = DPL::FromUTF8String(
201 m_installContext.locations->getConfigurationDir()) + L"/" +
204 // get property data from packaged app
205 if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
206 WidgetRegisterInfo::StartFileProperties startFileProperties;
208 startFileProperties.type = *type;
210 startFileProperties.type =
211 MimeTypeUtils::identifyFileMimeType(absolutePath);
214 //proceed only if MIME type is supported
215 if (MimeTypeUtils::isMimeTypeSupportedForStartFile(
216 startFileProperties.type))
219 startFileProperties.encoding = *encoding;
221 MimeTypeUtils::MimeAttributes attributes =
222 MimeTypeUtils::getMimeAttributes(
223 startFileProperties.type);
224 if (attributes.count(L"charset") > 0) {
225 startFileProperties.encoding =
226 attributes[L"charset"];
228 startFileProperties.encoding = L"UTF-8";
232 startFileData.propertiesForLocales[*i] =
236 //(there seems to be no similar requirement in .6,
237 //so let's throw only when mime type is
238 // provided explcitly in config.xml)
239 if (typeForcedInConfig) {
240 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
241 "Unsupported MIME type for start file.");
245 // set property data for hosted start url
246 // Hosted start url only support TIZEN WebApp
247 if (m_installContext.widgetConfig.webAppType ==
248 APP_TYPE_TIZENWEBAPP)
250 std::string startPath = DPL::ToUTF8String(
253 if (strstr(startPath.c_str(),
254 "http") == startPath.c_str())
256 WidgetRegisterInfo::StartFileProperties
259 startFileProperties.type = *type;
262 startFileProperties.encoding = *encoding;
264 startFileData.propertiesForLocales[*i] =
271 m_installContext.widgetConfig.localizationData.startFiles.push_back(
276 void TaskWidgetConfig::ProcessBackgroundPageFile()
278 if (!!m_installContext.widgetConfig.configInfo.backgroundPage) {
279 // check whether file exists
280 DPL::String backgroundPagePath = DPL::FromUTF8String(
281 m_installContext.locations->getConfigurationDir()) + L"/" +
282 *m_installContext.widgetConfig.configInfo.backgroundPage;
283 //if no then cancel installation
284 if (!WrtUtilFileExists(DPL::ToUTF8String(backgroundPagePath))) {
285 ThrowMsg(Exceptions::WidgetConfigFileInvalid,
286 L"Given background page file not found in archive");
291 void TaskWidgetConfig::ProcessLocalizedIcons()
293 using namespace WrtDB;
294 FOREACH(i, m_installContext.widgetConfig.configInfo.iconsList)
298 ProcessIcon(ConfigParserData::Icon(L"icon.svg"));
299 ProcessIcon(ConfigParserData::Icon(L"icon.ico"));
300 ProcessIcon(ConfigParserData::Icon(L"icon.png"));
301 ProcessIcon(ConfigParserData::Icon(L"icon.gif"));
302 ProcessIcon(ConfigParserData::Icon(L"icon.jpg"));
305 void TaskWidgetConfig::ProcessIcon(const WrtDB::ConfigParserData::Icon& icon)
308 bool isAnyIconValid = false;
309 //In case a default filename is passed as custom filename in config.xml, we
310 //need to keep a set of already processed filenames to avoid icon
314 using namespace WrtDB;
316 if (m_processedIconSet.count(icon.src) > 0) {
319 m_processedIconSet.insert(icon.src);
321 LocaleSet localesAvailableForIcon;
323 FOREACH(i, m_localeFolders)
325 DPL::String pathPrefix = *i;
326 if (!pathPrefix.empty()) {
327 pathPrefix = L"locales/" + pathPrefix + L"/";
330 DPL::String relativePath = pathPrefix + icon.src;
331 DPL::String absolutePath = DPL::FromUTF8String(
332 m_installContext.locations->getConfigurationDir()) + L"/" +
335 if (WrtUtilFileExists(DPL::ToUTF8String(absolutePath))) {
336 DPL::String type = MimeTypeUtils::identifyFileMimeType(absolutePath);
338 if (MimeTypeUtils::isMimeTypeSupportedForIcon(type)) {
339 isAnyIconValid = true;
340 localesAvailableForIcon.insert(*i);
341 LogDebug("Icon absolutePath :" << absolutePath <<
342 ", assigned locale :" << *i << ", type: " << type);
347 if (isAnyIconValid) {
348 WidgetRegisterInfo::LocalizedIcon localizedIcon(icon,
349 localesAvailableForIcon);
350 m_installContext.widgetConfig.localizationData.icons.push_back(
355 void TaskWidgetConfig::ProcessWidgetInstalledPath()
357 LogDebug("ProcessWidgetInstalledPath");
358 m_installContext.widgetConfig.widgetInstalledPath =
360 m_installContext.locations->getPackageInstallationDir());
363 void TaskWidgetConfig::ProcessAppControlInfo()
365 LogDebug("ProcessAppControlInfo");
366 using namespace WrtDB;
368 WrtDB::ConfigParserData::AppControlInfo::Disposition disposition =
369 WrtDB::ConfigParserData::AppControlInfo::Disposition::WINDOW;
370 FOREACH(it, m_installContext.widgetConfig.configInfo.settingsList) {
371 if (!strcmp(DPL::ToUTF8String(it->m_name).c_str(), "nodisplay") &&
372 !strcmp(DPL::ToUTF8String(it->m_value).c_str(), "true"))
375 WrtDB::ConfigParserData::AppControlInfo::Disposition::INLINE;
379 std::map<std::string, int> srcMap;
381 // index = 0 is reserved for start file
382 FOREACH(startFileIt, m_installContext.widgetConfig.localizationData.startFiles)
384 if (!startFileIt->propertiesForLocales.empty()) {
385 std::string src = DPL::ToUTF8String(startFileIt->path);
386 if (srcMap.find(src) == srcMap.end()) {
387 LogDebug("Insert [" << src << "," << index << "]");
388 srcMap.insert(std::pair<std::string, int>(src, index++));
393 FOREACH(appControlIt, m_installContext.widgetConfig.configInfo.appControlList)
395 appControlIt->m_disposition = disposition;
396 std::string src = DPL::ToUTF8String(appControlIt->m_src);
397 LogDebug("src = [" << src << "]");
398 std::map<std::string, int>::iterator findIt = srcMap.find(src);
399 if (findIt == srcMap.end()) {
400 LogDebug("Insert [" << src << "," << index << "]");
401 srcMap.insert(std::pair<std::string, int>(src, index));
402 appControlIt->m_index = index++;
404 LogDebug("Exist [" << src << "," << findIt->second << "]");
405 appControlIt->m_index = findIt->second;
410 void TaskWidgetConfig::ProcessSecurityModel()
412 // 0104. If the "required_version" specified in the Web Application's
413 // configuration is 2.2 or higher and if the Web Application's
414 // configuration is "CSP-compatible configuration", then the WRT MUST be
415 // set to "CSP-based security mode". Otherwise, the WRT MUST be set to
416 // "WARP-based security mode".
417 // 0105. A Web Application configuration is "CSP-compatible configuration"
418 // if the configuration includes one or more of
419 // <tizen:content-security-policy> /
420 // <tizen:content-security-policy-report-only> /
421 // <tizen:allow-navigation> elements.
423 bool isSecurityModelV1 = false;
424 bool isSecurityModelV2 = false;
425 WrtDB::ConfigParserData &data = m_installContext.widgetConfig.configInfo;
427 if (!data.cspPolicy.IsNull() ||
428 !data.cspPolicyReportOnly.IsNull() ||
429 !data.allowNavigationInfoList.empty())
431 data.accessInfoSet.clear();
435 if (!data.accessInfoSet.empty()) {
436 isSecurityModelV1 = true;
439 // CSP & allow-navigation is V2
440 if (!data.cspPolicy.IsNull() ||
441 !data.cspPolicyReportOnly.IsNull() ||
442 !data.allowNavigationInfoList.empty())
444 isSecurityModelV2 = true;
447 if (isSecurityModelV1 && isSecurityModelV2) {
448 LogError("Security model is conflict");
449 ThrowMsg(Exceptions::NotAllowed, "Security model is conflict");
450 } else if (isSecurityModelV1) {
451 data.securityModelVersion =
452 WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V1;
453 } else if (isSecurityModelV2) {
454 data.securityModelVersion =
455 WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V2;
457 data.securityModelVersion =
458 WrtDB::ConfigParserData::SecurityModelVersion::SECURITY_MODEL_V1;
461 m_installContext.job->UpdateProgress(
462 InstallerContext::INSTALL_WIDGET_CONFIG2,
463 "Finished process security model");
466 void TaskWidgetConfig::StepCheckMinVersionInfo()
468 if (!isMinVersionCompatible(
469 m_installContext.widgetConfig.webAppType.appType,
470 m_installContext.widgetConfig.minVersion))
473 "Platform version lower than required -> cancelling installation");
474 ThrowMsg(Exceptions::NotAllowed,
475 "Platform version does not meet requirements");
478 m_installContext.job->UpdateProgress(
479 InstallerContext::INSTALL_WIDGET_CONFIG2,
480 "Check MinVersion Finished");
483 void TaskWidgetConfig::StepVerifyFeatures()
485 using namespace WrtDB;
486 ConfigParserData &data = m_installContext.widgetConfig.configInfo;
487 ConfigParserData::FeaturesList list = data.featuresList;
488 ConfigParserData::FeaturesList newList;
490 //in case of tests, this variable is unused
491 std::string featureInfo;
494 // check feature vender for permission
495 // WAC, TIZEN WebApp cannot use other feature
497 if (!isFeatureAllowed(m_installContext.widgetConfig.webAppType.appType,
500 LogDebug("This application type not allowed to use this feature");
502 Exceptions::WidgetConfigFileInvalid,
504 m_installContext.widgetConfig.webAppType.getApptypeToString()
506 "] cannot be allowed to use [" <<
507 DPL::ToUTF8String(it->name) + "] feature");
510 featureInfo += DPL::ToUTF8String(it->name);
511 featureInfo += DPL::ToUTF8String(BR);
514 if (!data.accessInfoSet.empty()) {
515 featureInfo += WINDGET_INSTALL_NETWORK_ACCESS;
516 featureInfo += DPL::ToUTF8String(BR);
518 data.featuresList = newList;
520 m_installContext.job->UpdateProgress(
521 InstallerContext::INSTALL_WIDGET_CONFIG2,
522 "Widget Config step2 Finished");
525 void TaskWidgetConfig::StepVerifyLivebox()
527 using namespace WrtDB;
528 ConfigParserData &data = m_installContext.widgetConfig.configInfo;
529 ConfigParserData::LiveboxList liveBoxList = data.m_livebox;
531 if (liveBoxList.size() <= 0) {
535 FOREACH (it, liveBoxList) {
538 if ((**it).m_type.empty()) {
539 boxType = web_provider_livebox_get_default_type();
541 boxType = DPL::ToUTF8String((**it).m_type);
544 LogDebug("livebox type: " << boxType);
546 ConfigParserData::LiveboxInfo::BoxSizeList boxSizeList =
547 (**it).m_boxInfo.m_boxSize;
548 char** boxSize = static_cast<char**>(
549 malloc(sizeof(char*)* boxSizeList.size()));
552 FOREACH (m, boxSizeList) {
553 boxSize[boxSizeCnt++] = strdup(DPL::ToUTF8String((*m).m_size).c_str());
556 bool chkSize = web_provider_plugin_check_supported_size(
557 boxType.c_str(), boxSize, boxSizeCnt);
559 for(int i = 0; i < boxSizeCnt; i++) {
565 LogError("Invalid boxSize");
566 ThrowMsg(Exceptions::WidgetConfigFileInvalid, "Invalid boxSize");
571 bool TaskWidgetConfig::isFeatureAllowed(WrtDB::AppType appType,
572 DPL::String featureName)
574 using namespace WrtDB;
575 LogDebug("AppType = [" <<
576 WidgetType(appType).getApptypeToString() << "]");
577 LogDebug("FetureName = [" << featureName << "]");
579 AppType featureType = APP_TYPE_UNKNOWN;
580 std::string featureStr = DPL::ToUTF8String(featureName);
581 const char* feature = featureStr.c_str();
583 // check prefix of feature name
584 if (strstr(feature, PluginsPrefix::TIZENPluginsPrefix) == feature) {
585 // Tizen WebApp feature
586 featureType = APP_TYPE_TIZENWEBAPP;
587 } else if (strstr(feature, PluginsPrefix::W3CPluginsPrefix) == feature) {
588 // W3C standard feature
589 // Both WAC and TIZEN WebApp are possible to use W3C plugins
593 // unknown feature will be checked next step
597 if (appType == featureType) {
603 bool TaskWidgetConfig::parseVersionString(const std::string &version,
606 long µVersion) const
608 std::istringstream inputString(version);
609 inputString >> majorVersion;
610 if (inputString.bad() || inputString.fail()) {
611 LogWarning("Invalid minVersion format.");
614 inputString.get(); // skip period
615 inputString >> minorVersion;
616 if (inputString.bad() || inputString.fail()) {
617 LogWarning("Invalid minVersion format");
620 inputString.get(); // skip period
621 if (inputString.bad() || inputString.fail()) {
622 inputString >> microVersion;
628 bool TaskWidgetConfig::isMinVersionCompatible(
629 WrtDB::AppType appType,
630 const DPL::OptionalString &
633 if (widgetVersion.IsNull() || (*widgetVersion).empty()) {
634 if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
637 LogWarning("minVersion attribute is empty. WRT assumes platform "
638 "supports this widget.");
643 //Parse widget version
644 long majorWidget = 0, minorWidget = 0, microWidget = 0;
645 if (!parseVersionString(DPL::ToUTF8String(*widgetVersion), majorWidget,
646 minorWidget, microWidget))
648 LogWarning("Invalid format of widget version string.");
652 //Parse supported version
653 long majorSupported = 0, minorSupported = 0, microSupported = 0;
655 if (appType == WrtDB::AppType::APP_TYPE_TIZENWEBAPP) {
656 version = WrtDB::GlobalConfig::GetTizenVersion();
658 LogWarning("Invaild AppType");
662 if (!parseVersionString(version,
663 majorSupported, minorSupported, microSupported))
665 LogWarning("Invalid format of platform version string.");
669 if (majorWidget > majorSupported ||
670 (majorWidget == majorSupported && minorWidget > minorSupported) ||
671 (majorWidget == majorSupported && minorWidget == minorSupported
672 && microWidget > microSupported))
674 LogDebug("Platform doesn't support this widget.");
680 bool TaskWidgetConfig::isTizenWebApp() const
683 if (m_installContext.widgetConfig.webAppType.appType
684 == WrtDB::AppType::APP_TYPE_TIZENWEBAPP)
692 bool TaskWidgetConfig::parseConfigurationFileBrowser(
693 WrtDB::ConfigParserData& configInfo,
694 const std::string& _currentPath)
699 parser.Parse(_currentPath, ElementParserPtr(new
703 DPL::FromUTF32String(
706 Catch(ElementParser::Exception::Base)
708 LogError("Invalid widget configuration file!");
714 bool TaskWidgetConfig::parseConfigurationFileWidget(
715 WrtDB::ConfigParserData& configInfo,
716 const std::string& _currentPath)
718 std::string configFilePath;
719 WrtUtilJoinPaths(configFilePath, _currentPath, WRT_WIDGET_CONFIG_FILE_NAME);
720 if (!WrtUtilFileExists(configFilePath))
722 LogError("Archive does not contain configuration file");
726 LogDebug("Configuration file: " << configFilePath);
731 #ifdef SCHEMA_VALIDATION_ENABLED
732 if(!parser.Validate(configFilePath, WRT_WIDGETS_XML_SCHEMA))
734 LogError("Invalid configuration file - schema validation failed");
738 parser.Parse(configFilePath,
739 ElementParserPtr(new RootParser<WidgetParser>(
741 DPL::FromUTF32String(L"widget"))));
744 Catch (ElementParser::Exception::Base)
746 LogError("Invalid configuration file!");
751 bool TaskWidgetConfig::locateAndParseConfigurationFile(
752 const std::string& _currentPath,
753 WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
754 const std::string& baseFolder)
756 using namespace WrtDB;
758 ConfigParserData& configInfo = pWidgetConfigInfo.configInfo;
760 // check if this installation from browser, or not.
761 size_t pos = _currentPath.rfind("/");
762 std::ostringstream infoPath;
763 infoPath << _currentPath.substr(pos + 1);
765 if (infoPath.str() != WRT_WIDGET_CONFIG_FILE_NAME) {
766 if (_currentPath.empty() || baseFolder.empty()) {
769 // in case of general installation using wgt archive
770 if (!parseConfigurationFileWidget(configInfo, _currentPath))
775 // in case of browser installation
776 if (!parseConfigurationFileBrowser(configInfo, _currentPath))
782 if (!fillWidgetConfig(pWidgetConfigInfo, configInfo)) {
788 bool TaskWidgetConfig::fillWidgetConfig(
789 WrtDB::WidgetRegisterInfo& pWidgetConfigInfo,
790 WrtDB::ConfigParserData& configInfo)
792 if (!!configInfo.widget_id) {
793 if (!pWidgetConfigInfo.guid) {
794 pWidgetConfigInfo.guid = configInfo.widget_id;
796 if (pWidgetConfigInfo.guid != configInfo.widget_id) {
797 LogError("Invalid archive");
802 if (!!configInfo.tizenAppId) {
803 if (DPL::ToUTF8String(pWidgetConfigInfo.tzAppid).compare(
804 DPL::ToUTF8String(*configInfo.tizenAppId)) < 0)
806 LogError("Invalid archive - Tizen App ID not same error");
810 if (!!configInfo.tizenPkgId) {
811 if (pWidgetConfigInfo.tzPkgid != *configInfo.tizenPkgId) {
812 LogError("Invalid archive - Tizen Pkg ID not same error");
816 if (!!configInfo.version) {
817 if (!pWidgetConfigInfo.version) {
818 pWidgetConfigInfo.version = configInfo.version;
820 if (pWidgetConfigInfo.version != configInfo.version) {
821 LogError("Invalid archive");
826 if (!!configInfo.minVersionRequired) {
827 pWidgetConfigInfo.minVersion = configInfo.minVersionRequired;
828 } else if (!!configInfo.tizenMinVersionRequired) {
829 pWidgetConfigInfo.minVersion = configInfo.tizenMinVersionRequired;
834 void TaskWidgetConfig::processFile(
835 const std::string& path,
836 WrtDB::WidgetRegisterInfo &
839 if (!locateAndParseConfigurationFile(path, widgetConfiguration,
842 LogWarning("Widget archive: Failed while parsing config file");
843 ThrowMsg(Exception::ConfigParseFailed, path);
846 } //namespace WidgetInstall