error = OnStateGetPackageInfo();
break;
- case STATE_CHECK_APP_RUNNING:
- AppLog("[STATE_CHECK_APP_RUNNING]");
- error = OnStateCheckAppRunning();
+ case STATE_POLICY_CHECK:
+ AppLog("[STATE_POLICY_CHECK]");
+ error = OnStatePolicyCheck();
break;
case STATE_TERMINATE_APP:
InstallerError
UninstallStep::OnStateGetPackageInfo(void)
{
+ bool res = true;
+ result r = E_SUCCESS;
InstallerError error = INSTALLER_ERROR_NONE;
PackageId packageId = __pContext->__packageId;
AppLog("package = %ls", packageId.GetPointer());
- result r = pPackageInfoImpl->Construct(packageId);
+ r = pPackageInfoImpl->Construct(packageId);
TryReturn(r == E_SUCCESS, INSTALLER_ERROR_INTERNAL_STATE, "pPackageInfoImpl->Construct(%ls) failed.", packageId.GetPointer());
// bool isUninstallable = pPackageInfoImpl->IsUninstallable();
__pContext->__isPreloaded = true;
}
- __pContext->__rootPath = pPackageInfoImpl->GetAppRootPath();
+ //res = IsAvailableUninstall();
+ //TryReturn(res == true, INSTALLER_ERROR_DISABLED, "IsAvailableUninstall(%ls) failed.", packageId.GetPointer());
- if (__pContext->__isHybridService == true)
- {
- AppLog("Uninstallation for HybridService");
- __state = STATE_TERMINATE_APP;
- return error;
- }
+ __pContext->__rootPath = pPackageInfoImpl->GetAppRootPath();
if (pPackageInfoImpl->IsInstalledInExternalStorage() == true)
{
AppLog("[app2sd] pre_uninstall(%s)", pPackageId.get());
}
- ArrayList* pList = pPackageInfoImpl->GetAppInfoListN();
+ std::unique_ptr< ArrayList > pList(pPackageInfoImpl->GetAppInfoListN());
TryReturn(pList, INSTALLER_ERROR_DATABASE, "pList is null.");
- for (int i = 0; i < pList->GetCount(); i++)
+ for (int i = 0; i < pList.get()->GetCount(); i++)
{
- _PackageAppInfoImpl* pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pList->GetAt(i));
+ _PackageAppInfoImpl* pAppInfoImpl = dynamic_cast<_PackageAppInfoImpl*>(pList.get()->GetAt(i));
if (pAppInfoImpl)
{
- AppData* pAppData = new (std::nothrow) AppData;
- TryReturn(pAppData, INSTALLER_ERROR_OUT_OF_MEMORY, "pAppData is null");
+ std::unique_ptr< AppData > pAppData(new (std::nothrow) AppData);
+ TryReturn(pAppData, INSTALLER_ERROR_OUT_OF_MEMORY, "pAppData is null.");
- error = pAppData->Construct();
- TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "pAppData->Construct() failed.");
+ error = pAppData.get()->Construct();
+ TryReturn(error == INSTALLER_ERROR_NONE, INSTALLER_ERROR_INTERNAL_STATE, "pAppData.get()->Construct() failed.");
- pAppData->__appId = pAppInfoImpl->GetPackageName();
- pAppData->__feature = pAppInfoImpl->GetAppFeature();
+ pAppData.get()->__appId = pAppInfoImpl->GetPackageName();
+ pAppData.get()->__feature = pAppInfoImpl->GetAppFeature();
- __pContext->__pAppDataList->Add(pAppData);
+ __pContext->__pAppDataList->Add(pAppData.release());
}
}
- delete pList;
-
- __state = STATE_TERMINATE_APP;
+ GoNextState();
return error;
}
-
InstallerError
-UninstallStep::OnStateCheckAppRunning(void)
+UninstallStep::OnStatePolicyCheck(void)
{
InstallerError error = INSTALLER_ERROR_NONE;
{
InstallerError error = INSTALLER_ERROR_NONE;
- InstallerUtil::TerminateApps(__pContext->__packageId);
+ InstallerUtil::TerminateApps(__pContext->__packageId, true);
GoNextState();
return error;
InstallerError error = INSTALLER_ERROR_NONE;
bool res = true;
+ CompatibilityManager compatibilityManager;
+ compatibilityManager.Construct(__pContext);
+
String rootPath;
rootPath = __pContext->__rootPath;
AppLog("rootPath = [%ls]", rootPath.GetPointer());
result r = GetLastResult();
if (r == E_SUCCESS && ospCompat == true)
{
- if (CompatibilityManager::FinalizeDataCaging(rootPath) == false)
+ if (compatibilityManager.FinalizeDataCaging(rootPath) == false)
{
AppLog("[Tizen::Io] Failed to unmount directories for 2.0 application, appRootPath: %ls",
rootPath.GetPointer());
return INSTALLER_ERROR_UNMOUNT_FAILED;
}
- CompatibilityManager::CleanDirectories(rootPath, __pContext->__packageId);
+ compatibilityManager.CleanDirectories(rootPath, __pContext->__packageId);
- String virtualRoot = rootPath + DIR_VIRTUAL_ROOT;
- if (File::IsFileExist(virtualRoot) == true)
+
+ String virtualRootInfoFile = rootPath + VIRTUAL_ROOT_INFO_FILE;
+ if (File::IsFileExist(virtualRootInfoFile) == true)
{
- res = CompatibilityManager::FinalizeVirtualRoot(rootPath);
- TryReturn(res == true, INSTALLER_ERROR_UNMOUNT_FAILED, "CompatibilityManager::FinalizeVirtualRoot(%ls) failed.", rootPath.GetPointer());
+ res = compatibilityManager.FinalizeVirtualRoot(rootPath, __pContext->__packageId);
+ TryReturn(res == true, INSTALLER_ERROR_UNMOUNT_FAILED, "compatibilityManager.FinalizeVirtualRoot(%ls) failed.", rootPath.GetPointer());
}
AppLog("Directory::Remove - START");
- if (__pContext->__isHybridService == true)
+ String realPath;
+ if (InstallerUtil::IsSymlink(rootPath) == true)
{
- AppLog("Uninstallation for HybridService - skip Remove");
-
- }
- else
- {
- String realPath;
- if (InstallerUtil::IsSymlink(rootPath) == true)
+ if (InstallerUtil::GetRealPath(rootPath, realPath) == true)
{
- if (InstallerUtil::GetRealPath(rootPath, realPath) == true)
- {
- InstallerUtil::Remove(realPath);
- }
+ InstallerUtil::Remove(realPath);
}
-
- InstallerUtil::Remove(rootPath);
}
+ InstallerUtil::Remove(rootPath);
+
+
IListT<AppData*>* pAppDataList = __pContext->__pAppDataList;
TryReturn(pAppDataList, INSTALLER_ERROR_INTERNAL_STATE, "pAppDataList is null");