X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fpkgmgr-info.h;h=8fac17b2e84badb25a809942f86b9ea550f73f6d;hb=5e622b967bbcffd42a99ad5f56a0a2a83a20303b;hp=3ca623ad519de15622c3296d64df09835c3e8ffc;hpb=0c8c4f9c9e28654c617493a77ed4def1c56c8b8d;p=platform%2Fcore%2Fappfw%2Fpkgmgr-info.git diff --git a/include/pkgmgr-info.h b/include/pkgmgr-info.h index 3ca623a..8fac17b 100644 --- a/include/pkgmgr-info.h +++ b/include/pkgmgr-info.h @@ -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" @@ -165,6 +169,8 @@ extern "C" { #define PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE "PMINFO_APPINFO_PROP_APP_SUPPORT_DISABLE" /** Boolean property for filtering based on app info*/ #define PMINFO_APPINFO_PROP_APP_CHECK_STORAGE "PMINFO_APPINFO_PROP_APP_CHECK_STORAGE" +/** Boolean property for filtering based on app info*/ +#define PMINFO_APPINFO_PROP_PKG_DISABLE "PMINFO_APPINFO_PROP_PKG_DISABLE" /** will be updated*/ /** string property for filtering based on pkg info*/ @@ -175,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); /** @@ -1053,6 +1058,367 @@ static int get_pkg_installed_time(const char *pkgid) int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time); /** + * @fn int pkgmgrinfo_updateinfo_create(pkgmgrinfo_updateinfo_h *update_handle) + * @brief This API creates the update info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[out] handle pointer to package update info 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 + * @post pkgmgrinfo_updateinfo_destroy() + * @see pkgmgrinfo_updateinfo_set_pkgid() + * @see pkgmgrinfo_updateinfo_set_version() + * @see pkgmgrinfo_updateinfo_set_type() + * @see pkgmgr_client_register_pkg_updateinfo() + * @code +static int updateinfo_handle_create() +{ + int ret = 0; + + pkgmgrinfo_updateinfo_h handle; + ret = pkgmgrinfo_updateinfo_create(&handle); + if (ret != PMINFO_R_OK) + return -1; + pkgmgrinfo_update_infodestroy(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_create(pkgmgrinfo_updateinfo_h *update_handle); + +/** + * @fn int pkgmgrinfo_updateinfo_destroy(pkgmgrinfo_updateinfo_h update_handle) + * @brief This API destroy the update info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_updateinfo_create() + * @see pkgmgr_client_register_pkg_updateinfo() + * @code +static int updateinfo_handle_destroy(pkgmgrinfo_updateinfo_h handle) +{ + int ret = 0; + + ret = pkgmgrinfo_updateinfo_destroy(handle); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_destroy(pkgmgrinfo_updateinfo_h update_handle); + +/** + * @fn int pkgmgrinfo_updateinfo_get_updateinfo(const char *pkgid, pkgmgrinfo_updateinfo_h *update_handle) + * @brief This API creates the package update information handle from db + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] pkgid pointer to package ID + * @param[in] uid the addressee user id of the instruction + * @param[out] update_handle pointer to the package update info 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_updateinfo_destroy() + * @see pkgmgrinfo_updateinfo_get_pkgid() + * @see pkgmgrinfo_updateinfo_get_version() + * @see pkgmgrinfo_updateinfo_get_update_type() + * @code +static int get_pkg_update_info(const char *pkgid) +{ + int ret = 0; + char *version; + pkgmgrinfo_updateinfo_h handle; + ret = pkgmgrinfo_updateinfo_get_updateinfo(pkgid, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_updateinfo_get_version(handle, &version); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_updateinfo_destroy(handle); + return -1; + } + printf("pkg update version: %s\n", version + pkgmgrinfo_updateinfo_destroy(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_get_updateinfo(const char *pkgid, pkgmgrinfo_updateinfo_h *update_handle); +int pkgmgrinfo_updateinfo_get_usr_updateinfo(const char *pkgid, pkgmgrinfo_updateinfo_h *update_handle, uid_t uid); + +/** + * @fn int pkgmgrinfo_updateinfo_set_pkgid(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *pkgid) + * @brief This API sets given pkgid into handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @param[in] pkgid package id + * @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 set_pkgid_to_handle(pkgmgrinfo_updateinfo_h handle, const char *pkgid) +{ + int ret = 0; + + ret = pkgmgrinfo_updateinfo_set_pkgid(handle, pkgid); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_set_pkgid(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *pkgid); + +/** + * @fn int pkgmgrinfo_updateinfo_set_version(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *version) + * @brief This API sets given version into handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @param[in] version update version + * @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 set_version_to_handle(pkgmgrinfo_updateinfo_h handle, const char *version) +{ + int ret = 0; + + ret = pkgmgrinfo_updateinfo_set_version(handle, version); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_set_version(pkgmgrinfo_updateinfo_h updateinfo_handle, const char *version); + +/** + * @fn int pkgmgrinfo_updateinfo_set_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type type) + * @brief This API sets given update type into handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @param[in] type update type + * @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 set_type_to_handle(pkgmgrinfo_updateinfo_h handle, pkgmgrinfo_updateinfo_update_type type) +{ + int ret = 0; + + ret = pkgmgrinfo_updateinfo_set_type(handle, type); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_set_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type type); + +/** + * @fn int pkgmgrinfo_updateinfo_get_pkgid(pkgmgrinfo_updateinfo_h update_handle, char **pkgid) + * @brief This API retrieves the pkgid from given update info + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @param[out] pkgid package id + * @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_pkgid_from_handle(pkgmgrinfo_updateinfo_h handle) +{ + int ret = 0; + char *pkgid; + + ret = pkgmgrinfo_updateinfo_get_pkgid(handle, &pkgid); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_get_pkgid(pkgmgrinfo_updateinfo_h update_handle, char **pkgid); + +/** + * @fn int pkgmgrinfo_updateinfo_get_version(pkgmgrinfo_updateinfo_h updateinfo_handle, char **version) + * @brief This API retrieves the version from given update info + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @param[out] version update version + * @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_version_from_handle(pkgmgrinfo_updateinfo_h handle) +{ + int ret = 0; + char *version; + + ret = pkgmgrinfo_updateinfo_get_version(handle, &version); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_get_version(pkgmgrinfo_updateinfo_h updateinfo_handle, char **version); + +/** + * @fn int pkgmgrinfo_updateinfo_get_update_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type *type) + * @brief This API retrieves the update type from given update info + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package update info handle + * @param[out] type update type + * @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_type_from_handle(pkgmgrinfo_updateinfo_h handle) +{ + int ret = 0; + pkgmgrinfo_updateinfo_update_type *type; + + ret = pkgmgrinfo_updateinfo_get_type(handle, &type); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_get_update_type(pkgmgrinfo_updateinfo_h updateinfo_handle, pkgmgrinfo_updateinfo_update_type *type); + + +/** + * @fn int pkgmgrinfo_updateinfo_foreach_updateinfo(pkgmgrinfo_foreach_updateinfo_cb callback, void *user_data) + * @brief This API retrieve the update informations and invoke given callback for it. + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] callback callback to be invoked for each retrieved informations + * @param[in] 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_updateinfo(pkgmgrinfo_foreach_updateinfo_cb callback) +{ + int ret = 0; + + ret = pkgmgrinfo_updateinfo_foreach_updateinfo(callback, NULL); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_updateinfo_foreach_updateinfo(pkgmgrinfo_foreach_updateinfo_cb callback, void *user_data); +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 * @@ -1584,7 +1950,7 @@ int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly); /** * @fn int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update) - * @brief This API gets the package 'upate' value from the package ID + * @brief This API gets the package 'update' value from the package ID * * @par This API is for package-manager client application * @par Sync (or) Async : Synchronous API @@ -1660,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 @@ -2095,6 +2461,7 @@ static int get_tpk_pkg_count() */ int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count); int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid); + /** * @fn int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data); @@ -2140,18 +2507,109 @@ 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_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users); - /** - * @fn int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_pkginfo_h *clone) - * @brief This API copy the application information handle + * @fn int pkgmgrinfo_pkginfo_foreach_appdefined_privilege(pkgmgrinfo_pkginfo_h handle, + pkgmgrinfo_pkg_appdefined_privilege_list_cb privilege_func, void *user_data); + * @brief This API gets the list of appdefined privilege 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[out] handle pointer to the package info handle. + * @param[in] handle pointer to the package info 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 + * @retval PMINFO_R_ERROR internal error + * @pre pkgmgrinfo_pkginfo_get_pkginfo() + * @post pkgmgrinfo_pkginfo_destroy_pkginfo() + * @code +int privilege_func(const char *name, const char *license_path, void *user_data) +{ + printf("appdefined privilege : %s", name); + if (license_path) + printf("licensed privilege, lecense path : %s", license_path); + return 0; +} + +static int list_appdefined_privilege(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_appdefined_privilege(handle, privilege_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_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); + +/** + * @fn int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_pkginfo_h *clone) + * @brief This API copy the application information handle + * + * @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[out] handle pointer to the package info handle. * @return 0 if success, error code(<0) if fail * @retval PMINFO_R_OK success * @retval PMINFO_R_EINVAL invalid argument @@ -3112,45 +3570,6 @@ static int get_app_notification_icon(const char *appid) int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon); /** - * @fn int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon) - * @brief This API gets the setting icon of the 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[out] path pointer to hold setting icon - * @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() - * @see pkgmgrinfo_appinfo_get_appid() - * @see pkgmgrinfo_appinfo_is_multiple() - * @code -static int get_app_setting_icon(const char *appid) -{ - int ret = 0; - char *setting_icon = NULL; - pkgmgrinfo_appinfo_h handle; - ret = pkgmgrinfo_appinfo_get_appinfo(appid, &handle); - if (ret != PMINFO_R_OK) - return -1; - ret = pkgmgrinfo_appinfo_get_setting_icon(handle, &setting_icon); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return -1; - } - printf("setting icon : %s\n", setting_icon); - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return 0; -} - * @endcode - */ -int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon); - -/** * @fn int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type) * @brief This API gets the type of recent image on app-tray * @@ -3542,6 +3961,49 @@ int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appi int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid, uid_t uid, char **appid); /** + * @fn int pkgmgrinfo_appinfo_get_datacontrol_trusted_info(const char *providerid, char **appid, bool *is_trusted); + * @brief This API gets the information about trusted datacontrol + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] providerid pointer to the providerid of datacontrol. + * @param[out] appid pointer to hold appid, need to free after using + * @param[out] is_trusted pointer to hold whether it provides trusted datacontrol + * @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_trusted_info(const char *providerid, + const char *type, char **appid, bool *is_trusted); +int pkgmgrinfo_appinfo_usr_get_datacontrol_trusted_info(const char *providerid, + const char *type, uid_t uid, char **appid, bool *is_trusted); + +/** + * @fn int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(const char *providerid, const char *type, + pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data); + * @brief This API retrieves the privileges and invokes given callback for each privilege. + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] providerid pointer to the providerid of datacontrol. + * @param[in] type pointer to the type of dataconltrol. + * @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 + * @retval PMINFO_R_ERROR internal error + */ +int pkgmgrinfo_appinfo_foreach_datacontrol_privileges(const char *providerid, const char *type, + pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data); +int pkgmgrinfo_appinfo_usr_foreach_datacontrol_privileges(const char *providerid, const char *type, + pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data, uid_t uid); + +/** * @fn int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid) * @brief This API gets the alias_appid of the application * @@ -3845,50 +4307,6 @@ static int get_app_support_mode(const char *appid) */ int pkgmgrinfo_appinfo_get_support_mode(pkgmgrinfo_appinfo_h handle, int *support_mode); -/** - * @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 - * - * @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] permission_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 permission_func(const char *name, void *user_data) -{ - if (strcmp(name, (char *)user_data) == 0) - return -1; - else - return 0; -} - -static int list_permission(const char *appid, char *permission) -{ - 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_permission(handle, permission_func, (void *)permission); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return -1; - } - pkgmgrinfo_appinfo_destroy_appinfo(handle); - return 0; -} - * @endcode - */ -int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle, - pkgmgrinfo_app_permission_list_cb permission_func, void *user_data); /** * @fn int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle, @@ -3982,6 +4400,33 @@ static int list_metadata(const char *appid, char *key) int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data); +/** + * @fn int pkgmgrinfo_appinfo_foreach_appcontrol_privileges(const char *appid, + * const char *operation, + * pkgmgrinfo_pkg_privilege_list_cb privilege_func, + * void *user_data); + * @brief This API gets the list of privileges for a particular + * appllication's app_control + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * @param[in] appid application id + * @param[in] operation operation 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 + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @retval PMINFO_R_ERROR internal error + */ +int pkgmgrinfo_appinfo_usr_foreach_appcontrol_privileges(const char *appid, + 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, + pkgmgrinfo_pkg_privilege_list_cb privilege_func, + void *user_data); /** * @fn int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle, @@ -4037,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 */ @@ -4758,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 @@ -5405,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. @@ -5862,19 +6336,607 @@ int pkgmgrinfo_compare_package_version(const char *current_version, const char *target_version, pkgmgrinfo_version_compare_type *res); /** - * @brief TEMP + * @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 *from const char *to, const char *type, + const char *required_version,void *user_data) +{ + printf("this package %s %s", type, to); + 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_depends_on(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 directly + * and indirectly 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 *from, const char *to, const char *type, + const char *required_version,void *user_data) +{ + printf("%s %s %s package", from, to, type); + if (required_version) + printf("required version : %s", required_version); + return 0; +} -int pkgmgrinfo_pkginfo_get_usr_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb, - int flag, void *user_data, uid_t uid); -int pkgmgrinfo_pkginfo_get_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb, - int flag, void *user_data); -int pkgmgrinfo_appinfo_get_usr_installed_list_full( - pkgmgrinfo_app_list_cb app_func, uid_t uid, int flag, - void *user_data); -int pkgmgrinfo_appinfo_get_installed_list_full( - pkgmgrinfo_app_list_cb app_func, int flag, void *user_data); +static int list_depends_on(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_depends_on(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_depends_on(pkgmgrinfo_pkginfo_h handle, + pkgmgrinfo_pkg_dependency_list_cb dependency_cb, + 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 + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * @param[in] pkg_list_cb iteration function for list + * @param[in] flag enum value of pkgmgrinfo_pkginfo_get_option used for masking package's information + * @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 None + * @post None + * @see pkgmgrinfo_pkginfo_get_option + * @code +int pkg_list_cb(pkgmgrinfo_pkginfo_h handle, void *user_data) +{ + char *label1 = NULL; + char *label2 = NULL; + label1 = (char *)user_data; + pkgmgrinfo_pkginfo_get_label(handle, &label2); + if (strcmp(label1, label2) == 0) + return -1; + else + return 0; +} + +static int list_pkgs() +{ + int ret = 0; + char *label = "helloworld"; + ret = pkgmgrinfo_pkginfo_get_list_full(pkg_list_cb, PMINFO_PKGINFO_GET_LABEL, (void *)name); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_pkginfo_get_usr_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb, + int flag, void *user_data, uid_t uid); +int pkgmgrinfo_pkginfo_get_list_full(pkgmgrinfo_pkg_list_cb pkg_list_cb, + int flag, void *user_data); + +/** + * @fn int pkgmgrinfo_appinfo_get_installed_list_full(pkgmgrinfo_app_list_cb app_func, int flag, void *user_data) + * @brief This API gets list of installed applications from all packages using flag that used for masking application's information + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * @param[in] app_func iteration function for list + * @param[in] flag enum value of pkgmgrinfo_appinfo_get_option used for masking application's information + * @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 None + * @post None + * @see pkgmgrinfo_appinfo_get_option + * @code +int app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data) +{ + int ret = 0; + char *label1 = NULL; + char *label2 = NULL; + label1 = (char *)user_data; + ret = pkgmgrinfo_appinfo_get_label(handle, &label2); + if (ret != PMINFO_R_OK) { + printf("pkgmgrinfo_appinfo_get_label fail"); + return -1; + } + if (strcmp(label1, label2) == 0) + return -1; + else + return 0; +} + +static int list_apps() +{ + int ret = 0; + char *label = "helloworld"; + ret = pkgmgrinfo_appinfo_get_installed_list_full(app_list_cb, PMINFO_APPINFO_GET_LABEL, (void *)label); + if (ret != PMINFO_R_OK) + return -1; + return 0; +} + * @endcode + */ +int pkgmgrinfo_appinfo_get_usr_installed_list_full( + pkgmgrinfo_app_list_cb app_func, uid_t uid, int flag, + void *user_data); +int pkgmgrinfo_appinfo_get_installed_list_full( + pkgmgrinfo_app_list_cb app_func, int flag, void *user_data); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_archiveinfo(const char *path, pkgmgrinfo_archiveinfo_h *handle) + * @brief This API creates the package archive information handle from given path + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] path path of package archive + * @param[out] handle pointer to the package archive info 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_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_type(const char *path) +{ + int ret = 0; + char *type = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_type(handle, &type); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive type: %s\n", type); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_archiveinfo(const char *path, + pkgmgrinfo_archiveinfo_h *handle); + +/** + * @fn int pkgmgrinfo_archiveinfo_destroy_archiveinfo(pkgmgrinfo_archiveinfo_h handle) + * @brief This API destroys the package archive information handle freeing up all the resources + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to the package archive info handle + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post None + * @code +static int get_pkg_archive_type(const char *path) +{ + int ret = 0; + char *type = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_type(handle, &type); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive type: %s\n", type); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_destroy_archiveinfo(pkgmgrinfo_archiveinfo_h handle); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_pkgid(pkgmgrinfo_archiveinfo_h handle, char **pkgid) + * @brief This API gets the package id from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] pkgid pointer to hold package id + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_id(const char *path) +{ + int ret = 0; + char *pkg_id = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_pkgid(handle, &pkg_id); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive id: %s\n", pkg_id); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_pkgid(pkgmgrinfo_archiveinfo_h handle, + const char **pkgid); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_type(pkgmgrinfo_archiveinfo_h handle, char **type) + * @brief This API gets the package type from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] type pointer to hold package type + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_type(const char *path) +{ + int ret = 0; + char *type = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_type(handle, &type); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive type: %s\n", type); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_type(pkgmgrinfo_archiveinfo_h handle, + const char **type); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_version(pkgmgrinfo_archiveinfo_h handle, char **version) + * @brief This API gets the package version from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] version pointer to hold package version + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_version(const char *path) +{ + int ret = 0; + char *version = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_version(handle, &version); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive version: %s\n", version); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_version(pkgmgrinfo_archiveinfo_h handle, + const char **version); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_api_version(pkgmgrinfo_archiveinfo_h handle, char **api_version) + * @brief This API gets the package api version from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] api_version pointer to hold package api_version + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_api_version(const char *path) +{ + int ret = 0; + char *api_version = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_api_version(handle, &api_version); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive api_version: %s\n", api_version); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_api_version(pkgmgrinfo_archiveinfo_h handle, + const char **api_version); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_description(pkgmgrinfo_archiveinfo_h handle, char **description) + * @brief This API gets the package description from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] description pointer to hold package description + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_description(const char *path) +{ + int ret = 0; + char *description = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_description(handle, &description); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive description: %s\n", description); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_description(pkgmgrinfo_archiveinfo_h handle, + const char **description); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_label(pkgmgrinfo_archiveinfo_h handle, char **label) + * @brief This API gets the package label from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive 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 + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_label(const char *path) +{ + int ret = 0; + char *label = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_label(handle, &label); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive label: %s\n", label); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_label(pkgmgrinfo_archiveinfo_h handle, + const char **label); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_author(pkgmgrinfo_archiveinfo_h handle, char **author) + * @brief This API gets the package author from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] author pointer to hold package author + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_author(const char *path) +{ + int ret = 0; + char *author = NULL; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_author(handle, &author); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive author: %s\n", author); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_author(pkgmgrinfo_archiveinfo_h handle, + const char **author); + +/** + * @fn int pkgmgrinfo_archiveinfo_get_icon(pkgmgrinfo_archiveinfo_h handle, const unsigned char **icon, size_t *size) + * @brief This API gets the package icon and size from the package archive info handle + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[out] icon pointer to hold package icon + * @param[out] size pointer to hold size of package icon + * @return 0 if success, error code(<0) if fail + * @retval PMINFO_R_OK success + * @retval PMINFO_R_EINVAL invalid argument + * @retval PMINFO_R_ENOENT no result + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_icon(const char *path) +{ + int ret = 0; + unsigned char *icon = NULL; + size_t icon_size = 0; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_get_icon(handle, &icon, &icon_size); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + printf("pkg archive icon size : %zu\n", icon_size); + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_get_icon(pkgmgrinfo_archiveinfo_h handle, + const unsigned char **icon, size_t *size); + +/** + * @fn int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle, pkgmgrinfo_dependency_cb callback, void *user_data) + * @brief This API retrieve the dependency information and invoke given callback for it. + * + * @par This API is for package-manager client application + * @par Sync (or) Async : Synchronous API + * + * @param[in] handle pointer to package archive info handle + * @param[in] callback callback to be invoked for each retrieved dependency information + * @param[in] 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 + * @pre pkgmgrinfo_archiveinfo_get_archiveinfo() + * @post pkgmgrinfo_archiveinfo_destroy_archiveinfo() + * @code +static int get_pkg_archive_dependency(const char *path, pkgmgrinfo_pkg_dependency_list_cb callback) +{ + int ret = 0; + size_t icon_size = 0; + pkgmgrinfo_archiveinfo_h handle; + ret = pkgmgrinfo_archiveinfo_get_archiveinfo(path, &handle); + if (ret != PMINFO_R_OK) + return -1; + ret = pkgmgrinfo_archiveinfo_foreach_dependency(handle, callback, NULL); + if (ret != PMINFO_R_OK) { + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return -1; + } + pkgmgrinfo_archiveinfo_destroy_archiveinfo(handle); + return 0; +} + * @endcode + */ +int pkgmgrinfo_archiveinfo_foreach_dependency(pkgmgrinfo_archiveinfo_h handle, + pkgmgrinfo_pkg_dependency_list_cb callback, void *user_data); /** * @pkgmgrinfo client API end