+ res = pkgmgrinfo_appinfo_metadata_filter_foreach(metaHandle, PackageAppInfoMetadataHandler, pList);
+ if (res != PMINFO_R_OK)
+ {
+ SysLog(NID_APP, "pkgmgrinfo_appinfo_metadata_filter_foreach() is failed. result = [%d]", res);
+
+ pList->RemoveAll(true);
+ pList = null;
+ }
+ }
+ else
+ {
+ list.Construct();
+
+ res = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, PackageAppInfoHandler, &list);
+ if (res != PMINFO_R_OK)
+ {
+ SysLog(NID_APP, "pkgmgrinfo_appinfo_filter_foreach_appinfo() is failed. result = [%d]", res);
+ goto CATCH;
+ }
+
+ metadataList.Construct();
+
+ res = pkgmgrinfo_appinfo_metadata_filter_foreach(metaHandle, PackageAppInfoMetadataHandler, &metadataList);
+ if (res != PMINFO_R_OK)
+ {
+ SysLog(NID_APP, "pkgmgrinfo_appinfo_metadata_filter_foreach() is failed. result = [%d]", res);
+ goto CATCH;
+ }
+
+ for (int i = 0; i < list.GetCount(); i++)
+ {
+ PackageAppInfo* pPackageAppInfo = dynamic_cast < PackageAppInfo* >(list.GetAt(i));
+ if (pPackageAppInfo)
+ {
+ AppLog("PackageAppFilter - AppId [%ls]", pPackageAppInfo->GetAppId().GetPointer());
+
+ std::unique_ptr< AppId > pAppId(new (std::nothrow) AppId(pPackageAppInfo->GetAppId()));
+ appIdList.Add(pAppId.release());
+ }
+ }
+
+ pList = new (std::nothrow) ArrayList();
+ SysTryCatch(NID_APP, pList, , E_OUT_OF_MEMORY, "ArrayList creation failure.");
+ pList->Construct();
+
+ for (int j = 0; j < metadataList.GetCount(); j++)
+ {
+ PackageAppInfo* pPackageAppInfo = dynamic_cast < PackageAppInfo* >(metadataList.GetAt(j));
+ if (pPackageAppInfo)
+ {
+ if (appIdList.Contains(pPackageAppInfo->GetAppId()) == true)
+ {
+ AppLog("AppId [%ls] is matched.", pPackageAppInfo->GetAppId().GetPointer());
+
+ std::unique_ptr< PackageAppInfo > pPackageAppInfo(new (std::nothrow) PackageAppInfo);
+ SysTryCatch(NID_APP, pPackageAppInfo, , E_OUT_OF_MEMORY, "PackageAppInfo is null.");
+
+ _PackageAppInfoImpl* pPackageAppInfoImpl = _PackageAppInfoImpl::GetInstance(pPackageAppInfo.get());
+ pPackageAppInfoImpl->Construct(pPackageAppInfo->GetAppId());
+
+ pList->Add(pPackageAppInfo.release());
+ }
+ else
+ {
+ AppLog("AppId [%ls] is not matched.", pPackageAppInfo->GetAppId().GetPointer());
+ }
+ }
+ }