Change owner of parent directory
[platform/core/appfw/pkgmgr-info.git] / include / pkgmgr-info.h
old mode 100755 (executable)
new mode 100644 (file)
index 3adc8e1..48aa7b6
@@ -48,6 +48,7 @@
 
 #include <errno.h>
 #include <stdbool.h>
+#include <unistd.h>
 
 #ifdef __cplusplus
 extern "C" {
@@ -881,6 +882,45 @@ static int get_pkg_icon(const char *pkgid)
 int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon);
 
 /**
+ * @fn int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
+ * @brief      This API gets the package label from the package ID
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  handle  pointer to package info handle
+ * @param[out] label           pointer to hold package label
+ * @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()
+ * @see                pkgmgrinfo_pkginfo_get_pkgid()
+ * @see                pkgmgrinfo_pkginfo_is_removable()
+ * @code
+static int get_pkg_label(const char *pkgid)
+{
+       int ret = 0;
+       char *label = NULL;
+       pkgmgrinfo_pkginfo_h handle;
+       ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+       ret = pkgmgrinfo_pkginfo_get_label(handle, &label);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+               return -1;
+       }
+       printf("pkg label: %s\n", label);
+       pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label);
+
+/**
  * @fn int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
  * @brief      This API gets the package description from the package ID
  *
@@ -2069,6 +2109,15 @@ static int list_privilege(const char *package, char *privilege)
 int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
                        pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data);
 
+/* TODO: add doxygen comment here */
+int pkgmgrinfo_pkginfo_get_size_from_xml(const char *manifest, int *size);
+int pkgmgrinfo_pkginfo_get_location_from_xml(const char *manifest, pkgmgrinfo_install_location *location);
+int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users);
+int pkgmgrinfo_appinfo_set_state_enabled(const char *appid, bool enabled);
+int pkgmgrinfo_appinfo_set_usr_state_enabled(const char *appid, bool enabled, uid_t uid);
+int pkgmgrinfo_appinfo_set_default_label(const char *appid, const char *label);
+int pkgmgrinfo_appinfo_set_usr_default_label(const char *appid, const char *label, uid_t uid);
+
 /**
  * @fn int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
  pkgmgrinfo_app_list_cb app_func, void *user_data)
@@ -2475,6 +2524,41 @@ static int get_app_label(const char *appid)
 int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h  handle, char **label);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
+ * @brief      This API gets exactly matched label by given appid and locale
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in]  appid   pointer to appid
+ * @param[in]  locale  pointer to locale
+ * @param[out] label           pointer to hold app label
+ * @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_localed_label(const char *appid, const char *locale)
+{
+       int ret = 0;
+       char *label = NULL;
+
+       ret = pkgmgrinfo_appinfo_get_localed_label(appid, locale, &label);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       printf("localed label: %s\n", label);
+
+       free(label);
+
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label);
+int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label);
+
+/**
  * @fn int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
  * @brief      This API gets the component of the application
  *
@@ -3161,6 +3245,42 @@ static int get_app_submode_mainid(const char *appid)
 int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h  handle, char **submode_mainid);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access);
+ * @brief      This API gets the datacontrol info
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] providerid               pointer to the providerid of dataconltrol.
+ * @param[in] type                     pointer to the type of dataconltrol.
+ * @param[out] appid                   pointer to hold appid, need to free after using
+ * @param[out] access                  pointer to hold access, need to free after using
+ * @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
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access);
+
+/**
+ * @fn int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid);
+ * @brief      This API gets the appid of datacontrol
+ *
+ * @par                This API is for package-manager client application
+ * @par Sync (or) Async : Synchronous API
+ *
+ * @param[in] providerid               pointer to the providerid of dataconltrol.
+ * @param[out] appid                   pointer to hold appid, need to free after using
+ * @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
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid);
+
+/**
  * @fn int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
                        pkgmgrinfo_app_permission_list_cb permission_func, void *user_data);
  * @brief      This API gets the list of permission for a particular application
@@ -3747,6 +3867,44 @@ static int get_app_submode(const char *appid)
 int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode);
 
 /**
+ * @fn int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
+ * @brief      This API checks if the application has the given category
+ *
+ * @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]  category        category
+ * @param[out] exist           value Gets whether the application has the given category
+ * @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 is_category_exist(const char *appid, const char *category)
+{
+       int ret = 0;
+       pkgmgrinfo_appinfo_h handle;
+       bool exist = false;
+
+       ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle);
+       if (ret != PMINFO_R_OK)
+               return -1;
+
+       ret = pkgmgrinfo_appinfo_is_category_exist(handle, category, &exist);
+       if (ret != PMINFO_R_OK) {
+               pkgmgrinfo_appinfo_destroy_appinfo(handle);
+               return -1;
+       }
+
+       pkgmgrinfo_appinfo_destroy_appinfo(handle);
+       return 0;
+}
+ * @endcode
+ */
+int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist);
+
+/**
  * @fn int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
  * @brief      This API destroys the application information handle freeing up all the resources
  *
@@ -5064,7 +5222,7 @@ static int set_pkg_in_db(const char *pkgid)
  * @endcode
  */
 int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle);
-int pkgmgrinfo_save_pkgdbusrinfo(pkgmgrinfo_pkgdbinfo_h handle, uid_t uid);
+int pkgmgrinfo_save_pkgusrdbinfo(pkgmgrinfo_pkgdbinfo_h handle, uid_t uid);
 /**
  * @fn int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
  * @brief      This API destroys the package db information handle freeing up all the resources