#include <unique_ptr.h>
#include <FAppPkgPackageInfo.h>
+#include <FIoDirectory.h>
#include <FIoFile.h>
#include <FIoRegistry.h>
#include <FSecCryptoSha1Hash.h>
if (dirPath.Contains(L"shared/data") == true)
{
- label.Append("_shareddata");
+ label = L"*";
+ //label.Append("_shareddata");
AddSharedDirReaders(label);
}
else if (dirPath.Contains(L"shared/trusted") == true)
}
bool
-SmackManager::AddSharedDirReaders(const Tizen::Base::String& label)
+SmackManager::AddSharedDirReaders(const String& label)
{
if (__isSmackEnable == false)
{
int error = 0;
bool res = true;
+ IList* pPackageList = null;
std::unique_ptr<char[]> pLabel(_StringConverter::CopyToCharArrayN(label));
TryReturn(pLabel, false, "pLabel is null.");
- std::unique_ptr< IList > pPackageList(_PackageManagerImpl::GetInstance()->GetPackageInfoListN());
+ if (__pContext->__isPreloaded == true)
+ {
+ pPackageList = GetPreloadedAppListN();
+ }
+ else
+ {
+ pPackageList = _PackageManagerImpl::GetInstance()->GetPackageInfoListN();
+ }
TryReturn(pPackageList, false, "pPackageList is null.");
int count = pPackageList->GetCount();
for (int i = 0; i < count; i++)
{
- PackageInfo* pPackageInfo = dynamic_cast < PackageInfo* >(pPackageList->GetAt(i));
- if (pPackageInfo)
+ if (__pContext->__isPreloaded == true)
{
- PackageId packageId = pPackageInfo->GetId();
-
- if (packageId == __pContext->__packageId)
+ String* pPackage = dynamic_cast < String* >(pPackageList->GetAt(i));
+ if (pPackage)
{
- AppLog("packageId [%ls] is skipped.", packageId.GetPointer());
- continue;
+ PackageId packageId = *pPackage;
+
+ if (packageId == __pContext->__packageId)
+ {
+ AppLog("package [%ls] is skipped.", packageId.GetPointer());
+ continue;
+ }
+
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+ TryCatch(pPackageId, res = false, "pPackage is null.");
+
+ pList[i] = pPackageId.release();
+ AppLog("Package - [%s]", pList[i]);
}
+ }
+ else
+ {
+ PackageInfo* pPackage = dynamic_cast < PackageInfo* >(pPackageList->GetAt(i));
+ if (pPackage)
+ {
+ PackageId packageId = pPackage->GetId();
+
+ if (packageId == __pContext->__packageId)
+ {
+ AppLog("package [%ls] is skipped.", packageId.GetPointer());
+ continue;
+ }
- std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
- TryCatch(pPackageId, res = false, "pPackageId is null.");
+ std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(packageId));
+ TryCatch(pPackageId, res = false, "pPackage is null.");
- pList[i] = pPackageId.release();
- AppLog("Package - [%s]", pList[i]);
+ pList[i] = pPackageId.release();
+ AppLog("Package - [%s]", pList[i]);
+ }
}
}
delete[] pList[i];
}
delete[] pList;
+ delete pPackageList;
return res;
}
return ret;
}
+
+ArrayList*
+SmackManager::GetPreloadedAppListN() const
+{
+ result r = E_SUCCESS;
+
+ std::unique_ptr< ArrayList > pList(new (std::nothrow) ArrayList());
+ TryReturn(pList, null, "pList is null.");
+
+ r = pList->Construct();
+ TryReturn(r == E_SUCCESS, null, "pList->Construct() failed.");
+
+ std::unique_ptr< Directory > pDir(new (std::nothrow) Directory());
+ TryReturn(pDir, null, "pDir is null.");
+
+ r = pDir->Construct(PATH_USR_APPS);
+ TryReturn(r == E_SUCCESS, null, "pDir->Construct() failed.");
+
+ std::unique_ptr< DirEnumerator > pDirEnum(pDir->ReadN());
+ TryReturn(pDirEnum, null, "pDirEnum is null.");
+
+ while (pDirEnum->MoveNext() == E_SUCCESS)
+ {
+ DirEntry entry = pDirEnum->GetCurrentDirEntry();
+ String entryName = entry.GetName();
+
+ if (entryName == L"." || entryName == L"..")
+ {
+ continue;
+ }
+
+ if (entry.IsDirectory() == false)
+ {
+ continue;
+ }
+
+ const int entryLength = entryName.GetLength();
+ if (entryLength != PACKAGE_ID_LENGTH)
+ {
+ continue;
+ }
+
+ std::unique_ptr< String > pPackageId(new (std::nothrow) String(entryName));
+ TryReturn(pPackageId, null, "pPackageId is null.");
+
+ pList->Add(pPackageId.release());
+ }
+
+ if (pList->GetCount() <= 0)
+ {
+ AppLog("pList's count is 0.");
+ return null;
+ }
+
+ return pList.release();
+}