Print the request type when trying direct access
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
index b2f349c..9a856d6 100644 (file)
@@ -92,6 +92,8 @@ extern "C" {
 #define        PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF         "PMINFO_PKGINFO_PROP_PACKAGE_AUTHOR_HREF"
  /** String property for filtering based on package info*/
 #define        PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE           "PMINFO_PKGINFO_PROP_PACKAGE_PRIVILEGE"
+ /** String property for filtering based on package info*/
+#define        PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE            "PMINFO_PKGINFO_PROP_PACKAGE_RES_TYPE"
 
  /** Boolean property for filtering based on package info*/
 #define        PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE           "PMINFO_PKGINFO_PROP_PACKAGE_REMOVABLE"
@@ -1648,6 +1650,114 @@ static int get_csc_path(const char *pkgid)
 int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path);
 
 /**
+ * @fn int pkgmgrinfo_pkginfo_get_res_type(pkgmgrinfo_pkginfo_h handle, char **res_type)
+ * @brief      This API gets the resource type of package
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle          pointer to package info handle
+ * @param[out] res_type        pointer to hold resource type of package
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @code
+static int get_res_type(const char *pkgid)
+{
+       int ret = 0;
+       char *res_type = 0;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       ret = pkgmgrinfo_pkginfo_get_res_type(handle, &res_type);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       printf("res_type : %s\n", res_type);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_res_type(pkgmgrinfo_pkginfo_h handle, char **res_type);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_res_version(pkgmgrinfo_pkginfo_h handle, char **res_version)
+ * @brief      This API gets the resource version of package
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle          pointer to package info handle
+ * @param[out] res_version     pointer to hold resource version of package
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @code
+static int get_res_version(const char *pkgid)
+{
+       int ret = 0;
+       char *res_version = 0;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       ret = pkgmgrinfo_pkginfo_get_res_version(handle, &res_version);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       printf("res_version : %s\n", res_version);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_res_version(pkgmgrinfo_pkginfo_h handle, char **res_version);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_get_light_user_switch_mode(pkgmgrinfo_pkginfo_h handle, char **mode)
+ * @brief      This API gets the light_user_switch_mode of package
+ *
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle          pointer to package info handle
+ * @param[out] mode            pointer to hold resource version of package
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @code
+static int get_light_user_switch_mode(const char *pkgid)
+{
+       int ret = 0;
+       char *mode = 0;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       ret = pkgmgrinfo_pkginfo_get_light_user_switch_mode(handle, &mode);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       printf("light_user_switch_mode : %s\n", mode);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_light_user_switch_mode(pkgmgrinfo_pkginfo_h handle, char **mode);
+
+/**
  * @fn int pkgmgrinfo_pkginfo_get_support_mode(pkgmgrinfo_pkginfo_h handle, int *support_mode)
  * @brief      This API gets the support_mode of package
  *
@@ -2598,6 +2708,257 @@ static int list_plugin(const char *package)
 int pkgmgrinfo_pkginfo_foreach_plugin(pkgmgrinfo_pkginfo_h handle,
                        pkgmgrinfo_plugin_list_cb plugin_func, void *user_data);
 
+/**
+ * @fn int pkgmgrinfo_pkginfo_foreach_metadata(pkgmgrinfo_pkginfo_h handle,
+                       pkgmgrinfo_pkg_metadata_list_cb metadata_func, void *user_data);
+ * @brief      This API gets the list of metadata for a particular package
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in]  handle          pointer to the package info handle.
+ * @param[in]  metadata_func           callback function for list
+ * @param[in] user_data        user data to be passed to callback function
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post               pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int metadata_func(const char *key, const char *value, void *user_data)
+{
+       if (strcmp(key, (char *)user_data) == 0) {
+               printf("Value is %s\n", value);
+               return -1;
+       }
+       else
+               return 0;
+}
+
+static int list_metadata(const char *pkgid, char *key)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_foreach_metadata(handle, metadata_func, (void *)key);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_foreach_metadata(pkgmgrinfo_pkginfo_h handle,
+                       pkgmgrinfo_pkg_metadata_list_cb metadata_func, void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_metadata_filter_create(pkgmgrinfo_pkginfo_metadata_filter_h *handle)
+ * @brief      This API creates the application's metadata  information filter handle from db.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[out] handle          pointer to the package metadata info filter handle.
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                None
+ * @post               pkgmgrinfo_pkginfo_metadata_filter_destroy()
+ * @see                pkgmgrinfo_pkginfo_metadata_filter_foreach()
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+       char *pkgid = NULL;
+       pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+       printf("pkgid : %s\n", pkgid);
+       return 0;
+}
+
+static int get_pkg_list(const char *mkey, const char *mvalue)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_metadata_filter_h handle;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_metadata_filter_create(pkgmgrinfo_pkginfo_metadata_filter_h *handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_metadata_filter_destroy(pkgmgrinfo_pkginfo_metadata_filter_h handle)
+ * @brief      This API destroys the package's metadata  information filter handle.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle           pointer to the package metadata info filter handle.
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_pkginfo_metadata_filter_create()
+ * @post               None
+ * @see                pkgmgrinfo_pkginfo_metadata_filter_foreach()
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+       char *pkgid = NULL;
+       pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+       printf("pkgid : %s\n", pkgid);
+       return 0;
+}
+
+static int get_pkg_list(const char *mkey, const char *mvalue)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_metadata_filter_h handle;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_metadata_filter_destroy(pkgmgrinfo_pkginfo_metadata_filter_h handle);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_metadata_filter_add(pkgmgrinfo_pkginfo_metadata_filter_h handle, const char *key, const char *value)
+ * @brief      This API adds filter condition for the query API.  The query will search the entire package metadata  information collected from
+ * the manifest file of all the installed packages. You can specify value as NULL to search based on key only.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle           pointer to the package metadata info filter handle.
+ * @param[in] key                      pointer to metadata key
+ * @param[in] value                    pointer to metadata value
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_pkginfo_metadata_filter_create()
+ * @post               pkgmgrinfo_pkginfo_metadata_filter_foreach(), pkgmgrinfo_pkginfo_metadata_filter_destroy()
+ * @see                pkgmgrinfo_pkginfo_metadata_filter_foreach()
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+       char *pkgid = NULL;
+       pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+       printf("pkgid : %s\n", pkgid);
+       return 0;
+}
+
+static int get_pkg_list(const char *mkey, const char *mvalue)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_metadata_filter_h handle;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_metadata_filter_add(pkgmgrinfo_pkginfo_metadata_filter_h handle,
+               const char *key, const char *value);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
+ * @fn int pkgmgrinfo_pkginfo_usr_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle, pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid)
+ * @brief      This API executes the filter query. The query will search the entire package metadata  information collected from
+ * the manifest file of all the installed packages. For each package returned by the query, the callback will be called. If callback returns
+ * negative value, no more callbacks will be called and API will return.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] handle           pointer to the package metadata info filter handle.
+ * @param[in] app_cb           function pointer to callback
+ * @param[in] user_data                pointer to user data
+ * @param[in]  uid     the addressee user id of the instruction
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_pkginfo_metadata_filter_create()
+ * @post               pkgmgrinfo_pkginfo_metadata_filter_destroy()
+ * @code
+int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data)
+{
+       char *pkgid = NULL;
+       pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
+       printf("pkgid : %s\n", pkgid);
+       return 0;
+}
+
+static int get_pkg_list(const char *mkey, const char *mvalue)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_metadata_filter_h handle;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_create(&handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_metadata_filter_add(handle, mkey, mvalue);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       ret = pkgmgrinfo_pkginfo_metadata_filter_foreach(handle, pkg_list_cb, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_metadata_filter_destroy(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle,
+               pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data);
+int pkgmgrinfo_pkginfo_usr_metadata_filter_foreach(pkgmgrinfo_pkginfo_metadata_filter_h handle,
+               pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid);
+
 /* TODO: add doxygen comment here */
 int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users);
 
