static int InstallationEventHandler(int reqId, const char* pType, const char* pPackageId, const char* pKey, const char* pVal, const void* pMsg, void* pData);
static int UninstallationEventHandler(int reqId, const char* pType, const char* pPackageId, const char* pKey, const char* pVal, const void* pMsg, void* pData);
+ bool IsHybridPackage(const Tizen::Base::String& filePath) const;
+
protected:
friend class PackageManager;
result = pkgmgrinfo_pkginfo_get_installed_time(__packageInfoHandle, &installedTime);
if (result == PMINFO_R_OK)
{
- SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_installed_time(): installedTime = [%d]", installedTime);
-
time_t dateTime = (time_t) installedTime;
struct tm* pGmTime = null;
DateTime tempTime;
tempTime.SetValue(pGmTime->tm_year + 1900, pGmTime->tm_mon + 1, pGmTime->tm_mday, pGmTime->tm_hour, pGmTime->tm_min, pGmTime->tm_sec);
__dateTime = tempTime;
- SysLog(NID_APP, "Time %d %d/%d, %d:%d:%d", tempTime.GetYear(), tempTime.GetMonth(), tempTime.GetDay(), tempTime.GetHour(), tempTime.GetMinute(), tempTime.GetSecond());
}
}
else
#include <FBaseSysLog.h>
#include <FIo.h>
#include <FIoRegistry.h>
+#include <FSecPrivilegeInfo.h>
#include <FSysSystemTime.h>
#include <FBase_StringConverter.h>
using namespace Tizen::Base;
using namespace Tizen::Base::Runtime;
using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Utility;
using namespace Tizen::Io;
+using namespace Tizen::Security;
using namespace Tizen::System;
namespace Tizen { namespace App { namespace Package
pPackageInfoImpl->SetAuthor(pPkgInfo->author);
pPackageInfoImpl->SetMainAppId(pPkgInfo->pkg_name);
+ if (IsHybridPackage(filePath) == true)
+ {
+ PackageInfo hybridServiceInfo;
+ _PackageParser packageParser;
+
+ res = packageParser.Construct(&hybridServiceInfo);
+ SysTryReturn(NID_APP, res, null, E_PARSING_FAILED, "Construct() is failed. [%s]", pPackagePath.get());
+
+ res = packageParser.Parse(filePath);
+ SysTryReturn(NID_APP, res, null, E_PARSING_FAILED, "Parse() is failed. [%s]", pPackagePath.get());
+
+ IList* pList = hybridServiceInfo.GetPrivilegeListN();
+ if (pList)
+ {
+ for (int i = 0; i < pList->GetCount(); i++)
+ {
+ PrivilegeInfo* pPrivilegeInfo = dynamic_cast < PrivilegeInfo* >(pList->GetAt(i));
+ if (pPrivilegeInfo)
+ {
+ String privilege = pPrivilegeInfo->GetId();
+ pPackageInfoImpl->AddPrivilege(*new (std::nothrow) String(privilege));
+ SysLog(NID_APP, "privilege[%ls] is added for hybrid.", privilege.GetPointer());
+ }
+ }
+ }
+ }
+
if (pPkgInfo->privilege_list)
{
GList* pList = null;
return 0;
}
+bool
+_PackageManagerImpl::IsHybridPackage(const String& filePath) const
+{
+ SysTryReturn(NID_APP, filePath.IsEmpty() == false, false, E_INVALID_ARG, "filePath is empty.");
+
+ bool res = true;
+ FileUnzipper unzipper;
+ ZipEntry zipEntry;
+
+ result r = unzipper.Construct(filePath);
+ SysTryReturn(NID_APP, !IsFailed(r), false, E_SYSTEM, "unzipper.Construct() failed.");
+
+ r = unzipper.GetEntry(L"info/manifest.xml", zipEntry);
+ if (!IsFailed(r))
+ {
+ SysLog(NID_APP, "It's hybrid package. [%ls]", filePath.GetPointer());
+ res = true;
+ }
+ else
+ {
+ SysLog(NID_APP, "It's not hybrid package. [%ls]", filePath.GetPointer());
+ res = false;
+ }
+
+ return res;
+}
+
_PackageManagerImpl*
_PackageManagerImpl::GetInstance(void)
{