#include <FIoDirectory.h>
#include <FIo_FileImpl.h>
#include <FBase_StringConverter.h>
-#include <FAppPkg_PackageManagerImpl.h>
#include <FAppPkg_PackageInfoImpl.h>
-#include <FAppPkg_PackageAppInfoImpl.h>
#include "InstallationContext.h"
#include "UninstallStep.h"
#include "InstallerUtil.h"
+#include "CompatibilityManager.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
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;
std::unique_ptr< _PackageInfoImpl > pPackageInfoImpl(new (std::nothrow) _PackageInfoImpl());
TryReturn(pPackageInfoImpl, INSTALLER_ERROR_OUT_OF_MEMORY, "pPackageInfoImpl is null.");
- AppLog("packageId = %ls", packageId.GetPointer());
+ 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();
- if (isUninstallable == false)
- {
- __pContext->__additionalErrorString = L"Thrown when the application cannot be uninstalled because the application was preloaded.";
- }
- TryReturn(isUninstallable == true, INSTALLER_ERROR_PACKAGE_INVALID, "preload app cannot be uninstalled.");
+// bool isUninstallable = pPackageInfoImpl->IsUninstallable();
+// if (isUninstallable == false)
+// {
+// __pContext->__additionalErrorString = L"Thrown when the application cannot be uninstalled because the application was preloaded.";
+// }
+// TryReturn(isUninstallable == true, INSTALLER_ERROR_PACKAGE_INVALID, "preload app cannot be uninstalled.");
- __pContext->__rootPath = pPackageInfoImpl->GetAppRootPath();
- if (__pContext->__rootPath.StartsWith(PATH_USR_APPS, 0) == true)
+ String rwXmlPath;
+ rwXmlPath.Format(1024, DIR_RW_PACKAGE_SYSTEM_MANIFEST, packageId.GetPointer());
+ if (File::IsFileExist(rwXmlPath) == false)
{
+ AppLog("This is a preload app = [%ls]", rwXmlPath.GetPointer());
__pContext->__isPreloaded = true;
}
- if (__pContext->__isHybridService == true)
- {
- AppLog("Uninstallation for HybridService");
- __state = STATE_DELETE_DIR;
- return error;
- }
+ //res = IsAvailableUninstall();
+ //TryReturn(res == true, INSTALLER_ERROR_DISABLED, "IsAvailableUninstall(%ls) failed.", packageId.GetPointer());
+
+ __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_DELETE_DIR;
+ GoNextState();
return error;
}
-
InstallerError
-UninstallStep::OnStateCheckAppRunning(void)
+UninstallStep::OnStatePolicyCheck(void)
{
InstallerError error = INSTALLER_ERROR_NONE;
{
InstallerError error = INSTALLER_ERROR_NONE;
+ InstallerUtil::TerminateApps(__pContext->__packageId, true);
+
GoNextState();
return error;
}
UninstallStep::OnStateRemoveDir(void)
{
InstallerError error = INSTALLER_ERROR_NONE;
+ bool res = true;
+
+ CompatibilityManager compatibilityManager;
+ compatibilityManager.Construct(__pContext);
String rootPath;
rootPath = __pContext->__rootPath;
result r = GetLastResult();
if (r == E_SUCCESS && ospCompat == true)
{
- if (_FileImpl::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;
}
- AppLog("Directory::Remove - START");
+ compatibilityManager.CleanDirectories(rootPath, __pContext->__packageId);
- if (__pContext->__isHybridService == true)
- {
- AppLog("Uninstallation for HybridService - skip Remove");
+ String virtualRootInfoFile = rootPath + VIRTUAL_ROOT_INFO_FILE;
+ if (File::IsFileExist(virtualRootInfoFile) == true)
+ {
+ res = compatibilityManager.FinalizeVirtualRoot(rootPath, __pContext->__packageId);
+ TryReturn(res == true, INSTALLER_ERROR_UNMOUNT_FAILED, "compatibilityManager.FinalizeVirtualRoot(%ls) failed.", rootPath.GetPointer());
}
- else
+
+ AppLog("Directory::Remove - START");
+
+ String realPath;
+ if (InstallerUtil::IsSymlink(rootPath) == true)
{
- 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");