return 0;
}
-_PackageManagerImpl*
-_PackageManagerImpl::GetInstance(void)
-{
- return PackageManager::GetInstance()->__pPackageManagerImpl;
-}
-
-result
-_PackageManagerImpl::Construct(void)
-{
- ClearLastResult();
-
- result r = __installationList.Construct();
- SysTryReturnResult(NID_APP, r == E_SUCCESS, r, "The memory is insufficient.");
-
- return E_SUCCESS;
-}
-
PackageInfo*
_PackageManagerImpl::GetPackageInfoFromFileN(const String& filePath) const
{
{
SysTryReturn(NID_APP, packageAppFilterMap.GetCount() > 0, null, E_INVALID_ARG, "packageAppFilterMap.GetCount() is invalid.");
- return null;
+ std::unique_ptr<IMapEnumerator> pEnum(packageAppFilterMap.GetMapEnumeratorN());
+ SysTryReturn(NID_APP, pEnum, null, E_INVALID_ARG, "GetMapEnumeratorN() is failed.");
+
+ int res = 0;
+ ArrayList* pList = null;
+ pkgmgrinfo_appinfo_filter_h handle = null;
+
+ res = pkgmgrinfo_appinfo_filter_create(&handle);
+ SysTryReturn(NID_APP, res == PMINFO_R_OK, null, E_SYSTEM, "pkgmgrinfo_appinfo_filter_create() is failed. [%d]", res);
+
+ while(pEnum->MoveNext() == E_SUCCESS)
+ {
+ String* pKey = static_cast<String*>(pEnum->GetKey());
+ SysTryCatch(NID_APP, pKey, , E_INVALID_ARG, "GetKey() is failed.");
+
+ if ((*pKey) == PACKAGE_APP_FILTER_MENUICON_VISIBLE)
+ {
+ Boolean* pVal = static_cast<Boolean*>(pEnum->GetValue());
+ SysTryCatch(NID_APP, pVal, , E_INVALID_ARG, "GetValue() is failed.");
+
+ bool nodisplay = !(pVal->ToBool());
+ SysLog(NID_APP, "Key[%ls], Value[%d]", pKey->GetPointer(), nodisplay);
+
+ res = pkgmgrinfo_appinfo_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_NODISPLAY, nodisplay);
+ SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_pkginfo_filter_add_bool(NODISPLAY, %d) is failed. [%d]", nodisplay, res);
+ }
+ else if ((*pKey) == PACKAGE_APP_FILTER_CATEGORY)
+ {
+ String* pVal = static_cast<String*>(pEnum->GetValue());
+ SysTryCatch(NID_APP, pVal, , E_INVALID_ARG, "GetValue() is failed.");
+
+ SysLog(NID_APP, "Key[%ls], Value[%ls]", pKey->GetPointer(), pVal->GetPointer());
+
+ std::unique_ptr<char[]> pValue(_StringConverter::CopyToCharArrayN(*pVal));
+ SysTryCatch(NID_APP, pValue, , E_OUT_OF_MEMORY, "pValue is null.");
+
+ res = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_CATEGORY, pValue.get());
+ SysTryCatch(NID_APP, res == PMINFO_R_OK, , E_SYSTEM, "pkgmgrinfo_appinfo_filter_add_string(CATEGORY, %s) is failed. [%d]", pValue.get(), res);
+ }
+ else
+ {
+ SysTryCatch(NID_APP, false, , E_INVALID_ARG, "Invalid key(%ls)", pKey->GetPointer());
+ }
+ }
+
+ pList = new (std::nothrow) ArrayList();
+ SysTryCatch(NID_APP, pList, , E_OUT_OF_MEMORY, "ArrayList creation failure.");
+ pList->Construct();
+
+ res = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, PackageAppInfoHandler, pList);
+ if (res != 0)
+ {
+ SysLog(NID_APP, "pkgmgrinfo_appinfo_filter_foreach_appinfo() is failed. result = [%d]", res);
+
+ pList->RemoveAll(true);
+ pList = null;
+ }
+
+CATCH:
+ if (handle)
+ {
+ pkgmgrinfo_appinfo_filter_destroy(handle);
+ }
+
+ return pList;
}
IList*
return null;
}
+int
+_PackageManagerImpl::PackageAppInfoHandler(const pkgmgrinfo_appinfo_h handle, void* pUserData)
+{
+ SysTryReturn(NID_APP, handle, 0, E_SYSTEM, "handle must not be null.");
+ SysTryReturn(NID_APP, pUserData, 0, E_SYSTEM, "pUserData must not be null.");
+
+ result r = E_SUCCESS;
+ int res = PMINFO_R_OK;
+ char* pAppId = null;
+ ArrayList* pList = (ArrayList*)pUserData;
+
+ res = pkgmgrinfo_appinfo_get_appid(handle, &pAppId);
+ SysTryReturn(NID_APP, res == PMINFO_R_OK, 0, E_SYSTEM, "pkgmgrinfo_appinfo_get_appid is failed. [%d]", res);
+
+ std::unique_ptr<PackageAppInfo> pPackageAppInfo(new (std::nothrow) PackageAppInfo);
+ SysTryReturn(NID_APP, pPackageAppInfo, 0, E_OUT_OF_MEMORY, "pPackageAppInfo instance must not be null.");
+
+ _PackageAppInfoImpl* pPackageAppInfoImpl = _PackageAppInfoImpl::GetInstance(pPackageAppInfo.get());
+ r = pPackageAppInfoImpl->Construct(pAppId);
+ SysTryReturn(NID_APP, r == E_SUCCESS, 0, E_SYSTEM, "Construct(%s) is failed.", pAppId);
+
+ pList->Add(*pPackageAppInfo.release());
+
+ return 0;
+}
+
+_PackageManagerImpl*
+_PackageManagerImpl::GetInstance(void)
+{
+ return PackageManager::GetInstance()->__pPackageManagerImpl;
+}
+
+result
+_PackageManagerImpl::Construct(void)
+{
+ ClearLastResult();
+
+ result r = __installationList.Construct();
+ SysTryReturnResult(NID_APP, r == E_SUCCESS, r, "The memory is insufficient.");
+
+ return E_SUCCESS;
+}
+
_PackageManagerImpl::_PackageManagerImpl(void)
:__pRequestClient(null),
__pListeningClient(null),