--- /dev/null
+
+# Package Information for pkg-config
+
+prefix=@PREFIX@
+exec_prefix=/usr
+libdir=/usr/lib
+includedir=/usr/include/privacymgr
+
+Name: @PC_NAME@
+Description: @PACKAGE_DESCRIPTION@
+Version: @VERSION@
+Requires: @PC_REQUIRED@
+Libs: -L${libdir} @PC_LDFLAGS@
+Cflags: -I${includedir}
+
--- /dev/null
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+SET(fw_name "capi-security-privacy-manager")
+
+PROJECT(${fw_name})
+
+SET(CMAKE_INSTALL_PREFIX /usr)
+SET(PREFIX ${CMAKE_INSTALL_PREFIX})
+
+SET(INC_DIR include)
+INCLUDE_DIRECTORIES(${INC_DIR} /usr/include/privacy_manager)
+
+#SET(requires capi-base-common dlog privacy-manager-client glib-2.0)
+SET(pc_requires "capi-base-common")
+
+INCLUDE(FindPkgConfig)
+pkg_check_modules(${fw_name} REQUIRED capi-base-common dlog glib-2.0)
+FOREACH(flag ${${fw_name}_CFLAGS})
+ SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+ENDFOREACH(flag)
+
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall -Werror")
+SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
+
+IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ENDIF("${ARCH}" STREQUAL "arm")
+
+ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
+ADD_DEFINITIONS("-DSLP_DEBUG")
+
+SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=/usr/lib")
+
+aux_source_directory(src SOURCES)
+ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
+
+TARGET_LINK_LIBRARIES(${fw_name} ${${fw_name}_LDFLAGS})
+
+SET_TARGET_PROPERTIES(${fw_name}
+ PROPERTIES
+ VERSION ${FULLVER}
+ SOVERSION ${MAJORVER}
+ CLEAN_DIRECT_OUTPUT 1
+)
+
+INSTALL(TARGETS ${fw_name} DESTINATION ../lib)
+INSTALL(
+ DIRECTORY ${INC_DIR}/ DESTINATION ../include/privacymgr
+ FILES_MATCHING
+ PATTERN "*_private.h" EXCLUDE
+ PATTERN "${INC_DIR}/*.h"
+ )
+
+SET(PC_NAME ${fw_name})
+SET(PC_REQUIRED ${pc_requires})
+SET(PC_LDFLAGS -l${fw_name})
+SET(PC_CFLAGS -I\${includedir}/privacymgr)
+
+#CONFIGURE_FILE(
+# ../capi-security-privacy-manager.pc.in
+# ${CMAKE_CURRENT_SOURCE_DIR}/../${fw_name}.pc
+# @ONLY
+#)
+CONFIGURE_FILE(../capi-security-privacy-manager.pc.in capi-security-privacy-manager.pc @ONLY)
+
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${fw_name}.pc DESTINATION ../lib/pkgconfig)
+
+IF(UNIX)
+
+ADD_CUSTOM_TARGET (distclean @echo cleaning for source distribution)
+ADD_CUSTOM_COMMAND(
+ DEPENDS clean
+ COMMENT "distribution clean"
+ COMMAND find
+ ARGS .
+ -not -name config.cmake -and \(
+ -name tester.c -or
+ -name Testing -or
+ -name CMakeFiles -or
+ -name cmake.depends -or
+ -name cmake.check_depends -or
+ -name CMakeCache.txt -or
+ -name cmake.check_cache -or
+ -name *.cmake -or
+ -name Makefile -or
+ -name core -or
+ -name core.* -or
+ -name gmon.out -or
+ -name install_manifest.txt -or
+ -name *.pc -or
+ -name *~ \)
+ | grep -v TC | xargs rm -rf
+ TARGET distclean
+ VERBATIM
+)
+
+ENDIF(UNIX)
+
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#ifndef __TIZEN_SECURITY_PRIVACY_INFO_H
+#define __TIZEN_SECURITY_PRIVACY_INFO_H
+
+#include <tizen.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @brief Privacy information handle.
+ */
+typedef struct privacy_info_s *privacy_info_h;
+
+/**
+ * @brief Destroys the privacy information handle and releases all its resources.
+ * @param [in] privacy_info The application information handle
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @see app_manager_foreach_app_info()
+ * @see app_manager_get_app_info()
+ */
+EXPORT_API int privacy_info_destroy(privacy_info_h privacy_info);
+
+/**
+ * @brief Gets the privacy ID with the given privacy info.
+ * @remarks @a package must be released with free() by you.
+ * @param [in] privacy_info The privacy information
+ * @param [out] package_id The package ID of the privacy info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PRIVACY_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ */
+EXPORT_API int privacy_info_get_privacy_id(privacy_info_h privacy_info, char **privacy_id);
+
+/**
+ * @brief Gets the privacy display name with the given privacy info.
+ * @remarks @a name must be released with free() by you.
+ * @param [in] privacy_info The privacy information
+ * @param [out] name The display name of the privacy info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PRIVACY_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ */
+EXPORT_API int privacy_info_get_privacy_display_name(privacy_info_h privacy_info, char **name);
+
+/**
+ * @brief Gets the description with the given privacy info.
+ * @remarks @a description must be released with free() by you.
+ * @param [in] privacy_info The privacy information
+ * @param [out] description The description of the privacy info
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #PRIVACY_MANAGER_ERROR_OUT_OF_MEMORY Out of memory
+ */
+EXPORT_API int privacy_info_get_privacy_description(privacy_info_h privacy_info, char **description);
+
+/**
+ * @brief Checks whether the privacy setting is enabled.
+ * @param [in] privacy_info The privacy information
+ * @param [out] enabled A boolean value indicating whether the privacy setting is enabled.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ */
+EXPORT_API int privacy_info_is_enabled(privacy_info_h privacy_info, bool *enabled);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TIZEN_SECURITY_PRIVACY_INFO_H
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#ifndef __TIZEN_SECURITY_PRIVACY_MANAGER_H
+#define __TIZEN_SECURITY_PRIVACY_MANAGER_H
+
+#include <tizen.h>
+#include <privacy_info.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * @addtogroup CAPI_PRIVACY_MANAGER_MODULE
+ * @{
+ */
+
+/**
+ * @brief Enumerations of error code for Privacy Manager.
+ */
+typedef enum
+{
+ PRIVACY_MANAGER_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
+ PRIVACY_MANAGER_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+ PRIVACY_MANAGER_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
+ PRIVACY_MANAGER_ERROR_IO_ERROR = TIZEN_ERROR_IO_ERROR, /**< Internal I/O error */
+ PRIVACY_MANAGER_ERROR_NO_DATA = TIZEN_ERROR_NO_DATA, /**< No data found */
+ PRIVACY_MANAGER_ERROR_DB_FAILED = TIZEN_ERROR_APPLICATION_CLASS | 0x01, /**< Database error */
+ PRIVACY_MANAGER_ERROR_IPC_FAILED = TIZEN_ERROR_APPLICATION_CLASS | 0x02, /**< Failed to communication with server */
+} privacy_manager_error_e;
+
+//struct privacy_info_h;
+
+/**
+ * @brief Called to get a package id once for each privacy package.
+ * @remarks @a package_id will be automatically destroyed when the callback function returns. (Do not release @a package_id.)
+ * @param[in] package_id The privacy package id
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
+ * @pre privacy_manager_foreach_privacy_packages() will invoke this callback.
+ * @see privacy_manager_foreach_privacy_packages()
+ */
+typedef bool (*privacy_manager_privacy_packages_cb) (const char *package_id, void* user_data);
+
+/**
+ * @brief Called to get package privacy info once for specific package.
+ * @remarks @a privacy_info will be automatically destroyed when the callback function returns. (Do not release @a privacy_info.)
+ * @param[in] privacy_info_h privacy info of the packcage
+ * @param[in] user_data The user data passed from the foreach function
+ * @return @c true to continue with the next iteration of the loop, \n @c false to break out of the loop.
+ * @pre privacy_manager_foreach_privacy_info() will invoke this callback.
+ * @see privacy_manager_foreach_privacy_info()
+ */
+typedef bool (*privacy_manager_privacy_info_cb) (privacy_info_h privacy_info, void* user_data);
+
+/**
+ * @brief Retrieves privacy package list.
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_NO_DATA no package founded.
+ * @retval #PRIVACY_MANAGER_ERROR_IPC_FAILED IPC failed
+ * @retval #PRIVACY_MANAGER_ERROR_DB_FAILED DB operation failed
+ * @post This function invokes privacy_manager_privacy_packages_cb() repeatedly for each application context.
+ * @see privacy_manager_privacy_packages_cb()
+ */
+EXPORT_API int privacy_manager_foreach_privacy_packages(privacy_manager_privacy_packages_cb callback, void *user_data);
+
+/**
+ * @brief Retrieves privacy info of the pacakge.
+ * @param [in] package_id The ID of the pacakge.
+ * @param [in] callback The callback function to invoke
+ * @param [in] user_data The user data to be passed to the callback function
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_NO_DATA no privacy info founded.
+ * @retval #PRIVACY_MANAGER_ERROR_IPC_FAILED IPC failed
+ * @retval #PRIVACY_MANAGER_ERROR_DB_FAILED DB operation failed
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER invalid parameter
+ * @post This function invokes privacy_manager_privacy_info_cb() repeatedly for each application context.
+ * @see privacy_manager_privacy_info_cb()
+ */
+EXPORT_API int privacy_manager_foreach_privacy_info(const char *package_id, privacy_manager_privacy_info_cb callback, void* user_data);
+
+/**
+ * @brief Enables or disables privacy of the package.
+ * @param [in] package_id The ID of the pacakge.
+ * @param [in] privacy_id The ID of the privacy to be changed.
+ * @param [in] callback The callback function to invoke
+ * @param [in] enable A Boolean value indicating whether the privacy setting is enabled
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #PRIVACY_MANAGER_ERROR_NONE Successful
+ * @retval #PRIVACY_MANAGER_ERROR_IPC_FAILED IPC failed
+ * @retval #PRIVACY_MANAGER_ERROR_DB_FAILED DB operation failed
+ * @retval #PRIVACY_MANAGER_ERROR_INVALID_PARAMETER invalid parameter
+ */
+EXPORT_API int privacy_manager_set_package_privacy(const char *package_id, const char *privacy_id, bool enable);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif //__TIZEN_PRIVACYMGR_PRIVACY_MANAGER_H
--- /dev/null
+/*
+ * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * 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.
+ */
+
+
+#ifndef __TIZEN_SECURITY_PRIVACY_INFO_TYPES_H
+#define __TIZEN_SECURITY_PRIVACY_INFO_TYPES_H
+
+#include <tizen.h>
+#include <privacy_manager_client_types.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct privacy_info_s{
+ privacy_info_client_s* privacy_info_client;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // __TIZEN_SECURITY_PRIVACY_INFO_TYPES_H
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License. \r
+ */\r
+\r
+#include <string.h>\r
+#include <stdlib.h>\r
+#include <privacy_manager.h>\r
+#include <privacy_info.h>\r
+#include <privacy_manager_client_types.h>\r
+#include <privacy_info_client.h>\r
+#include <privacy_manager_client.h>\r
+#include <privacy_manager_types_private.h>\r
+\r
+\r
+static int _privacy_manager_convert_error(int error)\r
+{\r
+ return PRIVACY_MANAGER_ERROR_NONE;\r
+}\r
+\r
+typedef struct _foreach_privacy_package_context_\r
+{\r
+ privacy_manager_privacy_packages_cb callback;\r
+ void *user_data;\r
+} foreach_privacy_package_context_s;\r
+\r
+typedef struct _foreach_privacy_info_context_\r
+{\r
+ privacy_manager_privacy_info_cb callback;\r
+ void *user_data;\r
+} foreach_privacy_info_context_s;\r
+\r
+//static int _create_privacy_info(const char* package_id, bool enabled, privacy_info_h *privacy_info)\r
+//{\r
+// privacy_info_h temp = (privacy_info_h) calloc(1, sizeof(privacy_info_h));\r
+// if (temp == NULL)\r
+// return PRIV_MGR_ERROR_OUT_OF_MEMORY;\r
+//\r
+// int size = strlen(package_id);\r
+// temp->privacy_info_client->privacy_id = (char*) calloc(1, size + 1);\r
+// if (temp->privacy_info_client->privacy_id == NULL)\r
+// {\r
+// free(temp);\r
+// return PRIV_MGR_ERROR_OUT_OF_MEMORY;\r
+// }\r
+// memcpy(temp->privacy_info_client->privacy_id, package_id, size + 1);\r
+//\r
+// temp->privacy_info_client->is_enabled = enabled;\r
+//\r
+// *privacy_info = temp;\r
+//\r
+// return PRIV_MGR_ERROR_SUCCESS;\r
+//}\r
+\r
+bool __privacy_manager_client_privacy_packages_cb(const char *package_id, void* user_data)\r
+{\r
+ foreach_privacy_package_context_s* context = (foreach_privacy_package_context_s*) user_data;\r
+ return context->callback(package_id, context->user_data);\r
+}\r
+\r
+bool __privacy_manager_client_privacy_info_cb (privacy_info_client_s* privacy_info_client, void* user_data)\r
+{\r
+ foreach_privacy_info_context_s* context = (foreach_privacy_info_context_s*) user_data;\r
+\r
+ struct privacy_info_s* privacy_info = NULL;\r
+\r
+ bool ret = false;\r
+\r
+ privacy_info = (struct privacy_info_s*) calloc(1, sizeof(struct privacy_info_s));\r
+\r
+ privacy_info->privacy_info_client = privacy_info_client;\r
+\r
+ ret = context->callback(privacy_info, context->user_data);\r
+\r
+ free(privacy_info);\r
+\r
+ return ret;\r
+}\r
+\r
+int privacy_manager_foreach_privacy_packages(privacy_manager_privacy_packages_cb callback, void *user_data)\r
+{\r
+ int retval;\r
+\r
+ foreach_privacy_package_context_s* context = NULL;\r
+\r
+ context = (foreach_privacy_package_context_s*) calloc(1, sizeof(foreach_privacy_package_context_s));\r
+ if (context == NULL)\r
+ return PRIV_MGR_ERROR_OUT_OF_MEMORY;\r
+\r
+ context->callback = callback;\r
+ context->user_data = user_data;\r
+\r
+ retval = privacy_manager_client_foreach_privacy_packages(__privacy_manager_client_privacy_packages_cb, context);\r
+ free(context);\r
+\r
+ return _privacy_manager_convert_error(retval);\r
+}\r
+\r
+int privacy_manager_foreach_privacy_info(const char *package_id, privacy_manager_privacy_info_cb callback, void* user_data)\r
+{\r
+ int retval;\r
+\r
+ foreach_privacy_info_context_s* context = NULL;\r
+ \r
+ context = (foreach_privacy_info_context_s*) calloc(1, sizeof(foreach_privacy_info_context_s));\r
+ if (context == NULL)\r
+ return PRIV_MGR_ERROR_OUT_OF_MEMORY;\r
+\r
+ context->callback = callback;\r
+ context->user_data = user_data;\r
+\r
+ retval = privacy_manager_client_foreach_get_privacy_info(package_id, __privacy_manager_client_privacy_info_cb, context);\r
+\r
+ return _privacy_manager_convert_error(retval);\r
+}\r
+int privacy_manager_set_package_privacy(const char *package_id, const char *privacy_id, bool enable)\r
+{\r
+ int retval = privacy_manager_client_set_package_privacy(package_id, privacy_id, enable);\r
+\r
+ return _privacy_manager_convert_error(retval);\r
+}\r
--- /dev/null
+/*\r
+ * Copyright (c) 2013 Samsung Electronics Co., Ltd All Rights Reserved\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the License);\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an AS IS BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License. \r
+ */\r
+\r
+#include <stdlib.h>\r
+#include <privacy_manager.h>\r
+#include <privacy_info.h>\r
+#include <privacy_manager_client.h>\r
+#include <privacy_manager_client_types.h>\r
+#include <privacy_info_client.h>\r
+#include <privacy_manager_types_private.h>\r
+\r
+static int _privacy_info_convert_error(int error)\r
+{\r
+\r
+ return PRIVACY_MANAGER_ERROR_NONE;\r
+}\r
+\r
+int privacy_info_destroy(privacy_info_h privacy_info)\r
+{\r
+ int retval;\r
+ if (privacy_info == NULL)\r
+ return PRIV_MGR_ERROR_INVALID_PARAMETER;\r
+\r
+ if (privacy_info->privacy_info_client)\r
+ {\r
+ retval = privacy_info_client_s_destroy(privacy_info->privacy_info_client);\r
+ if (retval != PRIV_MGR_ERROR_SUCCESS)\r
+ return retval;\r
+ }\r
+\r
+ free (privacy_info);\r
+\r
+ return PRIV_MGR_ERROR_SUCCESS;\r
+}\r
+\r
+int privacy_info_get_privacy_id(privacy_info_h privacy_info, char **package)\r
+{\r
+ int retval = privacy_info_client_get_privacy_id(privacy_info->privacy_info_client, package);\r
+\r
+ return _privacy_info_convert_error(retval);\r
+}\r
+\r
+int privacy_info_get_privacy_display_name(struct privacy_info_s* privacy_info, char **name)\r
+{\r
+ int retval = privacy_info_client_get_privacy_display_name(privacy_info->privacy_info_client, name);\r
+\r
+ return _privacy_info_convert_error(retval);\r
+}\r
+\r
+int privacy_info_get_privacy_description(struct privacy_info_s* privacy_info, char **description)\r
+{\r
+ int retval = privacy_info_client_get_privacy_description(privacy_info->privacy_info_client, description);\r
+\r
+ return _privacy_info_convert_error(retval);\r
+}\r
+\r
+int privacy_info_is_enabled(struct privacy_info_s* privacy_info, bool *enable)\r
+{\r
+ int retval = privacy_info_client_is_enabled(privacy_info->privacy_info_client, enable);\r
+\r
+ return _privacy_info_convert_error(retval);\r
+}\r