#include <cstdlib>
#include <limits.h>
#include <regex.h>
+#include <vconf.h>
#include <dpl/utils/wrt_utility.h>
#include <dpl/utils/path.h>
static const DPL::String SETTING_VALUE_ENCRYPTION = L"encryption";
static const DPL::String SETTING_VALUE_ENCRYPTION_ENABLE = L"enable";
static const DPL::String SETTING_VALUE_ENCRYPTION_DISABLE = L"disable";
-const DPL::String SETTING_VALUE_INSTALLTOEXT_NAME =
- L"install-location";
-const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT =
- L"prefer-external";
-
+const DPL::String SETTING_VALUE_INSTALLTOEXT_NAME = L"install-location";
+const DPL::String SETTING_VALUE_INSTALLTOEXT_PREPER_EXT = L"prefer-external";
+const DPL::String SETTING_VALUE_INSTALLTOEXT_AUTO = L"auto";
const std::string XML_EXTENSION = ".xml";
bool hasExtension(const std::string& filename, const std::string& extension)
}
}
+bool TaskConfiguration::getMMCStatus()
+{
+ int mmcStatus;
+ if (vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS, &mmcStatus)) {
+ _E("vconf_get_int(VCONFKEY_SYSMAN_MMC_STATUS) failed.");
+ return false;
+ }
+
+ switch(mmcStatus)
+ {
+ case VCONFKEY_SYSMAN_MMC_MOUNTED:
+ _D("mmcStatus is MMC_MOUNTED.");
+ return true;
+ case VCONFKEY_SYSMAN_MMC_REMOVED:
+ case VCONFKEY_SYSMAN_MMC_INSERTED_NOT_MOUNTED:
+ _D("mmcStatus is MMC_REMOVED or NOT_MOUNTED.");
+ return false;
+ default:
+ _E("Platform is not supported, use the default settings");
+ return false;
+ }
+}
+
+bool TaskConfiguration::getDefaultExternalStorage()
+{
+ // XXX NOT IMPLEMENTED.
+ return false;
+}
+
void TaskConfiguration::InstallationFSLocationStep()
{
m_context.locationType = INSTALL_LOCATION_TYPE_NOMAL;
+ DPL::String locationValue;
+
if (m_context.mode.installTime != InstallMode::InstallTime::PRELOAD) {
FOREACH(it, m_widgetConfig.settingsList) {
- if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME &&
- it->m_value ==
- SETTING_VALUE_INSTALLTOEXT_PREPER_EXT)
- {
- _D("This widget will be installed to sd card");
- m_context.locationType =
- INSTALL_LOCATION_TYPE_EXTERNAL;
+ if (it->m_name == SETTING_VALUE_INSTALLTOEXT_NAME) {
+ locationValue = it->m_value;
+ break;
}
}
+
+ if ((SETTING_VALUE_INSTALLTOEXT_PREPER_EXT == locationValue
+ && getMMCStatus()) ||
+ (SETTING_VALUE_INSTALLTOEXT_AUTO == locationValue
+ && getDefaultExternalStorage())) {
+ _D("This webapp will be installed to sd card");
+ m_context.locationType = INSTALL_LOCATION_TYPE_EXTERNAL;
+ }
}
}