From ecb4b3412eb5cc457effeff1653db8dbfd1c22f1 Mon Sep 17 00:00:00 2001 From: Jihoon Chung Date: Mon, 7 Jan 2013 19:25:29 +0900 Subject: [PATCH] Change vconf create mechanism [Issue#] JIRA(#N_SE-17625) [Problem] Even change setting value in the "Advanced settings", value isn't saved. [Cause] Permission error is occurred during saving vconf value. Permission error is occurred in the case of installing application by IDE. [Solution] For making sure, change vconf create mechanism to use vconftool with group id setting option. [SCMRequest] N/A Change-Id: Idbe63f3da5abb1ee1465bac4d635045be51359e1 --- src/jobs/widget_install/task_database.cpp | 58 +++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/src/jobs/widget_install/task_database.cpp b/src/jobs/widget_install/task_database.cpp index 696a962..ee543c8 100644 --- a/src/jobs/widget_install/task_database.cpp +++ b/src/jobs/widget_install/task_database.cpp @@ -39,6 +39,7 @@ #include #include #include +#include using namespace WrtDB; @@ -191,41 +192,40 @@ void TaskDatabase::StepRemoveExternalFiles() void TaskDatabase::StepCreateVconf() { LogDebug("StepCreateVconf"); - std::string popupUsageKey = + std::map 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(WrtDB::SETTINGS_TYPE_ON)); - // prevent permission error - vconf_unset(popupUsageKey.c_str()); - vconf_set_int(popupUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(geolocationUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(webNotificationUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(webDatabaseUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(filesystemUsageKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_ON)); - vconf_set_int(memorySavingModeKey.c_str(), - static_cast(WrtDB::SETTINGS_TYPE_OFF)); + m_context.locations->getPkgname())] = WrtDB::SETTINGS_TYPE_OFF; + + // vconftool -g 5000 set -t int 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((*it).second) << "\""; + int ret = system(command.str().c_str()); + if (-1 == ret) { + ThrowMsg(Exceptions::CreateVconfFailure, "Failed to create vconf files"); + } + } } void TaskDatabase::StepAbortDBInsert() -- 2.7.4