void free_privilege_level_info_list(GList* list);
/**
+ * @brief Free GList of privilege_privacy_info_s* allocated by privilege_db_manager_get_privacy_filtered_privilege_info_list()
+ * @param [in] list The GList allocated by privilege_db_manager_get_privacy_filtered_privilege_info_list()
+ */
+void free_privilege_privacy_info_list(GList *list);
+
+/**
+ * @brief Free privilege_privacy_info_s
+ * @param [in] info The privilege_privacy_info_s
+ */
+void free_privilege_privacy_info(privilege_privacy_info_s* info);
+
+/**
* @brief Free GList allocated by privilege_db_manager APIs
* @param [in] list The GList allocated by privilege_db_manager APIs
*/
* @brief See if the given package id is privacy whitelisted for the given privilege.
* @remarks @a privilege must be privacy related
* @param [in] pkgid The package ID
- * @param [in] privilege The privilege
+ * @param [in] privacy_id The privacy id
* @return 1 on true(is whitelisted), 0 on false and negative value on error.
* @retval #PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY Out of memory.
* @retval #PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY Failed to prepare sql query.
* @retval #PRIVILEGE_DB_MANAGER_ERR_DB_NOENTRY DB not exist.
* @retval #PRIVILEGE_DB_MANAGER_ERR_CONNECTION_FAIL DB exist but failed to open DB.
*/
-int privilege_db_manager_is_privacy_white_list(const char* pkgid, const char* privilege);
+int privilege_db_manager_is_privacy_white_list(const char* pkgid, int privacy_id);
/**
* @brief See if the given package id is user-settable for the given privacy.
* @param [in] pkgid_name The privacy name
- * @param [in] privacy_name The privacy name
+ * @param [in] privacy_id The privacy ID
* @return 1 on true(is user-settable), 0 on false and negative value on error.
* @retval #PRIVILEGE_DB_MANAGER_ERR_OUT_OF_MEMORY Out of memory.
* @retval #PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY Failed to prepare sql query.
* @retval #PRIVILEGE_DB_MANAGER_ERR_DB_NOENTRY DB not exist.
* @retval #PRIVILEGE_DB_MANAGER_ERR_CONNECTION_FAIL DB exist but failed to open DB.
*/
-int privilege_db_manager_is_user_settable(const char* pkgid, const char* privacy_name);
+int privilege_db_manager_is_user_settable(const char* pkgid, int privacy_id);
/**
* @brief Get all privacy list
* @retval #PRIVILEGE_DB_MANAGER_ERR_DB_NOENTRY DB not exist.
* @retval #PRIVILEGE_DB_MANAGER_ERR_CONNECTION_FAIL DB exist but failed to open DB.
*/
-int privilege_db_manager_get_privacy_id(const char* privacy, int *privacy_id);
+int privilege_db_manager_get_privacy_id(const char* privacy_name, int *privacy_id);
/**
* @brief See if the given privilege is in the mdm blacklist for the given uid.
* @remarks @a privilege_list must be released by you.
* @param [in] uid The uid
* @param [in] pkgid The package ID
- * @param [in] package_type The package type of the given privilege list
* @param [in] api_version The api-version of the package
- * @param [in] privilege_list The privacy privilege list
+ * @param [in] privilege_list The user-settable privacy privilege list of the package
* @return 0 on success, otherwise a negative error value.
* @retval #PRIVILEGE_DB_MANAGER_ERR_NONE Successful.
* @retval #PRIVILEGE_DB_MANAGER_ERR_INVALID_QUERY Failed to prepare sql query.
* @retval #PRIVILEGE_DB_MANAGER_ERR_DB_FULL_FAIL Write could not complete due to the disk is full.
* @retval #PRIVILEGE_DB_MANAGER_ERR_DB_UPDATE_FAIL DB update failed.
*/
-int privilege_db_manager_set_package_privacy_privilege_info(const uid_t uid, const char* pkgid, privilege_manager_package_type_e package_type, const char* api_version, GList* privilege_list);
+int privilege_db_manager_set_package_privacy_privilege_info(const uid_t uid, const char* pkgid, const char* api_version, GList* privilege_list);
/**
* @brief Delete all privacy privilege info of the given application package.
*/
int privilege_db_manager_get_privilege_list_by_pkgid_and_privacy(const uid_t uid, const char* pkgid, const char* privacy, GList** privilege_list);
+/**
+ * @brief Get privilege privacy info list filtered by privacy
+ * @remarks @a privilage_privacy_info_list must released by using free_privilege_privacy_info_list().
+ * @remarks If you want to free an element of @a privilege_privacy_info_list then use free_privilege_privacy_info().
+ * @param [in] privilege_list The privilege list to filter privacy
+ * @param [in] privacy_name The privacy name to filter privilege list. If the privacy name is NULL then just filter privacy privileges.
+ * @param [out] privilege_privacy_info_list The filtered privileges and their privacy info
+ */
+int privilege_db_manager_get_privacy_filtered_privilege_info_list(GList *privilege_list, const char* privacy_name, GList **privilege_privacy_info_list);
+
#ifdef __cplusplus
}
#endif