Fix spelling
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
index 98f8ad1..0a4c9b3 100644 (file)
@@ -99,6 +99,8 @@ extern "C" {
 #define        PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD             "PMINFO_PKGINFO_PROP_PACKAGE_PRELOAD"
  /** Boolean property for filtering based on package info*/
 #define        PMINFO_PKGINFO_PROP_PACKAGE_READONLY            "PMINFO_PKGINFO_PROP_PACKAGE_READONLY"
+   /** Boolean property for filtering based on package info*/
+#define        PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM              "PMINFO_PKGINFO_PROP_PACKAGE_SYSTEM"
   /** Boolean property for filtering based on package info*/
 #define        PMINFO_PKGINFO_PROP_PACKAGE_UPDATE              "PMINFO_PKGINFO_PROP_PACKAGE_UPDATE"
   /** Boolean property for filtering based on package info*/
@@ -141,6 +143,8 @@ extern "C" {
 #define        PMINFO_APPINFO_PROP_APP_PACKAGE         "PMINFO_APPINFO_PROP_APP_PACKAGE"
  /** String property for filtering based on app info*/
 #define        PMINFO_APPINFO_PROP_APP_INSTALLED_STORAGE               "PMINFO_APPINFO_PROP_APP_INSTALLED_STORAGE"
+ /** String property for filtering based on app info*/
+#define        PMINFO_APPINFO_PROP_PRIVILEGE   "PMINFO_APPINFO_PROP_PRIVILEGE"
 
 /** Integer property for filtering app support mode */
 #define        PMINFO_APPINFO_PROP_APP_SUPPORT_MODE            "PMINFO_APPINFO_PROP_APP_SUPPORT_MODE"
@@ -177,7 +181,6 @@ const char *getIconPath(uid_t uid, bool readonly);
 char *getUserPkgParserDBPath(void);
 char *getUserPkgParserDBPathUID(uid_t uid);
 char *getUserPkgCertDBPath(void);
-char *getUserPkgCertDBPathUID(uid_t uid);
 const char *getUserManifestPath(uid_t uid, bool readonly);
 
 /**
@@ -1351,6 +1354,71 @@ int pkgmgrinfo_updateinfo_foreach_updateinfo(pkgmgrinfo_foreach_updateinfo_cb ca
 int pkgmgrinfo_updateinfo_usr_foreach_updateinfo(uid_t uid, pkgmgrinfo_foreach_updateinfo_cb callback, void *user_data);
 
 /**
+ * @fn int pkgmgrinfo_plugininfo_is_executed(const char *pkgid, const char *appid, const char *plugin_type, const char *plugin_name, bool *is_executed);
+ * @brief      This API checkes whether given plugin had been executed with given package ID and application ID or not.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  pkgid   package ID
+ * @param[in]  appid   application ID
+ * @param[in]  plugin_type     plugin type to be checked
+ * @param[in]  plugin_name     plugin name to be checked
+ * @param[out] is_executed     check result
+ * @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 bool check_execute_info(const char *pkgid, const char *appid, const char *plugin_type, const char *plugin_name)
+{
+       int ret = 0;
+       bool is_executed;
+
+       ret = pkgmgrinfo_plugininfo_is_executed(pkgid, appid, plugin_type, plugin_name, &is_executed);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       printf("is checked is [%d]\n", is_executed);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_plugininfo_is_executed(const char *pkgid, const char *appid,
+               const char *plugin_type, const char *plugin_name, bool *is_executed);
+
+/**
+ * @fn int pkgmgrinfo_plugininfo_foreach_plugininfo(const char *pkgid, const char *plugin_type, const char *plugin_name, pkgmgrinfo_plugin_list_cb plugin_list_cb, void *user_data);
+ * @brief      This API retrieve the previous plugin execution info and invoke callbacks each of it.
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  pkgid                   package ID
+ * @param[in]  plugin_type             type of plugin
+ * @param[in]  plugin_name             name of plugin
+ * @param[in]  plugin_list_cb  callback to be invoked for each plugin execution info
+ * @param[out] user_data               user data to be passed to callback
+ * @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 foreach_pkg_plugininfo(const char *pkgid, const char *plugin_type, const char *plugin_name, pkgmgrinfo_plugin_list_cb callback)
+{
+       int ret = 0;
+
+       ret = pkgmgrinfo_plugininfo_foreach_plugininfo(pkgid, plugin_type, plugin_name, callback, NULL);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_plugininfo_foreach_plugininfo(const char *pkgid,
+               const char *plugin_type, const char *plugin_name,
+               pkgmgrinfo_plugin_list_cb plugin_list_cb, void *user_data);
+
+/**
  * @fn int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
  * @brief      This API gets the launch mode of package from the package ID
  *
@@ -1958,7 +2026,7 @@ int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *sup
 
 /**
  * @fn int pkgmgrinfo_pkginfo_is_global(pkgmgrinfo_pkginfo_h handle, bool *global)
- * @brief      This API gets whethere the given package is global package or user package
+ * @brief      This API gets whether the given package is global package or user package
  *
  * @par                This API is for package-manager client application
  * @par Sync (or) Async : Synchronous API
@@ -2484,6 +2552,52 @@ static int list_appdefined_privilege(const char *package)
 int pkgmgrinfo_pkginfo_foreach_appdefined_privilege(pkgmgrinfo_pkginfo_h handle,
                        pkgmgrinfo_pkg_appdefined_privilege_list_cb privilege_func, void *user_data);
 
+/**
+ * @fn int pkgmgrinfo_pkginfo_foreach_plugin(pkgmgrinfo_pkginfo_h handle,
+                       pkgmgrinfo_plugin_list_cb plugin_func, void *user_data);
+ * @brief      This API gets the list of plugin execution info 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]  plugin_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 plugin_func(const char *pkgid, const char *appid,
+                               const char *plugin_type, const char *plugin_name,
+                               void *user_data)
+{
+       printf("appid : %s, type : %s, name : %s\n", appid, plugin_type, plugin_name);
+
+       return 0;
+}
+
+static int list_plugin(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_plugin(handle, plugin_func, 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_plugin(pkgmgrinfo_pkginfo_h handle,
+                       pkgmgrinfo_plugin_list_cb plugin_func, void *user_data);
+
 /* TODO: add doxygen comment here */
 int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users);
 
@@ -4288,7 +4402,7 @@ int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
 
 /**
  * @fn int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
- *                     const char *operation, const char *uri, const char *mime,
+ *                     const char *operation,
  *                     pkgmgrinfo_pkg_privilege_list_cb privilege_func,
  *                     void *user_data);
  * @brief      This API gets the list of privileges for a particular
@@ -4298,8 +4412,6 @@ int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
  * @par Sync (or) Async : Synchronous API
  * @param[in]  appid           application id
  * @param[in]  operation       operation of appcontrol
- * @param[in]  uri             uri of appcontrol
- * @param[in]  mime            mime of appcontrol
  * @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
@@ -4308,11 +4420,11 @@ int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
  * @retval     PMINFO_R_ERROR  internal error
  */
 int pkgmgrinfo_appinfo_usr_foreach_appcontrol_privileges(const char *appid,
-               const char *operation, const char *uri, const char *mime,
+               const char *operation,
                pkgmgrinfo_pkg_privilege_list_cb privilege_func,
                void *user_data, uid_t uid);
 int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid,
-               const char *operation, const char *uri, const char *mime,
+               const char *operation,
                pkgmgrinfo_pkg_privilege_list_cb privilege_func,
                void *user_data);
 
