summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--client/inc/PrivacyManagerClient.h4
-rw-r--r--client/inc/privacy_manager_client.h2
-rw-r--r--client/src/PrivacyManagerClient.cpp8
-rw-r--r--client/src/privacy_manager_client.cpp6
-rw-r--r--common/inc/IPrivacyManager.h2
-rw-r--r--common/inc/PrivacyDb.h2
-rw-r--r--common/src/PrivacyDb.cpp4
-rw-r--r--pkgmgr_plugin/privileges.cpp266
-rw-r--r--server/inc/PrivacyManagerServer.h2
-rw-r--r--server/src/PrivacyManagerServer.cpp4
-rw-r--r--server/src/service/PrivacyInfoService.cpp5
11 files changed, 157 insertions, 148 deletions
diff --git a/client/inc/PrivacyManagerClient.h b/client/inc/PrivacyManagerClient.h
index 960a96f..dcfca31 100644
--- a/client/inc/PrivacyManagerClient.h
+++ b/client/inc/PrivacyManagerClient.h
@@ -42,7 +42,7 @@ private:
public:
static PrivacyManagerClient* getInstance(void);
- int addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& list, bool isServerOperation = true);
+ int addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& list, bool privacyPopupRequired, bool isServerOperation = true);
int removeAppPackagePrivacyInfo(const std::string pkgId, bool isServerOperation = true);
@@ -63,4 +63,4 @@ public:
int getPrivaycDescription(const std::string privacyId, std::string& description) const;
};
-#endif // _PRIVACY_MANAGER_H_ \ No newline at end of file
+#endif // _PRIVACY_MANAGER_H_
diff --git a/client/inc/privacy_manager_client.h b/client/inc/privacy_manager_client.h
index aea74dd..e2cb73b 100644
--- a/client/inc/privacy_manager_client.h
+++ b/client/inc/privacy_manager_client.h
@@ -29,7 +29,7 @@ typedef bool (*privacy_manager_client_privacy_info_cb) (privacy_info_client_s* p
typedef bool (*privacy_manager_client_all_privacy_info_cb) (privacy_info_client_s* privacy_info, void* user_data);
typedef bool (*privacy_manager_client_packages_by_privacy_cb) (const char *package_id, bool is_enabled, void* user_data);
-EXTERN_API int privacy_manager_client_install_privacy(const char *package_id, const char** privacy_list);
+EXTERN_API int privacy_manager_client_install_privacy(const char *package_id, const char** privacy_list, bool privacy_popup_required);
EXTERN_API int privacy_manager_client_uninstall_privacy(const char *package_id);
EXTERN_API int privacy_manager_client_uninstall_privacy_by_server(const char *package_id);
EXTERN_API int privacy_manager_client_foreach_privacy_packages(privacy_manager_client_privacy_packages_cb callback, void *user_data);
diff --git a/client/src/PrivacyManagerClient.cpp b/client/src/PrivacyManagerClient.cpp
index f070dfe..fba5fc4 100644
--- a/client/src/PrivacyManagerClient.cpp
+++ b/client/src/PrivacyManagerClient.cpp
@@ -45,7 +45,7 @@ PrivacyManagerClient::getInstance(void)
}
int
-PrivacyManagerClient::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& list, bool isServerOperation)
+PrivacyManagerClient::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& list, bool privacyPopupRequired, bool isServerOperation)
{
std::list < std::string > privacyList;
@@ -62,7 +62,7 @@ PrivacyManagerClient::addAppPackagePrivacyInfo(const std::string pkgId, const st
int result = PRIV_MGR_ERROR_SUCCESS;
res = m_pSocketClient->connect();
TryReturn(res == PRIV_MGR_ERROR_SUCCESS, res, , "connect : %d", res);
- res = m_pSocketClient->call("addPrivacyInfo", pkgId, privacyList, &result);
+ res = m_pSocketClient->call("addPrivacyInfo", pkgId, privacyList, privacyPopupRequired, &result);
TryReturn(res == PRIV_MGR_ERROR_SUCCESS, res, m_pSocketClient->disconnect(), "call : %d", res);
res = m_pSocketClient->disconnect();
TryReturn(res == PRIV_MGR_ERROR_SUCCESS, res, , "disconnect : %d", res);
@@ -71,7 +71,7 @@ PrivacyManagerClient::addAppPackagePrivacyInfo(const std::string pkgId, const st
}
else
{
- return PrivacyDb::getInstance()->addAppPackagePrivacyInfo(pkgId, privacyList);
+ return PrivacyDb::getInstance()->addAppPackagePrivacyInfo(pkgId, privacyList, privacyPopupRequired);
}
}
@@ -198,7 +198,7 @@ int
PrivacyManagerClient::getAppPackagesbyPrivacyId(const std::string privacyId, std::list < std::pair < std::string, bool > >& list) const
{
return PrivacyDb::getInstance()->getAppPackagesbyPrivacyId(privacyId, list);
-}
+}
int
PrivacyManagerClient::getPrivaycDisplayName(const std::string privacyId, std::string& displayName) const
diff --git a/client/src/privacy_manager_client.cpp b/client/src/privacy_manager_client.cpp
index 920c12b..3670b86 100644
--- a/client/src/privacy_manager_client.cpp
+++ b/client/src/privacy_manager_client.cpp
@@ -45,15 +45,15 @@ int create_privacy_info_client_s(const char* privacy_id, bool enabled, privacy_i
return PRIV_MGR_ERROR_SUCCESS;
}
-int privacy_manager_client_install_privacy(const char *package_id, const char** privacy_list)
+int privacy_manager_client_install_privacy(const char *package_id, const char** privacy_list, bool privacy_popup_required)
{
PrivacyManagerClient* pInst = PrivacyManagerClient::getInstance();
- std::list < std::string > privacyList;
+ std::list < std::string > privacyList;
while (*privacy_list[0] != '\0')
privacyList.push_back(std::string(*privacy_list++));
- int retval = pInst->addAppPackagePrivacyInfo(std::string(package_id), privacyList, false);
+ int retval = pInst->addAppPackagePrivacyInfo(std::string(package_id), privacyList, privacy_popup_required, false);
return retval;
}
diff --git a/common/inc/IPrivacyManager.h b/common/inc/IPrivacyManager.h
index 599e964..26beb33 100644
--- a/common/inc/IPrivacyManager.h
+++ b/common/inc/IPrivacyManager.h
@@ -29,7 +29,7 @@ class SocketClient;
class EXTERN_API IPrivacyManager
{
public:
- int addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& pList);
+ int addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string >& pList, bool privacyPopupRequired);
int removeAppPackagePrivacyInfo(const std::string pkgId);
diff --git a/common/inc/PrivacyDb.h b/common/inc/PrivacyDb.h
index c9286ae..dad0e9a 100644
--- a/common/inc/PrivacyDb.h
+++ b/common/inc/PrivacyDb.h
@@ -46,7 +46,7 @@ public:
int setPrivacySetting(const std::string pkgId, const std::string privacyId, bool enabled);
- int addAppPackagePrivacyInfo(const std::string pkgcId, const std::list < std::string > privilegeList);
+ int addAppPackagePrivacyInfo(const std::string pkgcId, const std::list < std::string > privilegeList, bool privacyPopupRequired);
int removeAppPackagePrivacyInfo(const std::string pkgId);
diff --git a/common/src/PrivacyDb.cpp b/common/src/PrivacyDb.cpp
index 8709203..2ce0d7a 100644
--- a/common/src/PrivacyDb.cpp
+++ b/common/src/PrivacyDb.cpp
@@ -134,7 +134,7 @@ PrivacyDb::getAppPackagePrivacyInfo(const std::string pkgId, std::list < std::pa
int
-PrivacyDb::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string > privilegeList)
+PrivacyDb::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string > privilegeList, bool privacyPopupRequired)
{
LOGI("enter");
@@ -147,7 +147,7 @@ PrivacyDb::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < s
int res = sqlite3_bind_text(pPkgInfoStmt.get(), 1, pkgId.c_str(), -1, SQLITE_TRANSIENT);
TryReturn( res == SQLITE_OK, PRIV_MGR_ERROR_DB_ERROR, , "sqlite3_bind_text : %d", res);
- res = sqlite3_bind_int(pPkgInfoStmt.get(), 2, 0);
+ res = sqlite3_bind_int(pPkgInfoStmt.get(), 2, privacyPopupRequired ? 0 : 1);
TryReturn( res == SQLITE_OK, PRIV_MGR_ERROR_DB_ERROR, , "sqlite3_bind_int : %d", res);
res = sqlite3_step(pPkgInfoStmt.get());
diff --git a/pkgmgr_plugin/privileges.cpp b/pkgmgr_plugin/privileges.cpp
index c0612e3..8f6cd6f 100644
--- a/pkgmgr_plugin/privileges.cpp
+++ b/pkgmgr_plugin/privileges.cpp
@@ -1,129 +1,137 @@
-//
-// Open Service Platform
-// Copyright (c) 2013 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.
-//
-
-#include <errno.h>
-#include <libxml/parser.h>
-#include <libxml/tree.h>
-#include <privacy_manager_client.h>
-#include <dlog.h>
-#include <list>
-#include <string>
-
-static const xmlChar _NODE_PRIVILEGES[] = "privileges";
-static const xmlChar _NODE_PRIVILEGE[] = "privilege";
-
-
-void destroy_char_list(char** ppList, int size)
-{
- int i;
- for (i = 0; i < size; ++i)
- {
- if (ppList[i])
- free(ppList[i]);
- }
- free(ppList);
-}
-
-extern "C"
-__attribute__ ((visibility("default")))
-int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
-{
- int ret;
- LOGI("enter");
-
- // Node: <privileges>
- xmlNodePtr curPtr = xmlFirstElementChild(xmlDocGetRootElement(docPtr));
- LOGD("Node: %s", curPtr->name);
-
- curPtr = curPtr->xmlChildrenNode;
- if (curPtr == NULL)
- {
- LOGD("No privileges");
- return 0;
- }
-
- std::list <std::string> privilegeList;
- while (curPtr != NULL)
- {
- LOGD("Node: %s", curPtr->name);
-
- if (xmlStrcmp(curPtr->name, _NODE_PRIVILEGE) == 0)
- {
- xmlChar* pPrivilege = xmlNodeListGetString(docPtr, curPtr->xmlChildrenNode, 1);
- LOGD(" value= %s", reinterpret_cast<char*>(pPrivilege));
- if (pPrivilege == NULL)
- {
- LOGE("Failed to get value");
- return -EINVAL;
- }
- privilegeList.push_back(std::string( reinterpret_cast<char*> (pPrivilege)));
- }
- curPtr = curPtr->next;
- }
-
- char** ppPrivilegeList = (char**) calloc(privilegeList.size() + 1, sizeof(char*));
- std::list <std::string>::iterator iter = privilegeList.begin();
- for (int i = 0; i < privilegeList.size(); ++i)
- {
- ppPrivilegeList[i] = (char*)calloc (strlen(iter->c_str()) + 1, sizeof(char));
- if (ppPrivilegeList[i] == NULL)
- {
- destroy_char_list(ppPrivilegeList, privilegeList.size() + 1);
- return -ENOMEM;
- }
- memcpy(ppPrivilegeList[i], iter->c_str(), strlen(iter->c_str()));
- ++iter;
- }
-
- ppPrivilegeList[privilegeList.size()] = (char*)calloc (2, sizeof(char));
- memcpy(ppPrivilegeList[privilegeList.size()], "\0", 1);
-
- ret = privacy_manager_client_install_privacy(packageId, (const char**) ppPrivilegeList);
- destroy_char_list(ppPrivilegeList, privilegeList.size() + 1);
- if (ret != PRIV_MGR_ERROR_SUCCESS)
- {
- LOGD("Failed to install privacy : %d", ret);
- return -EINVAL;
- }
-
- LOGI("leave");
-
- return 0;
-}
-
-extern "C"
-__attribute__ ((visibility("default")))
-int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char* packageId)
-{
- LOGI("enter");
-
- int res = privacy_manager_client_uninstall_privacy_by_server(packageId);
- if (res != PRIV_MGR_ERROR_SUCCESS)
- {
- LOGD("Failed to uninstall privacy in server: %d", res);
-
- res = privacy_manager_client_uninstall_privacy(packageId);
- if (res != PRIV_MGR_ERROR_SUCCESS)
- {
- LOGD("Failed to uninstall privacy: %d", res);
- return -EINVAL;
- }
- }
-
- LOGI("leave");
- return 0;
-}
+//
+// Open Service Platform
+// Copyright (c) 2013 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.
+//
+
+#include <errno.h>
+#include <libxml/parser.h>
+#include <libxml/tree.h>
+#include <privacy_manager_client.h>
+#include <dlog.h>
+#include <list>
+#include <string>
+
+static const xmlChar _NODE_PRIVILEGES[] = "privileges";
+static const xmlChar _NODE_PRIVILEGE[] = "privilege";
+static const char TEST_AUTOMATION_PRIVILEGE[] = "http://tizen.org/privilege/testautomation";
+
+void destroy_char_list(char** ppList, int size)
+{
+ int i;
+ for (i = 0; i < size; ++i)
+ {
+ if (ppList[i])
+ free(ppList[i]);
+ }
+ free(ppList);
+}
+
+extern "C"
+__attribute__ ((visibility("default")))
+int PKGMGR_PARSER_PLUGIN_INSTALL(xmlDocPtr docPtr, const char* packageId)
+{
+ int ret;
+ bool privacyPopupRequired = true;
+ LOGI("enter");
+
+ // Node: <privileges>
+ xmlNodePtr curPtr = xmlFirstElementChild(xmlDocGetRootElement(docPtr));
+ LOGD("Node: %s", curPtr->name);
+
+ curPtr = curPtr->xmlChildrenNode;
+ if (curPtr == NULL)
+ {
+ LOGD("No privileges");
+ return 0;
+ }
+
+ std::list <std::string> privilegeList;
+ while (curPtr != NULL)
+ {
+ LOGD("Node: %s", curPtr->name);
+
+ if (xmlStrcmp(curPtr->name, _NODE_PRIVILEGE) == 0)
+ {
+ xmlChar* pPrivilege = xmlNodeListGetString(docPtr, curPtr->xmlChildrenNode, 1);
+ LOGD(" value= %s", reinterpret_cast<char*>(pPrivilege));
+ if (pPrivilege == NULL)
+ {
+ LOGE("Failed to get value");
+ return -EINVAL;
+ }
+ if (strncmp(reinterpret_cast<char*>(pPrivilege), TEST_AUTOMATION_PRIVILEGE, strlen(TEST_AUTOMATION_PRIVILEGE) ) == 0 )
+ {
+ privacyPopupRequired = false;
+ }
+ else
+ {
+ privilegeList.push_back(std::string( reinterpret_cast<char*> (pPrivilege)));
+ }
+ }
+ curPtr = curPtr->next;
+ }
+
+ char** ppPrivilegeList = (char**) calloc(privilegeList.size() + 1, sizeof(char*));
+ std::list <std::string>::iterator iter = privilegeList.begin();
+ for (int i = 0; i < privilegeList.size(); ++i)
+ {
+ ppPrivilegeList[i] = (char*)calloc (strlen(iter->c_str()) + 1, sizeof(char));
+ if (ppPrivilegeList[i] == NULL)
+ {
+ destroy_char_list(ppPrivilegeList, privilegeList.size() + 1);
+ return -ENOMEM;
+ }
+ memcpy(ppPrivilegeList[i], iter->c_str(), strlen(iter->c_str()));
+ ++iter;
+ }
+
+ ppPrivilegeList[privilegeList.size()] = (char*)calloc (2, sizeof(char));
+ memcpy(ppPrivilegeList[privilegeList.size()], "\0", 1);
+
+ ret = privacy_manager_client_install_privacy(packageId, (const char**) ppPrivilegeList, privacyPopupRequired);
+ destroy_char_list(ppPrivilegeList, privilegeList.size() + 1);
+ if (ret != PRIV_MGR_ERROR_SUCCESS)
+ {
+ LOGD("Failed to install privacy : %d", ret);
+ return -EINVAL;
+ }
+
+ LOGI("leave");
+
+ return 0;
+}
+
+extern "C"
+__attribute__ ((visibility("default")))
+int PKGMGR_PARSER_PLUGIN_UNINSTALL(xmlDocPtr docPtr, const char* packageId)
+{
+ LOGI("enter");
+
+ int res = privacy_manager_client_uninstall_privacy_by_server(packageId);
+ if (res != PRIV_MGR_ERROR_SUCCESS)
+ {
+ LOGD("Failed to uninstall privacy in server: %d", res);
+
+ res = privacy_manager_client_uninstall_privacy(packageId);
+ if (res != PRIV_MGR_ERROR_SUCCESS)
+ {
+ LOGD("Failed to uninstall privacy: %d", res);
+ return -EINVAL;
+ }
+ }
+
+ LOGI("leave");
+ return 0;
+}
diff --git a/server/inc/PrivacyManagerServer.h b/server/inc/PrivacyManagerServer.h
index f6f49f4..26c8b4d 100644
--- a/server/inc/PrivacyManagerServer.h
+++ b/server/inc/PrivacyManagerServer.h
@@ -47,7 +47,7 @@ public:
int setPrivacySetting(const std::string pkgId, const std::string privacyId, bool enabled);
- int addAppPackagePrivacyInfo(const std::string pkgcId, const std::list < std::string > privilegeList);
+ int addAppPackagePrivacyInfo(const std::string pkgcId, const std::list < std::string > privilegeList, bool privacyPopupRequired);
int removeAppPackagePrivacyInfo(const std::string pkgId);
diff --git a/server/src/PrivacyManagerServer.cpp b/server/src/PrivacyManagerServer.cpp
index e6b2a4b..3887f88 100644
--- a/server/src/PrivacyManagerServer.cpp
+++ b/server/src/PrivacyManagerServer.cpp
@@ -56,9 +56,9 @@ PrivacyManagerServer::getAppPackagePrivacyInfo(const std::string pkgId, std::lis
int
-PrivacyManagerServer::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string > privilegeList)
+PrivacyManagerServer::addAppPackagePrivacyInfo(const std::string pkgId, const std::list < std::string > privilegeList, bool privacyPopupRequired)
{
- return PrivacyDb::getInstance()->addAppPackagePrivacyInfo(pkgId, privilegeList);
+ return PrivacyDb::getInstance()->addAppPackagePrivacyInfo(pkgId, privilegeList, privacyPopupRequired);
}
int
diff --git a/server/src/service/PrivacyInfoService.cpp b/server/src/service/PrivacyInfoService.cpp
index a39698f..a8bbbe6 100644
--- a/server/src/service/PrivacyInfoService.cpp
+++ b/server/src/service/PrivacyInfoService.cpp
@@ -26,10 +26,11 @@ PrivacyInfoService::addPrivacyInfo(SocketConnection* pConnector)
std::string pkgId;
std::list < std::string > list;
- pConnector->read(&pkgId, &list);
+ bool privacyPopupRequired = true;
+ pConnector->read(&pkgId, &list, &privacyPopupRequired);
PrivacyManagerServer* pPrivacyManagerServer = PrivacyManagerServer::getInstance();
- int result = pPrivacyManagerServer->addAppPackagePrivacyInfo(pkgId, list);
+ int result = pPrivacyManagerServer->addAppPackagePrivacyInfo(pkgId, list, privacyPopupRequired);
pConnector->write(result);
}