--- /dev/null
+//
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FSys_SettingService.cpp
+ * @brief This is the implementation file for _SettingService class.
+ */
+
+#include <unique_ptr.h>
+
+#include <FBaseBoolean.h>
+#include <FBaseInteger.h>
+#include <FBaseSysLog.h>
+
+#include <FIo_IpcServer.h>
+#include <FIo_AppServiceIpcMessages.h>
+#include <FSec_AccessController.h>
+
+#include "FSys_SettingService.h"
+
+using namespace std;
+using namespace Tizen::App;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Io;
+using namespace Tizen::Security;
+
+namespace Tizen { namespace System {
+
+const static wchar_t* SETTING_SERVICE_ID = L"osp.sys.ipcserver.setting_service";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_GET_BOOL = L"osp.sys.ipcserver.setting_service.command.get.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_GET_INT = L"osp.sys.ipcserver.setting_service.command.get.int";
+const static wchar_t* SETTING_SERVICE_COMMAND_GET_STRING = L"osp.sys.ipcserver.setting_service.command.get.string";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_BOOL = L"osp.sys.ipcserver.setting_service.command.set.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_INT = L"osp.sys.ipcserver.setting_service.command.set.int";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_STRING = L"osp.sys.ipcserver.setting_service.command.set.string";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_PRIV_BOOL = L"osp.sys.ipcserver.setting_service.command.set.priv.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_PRIV_STRING = L"osp.sys.ipcserver.setting_service.command.set.priv.string";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_ASYNC_BOOL = L"osp.sys.ipcserver.setting_service.command.set.async.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_SET_PRIV_ASYNC_BOOL = L"osp.sys.ipcserver.setting_service.command.set.priv.async.bool";
+const static wchar_t* SETTING_SERVICE_COMMAND_RESULT = L"osp.sys.ipcserver.setting_service.command.result";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SUBSCRIBE = L"osp.sys.ipcserver.setting_service.command.subscribe";
+const static wchar_t* SETTING_SERVICE_COMMAND_UNSUBSCRIBE = L"osp.sys.ipcserver.setting_service.command.unsubscribe";
+const static wchar_t* SETTING_SERVICE_COMMAND_EVENT = L"osp.sys.ipcserver.setting_service.command.event";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SUPPORTED = L"osp.sys.ipcserver.setting_service.command.supported";
+
+const static wchar_t* SETTING_SERVICE_COMMAND_SUBSCRIBE_INTERNAL = L"osp.sys.ipcserver.setting_service.command.subscribe.internal";
+const static wchar_t* SETTING_SERVICE_COMMAND_UNSUBSCRIBE_INTERNAL = L"osp.sys.ipcserver.setting_service.command.unsubscribe.internal";
+const static wchar_t* SETTING_SERVICE_COMMAND_EVENT_INTERNAL = L"osp.sys.ipcserver.setting_service.command.event.internal";
+
+const static int SETTING_SERVICE_IPC_MSG_COMMAND = 0;
+const static int SETTING_SERVICE_IPC_MSG_KEY = 1;
+const static int SETTING_SERVICE_IPC_MSG_VALUE = 2;
+
+const static wchar_t* _SETTINGS_KEY_FONT_SIZE = L"http://tizen.org/setting/font.size";
+const static wchar_t* _SETTINGS_KEY_FONT_TYPE = L"http://tizen.org/setting/font.type";
+const static wchar_t* _SETTINGS_KEY_LOCALE_COUNTRY = L"http://tizen.org/setting/locale.country";
+const static wchar_t* _SETTINGS_KEY_LOCALE_LANGUAGE = L"http://tizen.org/setting/locale.language";
+
+_SettingService* _SettingService::__pSettingService = null;
+
+_SettingService::_SettingService()
+ : __serviceId(SETTING_SERVICE_ID)
+ , __pSettingInfo(null)
+ , __asyncList(SingleObjectDeleter)
+ , __eventList(SingleObjectDeleter)
+{
+ result r = E_SUCCESS;
+
+ r = __ipcServer.Construct(__serviceId, *this, true);
+ SysTryReturnVoidResult(NID_SYS, r == E_SUCCESS, r, "It is failed to construct IPC server.");
+
+ r = __ipcServer.Start();
+ SysTryCatch(NID_SYS, r == E_SUCCESS, , r, "It is failed to start IPC server.");
+
+ __pSettingInfo = _SettingInfo::GetInstance();
+ SysTryCatch(NID_SYS, __pSettingInfo != null, r = E_SYSTEM, E_SYSTEM, "It is failed to get instance of _SettingInfo.");
+
+ __pSettingInfo->AddSettingEventListener(*this);
+ r = __asyncList.Construct();
+ SysTryCatch(NID_SYS, r == E_SUCCESS, , r, "It is failed to construct async list.");
+
+ r = __eventList.Construct();
+ SysTryCatch(NID_SYS, r == E_SUCCESS, , r, "It is failed to construct event list.");
+
+ r = __eventListForInternal.Construct();
+ SysTryCatch(NID_SYS, r == E_SUCCESS, , r, "It is failed to construct event list for internal.");
+
+CATCH:
+ if(r != E_SUCCESS)
+ {
+ __pSettingInfo = null;
+ SysLogException(NID_SYS, r, "It is failed to construct _SettingService.");
+ __ipcServer.Stop();
+ }
+}
+
+_SettingService::~_SettingService()
+{
+ __pSettingInfo->RemoveSettingEventListener(*this);
+ __pSettingInfo = null;
+ result r = __ipcServer.Stop();
+ SysTryReturnVoidResult(NID_SYS, r == E_SUCCESS, r, "It is failed to stop IPC server.");
+}
+
+_SettingService*
+_SettingService::GetInstance(void)
+{
+ static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
+ if(__pSettingService == null)
+ {
+ pthread_once(&onceBlock, InitSingleton);
+ }
+ return __pSettingService;
+}
+
+void
+_SettingService::InitSingleton(void)
+{
+ _SettingService* pSettingService = new (nothrow) _SettingService();
+ SysTryReturnVoidResult(NID_SYS, pSettingService != null, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
+ GetErrorMessage(E_OUT_OF_MEMORY));
+
+ __pSettingService = pSettingService;
+ atexit(DestroySingleton);
+}
+
+void
+_SettingService::OnIpcRequestReceived(_IpcServer& server, const IPC::Message& message)
+{
+ __currentPkgId = server.GetClientPackageId();
+ __currentPid = server.GetClientId();
+ IPC_BEGIN_MESSAGE_MAP(_SettingService, message)
+ IPC_MESSAGE_HANDLER_EX(IoService_Request, &server, OnRequestOccured)
+ IPC_END_MESSAGE_MAP_EX()
+}
+
+bool
+_SettingService::OnRequestOccured(const ArrayList& request, ArrayList* response)
+{
+ result r = E_SUCCESS;
+ String* pCommand = null;
+ String* pKey = null;
+ String* pValue = null;
+
+ SysTryCatch(NID_SYS, response != null, r = E_SYSTEM, r, "There is no response instance.");
+
+ pCommand = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_COMMAND);
+ SysTryCatch(NID_SYS, pCommand != null, r = E_SYSTEM, r, "There is no command information.");
+
+ SysLog(NID_SYS, "Required command is [%ls].", pCommand->GetPointer());
+
+ if(*pCommand == SETTING_SERVICE_COMMAND_GET_INT)
+ {
+ int value = 0;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ r = __pSettingInfo->GetValue(*pKey, value);
+ pValue = new (nothrow) String();
+ SysTryCatch(NID_SYS, pValue != null, r = E_SYSTEM, r, "It is failed to create pValue.");
+ pValue->Append(value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_GET_BOOL)
+ {
+ bool value = false;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ r = __pSettingInfo->GetValue(*pKey, value);
+ pValue = new (nothrow) String();
+ SysTryCatch(NID_SYS, pValue != null, r = E_SYSTEM, r, "It is failed to create pValue.");
+ pValue->Append(value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_GET_STRING)
+ {
+ String value;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ r = __pSettingInfo->GetValue(*pKey, value);
+ pValue = new (nothrow) String(value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_INT)
+ {
+ int value = 0;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+ Integer::Parse(*pValue, value);
+ r = __pSettingInfo->SetValue(*pKey, value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_BOOL)
+ {
+ bool value = false;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+ value = Boolean::Parse(*pValue);
+ r = __pSettingInfo->SetValue(*pKey, value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_STRING)
+ {
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+ r = __pSettingInfo->SetValue(*pKey, *pValue);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_PRIV_BOOL)
+ {
+ bool value = false;
+
+ r = _AccessController::CheckSystemPrivilege(__currentPkgId, _PRV_SYSTEMSETTING_WRITE, _PRV_SETTINGMANAGER_WRITE);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_PRIVILEGE_DENIED, r, "The application[%ls] does not have the privilege to call this method.", __currentPkgId.GetPointer());
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+ value = Boolean::Parse(*pValue);
+ r = __pSettingInfo->SetValueForPrivilegedKey(*pKey, value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_PRIV_STRING)
+ {
+ r = _AccessController::CheckSystemPrivilege(__currentPkgId, _PRV_SYSTEMSETTING_WRITE, _PRV_SETTINGMANAGER_WRITE);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_PRIVILEGE_DENIED, r, "The application[%ls] does not have the privilege to call this method.", __currentPkgId.GetPointer());
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+ r = __pSettingInfo->SetValueForPrivilegedKey(*pKey, *pValue);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_ASYNC_BOOL)
+ {
+ bool value = false;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+
+ SysLog(NID_SYS, "Key is %ls, Value is %ls, pid is %d.", pKey->GetPointer(), pValue->GetPointer(), __currentPid);
+ if(*pValue == L"true")
+ {
+ value = true;
+ }
+ else
+ {
+ value = false;
+ }
+ unique_ptr<String> reservedKey(new (nothrow)String(*pKey));
+ SysTryCatch(NID_SYS, __asyncList.ContainsKey(*(reservedKey.get())) == false, r = E_IN_PROGRESS, r, "Required key(%ls) is already under processing.", pKey->GetPointer());
+ unique_ptr<Integer> reservedPid(new (nothrow)Integer(__currentPid));
+
+ r = __asyncList.Add(reservedKey.get(), reservedPid.get());
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to add aync list.");
+ reservedPid.release();
+ reservedKey.release();
+
+ r = __pSettingInfo->SetValueAsync(*pKey, value, this);
+ if(r != E_SUCCESS)
+ {
+ __asyncList.Remove(*pKey);
+ }
+ SysLog(NID_SYS, "Result is %s.", GetErrorMessage(r));
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SET_PRIV_ASYNC_BOOL)
+ {
+ bool value = false;
+ r = _AccessController::CheckSystemPrivilege(__currentPkgId, _PRV_SYSTEMSETTING_WRITE, _PRV_SETTINGMANAGER_WRITE);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_PRIVILEGE_DENIED, r, "The application[%ls] does not have the privilege to call this method.", __currentPkgId.GetPointer());
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ pValue = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_VALUE);
+
+ SysLog(NID_SYS, "Key is %ls, Value is %ls, pid is %d.", pKey->GetPointer(), pValue->GetPointer(), __currentPid);
+ if(*pValue == L"true")
+ {
+ value = true;
+ }
+ else
+ {
+ value = false;
+ }
+
+ unique_ptr<String> reservedKey(new (nothrow)String(*pKey));
+ SysTryCatch(NID_SYS, __asyncList.ContainsKey(*(reservedKey.get())) == false, r = E_IN_PROGRESS, r, "Required key(%ls) is already under processing.", pKey->GetPointer());
+ unique_ptr<Integer> reservedPid(new (nothrow)Integer(__currentPid));
+
+ r = __asyncList.Add(reservedKey.get(), reservedPid.get());
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to add aync list.");
+ reservedPid.release();
+ reservedKey.release();
+
+ r = __pSettingInfo->SetValueAsyncForPrivilegedKey(*pKey, value, this);
+ if(r != E_SUCCESS)
+ {
+ __asyncList.Remove(*pKey);
+ }
+ SysLog(NID_SYS, "Result is %s.", GetErrorMessage(r));
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SUBSCRIBE)
+ {
+ unique_ptr<Integer> pid(new (nothrow) Integer(__currentPid));
+
+ SysTryCatch(NID_SYS, __eventList.Contains(*(pid.get())) == false, r = E_OBJ_ALREADY_EXIST, r, "Required application(%ls, %d) is already subscribe event.", __currentPkgId.GetPointer(), __currentPid);
+ r = __eventList.Add(pid.get());
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to add application(%ls, %d) on event list", __currentPkgId.GetPointer(), __currentPid);
+ pid.release();
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_UNSUBSCRIBE)
+ {
+ unique_ptr<Integer> pid(new (nothrow) Integer(__currentPid));
+
+ SysTryCatch(NID_SYS, __eventList.Contains(*(pid.get())) == true, r = E_OBJ_NOT_FOUND, r, "Required application(%ls, %d) is not subscribe event.", __currentPkgId.GetPointer(), __currentPid);
+ r = __eventList.Remove(*(pid.get()), true);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to remove application(%ls, %d) on event list", __currentPkgId.GetPointer(), __currentPid);
+ pid.release();
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SUPPORTED)
+ {
+ bool value = false;
+
+ pKey = (String*)request.GetAt(SETTING_SERVICE_IPC_MSG_KEY);
+ SysTryCatch(NID_SYS, pKey != null, r = E_SYSTEM, r, "There is no key information.");
+ value = __pSettingInfo->HasKey(*pKey);
+ pValue = new (nothrow) String();
+ SysTryCatch(NID_SYS, pValue != null, r = E_SYSTEM, r, "It is failed to create pValue.");
+ pValue->Append(value);
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_SUBSCRIBE_INTERNAL)
+ {
+ unique_ptr<Integer> pid(new (nothrow) Integer(__currentPid));
+
+ SysTryCatch(NID_SYS, __eventListForInternal.Contains(*(pid.get())) == false, r = E_OBJ_ALREADY_EXIST, r, "Required application(%ls, %d) is already subscribe event.", __currentPkgId.GetPointer(), __currentPid);
+ r = __eventListForInternal.Add(pid.get());
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to add application(%ls, %d) on event list", __currentPkgId.GetPointer(), __currentPid);
+ pid.release();
+ }
+ else if(*pCommand == SETTING_SERVICE_COMMAND_UNSUBSCRIBE_INTERNAL)
+ {
+ unique_ptr<Integer> pid(new (nothrow) Integer(__currentPid));
+
+ SysTryCatch(NID_SYS, __eventListForInternal.Contains(*(pid.get())) == true, r = E_OBJ_NOT_FOUND, r, "Required application(%ls, %d) is not subscribe event.", __currentPkgId.GetPointer(), __currentPid);
+ r = __eventListForInternal.Remove(*(pid.get()), true);
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to remove application(%ls, %d) on event list", __currentPkgId.GetPointer(), __currentPid);
+ pid.release();
+ }
+ else
+ {
+ return false;
+ }
+
+CATCH:
+ if(response != null)
+ {
+ String* pCommandCode = new (nothrow) String(*pCommand);
+ String* pResultCode = new (nothrow) String(GetErrorMessage(r));
+
+ SysLog(NID_SYS, "Result value is %ls.", pCommandCode->GetPointer());
+ SysLog(NID_SYS, "Result value is %ls.", pResultCode->GetPointer());
+
+ response->Add(pCommandCode);
+ response->Add(pResultCode);
+ if(pValue != null)
+ {
+ SysLog(NID_SYS, "Result value is %ls.", pValue->GetPointer());
+ response->Add(pValue);
+ }
+ }
+
+ return true;
+}
+
+void
+_SettingService::OnResultReceivedForSetValueAsync(const String& key, result rCode)
+{
+ SysLog(NID_SYS, "Key is %ls, result is %s.", key.GetPointer(), GetErrorMessage(rCode));
+ Integer* pid = (Integer*) __asyncList.GetValue(key);
+ ArrayList* pData = null;
+ result r = E_SUCCESS;
+ String cmdCode(SETTING_SERVICE_COMMAND_RESULT);
+ String keyCode;
+ String resultCode;
+
+ SysTryCatch(NID_SYS, pid != null, r = E_SYSTEM, r, "Required key(%ls) is not reserved.", key.GetPointer());
+ pData = new (nothrow) ArrayList;
+ pData->Construct();
+ keyCode.Append(key);
+ resultCode.Append(GetErrorMessage(rCode));
+ pData->Add(cmdCode);
+ pData->Add(keyCode);
+ pData->Add(resultCode);
+
+ r = __ipcServer.SendResponse(pid->value, new (nothrow) IoService_Data(*pData));
+ SysTryCatch(NID_SYS, r == E_SUCCESS, r = E_SYSTEM, r, "It is failed to send result to %d.", pid->value);
+
+CATCH:
+ __asyncList.Remove(key, true);
+
+ if(pData != null)
+ {
+ delete pData;
+ }
+}
+
+void
+_SettingService::OnSettingChanged(Tizen::Base::String& key)
+{
+ result r = E_SUCCESS;
+ IEnumerator* pEnum = null;
+
+ if(key == _SETTINGS_KEY_FONT_SIZE || key == _SETTINGS_KEY_FONT_TYPE
+ || key == _SETTINGS_KEY_LOCALE_COUNTRY || key == _SETTINGS_KEY_LOCALE_LANGUAGE)
+ {
+ pEnum = __eventListForInternal.GetEnumeratorN();
+
+ while(pEnum->MoveNext() == E_SUCCESS)
+ {
+ Integer* pid = (Integer*) pEnum->GetCurrent();
+
+ ArrayList* pData = new (nothrow) ArrayList;
+ pData->Construct();
+ String cmdCode(SETTING_SERVICE_COMMAND_EVENT);
+ String keyCode(key);
+ pData->Add(cmdCode);
+ pData->Add(keyCode);
+
+ r = __ipcServer.SendResponse(pid->value, new (nothrow) IoService_Data(*pData));
+ SysLog(NID_SYS, "Internal setting event is delivered to %d. result is %s.", pid->value, GetErrorMessage(r));
+ }
+ delete pEnum;
+ }
+
+ pEnum = __eventList.GetEnumeratorN();
+ while(pEnum->MoveNext() == E_SUCCESS)
+ {
+ Integer* pid = (Integer*) pEnum->GetCurrent();
+
+ ArrayList* pData = new (nothrow) ArrayList;
+ pData->Construct();
+ String cmdCode(SETTING_SERVICE_COMMAND_EVENT);
+ String keyCode(key);
+ pData->Add(cmdCode);
+ pData->Add(keyCode);
+
+ r = __ipcServer.SendResponse(pid->value, new (nothrow) IoService_Data(*pData));
+ SysLog(NID_SYS, "Setting event is delivered to %d. result is %s.", pid->value, GetErrorMessage(r));
+ }
+
+ delete pEnum;
+}
+
+void
+_SettingService::OnIpcServerStarted(const _IpcServer& server)
+{
+}
+
+void
+_SettingService::OnIpcServerStopped(const _IpcServer& server)
+{
+}
+
+void
+_SettingService::OnIpcClientConnected(const _IpcServer& server, int clientId)
+{
+}
+
+void
+_SettingService::OnIpcClientDisconnected(const _IpcServer&server, int clientId)
+{
+}
+
+void
+_SettingService::OnApplicationLaunched(const AppId& appId, int pid)
+{
+}
+
+void
+_SettingService::OnApplicationTerminated(const AppId& appId, int pid)
+{
+ Integer reservedKey(pid);
+ result r = __eventList.Remove(reservedKey, true);
+ SysLog(NID_SYS, "Application(%d) is terminated and unsubscribe result is %s.", pid, GetErrorMessage(r));
+ r = __eventListForInternal.Remove(reservedKey, true);
+ SysLog(NID_SYS, "unsubscribe result is %s on internal event.", GetErrorMessage(r));
+}
+
+void
+_SettingService::DestroySingleton(void)
+{
+ delete __pSettingService;
+}
+
+}}
+