2 * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved
\r
4 * Licensed under the Apache License, Version 2.0 (the "License");
\r
5 * you may not use this file except in compliance with the License.
\r
6 * You may obtain a copy of the License at
\r
8 * http://www.apache.org/licenses/LICENSE-2.0
\r
10 * Unless required by applicable law or agreed to in writing, software
\r
11 * distributed under the License is distributed on an "AS IS" BASIS,
\r
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
13 * See the License for the specific language governing permissions and
\r
14 * limitations under the License.
\r
20 #include <PrivacyManagerServer.h>
\r
21 #include <PrivacyManagerTypes.h>
\r
22 #include <PrivacyDb.h>
\r
24 std::mutex PrivacyManagerServer::m_singletonMutex;
\r
25 PrivacyManagerServer* PrivacyManagerServer::m_pInstance = NULL;
\r
28 PrivacyManagerServer::createDB(void)
\r
34 PrivacyManagerServer::setPrivacySetting(const std::string pkgId, const std::string privacyId, bool enabled)
\r
36 int res = PrivacyDb::getInstance()->setPrivacySetting(pkgId, privacyId, enabled);
\r
37 TryReturn( res == PRIV_MGR_ERROR_SUCCESS, res, , "privacyDb::setPrivacySetting : %d", res);
\r
39 res = m_notificationServer.notify(pkgId, privacyId);
\r
40 TryReturn( res == PRIV_MGR_ERROR_SUCCESS, res, , "NotificationServer::notify : %d", res);
\r
46 PrivacyManagerServer::getPrivacyAppPackages(std::list <std::string>& list)
\r
48 return PrivacyDb::getInstance()->getPrivacyAppPackages(list);
\r
52 PrivacyManagerServer::getAppPackagePrivacyInfo(const std::string pkgId, std::list < std::pair < std::string, bool > >& privacyInfoList)
\r
54 return PrivacyDb::getInstance()->getAppPackagePrivacyInfo(pkgId, privacyInfoList);
\r
59 PrivacyManagerServer::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string > privilegeList)
\r
61 return PrivacyDb::getInstance()->addAppPackagePrivacyInfo(pkgId, privilegeList);
\r
65 PrivacyManagerServer::removeAppPackagePrivacyInfo(const std::string pkgId)
\r
67 return PrivacyDb::getInstance()->removeAppPackagePrivacyInfo(pkgId);
\r
71 PrivacyManagerServer::isUserPrompted(const std::string pkgId, bool& isPrompted)
\r
73 return PrivacyDb::getInstance()->isUserPrompted(pkgId, isPrompted);
\r
77 PrivacyManagerServer::setUserPrompted(const std::string pkgId, bool prompted)
\r
79 return PrivacyDb::getInstance()->setUserPrompted(pkgId, prompted);
\r
82 PrivacyManagerServer::PrivacyManagerServer(void)
\r
87 PrivacyManagerServer*
\r
88 PrivacyManagerServer::getInstance(void)
\r
91 std::lock_guard < std::mutex > guard(m_singletonMutex);
\r
93 if (m_pInstance == NULL)
\r
95 m_pInstance = new PrivacyManagerServer();
\r
97 m_pInstance->m_notificationServer.initialize();
\r
100 return m_pInstance;
\r