* @brief This is the implementation file for %ManifestGenerator class.
*/
+#include <sys/stat.h>
+
#include <FLclLocale.h>
#include <FApp_Aul.h>
#include <FAppPkg_PackageInfoImpl.h>
+#include <FIoFile.h>
#include "ManifestGenerator.h"
#include "InstallerUtil.h"
using namespace Tizen::App;
using namespace Tizen::App::Package;
using namespace Tizen::Locales;
+using namespace Tizen::Io;
ManifestGenerator::ManifestGenerator(void)
:__pContext(null)
//}
//else
//{
- xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
- location = L"auto";
+ xmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, __pContext->GetAppId().GetPointer());
+ location = L"auto";
//}
package = __pContext->GetAppId();
_PackageAppInfoImpl* pAppInfoImpl = null;
ArrayList* pAppList = null;
pAppList = pPackageInfoImpl->GetAppInfoList();
+ int appCount = pAppList->GetCount();
+ AppLogTag(OSP_INSTALLER, "Write(): appCount=%d", appCount);
- for (int i = 0 ; i < pAppList->GetCount(); i++)
+ for (int i = 0 ; i < appCount; i++)
{
pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pAppList->GetAt(i));
if (pAppInfoImpl)
{
- IMap* pNameList = pAppInfoImpl->GetNameList();
- String label("label");
- String type("c++app");
- String binaryPath;
- binaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, pAppInfoImpl->GetName().GetPointer());
-
- if (pAppInfoImpl->GetDefault() == L"True")
- {
- WriteLanguageValue(pNameList, label);
-
- if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
- {
- String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pAppInfoImpl->GetMainmenuIcon().GetPointer());
-
- __pWriter->StartElement("icon");
- __pWriter->WriteString(iconPath);
- __pWriter->EndElement();
- }
- }
-
- // temp
- String nodisplay("true");
- String taskmanage("false");
- String category;
-
- if (pAppInfoImpl->GetType() == L"UiApp")
- {
- taskmanage = L"true";
-
- if (pAppInfoImpl->IsMainmenuVisible() == true)
- {
- nodisplay = L"false";
- }
- else
- {
- nodisplay = L"true";
- }
-
- if (FindCategory(i, "http://tizen.org/category/ime") == true)
- {
- AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/ime] is detected. taskmanage=false, nodisplay=true");
- taskmanage = L"false";
- nodisplay = L"true";
- }
- }
-
- ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
- String glFrame = GetGlFrameValue(pFeatureList);
-
- __pWriter->StartElement("ui-application");
- __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
- __pWriter->WriteAttribute("exec", binaryPath);
- __pWriter->WriteAttribute("nodisplay", nodisplay);
- __pWriter->WriteAttribute("taskmanage", taskmanage);
- __pWriter->WriteAttribute("multiple", "false");
- __pWriter->WriteAttribute("type", type);
- __pWriter->WriteAttribute("hw-acceleration", glFrame);
-
- WriteCategory(i);
-
-#if 0
- if (pAppInfoImpl->GetType() == L"UiApp")
- {
- String nodisplay;
-
- if (pAppInfoImpl->IsMainmenuVisible() == true)
- {
- nodisplay = "false";
- }
- else
- {
- nodisplay = "true";
- }
-
- __pWriter->StartElement("ui-application");
- __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
- __pWriter->WriteAttribute("exec", binaryPath);
- __pWriter->WriteAttribute("nodisplay", nodisplay);
- __pWriter->WriteAttribute("taskmanage", "true");
- __pWriter->WriteAttribute("multiple", "false");
- __pWriter->WriteAttribute("type", type);
- }
- else if (pAppInfoImpl->GetType() == L"ServiceApp")
- {
- ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
- String onBoot("false");
- String autoRestart("false");
-
- if (FindFeatureValue(pFeatureList, "LaunchOnBoot", "True") == true)
- {
- onBoot = L"true";
- }
-
- if (FindFeatureValue(pFeatureList, "AutoRestart", "True") == true)
- {
- autoRestart = L"true";
- }
-
- __pWriter->StartElement("service-application");
- __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
- __pWriter->WriteAttribute("exec", binaryPath);
- __pWriter->WriteAttribute("type", type);
- __pWriter->WriteAttribute("on-boot", onBoot);
- __pWriter->WriteAttribute("auto-restart", autoRestart);
- }
- else
- {
- AppLogTag(OSP_INSTALLER, "Type is invalid! [%ls]", pAppInfoImpl->GetType().GetPointer());
- return false;
- }
-#endif
-
- WriteLanguageValue(pNameList, label);
-
- if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
- {
- String iconPath;
- iconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pAppInfoImpl->GetMainmenuIcon().GetPointer());
-
- __pWriter->StartElement("icon");
- __pWriter->WriteString(iconPath);
- __pWriter->EndElement();
- }
-
- WriteAppControl(pAppInfoImpl);
-
- __pWriter->EndElement();
-
- if (pAppInfoImpl->GetType() == L"ServiceApp")
- {
- WriteLiveboxes(pAppInfoImpl);
- }
+ WriteApp(i, pAppInfoImpl);
}
}
+ if (__pContext->__isSubMode == true)
+ {
+ AppLogTag(OSP_INSTALLER, "Write(): __pContext->__isSubMode is detected");
+ WriteSubModeApp(appCount);
+ }
+
__pWriter->EndElement();
return true;
return false;
}
+
+bool
+ManifestGenerator::WriteApp(int index, Tizen::App::Package::_PackageAppInfoImpl* pAppInfoImpl)
+{
+ _PackageInfoImpl *pPackageInfoImpl = null;
+ pPackageInfoImpl = __pContext->GetPackageInfoImpl();
+
+ IMap* pNameList = pAppInfoImpl->GetNameList();
+ String label("label");
+ String type("c++app");
+ String binaryPath;
+ binaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, pAppInfoImpl->GetName().GetPointer());
+
+ if (pAppInfoImpl->GetDefault() == L"True")
+ {
+ WriteLanguageValue(pNameList, label);
+
+ if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
+ {
+ String iconPath;
+ iconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pAppInfoImpl->GetMainmenuIcon().GetPointer());
+
+ __pWriter->StartElement("icon");
+ __pWriter->WriteString(iconPath);
+ __pWriter->EndElement();
+ }
+ }
+
+ String nodisplay("true");
+ String taskmanage("false");
+ String category;
+
+ if (pAppInfoImpl->GetType() == L"UiApp")
+ {
+ taskmanage = L"true";
+
+ if (pAppInfoImpl->IsMainmenuVisible() == true)
+ {
+ nodisplay = L"false";
+ }
+ else
+ {
+ nodisplay = L"true";
+ }
+
+ if (FindCategory(index, "http://tizen.org/category/ime") == true)
+ {
+ AppLogTag(OSP_INSTALLER, "Write(): [http://tizen.org/category/ime] is detected. taskmanage=false, nodisplay=true");
+ taskmanage = L"false";
+ nodisplay = L"true";
+ }
+ }
+
+ ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
+ String glFrame = GetGlFrameValue(pFeatureList);
+
+ __pWriter->StartElement("ui-application");
+ __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
+ __pWriter->WriteAttribute("exec", binaryPath);
+ __pWriter->WriteAttribute("nodisplay", nodisplay);
+ __pWriter->WriteAttribute("taskmanage", taskmanage);
+ __pWriter->WriteAttribute("multiple", "false");
+ __pWriter->WriteAttribute("type", type);
+ __pWriter->WriteAttribute("hw-acceleration", glFrame);
+
+ WriteCategory(index);
+
+#if 0
+ if (pAppInfoImpl->GetType() == L"UiApp")
+ {
+ String nodisplay;
+
+ if (pAppInfoImpl->IsMainmenuVisible() == true)
+ {
+ nodisplay = "false";
+ }
+ else
+ {
+ nodisplay = "true";
+ }
+
+ __pWriter->StartElement("ui-application");
+ __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
+ __pWriter->WriteAttribute("exec", binaryPath);
+ __pWriter->WriteAttribute("nodisplay", nodisplay);
+ __pWriter->WriteAttribute("taskmanage", "true");
+ __pWriter->WriteAttribute("multiple", "false");
+ __pWriter->WriteAttribute("type", type);
+ }
+ else if (pAppInfoImpl->GetType() == L"ServiceApp")
+ {
+ ArrayList* pFeatureList = pAppInfoImpl->GetAppFeatureList();
+ String onBoot("false");
+ String autoRestart("false");
+
+ if (FindFeatureValue(pFeatureList, "LaunchOnBoot", "True") == true)
+ {
+ onBoot = L"true";
+ }
+
+ if (FindFeatureValue(pFeatureList, "AutoRestart", "True") == true)
+ {
+ autoRestart = L"true";
+ }
+
+ __pWriter->StartElement("service-application");
+ __pWriter->WriteAttribute("appid", pAppInfoImpl->GetPackageName());
+ __pWriter->WriteAttribute("exec", binaryPath);
+ __pWriter->WriteAttribute("type", type);
+ __pWriter->WriteAttribute("on-boot", onBoot);
+ __pWriter->WriteAttribute("auto-restart", autoRestart);
+ }
+ else
+ {
+ AppLogTag(OSP_INSTALLER, "Type is invalid! [%ls]", pAppInfoImpl->GetType().GetPointer());
+ return false;
+ }
+ #endif
+
+ WriteLanguageValue(pNameList, label);
+
+ if (pAppInfoImpl->GetMainmenuIcon().IsEmpty() == false)
+ {
+ String iconPath;
+ iconPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_ICONS, pAppInfoImpl->GetMainmenuIcon().GetPointer());
+
+ __pWriter->StartElement("icon");
+ __pWriter->WriteString(iconPath);
+ __pWriter->EndElement();
+ }
+
+ WriteAppControl(pAppInfoImpl);
+ WriteAppControl(index);
+
+ __pWriter->EndElement();
+
+ if (pAppInfoImpl->GetType() == L"ServiceApp")
+ {
+ WriteLiveboxes(pAppInfoImpl);
+ }
+
+ return true;
+}
+
+bool
+ManifestGenerator::WriteSubModeApp(int index)
+{
+ _PackageInfoImpl *pPackageInfoImpl = null;
+ pPackageInfoImpl = __pContext->GetPackageInfoImpl();
+
+ String binaryPath;
+ binaryPath.Format(1024, L"%ls%ls/%ls", pPackageInfoImpl->GetAppRootPath().GetPointer(), DIR_BIN, SUB_MODE_APPCONTROL_NAME);
+
+ String binaryExecPath = binaryPath + ".exe";
+
+ InstallerUtil::Copy(UIAPP_LOADER_PATH, binaryExecPath);
+ InstallerUtil::ChangeMode(binaryExecPath, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH);
+
+ if (File::IsFileExist(binaryPath) == true)
+ {
+ InstallerUtil::Remove(binaryPath);
+ }
+
+ InstallerUtil::CreateSymlink(binaryExecPath, binaryPath);
+
+ IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+ TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+
+ AppLogTag(OSP_INSTALLER, "WriteSubModeApp(): appCount=%d", pAppDataList->GetCount());
+
+ AppData* pAppData = null;
+ pAppDataList->GetAt(index, pAppData);
+ TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+
+ PackageId packageId = __pContext->GetAppId();
+ AppId appId = packageId + L"." + SUB_MODE_APPCONTROL_NAME;
+
+ __pWriter->StartElement("ui-application");
+ __pWriter->WriteAttribute("appid", appId);
+ __pWriter->WriteAttribute("exec", binaryPath);
+ __pWriter->WriteAttribute("nodisplay", "true");
+ __pWriter->WriteAttribute("taskmanage", "false");
+ __pWriter->WriteAttribute("multiple", "true");
+ __pWriter->WriteAttribute("type", "c++app");
+
+ WriteAppControl(index);
+
+ __pWriter->EndElement(); // end of "ui-application"
+
+ return true;
+}
+
+bool
+ManifestGenerator::WriteAppControl(int index)
+{
+ IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
+ TryReturn(pAppDataList, false, "[osp-installer] pAppDataList is null");
+
+ AppData* pAppData = null;
+ pAppDataList->GetAt(index, pAppData);
+ TryReturn(pAppData, false, "[osp-installer] pAppData is null");
+
+ if (pAppData->__pAppControlData)
+ {
+ if (pAppData->__pAppControlData->__pOperationDataList)
+ {
+ int operationCount = pAppData->__pAppControlData->__pOperationDataList->GetCount();
+
+ for (int i = 0; i < operationCount; i++)
+ {
+ OperationData* pOperationData = null;
+ pAppData->__pAppControlData->__pOperationDataList->GetAt(i, pOperationData);
+
+ if (pOperationData == null) continue;
+
+ __pWriter->StartElement("application-service");
+ __pWriter->StartElement("operation");
+ __pWriter->WriteAttribute("name", pOperationData->__id);
+ __pWriter->EndElement(); // end of "operation"
+
+ if (pOperationData->__uri.IsEmpty() == false)
+ {
+ __pWriter->StartElement("uri");
+ __pWriter->WriteAttribute("name", pOperationData->__uri);
+ __pWriter->EndElement();
+ }
+
+ if (pOperationData->__mimeType.IsEmpty() == false)
+ {
+ __pWriter->StartElement("mime");
+ __pWriter->WriteAttribute("name", pOperationData->__mimeType);
+ __pWriter->EndElement();
+ }
+
+ __pWriter->EndElement(); // end of ""application-service""
+ }
+ }
+ }
+
+ return true;
+}
+
,__isDefaultName(false)
,__isDefaultAppDetected(false)
,__pAppData(null)
+,__pSubModeAppControlData(null)
+,__pOperationData(null)
{
}
{
status = OnContentStartElement();
}
+ else if (strcasecmp(pName, "Operation") == 0)
+ {
+ status = OnOperationStartElement();
+ }
if (!status)
{
}
else if (strcasecmp(pName, "Apps") == 0)
{
- AppLogTag(OSP_INSTALLER, "</%s>", pName);
+ status = OnAppsEndElement();
}
else if (strcasecmp(pName, "UiScalability") == 0)
{
{
status = OnManifestEndElement();
}
+ else if (strcasecmp(pName, "Operation") == 0)
+ {
+ status = OnOperationEndElement();
+ }
if (!status)
{
{
status = OnCategoryValue(pCharacters);
}
+ else if (strcasecmp(pName, "MimeType") == 0)
+ {
+ status = OnMimeTypeValue(pCharacters);
+ }
+ else if (strcasecmp(pName, "Uri") == 0)
+ {
+ status = OnUriValue(pCharacters);
+ }
if (!status)
{
}
AddAppFeature("MainmenuVisible", pMainmenuVisible);
- AppLogTag(OSP_INSTALLER, "<MainmenuVisible=%s>", pMainmenuVisible);
+ AppLogTag(OSP_INSTALLER, " - MainmenuVisible=%s", pMainmenuVisible);
}
char* pGlFrame = pAttr->Find("GlFrame");
if (pGlFrame)
{
AddAppFeature("GlFrame", pGlFrame);
- AppLogTag(OSP_INSTALLER, "<GlFrame=%s>", pGlFrame);
+ AppLogTag(OSP_INSTALLER, " - GlFrame=%s", pGlFrame);
}
char* pCategory = pAttr->Find("Category");
if (pCategory)
{
- AppLogTag(OSP_INSTALLER, "<Category=%s>", pCategory);
+ AppLogTag(OSP_INSTALLER, " - Category=%s", pCategory);
if (strcasecmp(pCategory, "home-screen") == 0)
{
// __pPackageAppInfoImpl->SetAppFeature(categoryType);
}
+ char* pSubMode = pAttr->Find("SubMode");
+ if (pSubMode)
+ {
+ if (strcasecmp(pSubMode, "True") == 0)
+ {
+ __pContext->__isSubMode = true;
+ AppLogTag(OSP_INSTALLER, " - SubMode=%s", pSubMode);
+ }
+ }
+
String app_id;
if (__pContext->GetPackageNameType() == INSTALLER_PREFIX_TYPE_ORG)
{
}
bool
+ManifestHandler::OnOperationStartElement(void)
+{
+ XmlAttribute *pAttr = null;
+ char *pId = null;
+
+ pAttr = GetAttribute();
+ TryReturn(pAttr, true, "[osp-installer] pAttr is null");
+
+ pId = pAttr->Find("Id");
+ TryReturn(pId, true, "[osp-installer] pId is null");
+
+ __pOperationData = new (std::nothrow) OperationData;
+ TryReturn(__pOperationData, false, "[osp-installer] __pOperationData is null");
+
+ __pOperationData->__id = pId;
+
+ AppLogTag(OSP_INSTALLER, "<Operation Id=\"%s\">", pId);
+
+ return true;
+}
+
+bool
ManifestHandler::OnDataControlStartElement(void)
{
XmlAttribute *pAttr = null;
}
bool
+ManifestHandler::OnAppsEndElement(void)
+{
+ if (__pContext->__isSubMode == true)
+ {
+ __pAppData = new (std::nothrow) AppData;
+ TryReturn(__pAppData, false, "[osp-installer] __pAppData is null");
+
+ __pAppData->__pAppControlData = __pSubModeAppControlData;
+ __pSubModeAppControlData = null;
+
+ __pContext->__pAppDataList->Add(__pAppData);
+ }
+
+ AppLogTag(OSP_INSTALLER, "</Apps>");
+
+ return true;
+}
+
+bool
ManifestHandler::OnIconsEndElement(void)
{
delete[] __pDefaultIconType;
__pAppControlInfoImpl = null;
AppLogTag(OSP_INSTALLER, "</AppControl>");
+ if (__pContext->__isSubMode == true)
+ {
+ __pSubModeAppControlData = __pAppData->__pAppControlData;
+ __pAppData->__pAppControlData = null;
+ }
+
return true;
}
}
bool
+ManifestHandler::OnOperationEndElement(void)
+{
+ __pAppData->__pAppControlData->__pOperationDataList->Add(__pOperationData);
+
+ return true;
+}
+
+bool
ManifestHandler::OnDataControlEndElement(void)
{
__pPackageAppInfoImpl->AddDataControl(__pDataControlInfoImpl);
}
bool
+ManifestHandler::OnMimeTypeValue(const char* pCharacters)
+{
+ __pOperationData->__mimeType = pCharacters;
+
+ AppLogTag(OSP_INSTALLER, "<MimeType>%s</MimeType>", pCharacters);
+ return true;
+}
+
+bool
+ManifestHandler::OnUriValue(const char* pCharacters)
+{
+ __pOperationData->__uri = pCharacters;
+
+ AppLogTag(OSP_INSTALLER, "<Uri>%s</Uri>", pCharacters);
+ return true;
+
+}
+
+bool
ManifestHandler::FindElement(const char *pName)
{
bool res = false;