@@ -4370,6 +4482,9 @@ static int check_operation(const char *appid, char *operation)
 int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
                        pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
 
+int pkgmgrinfo_appinfo_foreach_remote_appcontrol(pkgmgrinfo_appinfo_h handle,
+                       pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data);
+
 /**
  * @brief
  */
@@ -5091,7 +5206,7 @@ int pkgmgrinfo_appinfo_is_disabled(pkgmgrinfo_appinfo_h handle, bool *disabled);
 
 /**
  * @fn int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
- * @brief      This API gets whethere the given application is global application or user application
+ * @brief      This API gets whether the given application is global application or user application
  *
  * @par                This API is for package-manager client application
  * @par Sync (or) Async : Synchronous API
@@ -5738,6 +5853,32 @@ int pkgmgrinfo_appinfo_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filte
                pkgmgrinfo_app_list_cb app_cb, void *user_data);
 int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(pkgmgrinfo_appinfo_metadata_filter_h handle,
                pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
+                       pkgmgrinfo_app_control_list_cb_v2 appcontrol_func, void *user_data);
+ * @fn int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
+                       pkgmgrinfo_app_control_list_cb_v2 appcontrol_func, void *user_data);
+ * @brief      This API gets the list of app-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]  appcontrol_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()
+ */
+int pkgmgrinfo_appinfo_foreach_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
+               void *user_data);
+int pkgmgrinfo_appinfo_foreach_remote_appcontrol_v2(pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_app_control_list_cb_v2 appcontrol_func,
+               void *user_data);
 /**
  * @fn int pkgmgrinfo_pkginfo_create_certinfo(pkgmgrinfo_certinfo_h *handle)
  * @brief      This API creates the package cert information handle to get data from db.
@@ -6195,6 +6336,102 @@ int pkgmgrinfo_compare_package_version(const char *current_version,
                const char *target_version, pkgmgrinfo_version_compare_type *res);
 
 /**
+ * @fn int pkgmgrinfo_pkginfo_foreach_dependency(pkgmgrinfo_pkginfo_h handle,
+                       pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+                       void *user_data);
+ * @brief      This API gets the list of dependency of 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]  dependency_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 dependency_cb(const char *pkgid, const char *type,
+               const char *required_version,void *user_data)
+{
+       printf("this package %s %s", type, pkgid);
+       if (required_version)
+               printf("required version : %s", required_version);
+       return 0;
+}
+
+static int list_dependency(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_dependency(handle, dependency_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_dependency(pkgmgrinfo_pkginfo_h handle,
+               pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+               void *user_data);
+
+/**
+ * @fn int pkgmgrinfo_pkginfo_foreach_required_by(pkgmgrinfo_pkginfo_h handle,
+                       pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+                       void *user_data);
+ * @brief      This API gets the list of packages which has dependency of 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]  dependency_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 dependency_cb(const char *pkgid, const char *type,
+               const char *required_version,void *user_data)
+{
+       printf("%s %s this package", pkgid, type);
+       if (required_version)
+               printf("required version : %s", required_version);
+       return 0;
+}
+
+static int list_required_by(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_required_by(handle, dependency_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_by(pkgmgrinfo_pkginfo_h handle,
+               pkgmgrinfo_pkg_dependency_list_cb dependency_cb,
+               void *user_data);
+
+/**
  * @brief      TEMP
  */
 
@@ -6230,6 +6467,18 @@ int pkgmgrinfo_archiveinfo_get_author(pkgmgrinfo_archiveinfo_h handle,
 int pkgmgrinfo_archiveinfo_get_icon(pkgmgrinfo_archiveinfo_h handle,
                const unsigned char **icon, size_t *size);
 
+int pkgmgrinfo_appinfo_foreach_component_info(pkgmgrinfo_appinfo_h handle,
+               pkgmgrinfo_component_info_list_cb callback, void *user_data);
+
+int pkgmgrinfo_compinfo_get_appid(pkgmgrinfo_compinfo_h handle,
+               const char **appid);
+int pkgmgrinfo_compinfo_get_compid(pkgmgrinfo_compinfo_h handle,
+               const char **compid);
+int pkgmgrinfo_compinfo_get_type(pkgmgrinfo_compinfo_h handle,
+               const char **type);
+int pkgmgrinfo_compinfo_get_launch_mode(pkgmgrinfo_compinfo_h handle,
+               const char **launch_mode);
+
 /**
  * @pkgmgrinfo client API end
 **/