X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fpkgmgr-info.h;h=a82ab8bcbe03ccf7c37568d3a85ddef9e49d361a;hb=26a21fba38f7426680df92618024109903669699;hp=45341901a979a9bae454d7f3cf74aa135d09a49a;hpb=90e07d1da0867ecc3c1d8c3dbcc63927fa1ae831;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h old mode 100755 new mode 100644 index 4534190..a82ab8b --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -48,6 +48,8 @@ #include #include +#include +#include #ifdef __cplusplus extern "C" { @@ -442,6 +444,7 @@ typedef enum { #define PMINFO_PKGINFO_PROP_RANGE_BASIC "PMINFO_PKGINFO_PROP_RANGE_BASIC" /* For multiuser support */ +char *getIconPath(uid_t uid); char *getUserPkgParserDBPath(void); char *getUserPkgParserDBPathUID(uid_t uid); char *getUserPkgCertDBPath(void); @@ -880,6 +883,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 * @@ -2068,6 +2110,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) @@ -2474,6 +2525,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 * @@ -3160,6 +3246,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 @@ -3746,6 +3868,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 * @@ -4393,7 +4553,7 @@ static int get_cert_info(const char *pkgid) } * @endcode */ -int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle); +int pkgmgrinfo_pkginfo_load_certinfo(const char *pkgid, pkgmgrinfo_certinfo_h handle, uid_t uid); /** * @fn int pkgmgrinfo_pkginfo_get_cert_value(pkgmgrinfo_certinfo_h handle, pkgmgrinfo_cert_type cert_type, const char **cert_value) @@ -5063,7 +5223,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 @@ -5135,7 +5295,7 @@ static int set_cert_in_db(const char *pkgid) pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; } - ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle); + ret = pkgmgrinfo_save_certinfo(pkgid, handle); if (ret != PMINFO_R_OK) { pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; @@ -5177,7 +5337,7 @@ static int set_cert_in_db(const char *pkgid) pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; } - ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle); + ret = pkgmgrinfo_save_certinfo(pkgid, handle); if (ret != PMINFO_R_OK) { pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; @@ -5218,7 +5378,7 @@ static int set_cert_in_db(const char *pkgid) pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; } - ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle); + ret = pkgmgrinfo_save_certinfo(pkgid, handle); if (ret != PMINFO_R_OK) { pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; @@ -5228,7 +5388,7 @@ static int set_cert_in_db(const char *pkgid) } * @endcode */ -int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle); +int pkgmgrinfo_save_certinfo(const char *pkgid, pkgmgrinfo_instcertinfo_h handle, uid_t uid); /** * @fn int pkgmgrinfo_destroy_certinfo_set_handle(pkgmgrinfo_instcertinfo_h handle) @@ -5258,7 +5418,7 @@ static int set_cert_in_db(const char *pkgid) pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1; } - ret = pkgmgrinfo_save_pkgdbinfo(pkgid, handle); + ret = pkgmgrinfo_save_certinfo(pkgid, handle); if (ret != PMINFO_R_OK) { pkgmgrinfo_destroy_certinfo_set_handle(handle); return -1;