#include <errno.h>
#include <string.h>
#include <vconf.h>
+#include <map>
using namespace WrtDB;
void TaskDatabase::StepCreateVconf()
{
LogDebug("StepCreateVconf");
- std::string popupUsageKey =
+ std::map<std::string, WrtDB::SettingsType> vconfData;
+ vconfData[
WrtDB::VconfConfig::GetVconfKeyPopupUsage(
- m_context.locations->getPkgname());
- std::string geolocationUsageKey =
+ m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ vconfData[
WrtDB::VconfConfig::GetVconfKeyGeolocationUsage(
- m_context.locations->getPkgname());
- std::string webNotificationUsageKey =
+ m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ vconfData[
WrtDB::VconfConfig::GetVconfKeyWebNotificationUsage(
- m_context.locations->getPkgname());
- std::string webDatabaseUsageKey =
+ m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ vconfData[
WrtDB::VconfConfig::GetVconfKeyWebDatabaseUsage(
- m_context.locations->getPkgname());
- std::string filesystemUsageKey =
+ m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ vconfData[
WrtDB::VconfConfig::GetVconfKeyFilesystemUsage(
- m_context.locations->getPkgname());
- std::string memorySavingModeKey =
+ m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_ON;
+ vconfData[
WrtDB::VconfConfig::GetVconfKeyMemorySavingMode(
- m_context.locations->getPkgname());
-
- vconf_set_int(popupUsageKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
- // prevent permission error
- vconf_unset(popupUsageKey.c_str());
- vconf_set_int(popupUsageKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
- vconf_set_int(geolocationUsageKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
- vconf_set_int(webNotificationUsageKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
- vconf_set_int(webDatabaseUsageKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
- vconf_set_int(filesystemUsageKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_ON));
- vconf_set_int(memorySavingModeKey.c_str(),
- static_cast<int>(WrtDB::SETTINGS_TYPE_OFF));
+ m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_OFF;
+
+ // vconftool -g 5000 set -t int <path> initialize value
+ // Current installer should use vconftool for setting group ID
+ // In case of install application by pkgcmd, permission for others
+ // set to read-only
+ FOREACH(it, vconfData) {
+ std::ostringstream command;
+ command << "vconftool -g 5000 set -t int ";
+ command << (*it).first;
+ command << " \"" << static_cast<int>((*it).second) << "\"";
+ int ret = system(command.str().c_str());
+ if (-1 == ret) {
+ ThrowMsg(Exceptions::CreateVconfFailure, "Failed to create vconf files");
+ }
+ }
}
void TaskDatabase::StepAbortDBInsert()