#include <FIoDbEnumerator.h>
#include <FIoDbStatement.h>
#include <FBaseSysLog.h>
+#include <FSecPrivilegeInfo.h>
#include <FBase_StringConverter.h>
#include <FBaseUtilStringTokenizer.h>
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
-using namespace Tizen::Io;
using namespace Tizen::Base::Utility;
+using namespace Tizen::Io;
+using namespace Tizen::Security;
namespace Tizen { namespace App { namespace Package
{
PackageAppInfo* pPackageAppInfo = dynamic_cast <PackageAppInfo*>(__pPackageAppInfoList->GetAt(i));
if (pPackageAppInfo)
{
- PackageAppInfo* pInfo = new (std::nothrow) PackageAppInfo;
+ std::unique_ptr< PackageAppInfo > pInfo(new (std::nothrow) PackageAppInfo);
SysTryReturn(NID_APP, pInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
- _PackageAppInfoImpl* pPackageAppInfoImpl = _PackageAppInfoImpl::GetInstance(pInfo);
+ _PackageAppInfoImpl* pPackageAppInfoImpl = _PackageAppInfoImpl::GetInstance(pInfo.get());
SysTryReturn(NID_APP, pPackageAppInfoImpl, null, E_SYSTEM, "pPackageAppInfoImpl is null.");
AppId appId = pPackageAppInfo->GetAppId();
pPackageAppInfoImpl->SetMenuIconVisible(menuIconVisible);
pPackageAppInfoImpl->SetMainApp(mainApp);
- r = pList->Add(*pInfo);
+ r = pList->Add(*pInfo.release());
}
}
}
}
else
{
- SysLog(NID_APP, "GetPackageAppInfoN() is not available.");
+ SysTryReturn(NID_APP, __pPackageAppInfoList, null, E_SYSTEM, "__pPackageAppInfoList must not be null.");
+
+ for (int i = 0; i < __pPackageAppInfoList->GetCount(); i++)
+ {
+ PackageAppInfo* pPackageAppInfo = dynamic_cast < PackageAppInfo* >(__pPackageAppInfoList->GetAt(i));
+ if (pPackageAppInfo)
+ {
+ if (appId != pPackageAppInfo->GetAppId())
+ {
+ continue;
+ }
+
+ _PackageAppInfoImpl* pPackageAppInfoImpl = _PackageAppInfoImpl::GetInstance(pPackageAppInfo);
+ SysTryReturn(NID_APP, pPackageAppInfoImpl, null, E_SYSTEM, "pPackageAppInfoImpl is null.");
+
+ std::unique_ptr< PackageAppInfo > pInfo(new (std::nothrow) PackageAppInfo);
+ SysTryReturn(NID_APP, pInfo, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Insufficient memory");
+
+ _PackageAppInfoImpl* pImpl = _PackageAppInfoImpl::GetInstance(pInfo.get());
+ SysTryReturn(NID_APP, pImpl, null, E_SYSTEM, "pImpl is null.");
+
+ String appName = pPackageAppInfo->GetAppName();
+ String appDisplayName = pPackageAppInfo->GetAppDisplayName();
+ bool menuIconVisible = pPackageAppInfo->IsMenuIconVisible();
+ bool mainApp = pPackageAppInfo->IsMainApp();
+ String tempIconPath = pPackageAppInfoImpl->GetAppTempIconPath();
+
+ pImpl->SetAppId(appId);
+ pImpl->SetAppName(appName);
+ pImpl->SetAppDisplayName(appDisplayName);
+ pImpl->SetMenuIconVisible(menuIconVisible);
+ pImpl->SetMainApp(mainApp);
+ pImpl->SetAppTempIconPath(tempIconPath);
+
+ return pInfo.release();
+ }
+ }
}
return null;
String* pPrivilege = dynamic_cast <String*>(__pPrivilegeList->GetAt(i));
if (pPrivilege)
{
- String* pPrivilegeString = new (std::nothrow) String(*pPrivilege);
- SysTryReturn(NID_APP, pPrivilegeString, null, E_OUT_OF_MEMORY, "pPrivilegeString must not be null.");
+ PrivilegeInfo* pPrivilegeInfo = new (std::nothrow) PrivilegeInfo;
+ SysTryReturn(NID_APP, pPrivilegeInfo, null, E_OUT_OF_MEMORY, "pPrivilegeInfo must not be null.");
+
+ pPrivilegeInfo->Construct(*pPrivilege);
- r = pPrivilegeList->Add(*pPrivilegeString);
+ r = pPrivilegeList->Add(*pPrivilegeInfo);
}
}
char* pUrl = null;
char* pMainAppId = null;
char* pStoreClientId = null;
+ char* pRootPath = null;
int installedTime = 0;
pkgmgrinfo_installed_storage storage = PMINFO_INTERNAL_STORAGE;
bool removable = true;
- // temp
- Database db;
- DbStatement* pStmt = null;
- DbEnumerator* pEnum = null;
- String query;
-
std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
SysTryReturnResult(NID_APP, pPackageId, E_OUT_OF_MEMORY, "pPackageId is null");
SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_storeclientid() is failed. result = [%d]", result);
}
- // temp
- query.Format(1024, L"SELECT PkgInfo.*, AppInfo.APP_MAINMENU_ICON FROM AppInfo, PkgInfo WHERE AppInfo.ID = PkgInfo.UNIQUE_ID and AppInfo.APP_DEFAULT = 'True' and PkgInfo.PKG_ID = '%ls'", packageId.GetPointer());
-
- r = db.Construct(PACKAGE_DATABASE_FILE_NAME, "r");
- SysTryCatch(NID_APP, r == E_SUCCESS, , r, "[%s] An error occurs while opening a database.", GetErrorMessage(r));
-
- pStmt = _PackageManagerImpl::CreateStatementN(db, query);
- SysTryCatch(NID_APP, pStmt != null, GetLastResult(), GetLastResult(), "[%s] An error occurs while creating a database statement.", GetErrorMessage(GetLastResult()));
-
- pEnum = _PackageManagerImpl::ExecuteStatementN(db, pStmt);
- if (pEnum != null)
+ result = pkgmgrinfo_pkginfo_get_root_path(__packageInfoHandle, &pRootPath);
+ if (result == PMINFO_R_OK)
{
- if (pEnum->MoveNext() == E_SUCCESS)
- {
- String rootPath;
- int storageType = 0;
-
- if (pEnum->GetColumnType(16) != DB_COLUMNTYPE_NULL)
- {
- pEnum->GetStringAt(16, rootPath);
- }
- if (pEnum->GetColumnType(17) != DB_COLUMNTYPE_NULL)
- {
- pEnum->GetIntAt(17, storageType);
- }
-
- SetAppRootPath(rootPath);
- SetAppStorageType(storageType);
- }
-
- delete pEnum;
+ SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_root_path(): rootPath = [%s]", pRootPath);
+ String rootPath(pRootPath);
+ __appRootPath = rootPath;
+ }
+ else
+ {
+ SysLog(NID_APP, "pkgmgrinfo_pkginfo_get_root_path() is failed. result = [%d]", result);
}
-CATCH:
- delete pStmt;
return r;
}