2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file ManifestHandler.cpp
19 * @brief This is the implementation file for %ManifestHandler class.
23 #include <FSys_SystemInfoImpl.h>
24 #include <FBase_StringConverter.h>
26 #include "ManifestHandler.h"
27 #include "PrivilegeHandler.h"
28 #include "InstallerUtil.h"
29 #include "ManifestLiveboxesParser.h"
30 #include "ManifestAccountsParser.h"
31 #include "ManifestAppControlsParser.h"
33 using namespace Tizen::Base;
34 using namespace Tizen::Base::Collection;
35 using namespace Tizen::Base::Utility;
36 using namespace Tizen::App;
37 using namespace Tizen::Io;
38 using namespace Tizen::System;
40 ManifestHandler::ManifestHandler(void)
42 ,__pPrivilegeList(null)
43 ,__pContentDataList(null)
44 ,__pAppControlInfoImpl(null)
45 ,__pAppControlCapabilityInfoImpl(null)
46 ,__pAppControlResolutionInfoImpl(null)
47 ,__pDataControlInfo(null)
48 ,__pDataControlType(null)
50 ,__pDefaultIconType(null)
51 ,__isDefaultMainmenu(false)
52 ,__isDefaultSetting(false)
53 ,__isDefaultTicker(false)
54 ,__isDefaultQuickpanel(false)
55 ,__isDefaultLaunchImage(false)
56 ,__isDefaultName(false)
57 ,__isDefaultAppDetected(false)
59 ,__isParserMode(false)
64 ManifestHandler::~ManifestHandler(void)
66 delete[] __pDefaultIconType;
67 __pDefaultIconType = null;
71 ManifestHandler::Construct(InstallationContext* pContext)
73 __pContext = pContext;
79 ManifestHandler::GetContext(void)
85 ManifestHandler::Parse(const char *pFilepath)
87 return ParseDocument(pFilepath);
91 ManifestHandler::OnStartElement(const char *pName)
93 TryReturn(pName, true, "pName is null.");
97 if (__isParserMode == true)
99 TryReturn(__pParser, false, "__pParser is null");
100 return __pParser->OnStartElement(pName);
103 if (strcasecmp(pName, "Manifest") == 0)
105 AppLog("------------------------------------------");
106 AppLog("manifest.xml");
107 AppLog("------------------------------------------");
108 AppLog("<%s>", pName);
110 else if (strcasecmp(pName, "Apps") == 0)
112 AppLog("<%s>", pName);
114 else if (strcasecmp(pName, "UiApp") == 0)
116 status = OnUiAppStartElement();
118 else if (strcasecmp(pName, "ServiceApp") == 0)
120 status = OnServiceAppStartElement();
122 else if (strcasecmp(pName, "DataControl") == 0)
124 status = OnDataControlStartElement();
126 else if (strcasecmp(pName, "Privileges") == 0)
128 status = OnPrivilegesStartElement();
130 else if (strcasecmp(pName, "UiScalability") == 0)
132 status = OnUiScalabilityStartElement();
134 else if (strcasecmp(pName, "UiTheme") == 0)
136 status = OnUiThemeStartElement();
138 else if (strcasecmp(pName, "Icons") == 0)
140 status = OnIconsStartElement();
142 else if (strcasecmp(pName, "Contents") == 0)
144 status = OnContentsStartElement();
146 else if (strcasecmp(pName, "Content") == 0)
148 status = OnContentStartElement();
150 else if ((strcasecmp(pName, "Liveboxes") == 0) || strcasecmp(pName, "AppWidgets") == 0)
152 status = OnLiveboxesStartElement(pName);
154 else if (strcasecmp(pName, "Accounts") == 0)
156 status = OnAccountsStartElement(pName);
158 else if (strcasecmp(pName, "AppControls") == 0)
160 status = OnAppControlsStartElement(pName);
162 else if (strcasecmp(pName, "Permission") == 0)
164 status = OnPermissionStartElement(pName);
169 __isParserMode = false;
177 ManifestHandler::OnEndElement(const char *pName)
179 TryReturn(pName, true, "pName is null.");
183 if (__isParserMode == true)
185 TryReturn(__pParser, false, "__pParser is null");
186 __pParser->OnEndElement(pName);
188 if ((strcasecmp(pName, "Liveboxes") == 0) || strcasecmp(pName, "AppWidgets") == 0)
190 status = OnLiveboxesEndElement();
192 else if (strcasecmp(pName, "Accounts") == 0)
194 status = OnAccountsEndElement();
196 else if (strcasecmp(pName, "AppControls") == 0)
198 status = OnAppControlsEndElement();
204 if (strcasecmp(pName, "Privileges") == 0)
206 status = OnPrivilegesEndElement();
208 else if (strcasecmp(pName, "UiApp") == 0)
210 status = OnUiAppEndElement();
212 else if (strcasecmp(pName, "ServiceApp") == 0)
214 status = OnServiceAppEndElement();
216 else if (strcasecmp(pName, "DataControl") == 0)
218 status = OnDataControlEndElement();
220 else if (strcasecmp(pName, "DataControlType") == 0)
222 status = OnDataControlTypeEndElement();
224 else if (strcasecmp(pName, "Apps") == 0)
226 status = OnAppsEndElement();
228 else if (strcasecmp(pName, "UiScalability") == 0)
230 AppLog("</%s>", pName);
232 else if (strcasecmp(pName, "Icons") == 0)
234 status = OnIconsEndElement();
236 else if (strcasecmp(pName, "Contents") == 0)
238 status = OnContentsEndElement();
240 else if (strcasecmp(pName, "Content") == 0)
242 status = OnContentEndElement();
244 else if (strcasecmp(pName, "Manifest") == 0)
246 status = OnManifestEndElement();
258 ManifestHandler::OnCharacters(const char *pCharacters)
262 if (__isParserMode == true)
264 TryReturn(__pParser, false, "__pParser is null");
265 return __pParser->OnCharacters(pCharacters);
268 char *pName = GetElementName();
269 TryReturn(pName, false, "pName is null.");
271 if (strcasecmp(pName, "Id") == 0)
273 status = OnIdValue(pCharacters);
275 else if (strcasecmp(pName, "Version") == 0)
277 status = OnVersionValue(pCharacters);
279 else if (strcasecmp(pName, "Type") == 0)
281 status = OnTypeValue(pCharacters);
283 else if (strcasecmp(pName, "Url") == 0)
285 status = OnUrlValue(pCharacters);
287 else if (strcasecmp(pName, "ApiVersion") == 0)
289 status = OnApiVersionValue(pCharacters);
291 else if (strcasecmp(pName, "Privilege") == 0)
293 status = OnPrivilegeValue(pCharacters);
295 else if (strcasecmp(pName, "Name") == 0)
297 status = OnNameValue(pCharacters);
299 else if (strcasecmp(pName, "DisplayName") == 0)
301 status = OnNameValue(pCharacters);
303 else if (strcasecmp(pName, "Author") == 0)
305 status = OnAuthorValue(pCharacters);
307 else if (strcasecmp(pName, "Description") == 0)
309 status = OnDescriptionValue(pCharacters);
311 else if (strcasecmp(pName, "Icon") == 0)
313 status = OnIconValue(pCharacters);
315 else if (strcasecmp(pName, "DataControlType") == 0)
317 status = OnDataControlTypeValue(pCharacters);
319 else if (strcasecmp(pName, "Condition") == 0)
321 status = OnConditionValue(pCharacters);
323 else if (strcasecmp(pName, "Notification") == 0)
325 status = OnNotificationValue(pCharacters);
327 else if (strcasecmp(pName, "InstallationLocation") == 0)
329 status = OnInstallationLocationValue(pCharacters);
331 else if (strcasecmp(pName, "Category") == 0)
333 status = OnCategoryValue(pCharacters);
345 ManifestHandler::OnPrivilegesStartElement(void)
347 __pPrivilegeList = new (std::nothrow) ArrayList;
348 TryReturn(__pPrivilegeList, false, "__pPrivilegeList is null");
350 AppLog("<Privileges>");
356 ManifestHandler::OnUiAppStartElement(void)
358 __pAppData = new (std::nothrow) AppData;
359 TryReturn(__pAppData, false, "__pAppData is null");
361 InstallerError error = __pAppData->Construct();
362 TryReturn(error == INSTALLER_ERROR_NONE, false, "pAppData->Construct() failed.");
366 XmlAttribute *pAttr = GetAttribute();
367 TryReturn(pAttr, true, "pAttr is null");
369 ParseAppAttribute(pAttr, true);
375 ManifestHandler::OnServiceAppStartElement(void)
377 __pAppData = new (std::nothrow) AppData;
378 TryReturn(__pAppData, false, "__pAppData is null");
380 InstallerError error = __pAppData->Construct();
381 TryReturn(error == INSTALLER_ERROR_NONE, false, "pAppData->Construct() failed.");
383 AppLog("<ServiceApp>");
385 XmlAttribute *pAttr = GetAttribute();
386 TryReturn(pAttr, true, "pAttr is null");
388 ParseAppAttribute(pAttr, false);
394 ManifestHandler::OnIconsStartElement(void)
396 result r = E_SUCCESS;
398 String defaultIconType;
402 r = _SystemInfoImpl::GetSysInfo(L"ScreenWidth", width);
405 defaultIconType = L"Xhigh";
411 defaultIconType = L"High";
415 defaultIconType = L"Xhigh";
419 AppLog("ScreenWidth = [%d]", width);
421 __pDefaultIconType = _StringConverter::CopyToCharArrayN(defaultIconType);
422 TryReturn(__pDefaultIconType, false, "__pDefaultIconType is null.");
424 AppLog("DefaultIconType = [%s]", __pDefaultIconType);
430 ManifestHandler::OnUiScalabilityStartElement(void)
432 XmlAttribute *pAttr = null;
433 char* pCoordinateSystem = null;
434 char* pBaseScreenSize = null;
435 char* pLogicalCoordinate = null;
437 AppLog("<UiScalability>");
439 pAttr = GetAttribute();
440 TryReturn(pAttr, true, "pAttr is null");
442 pCoordinateSystem = pAttr->Find("CoordinateSystem");
443 if (pCoordinateSystem)
445 String* pKey = new (std::nothrow) String("CoordinateSystem");
446 TryReturn(pKey, false, "pKey is null");
447 String* pValue = new (std::nothrow) String(pCoordinateSystem);
448 TryReturn(pValue, false, "pValue is null");
450 __pAppData->__pFeatureList->Add(pKey, pValue);
451 AppLog("<CoordinateSystem=%s>", pCoordinateSystem);
454 pBaseScreenSize = pAttr->Find("BaseScreenSize");
457 String* pKey = new (std::nothrow) String("BaseScreenSize");
458 TryReturn(pKey, false, "pKey is null");
459 String* pValue = new (std::nothrow) String(pBaseScreenSize);
460 TryReturn(pValue, false, "pValue is null");
462 __pAppData->__pFeatureList->Add(pKey, pValue);
463 AppLog("<BaseScreenSize=%s>", pBaseScreenSize);
466 pLogicalCoordinate = pAttr->Find("LogicalCoordinate");
467 if (pLogicalCoordinate)
469 String* pKey = new (std::nothrow) String("LogicalCoordinate");
470 TryReturn(pKey, false, "pKey is null");
471 String* pValue = new (std::nothrow) String(pLogicalCoordinate);
472 TryReturn(pValue, false, "pValue is null");
474 __pAppData->__pFeatureList->Add(pKey, pValue);
475 AppLog("<LogicalCoordinate=%s>", pLogicalCoordinate);
482 ManifestHandler::OnUiThemeStartElement(void)
484 XmlAttribute *pAttr = null;
485 char *pSystemTheme = null;
486 char *pUserDefinedTheme = null;
490 pAttr = GetAttribute();
491 TryReturn(pAttr, true, "pAttr is null");
493 pSystemTheme = pAttr->Find("SystemTheme");
496 String* pKey = new (std::nothrow) String("SystemTheme");
497 TryReturn(pKey, false, "pKey is null");
498 String* pValue = new (std::nothrow) String(pSystemTheme);
499 TryReturn(pValue, false, "pValue is null");
501 __pAppData->__pFeatureList->Add(pKey, pValue);
502 AppLog("<SystemTheme=%s>", pSystemTheme);
505 pUserDefinedTheme = pAttr->Find("UserDefinedTheme");
506 if (pUserDefinedTheme)
508 String* pKey = new (std::nothrow) String("UserDefinedTheme");
509 TryReturn(pKey, false, "pKey is null");
510 String* pValue = new (std::nothrow) String(pUserDefinedTheme);
511 TryReturn(pValue, false, "pValue is null");
513 __pAppData->__pFeatureList->Add(pKey, pValue);
514 AppLog("<UserDefinedTheme=%s>", pUserDefinedTheme);
521 ManifestHandler::OnDataControlStartElement(void)
523 XmlAttribute* pAttr = null;
524 char* pProviderId = null;
526 pAttr = GetAttribute();
527 TryReturn(pAttr, true, "pAttr is null");
529 pProviderId = pAttr->Find("ProviderId");
530 TryReturn(pProviderId, true, "pProviderId is null");
532 __pDataControlInfo = new (std::nothrow) DataControlInfo;
533 TryReturn(__pDataControlInfo, false, "__pDataControlInfo is null");
535 __pDataControlInfo->__providerId = pProviderId;
537 AppLog("<DataControl ProviderId=\"%s\">", pProviderId);
543 ManifestHandler::OnContentsStartElement(void)
545 __pContentDataList = new (std::nothrow) ArrayList;
546 TryReturn(__pContentDataList, false, "__pContentDataList is null");
548 AppLog("<Contents>");
554 ManifestHandler::OnContentStartElement(void)
556 TryReturn(__pContentData == null, false, "__pContentData is not null");
558 XmlAttribute *pAttr = null;
559 char *pDefault = null;
561 __pContentData = new (std::nothrow) ContentData;
562 TryReturn(__pContentData, false, "__pContentData is null");
564 pAttr = GetAttribute();
565 TryReturn(pAttr, true, "pAttr is null");
567 char* pId = pAttr->Find("Id");
570 __pContentData->SetContentId(pId);
573 char* pEntryName = pAttr->Find("EntryName");
576 __pContentData->SetContentId(pEntryName);
579 pDefault = pAttr->Find("Default");
582 if (strcasecmp(pDefault, "True") == 0)
584 __isDefaultAppDetected = true;
588 AppLog("<Content Id=\"%s\" EntryName=\"%s\">", pId, pEntryName);
594 ManifestHandler::OnLiveboxesStartElement(const char *pName)
596 __pParser = new (std::nothrow) ManifestLiveboxesParser;
597 TryReturn(__pParser, false, "__pParser is null");
599 __isParserMode = true;
600 AppLog("------------------------------------------");
601 __pParser->Construct(this);
603 return __pParser->OnStartElement(pName);
607 ManifestHandler::OnAccountsStartElement(const char *pName)
609 __pParser = new (std::nothrow) ManifestAccountsParser;
610 TryReturn(__pParser, false, "__pParser is null");
612 __isParserMode = true;
613 AppLog("------------------------------------------");
614 __pParser->Construct(this);
616 return __pParser->OnStartElement(pName);
620 ManifestHandler::OnAppControlsStartElement(const char *pName)
622 __pParser = new (std::nothrow) ManifestAppControlsParser;
623 TryReturn(__pParser, false, "__pParser is null");
625 __isParserMode = true;
626 AppLog("------------------------------------------");
627 __pParser->Construct(this);
629 return __pParser->OnStartElement(pName);
633 ManifestHandler::OnPermissionStartElement(const char* pName)
635 XmlAttribute* pAttr = null;
638 pAttr = GetAttribute();
639 TryReturn(pAttr, true, "pAttr is null.");
641 pType = pAttr->Find("Type");
642 TryReturn(pType, true, "pType is null.");
644 if (__pAppData->__permissionType.IsEmpty() == true)
646 __pAppData->__permissionType = pType;
651 if (__pAppData->__permissionType.Equals(type, true) == false)
653 AppLog("Invalid Permission Type [%ls][%ls]", __pAppData->__permissionType.GetPointer(), type.GetPointer());
658 AppLog("<Permission Type=\"%s\">", pType);
664 ManifestHandler::OnPrivilegesEndElement(void)
666 if (__pContext->__isVerificationMode == false)
668 AppLog("no signature file[%ls]", __pContext->GetSignatureXmlPath().GetPointer());
670 result r = E_SUCCESS;
672 String hmacPrivileges;
673 ArrayList stringPrivilegeList;
674 stringPrivilegeList.Construct(125);
675 PackageId packageId = __pContext->__packageId;
676 r = PrivilegeHandler::GenerateCipherPrivilege(packageId, *__pPrivilegeList, privileges, hmacPrivileges, stringPrivilegeList);
677 TryReturn(!IsFailed(r), false, "privMgr.GeneratePrivilegeString() failed");
679 __pContext->__privileges = privileges;
680 __pContext->__hmacPrivileges = hmacPrivileges;
681 __pContext->__pStringPrivilegeList = new ArrayList;
682 __pContext->__pStringPrivilegeList->Construct(stringPrivilegeList);
685 __pContext->SetPrivilegeList(__pPrivilegeList);
687 AppLog("</Privileges>");
693 ManifestHandler::OnUiAppEndElement(void)
695 if (__pAppData->__isSubMode == true)
697 __pAppData->__pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
698 __pAppData->__pAppControlDataList = null;
699 __pAppData->__subModeAppName = __pAppData->__name;
702 __isDefaultName = false;
704 __pContext->__pAppDataList->Add(__pAppData);
713 ManifestHandler::OnServiceAppEndElement(void)
715 if (__pAppData->__isSubMode == true)
717 __pAppData->__pSubModeAppControlDataList = __pAppData->__pAppControlDataList;
718 __pAppData->__pAppControlDataList = null;
719 __pAppData->__subModeAppName = __pAppData->__name;
722 __isDefaultName = false;
724 __pContext->__pAppDataList->Add(__pAppData);
727 AppLog("</ServiceApp>");
733 ManifestHandler::OnAppsEndElement(void)
741 ManifestHandler::OnIconsEndElement(void)
749 ManifestHandler::OnDataControlEndElement(void)
751 __pAppData->__pDataControlList->Add(__pDataControlInfo);
752 __pDataControlInfo = null;
753 AppLog("</DataControl>");
759 ManifestHandler::OnDataControlTypeEndElement(void)
761 __pDataControlInfo->__pControlTypeList->Add(__pDataControlType);
762 __pDataControlType = null;
763 AppLog("</DataControlType>");
769 ManifestHandler::OnContentsEndElement(void)
771 __pContext->SetContentDataList(__pContentDataList);
772 __pContentDataList = null;
773 AppLog("</Contents>");
779 ManifestHandler::OnContentEndElement(void)
781 __pContentDataList->Add(*__pContentData);
782 __pContentData = null;
783 AppLog("</Content>");
789 ManifestHandler::OnLiveboxesEndElement(void)
792 __isParserMode = false;
793 AppLog("------------------------------------------");
799 ManifestHandler::OnAccountsEndElement(void)
802 __isParserMode = false;
803 AppLog("------------------------------------------");
809 ManifestHandler::OnAppControlsEndElement(void)
812 __isParserMode = false;
813 AppLog("------------------------------------------");
819 ManifestHandler::OnManifestEndElement(void)
821 TryReturn(__isDefaultAppDetected, false, "[osp-installer][Error] Main tag is not detected...");
822 AppLog("</Manifest>");
828 ManifestHandler::OnIdValue(const char *pCharacters)
830 AppLog("<Id>%s</Id>", pCharacters);
831 __pContext->__packageId = pCharacters;
837 ManifestHandler::OnVersionValue(const char *pCharacters)
839 AppLog("<Version>%s</Version>", pCharacters);
840 __pContext->__version = pCharacters;
846 ManifestHandler::OnTypeValue(const char *pCharacters)
848 AppLog("<Type>%s</Type>", pCharacters);
850 if (strcasecmp(pCharacters, "Contents") == 0)
852 __pContext->__apiVersion = L"3.0";
859 ManifestHandler::OnAuthorValue(const char *pCharacters)
861 AppLog("<Author>%s</Author>", pCharacters);
862 __pContext->__author = pCharacters;
868 ManifestHandler::OnUrlValue(const char *pCharacters)
870 __pContext->__url = pCharacters;
871 AppLog("<Url>%s</Url>", pCharacters);
877 ManifestHandler::OnApiVersionValue(const char *pCharacters)
879 __pContext->__apiVersion = pCharacters;
880 AppLog("<ApiVersion>%s</ApiVersion>", pCharacters);
882 XmlAttribute *pAttr = GetAttribute();
885 char* pOspCompat = pAttr->Find("OspCompat");
888 AppLog(" - OspCompat=%s", pOspCompat);
889 __pContext->__isOspCompat = true;
897 ManifestHandler::OnPrivilegeValue(const char *pCharacters)
899 __pPrivilegeList->Add(*new (std::nothrow) String(pCharacters));
900 AppLog("<Privilege>%s</Privilege>", pCharacters);
906 ManifestHandler::OnIconValue(const char *pCharacters)
908 AppLog("<Icon>%s</Icon>", pCharacters);
910 XmlAttribute* pAttr = GetAttribute();
911 TryReturn(pAttr, true, "pAttr is null");
913 char* pSection = pAttr->Find("Section");
914 TryReturn(pSection, true, "pSection is null");
915 AppLog(" - Section=%s", pSection);
917 TryReturn(__pDefaultIconType, false, "__pDefaultIconType is null");
920 char* pType = pAttr->Find("Type");
923 AppLog("__pDefaultIconType=%s", __pDefaultIconType);
924 if (strcasecmp(__pDefaultIconType, "Xhigh") == 0)
926 iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
928 else if (strcasecmp(__pDefaultIconType, "High") == 0)
930 iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
934 TryReturn(0, false, "Invalid __pDefaultIconType[%s]", __pDefaultIconType);
939 AppLog(" - Type=%s", pType);
940 if (strcasecmp(pType, "Xhigh") == 0)
942 iconRelPath.Format(1024, L"screen-density-xhigh/%s", pCharacters);
944 else if (strcasecmp(pType, "High") == 0)
946 iconRelPath.Format(1024, L"screen-density-high/%s", pCharacters);
950 TryReturn(0, false, "Invalid IconType [%s]", __pDefaultIconType);
954 if (FindElement("Content") == true)
956 TryReturn(__pContentData, false, "__pContentData is null");
957 __pContentData->SetIcon(iconRelPath);
963 if (strcasecmp(pSection, "MainMenu") == 0)
965 __pAppData->__mainmenuIcon = iconRelPath;
967 else if (strcasecmp(pSection, "Setting") == 0)
969 __pAppData->__settingIcon = iconRelPath;
971 else if (strcasecmp(pSection, "Notification") == 0)
973 __pAppData->__notificationIcon = iconRelPath;
978 if (strcasecmp(pSection, "MainMenu") == 0)
980 if (__isDefaultMainmenu == false)
982 __pAppData->__mainmenuIcon = iconRelPath;
985 if (strcasecmp(pType, __pDefaultIconType) == 0)
987 __isDefaultMainmenu = true;
990 else if (strcasecmp(pSection, "Setting") == 0)
992 if (__isDefaultSetting == false)
994 __pAppData->__settingIcon = iconRelPath;
997 if (strcasecmp(pType, __pDefaultIconType) == 0)
999 __isDefaultSetting = true;
1002 else if (strcasecmp(pSection, "Notification") == 0)
1004 if (__isDefaultQuickpanel == false)
1006 __pAppData->__notificationIcon = iconRelPath;
1009 if (strcasecmp(pType, __pDefaultIconType) == 0)
1011 __isDefaultQuickpanel = true;
1021 ManifestHandler::OnNameValue(const char *pCharacters)
1023 XmlAttribute* pAttr = 0;
1024 char* pAttrValue = 0;
1026 pAttr = GetAttribute();
1027 TryReturn(pAttr, true, "pAttr is null");
1029 pAttrValue = pAttr->Find("Locale");
1030 TryReturn(pAttrValue, true, "pAttrValue is null");
1032 if (FindElement("Content") == true)
1034 TryReturn(__pContentData, false, "__pContentData is null");
1036 String* pValue = new (std::nothrow) String;
1037 StringUtil::Utf8ToString(pCharacters, *pValue);
1038 __pContentData->AddName(*(new (std::nothrow) String(pAttrValue)), *pValue);
1042 if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
1044 if (__isDefaultName == true)
1046 __pContext->__displayName = pCharacters;
1050 String* pValue = new (std::nothrow) String;
1051 StringUtil::Utf8ToString(pCharacters, *pValue);
1053 __pAppData->__pNameList->Add((new (std::nothrow) String(pAttrValue)), pValue);
1056 AppLog("<DisplayName Locale=\"%s\">%s</DisplayName>", pAttrValue, pCharacters);
1062 ManifestHandler::OnDescriptionValue(const char *pCharacters)
1064 XmlAttribute *pAttr = 0;
1065 char *pAttrValue = 0;
1067 pAttr = GetAttribute();
1068 TryReturn(pAttr, true, "pAttr is null");
1070 pAttrValue = pAttr->Find("Locale");
1071 TryReturn(pAttrValue, true, "pAttrValue is null");
1073 if (strcasecmp(pAttrValue, "eng-GB") == 0 || strcasecmp(pAttrValue, "eng-US") == 0)
1075 __pContext->__description = pCharacters;
1078 AppLog("<Description Locale=\"%s\">%s</Description>", pAttrValue, pCharacters);
1084 ManifestHandler::OnDataControlTypeValue(const char *pCharacters)
1086 XmlAttribute* pAttr = null;
1087 char* pAccessValue = null;
1089 pAttr = GetAttribute();
1090 TryReturn(pAttr, true, "pAttr is null");
1092 pAccessValue = pAttr->Find("Access");
1093 TryReturn(pAccessValue, true, "pAccessValue is null");
1095 __pDataControlType = new (std::nothrow) DataControlType;
1096 TryReturn(__pDataControlType, false, "__pDataControlType is null");
1098 __pDataControlType->__type = pCharacters;
1099 __pDataControlType->__access = pAccessValue;
1101 AppLog("<DataControlType Access=\"%s\", Type=\"%s\">", pAccessValue, pCharacters);
1107 ManifestHandler::OnConditionValue(const char *pCharacters)
1109 XmlAttribute *pAttr = null;
1112 pAttr = GetAttribute();
1113 TryReturn(pAttr, true, "pAttr is null");
1115 pName = pAttr->Find("Name");
1116 TryReturn(pName, true, "pName is null");
1118 String* pKey = new (std::nothrow) String(pName);
1119 TryReturn(pKey, false, "pKey is null");
1120 String* pValue = new (std::nothrow) String(pCharacters);
1121 TryReturn(pValue, false, "pValue is null");
1123 __pAppData->__pLaunchConditionList->Add(pKey, pValue);
1124 AppLog("<LaunchCondition Name=\"%s\", Value=\"%s\">", pName, pCharacters);
1130 ManifestHandler::OnNotificationValue(const char *pCharacters)
1132 XmlAttribute *pAttr = null;
1133 const char *pName = null;
1135 pAttr = GetAttribute();
1136 TryReturn(pAttr, true, "pAttr is null.");
1138 pName = pAttr->Find("Name");
1139 TryReturn(pName, true, "pName is null.");
1141 if (strcasecmp(pName, "Ticker") == 0)
1143 pName = "Notification";
1145 else if (strcasecmp(pName, "Notification") == 0 || strcasecmp(pName, "Sounds") == 0
1146 || strcasecmp(pName, "Badge") == 0 || strcasecmp(pName, "Contents") == 0)
1148 // known notification attributes
1152 TryReturn(0, true, "Unknown notification attributes=%s", pCharacters);
1155 String* pKey = new (std::nothrow) String(pName);
1156 TryReturn(pKey, false, "pKey is null.");
1158 String* pValue = new (std::nothrow) String(pCharacters);
1159 TryReturn(pValue, false, "pValue is null.");
1161 pKey->ToLowerCase();
1162 pValue->ToLowerCase();
1164 __pAppData->__pNotificationMap->Add(pKey, pValue);
1165 AppLog("<Notification Name=\"%s\", Value=\"%s\">", pName, pCharacters);
1171 ManifestHandler::OnInstallationLocationValue(const char *pCharacters)
1173 AppLog("<InstallationLocation>%s</InstallationLocation>", pCharacters);
1175 if ((strcasecmp(pCharacters, "UserPreferred") == 0) &&
1176 (File::IsFileExist(DIR_MEMORYCARD_INSTALLATION) == true))
1178 AppLog("INSTALLATION_STORAGE = [EXTERNAL]");
1179 __pContext->__storage = INSTALLATION_STORAGE_EXTERNAL;
1186 ManifestHandler::OnCategoryValue(const char *pCharacters)
1188 TryReturn(__pAppData, false, "__pAppData is null");
1190 __pAppData->__pCategoryList->Add(new (std::nothrow) String(pCharacters));
1192 if (strcasecmp(pCharacters, TIZEN_CATEGORY_IME) == 0)
1194 __pAppData->__feature = CATEGORY_TYPE_IME;
1201 ManifestHandler::FindElement(const char *pName)
1204 Tizen::Base::Collection::IEnumerator* pEnum = GetElementEnumeratorN();
1208 while(pEnum->MoveNext() == E_SUCCESS)
1210 String* pStr = static_cast<String*>(pEnum->GetCurrent());
1213 if (pStr->Equals(pName, false) == true)
1215 AppLog("[%s] is matched.", pName);
1229 ManifestHandler::AddAppFeature(const Tizen::Base::String& name, const Tizen::Base::String& value)
1231 String* pKey = new (std::nothrow) String(name);
1232 TryReturn(pKey, false, "pKey is null");
1233 String* pValue = new (std::nothrow) String(value);
1234 TryReturn(pValue, false, "pValue is null");
1236 __pAppData->__pFeatureList->Add(pKey, pValue);
1241 ManifestHandler::ParseAppAttribute(XmlAttribute* pAttr, bool isUiApp)
1243 char* pName = pAttr->Find("Name");
1246 pName = pAttr->Find("ExecutableName");
1251 AppLog(" - Name=%s", pName);
1252 __pAppData->__name = pName;
1253 __pAppData->__appId = __pContext->__packageId + L"." + pName;
1256 char* pMain = pAttr->Find("Main");
1259 pMain = pAttr->Find("Default");
1264 AppLog(" - Main=%s", pMain);
1265 __pAppData->__main = pMain;
1267 if (strcasecmp(pMain, "True") == 0)
1269 __isDefaultName = true;
1270 __isDefaultAppDetected = true;
1271 __pContext->__mainAppName = pName;
1276 __pAppData->__main = L"False";
1279 char* pRecent = pAttr->Find("LaunchingHistoryVisible");
1282 AppLog(" - LaunchingHistoryVisible=%s", pRecent);
1283 __pAppData->__launchingHistoryVisible = pRecent;
1286 char* pHwAcceleration = pAttr->Find("HwAcceleration");
1287 if (pHwAcceleration)
1289 AddAppFeature("HwAcceleration", pHwAcceleration);
1290 AppLog(" - HwAcceleration=%s", pHwAcceleration);
1294 char* pGlFrame = pAttr->Find("GlFrame");
1297 AddAppFeature("GlFrame", pGlFrame);
1298 AppLog(" - GlFrame=%s", pGlFrame);
1302 char* pCategory = pAttr->Find("Category");
1305 AppLog(" - Category=%s", pCategory);
1307 if (strcasecmp(pCategory, "home-screen") == 0)
1309 __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_HOMESCREEN));
1311 else if (strcasecmp(pCategory, "lock-screen") == 0)
1313 __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_LOCKSCREEN));
1315 else if (strcasecmp(pCategory, "Ime") == 0)
1317 __pAppData->__pCategoryList->Add(new (std::nothrow) String(TIZEN_CATEGORY_IME));
1320 int categoryType = InstallerUtil::GetCategoryType(pCategory);
1321 __pAppData->__feature = categoryType;
1324 char* pSubMode = pAttr->Find("SubMode");
1327 if (strcasecmp(pSubMode, "True") == 0)
1329 __pAppData->__isSubMode = true;
1330 AppLog(" - SubMode=%s", pSubMode);
1334 if (isUiApp == true)
1336 __pAppData->__type = L"UiApp";
1338 char* pMenuIconVisible = pAttr->Find("MenuIconVisible");
1339 if (pMenuIconVisible == null)
1341 pMenuIconVisible = pAttr->Find("MainmenuVisible");
1344 if (pMenuIconVisible)
1346 if (strcasecmp(pMenuIconVisible, "True") == 0)
1348 __pAppData->__mainmenuVisible = true;
1352 __pAppData->__mainmenuVisible = false;
1355 AddAppFeature("MenuIconVisible", pMenuIconVisible);
1356 AppLog(" - MenuIconVisible=%s", pMenuIconVisible);
1361 __pAppData->__type = L"ServiceApp";
1362 __pAppData->__mainmenuVisible = false;
1364 char *pUseUi = pAttr->Find("UseUi");
1367 AddAppFeature("UseUi", pUseUi);
1368 AppLog(" - UseUi=%s", pUseUi);
1371 char *pLifeDuration = pAttr->Find("LifeDuration");
1374 AddAppFeature("LifeDuration", pLifeDuration);
1375 AppLog(" - LifeDuration=%s", pLifeDuration);
1378 char *pLaunchOnBoot = pAttr->Find("LaunchOnBoot");
1381 AddAppFeature("LaunchOnBoot", pLaunchOnBoot);
1382 AppLog(" - LaunchOnBoot=%s", pLaunchOnBoot);
1385 char *pAutoRestart = pAttr->Find("AutoRestart");
1388 AddAppFeature("AutoRestart", pAutoRestart);
1389 AppLog(" - AutoRestart=%s", pAutoRestart);
1392 char *pSystemService = pAttr->Find("SystemService");
1395 if (strcasecmp(pSystemService, "True") == 0)
1397 __pAppData->__isSystemService = true;
1398 AppLog(" - SystemService=%s", pSystemService);
1403 AppLog(" - appId=%ls", __pAppData->__appId.GetPointer());
1409 ManifestHandler::GetAppData(void)
1415 ManifestHandler::GetDefaultIconType(void)
1417 return __pDefaultIconType;