@@ -4251,6 +4612,52 @@ int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
                pkgmgrinfo_app_splash_screen_list_cb splash_screen_func, void *user_data);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_foreach_res_control(pkgmgrinfo_appinfo_h handle,
+                       pkgmgrinfo_app_res_control_list_cb res_control_func, void *user_data);
+ * @brief      This API gets the list of resource control for a particular application
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in]  handle                  pointer to the application info handle.
+ * @param[in]  res_control_func        callback function for list
+ * @param[in]  user_data               user data to be passed to callback function
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_appinfo_get_appinfo()
+ * @post       pkgmgrinfo_appinfo_destroy_appinfo()
+ * @code
+int res_control_func(const char *res_type,
+               const char *min_res_version, const char *max_res_version,
+               const char *auto_close, void *user_data)
+{
+       printf("res_type : %s\n", res_type);
+       return 0;
+}
+
+static int list_res_control(const char *appid, char *key)
+{
+       int ret = 0;
+       pkgmgrinfo_appinfo_h handle;
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_appinfo_foreach_res_control(handle, res_control_func, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_foreach_res_control(pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_res_control_list_cb res_control_func,
+               void *user_data);
+
+/**
  * @fn int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
  * @brief      This API gets the application 'nodisplay' value from the app ID
  *
@@ -5028,6 +5435,22 @@ int pkgmgrinfo_appinfo_get_setup_appid(pkgmgrinfo_appinfo_h handle, char **setup
 int pkgmgrinfo_appinfo_is_support_ambient(pkgmgrinfo_appinfo_h handle, bool *support_ambient);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_light_user_switch_mode(pkgmgrinfo_appinfo_h handle, char *mode)
+ * @brief      This API gets the application 'light_user_switch_mode' value from the app ID
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle          pointer to application info handle
+ * @param[out] mode    pointer to hold package light_user_switch_mode value
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ */
+int pkgmgrinfo_appinfo_get_light_user_switch_mode(pkgmgrinfo_appinfo_h handle, char **mode);
+
+/**
  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
  * @brief      This API destroys the application information handle freeing up all the resources
  *
@@ -6152,6 +6575,113 @@ int pkgmgrinfo_pkginfo_foreach_depends_on(pkgmgrinfo_pkginfo_h handle,
                void *user_data);
 
 /**
+ * @fn int pkgmgrinfo_pkginfo_foreach_res_allowed_package(pkgmgrinfo_pkginfo_h handle,
+               pkgmgrinfo_res_allowed_package_list_cb res_allowed_package_cb,
+               void *user_data)
+ * @brief      This API gets the list of allowed package for a particular package
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in]  handle                  pointer to the package info handle.
+ * @param[in]  res_allowed_package_cb  callback function for list
+ * @param[in]  user_data               user data to be passed to callback function
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @retval     PMINFO_R_ERROR  internal error
+ * @pre                pkgmgrinfo_pkginfo_get_pkginfo()
+ * @post       pkgmgrinfo_pkginfo_destroy_pkginfo()
+ * @code
+int res_allowed_package_cb(const char *allowed_package,
+               required_privilege_h handle, void *user_data)
+{
+       printf("allowed package : %s", allowed_package);
+
+       return 0;
+}
+
+static int list_res_allowed_package(const char *package)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_foreach_res_allowed_package(handle, res_allowed_package_cb, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_foreach_res_allowed_package(pkgmgrinfo_pkginfo_h handle,
+               pkgmgrinfo_res_allowed_package_list_cb res_allowed_package_cb,
+               void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_foreach_required_privilege(
+               required_privilege_h handle,
+               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
+               void *user_data)
+ * @brief      This API gets the list of allowed package's required privileges
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ * @param[in]  handle                  pointer to the required privilege handle.
+ * @param[in]  privilege_func          callback function for list
+ * @param[in]  user_data               user data to be passed to callback function
+ * @return     0 if success, error code(<0) if fail
+ * @retval     PMINFO_R_OK     success
+ * @retval     PMINFO_R_EINVAL invalid argument
+ * @pre                pkgmgrinfo_pkginfo_foreach_res_allowed_package()
+ * @post       None
+ * @code
+int privilege_func(const char *privilege_name, void *user_data)
+{
+       printf("required privilege : %s", privilege_name);
+
+       return 0;
+}
+
+int res_allowed_package_cb(const char *allowed_package,
+               required_privilege_h handle, void *user_data)
+{
+       int ret = 0;
+       printf("allowed package : %s", allowed_package);
+
+       ret = pkgmgrinfo_pkginfo_foreach_required_privilege(handle, privilege_func, user_data);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       return 0;
+}
+
+static int list_res_allowed_package(const char *package)
+{
+       int ret = 0;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(package, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_foreach_res_allowed_package(handle, res_allowed_package_cb, NULL);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_foreach_required_privilege(
+               required_privilege_h handle,
+               pkgmgrinfo_pkg_privilege_list_cb privilege_func,
+               void *user_data);
+
+/**
  * @fn int pkgmgrinfo_pkginfo_get_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb, int flag, void *user_data)
  * @brief      This API gets list of installed packages using flag that used for masking package's information
  *
@@ -6671,4 +7201,3 @@ int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle,
  * @}
  * @}
  */
-