From f94ce531d6f3833ad2867fa84f6e6e1437c612be Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 28 Jul 2015 14:58:18 +0900 Subject: [PATCH] Remove obsolete apis we should use pkgmgr-info apis instead of pkgmgr_pkginfo_* / pkgmgr_appinfo_* remove pkgmgr-dbinfo.h Change-Id: I56b8931d547cba4b4cd262e863d88610ff19cf07 Signed-off-by: Sangyoon Jang --- client/CMakeLists.txt | 3 +- client/include/package-manager.h | 556 ------------------------------- client/src/pkgmgr-dbinfo.c | 146 -------- client/src/pkgmgr.c | 431 +++--------------------- include/SLP_package_manager_PG.h | 276 --------------- include/pkgmgr-dbinfo.h | 1 - packaging/pkgmgr.spec | 1 - tool/pkg_cmd.c | 41 +-- tool/pkg_info.c | 417 ++++++----------------- 9 files changed, 156 insertions(+), 1716 deletions(-) delete mode 100644 client/src/pkgmgr-dbinfo.c delete mode 100644 include/SLP_package_manager_PG.h delete mode 120000 include/pkgmgr-dbinfo.h diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 95b961b..8c16544 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,6 +1,6 @@ # package manager client library -SET(SRCS src/pkgmgr-internal.c src/pkgmgr.c src/pkgmgr-dbinfo.c) +SET(SRCS src/pkgmgr-internal.c src/pkgmgr.c) pkg_check_modules(CLIENT_DEPS REQUIRED dbus-glib-1 @@ -32,6 +32,5 @@ CONFIGURE_FILE(pkg_path.conf.in pkg_path.conf @ONLY) INSTALL(TARGETS ${PKGMGR_CLIENT} DESTINATION ${LIB_INSTALL_DIR} COMPONENT RuntimeLibraries) INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/package-manager.h DESTINATION include) -INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/pkgmgr-dbinfo.h DESTINATION include) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgmgr.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkg_path.conf DESTINATION ${SYSCONFDIR}/package-manager/) diff --git a/client/include/package-manager.h b/client/include/package-manager.h index 57865ee..f2843d7 100644 --- a/client/include/package-manager.h +++ b/client/include/package-manager.h @@ -200,10 +200,6 @@ typedef enum _pkgmgr_return_val { * @{ */ -typedef void* pkgmgr_pkginfo_h; -typedef void* pkgmgr_appinfo_h; -typedef void* pkgmgr_certinfo_h; - typedef void pkgmgr_client; typedef void pkgmgr_info; @@ -223,25 +219,12 @@ typedef int (*pkgmgr_handler)(uid_t target_uid, int req_id, const char *pkg_type const char *pkgid, const char *key, const char *val, const void *pmsg, void *data); -typedef int (*pkgmgr_info_pkg_list_cb ) (const pkgmgr_pkginfo_h handle, - void *user_data); - -typedef int (*pkgmgr_info_app_list_cb ) (const pkgmgr_appinfo_h handle, - void *user_data); - -typedef int (*pkgmgr_info_app_category_list_cb ) (const char *category_name, - void *user_data); - typedef void (*pkgmgr_pkg_size_info_receive_cb)(pkgmgr_client *pc, const char *pkgid, const pkg_size_info_t *size_info, void *user_data); typedef void (*pkgmgr_total_pkg_size_info_receive_cb)(pkgmgr_client *pc, const pkg_size_info_t *size_info, void *user_data); -typedef void pkgmgr_client; - -typedef void pkgmgr_info; - typedef enum { PC_REQUEST = 0, PC_LISTENING, @@ -253,46 +236,11 @@ typedef enum { PM_QUIET }pkgmgr_mode; -typedef enum { - PM_INSTALL_LOCATION_AUTO = 0, - PM_INSTALL_LOCATION_INTERNAL_ONLY, - PM_INSTALL_LOCATION_PREFER_EXTERNAL, -}pkgmgr_install_location; - -typedef enum { - PM_HWACCELERATION_NOT_USE_GL = 0, - PM_HWACCELERATION_USE_GL = 1, - PM_HWACCELERATION_USE_SYSTEM_SETTING = 2, -}pkgmgr_hwacceleration_type; - -typedef enum { - PM_ALL_APP = 0, - PM_UI_APP, - PM_SVC_APP -}pkgmgr_app_component; - typedef enum { PM_MOVE_TO_INTERNAL = 0, PM_MOVE_TO_SDCARD = 1, }pkgmgr_move_type; -typedef enum { - PM_INTERNAL_STORAGE = 0, - PM_EXTERNAL_STORAGE = 1, -}pkgmgr_installed_storage; - -typedef enum { - PM_AUTHOR_ROOT_CERT = 0, - PM_AUTHOR_INTERMEDIATE_CERT = 1, - PM_AUTHOR_SIGNER_CERT = 2, - PM_DISTRIBUTOR_ROOT_CERT = 3, - PM_DISTRIBUTOR_INTERMEDIATE_CERT = 4, - PM_DISTRIBUTOR_SIGNER_CERT = 5, - PM_DISTRIBUTOR2_ROOT_CERT = 6, - PM_DISTRIBUTOR2_INTERMEDIATE_CERT = 7, - PM_DISTRIBUTOR2_SIGNER_CERT = 8, -}pkgmgr_cert_type; - typedef enum { PM_REQUEST_CSC = 0, PM_REQUEST_MOVE = 1, @@ -789,510 +737,6 @@ char * pkgmgr_info_get_string(pkgmgr_info * pkg_info, const char *key); */ int pkgmgr_info_free(pkgmgr_info * pkg_info); -/** - * @brief This API gets list of installed applications. - * - * This API is for package-manager client application.\n - * - * @param[in] pkg_list_cb iteration function for list - * @param[in] user_data user data to be passed to callback function - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data); -int pkgmgr_pkginfo_get_usr_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid); -/** - * @brief This API get package info entry from db - * - * This API is for package-manager client application.\n - * - * @param[in] pkgid pointer to package id - * @param[out] handle pointer to the package info handle. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle); -int pkgmgr_pkginfo_get_usr_pkginfo(const char *pkgid, uid_t uid,pkgmgr_pkginfo_h *handle); - -/** - * @brief This API gets type of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] type to hold package type. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name); - -/** - * @brief This API gets id of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out]pkgid to hold package id. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid); - -/** - * @brief This API gets type of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] type to hold package type. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type); - -/** - * @brief This API gets version of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] version to hold package version. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version); - -/** - * @brief This API gets install location of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] location to hold install location. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location); - -/** - * @brief This API gets package size of the given package in case of external installation. - * size will be 0 if package install location is internal-only. - * size will be 0 if package install location is prefer-external but size is not specified in manifest file. - * Application should check the return value and use it distinguish the above cases. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] size to hold package size. - * @return 0 if success, error code(<0) if fail\n - * @return -*/ -int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size); - -/** - * @brief This API gets icon of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] icon to hold package icon. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon); - -/** - * @brief This API gets label of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] label to hold package label. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label); - -/** - * @brief This API gets desription of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] description to hold package description. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description); - -/** - * @brief This API gets author's name of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] author_name to hold author's name. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name); - -/** - * @brief This API gets author's email of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] author_email to hold author's email id. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email); - -/** - * @brief This API gets author's href of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] author_href to hold author's href. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href); - -/** - * @brief This API gets removable of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] removable to hold removable value. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable); - -/** - * @brief This API gets preload of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] preload to hold preload value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload); - -/** - * @brief This API gets readonly value of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] readonly to hold readonly value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly); - -/** - * @brief This API gets accessible of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] pkgid id of package - * @param[out]accessible accessible of package - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible); - -/** - * @brief This API destroy the pacakge info handle - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle); - -/** - * @brief This API gets installed storage of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] pkgid id of package - * @param[out] storage storage of package - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage); - -/** - * @brief This API gets installed time of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[out] installed_time installed time of package - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time); - -/** - * @brief This API gets list of ui-application/service application of the given package. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[in] component application component type. - * @param[in] app_func application's callback function. - * @param[in] user_data user data to be passed to callback function - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component, - pkgmgr_info_app_list_cb app_func, void *user_data); -int pkgmgr_appinfo_get_usr_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component, - pkgmgr_info_app_list_cb app_func, void *user_data, uid_t uid); -/** - * @brief This API gets list of category for ui-application/service application. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to package info handle - * @param[in] category_func callback function. - * @param[in] user_data user data to be passed to callback function - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func, - void *user_data); - -/** - * @brief This API gets application info entry from db. - * - * This API is for package-manager client application.\n - * - * @param[in] appid application id - * @param[out] handle pointer to app info handle - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle); - -/** - * @brief This API gets appid of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] appid to hold appid value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h handle, char **appid); - -/** - * @brief This API gets pkgid of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out]pkg_name to hold pkgid value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h handle, char **pkg_name); - -/** - * @brief This API gets pkgid of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] pkgid to hold pkgid value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h handle, char **pkgid); - -/** - * @brief This API gets exec of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] exec to hold exec value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h handle, char **exec); - -/** - * @brief This API gets icon name of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] icon to hold icon value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h handle, char **icon); - -/** - * @brief This API gets label of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] label to hold label value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h handle, char **label); - -/** - * @brief This API gets package name of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] package to hold package value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_package(pkgmgr_appinfo_h handle, char **package); - -/** - * @brief This API gets component type of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] component to hold component value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h handle, pkgmgr_app_component *component); - -/** - * @brief This API gets app type of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] app_type to hold the apptype. - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h handle, char **app_type); - -/** - * @brief This API gets nodisplay value of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] nodisplay to hold the nodisplay value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h handle, bool *nodisplay); - -/** - * @brief This API gets multiple value of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] multiple to hold the multiple value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h handle, bool *multiple); - -/** - * @brief This API gets taskmanage value of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] taskmanage to hold the taskmanage value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h handle, bool *taskmanage); - -/** - * @brief This API gets hwacceleration value of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] hwacceleration to hold the hwacceleration value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h handle, pkgmgr_hwacceleration_type *hwacceleration); - -/** - * @brief This API gets onboot value of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] onboot to hold the onboot value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h handle, bool *onboot); - -/** - * @brief This API gets autorestart value of the given appid. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @param[out] autorestart to hold the autorestart value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h handle, bool *autorestart); - -/** - * @brief This API destroy the appinfo handle. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to app info handle - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h handle); - -/** - * @brief This API creates the certinfo handle. - * - * This API is for package-manager client application.\n - * - * @param[out] handle pointer to cert info handle - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle); - -/** - * @brief This API loads cert info in the handle. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to cert info handle - * @param[in] pkgid package ID - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle, uid_t uid); - -/** - * @brief This API gets cert value for corresponding cert type. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to cert info handle - * @param[in] cert_type enum value for certificate type - * @param[out] cert_value pointer to store cert value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value); - -/** - * @brief This API destroys cert info handle freeing all resources. - * - * This API is for package-manager client application.\n - * - * @param[in] handle pointer to cert info handle - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle); - -/** - * @brief This API gets datacontrol info entry from db. - * - * This API is for package-manager client application.\n - * - * @param[in] providerid pointer to providerid - * @param[in] type pointer to type - * @param[out] appid pointer to appid value - * @param[out] access pointer to access value - * @return 0 if success, error code(<0) if fail\n -*/ -int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access); /** @} */ diff --git a/client/src/pkgmgr-dbinfo.c b/client/src/pkgmgr-dbinfo.c deleted file mode 100644 index 718dc83..0000000 --- a/client/src/pkgmgr-dbinfo.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - - - - -#include -#include -#include -#include -#include -#include -#include - -#include "package-manager.h" -#include "package-manager-types.h" -#include "pkgmgr-internal.h" -#include "pkgmgr-api.h" -#include "pkgmgr-dbinfo.h" -#include - -API int pkgmgr_create_pkgdbinfo(const char *pkgid, pkgmgr_pkgdbinfo_h *handle) -{ - int ret = 0; - ret = pkgmgrinfo_create_pkgdbinfo(pkgid, handle); - return ret; -} -API int pkgmgr_create_pkgusrdbinfo(const char *pkgid, uid_t uid, pkgmgr_pkgdbinfo_h *handle) -{ - int ret = 0; - ret = pkgmgrinfo_create_pkgusrdbinfo(pkgid, uid, handle); - return ret; -} - -API int pkgmgr_set_type_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *type) -{ - int ret = 0; - ret = pkgmgrinfo_set_type_to_pkgdbinfo(handle, type); - return ret; -} - -API int pkgmgr_set_version_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *version) -{ - int ret = 0; - ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, version); - return ret; -} - -API int pkgmgr_set_install_location_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, PM_INSTALL_LOCATION location) -{ - int ret = 0; - ret = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, location); - return ret; -} - -API int pkgmgr_set_size_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *size) -{ - int ret = 0; - ret = pkgmgrinfo_set_size_to_pkgdbinfo(handle, size); - return ret; -} - -API int pkgmgr_set_label_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *label, const char *locale) -{ - int ret = 0; - ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, label, locale); - return ret; -} - -API int pkgmgr_set_icon_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *icon, const char *locale) -{ - int ret = 0; - ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, icon, locale); - return ret; -} - -API int pkgmgr_set_description_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *description, const char *locale) -{ - int ret = 0; - ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, description, locale); - return ret; -} - -API int pkgmgr_set_author_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, const char *author_name, - const char *author_email, const char *author_href, const char *locale) -{ - int ret = 0; - ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, author_name, author_email, author_href, locale); - return ret; -} - -API int pkgmgr_set_removable_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, int removable) -{ - int ret = 0; - ret = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, removable); - return ret; -} - -API int pkgmgr_set_preload_to_pkgdbinfo(pkgmgr_pkgdbinfo_h handle, int preload) -{ - int ret = 0; - ret = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, preload); - return ret; -} - -API int pkgmgr_save_pkgdbinfo(pkgmgr_pkgdbinfo_h handle) -{ - int ret = 0; - ret = pkgmgrinfo_save_pkgdbinfo(handle); - return ret; -} - -API int pkgmgr_save_pkgusrdbinfo(pkgmgr_pkgdbinfo_h handle, uid_t uid) -{ - int ret = 0; - ret = pkgmgrinfo_save_pkgusrdbinfo(handle, uid); - return ret; -} - -API int pkgmgr_destroy_pkgdbinfo(pkgmgr_pkgdbinfo_h handle) -{ - int ret = 0; - ret = pkgmgrinfo_destroy_pkgdbinfo(handle); - return ret; -} - diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c index 303f3ff..40f9839 100644 --- a/client/src/pkgmgr.c +++ b/client/src/pkgmgr.c @@ -29,13 +29,14 @@ #include #include #include + #include #include + #include #include #include #include - /* For multi-user support */ #include @@ -666,11 +667,11 @@ static int __pkgmgr_proc_iter_kill_cmdline(const char *apppath) } -static int __app_list_cb (const pkgmgr_appinfo_h handle, +static int __app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data) { char *exec = NULL; - pkgmgr_appinfo_get_exec(handle, &exec); + pkgmgrinfo_appinfo_get_exec(handle, &exec); __pkgmgr_proc_iter_kill_cmdline(exec); @@ -894,10 +895,10 @@ static int __move_pkg_process(pkgmgr_client * pc, const char *pkgid, uid_t uid, ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); else ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); - retvm_if(ret < 0, PKGMGR_R_ERROR, "pkgmgr_pkginfo_get_pkginfo failed"); + retvm_if(ret < 0, PKGMGR_R_ERROR, "pkgmgrinfo_pkginfo_get_pkginfo failed"); ret = pkgmgrinfo_pkginfo_get_type(handle, &pkgtype); - tryvm_if(ret < 0, ret = PKGMGR_R_ERROR, "pkgmgr_pkginfo_get_type failed"); + tryvm_if(ret < 0, ret = PKGMGR_R_ERROR, "pkgmgrinfo_pkginfo_get_type failed"); installer_path = _get_backend_path_with_type(pkgtype); req_key = __get_req_key(pkgid); @@ -976,10 +977,10 @@ static int __check_app_process(pkgmgr_request_service_type service_type, pkgmgr_ ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); else ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); - retvm_if(ret < 0, PKGMGR_R_ERROR, "pkgmgr_pkginfo_get_pkginfo failed"); + retvm_if(ret < 0, PKGMGR_R_ERROR, "pkgmgrinfo_pkginfo_get_pkginfo failed"); ret = pkgmgrinfo_pkginfo_get_type(handle, &pkgtype); - tryvm_if(ret < 0, ret = PKGMGR_R_ERROR, "pkgmgr_pkginfo_get_type failed"); + tryvm_if(ret < 0, ret = PKGMGR_R_ERROR, "pkgmgrinfo_pkginfo_get_type failed"); /* 2. generate req_key */ req_key = __get_req_key(pkgid); @@ -1584,38 +1585,38 @@ API int pkgmgr_client_usr_uninstall(pkgmgr_client *pc, const char *pkg_type, /* 1. check argument */ retv_if(pkgid == NULL, PKGMGR_R_EINVAL); - pkgmgr_pkginfo_h handle; - ret = pkgmgr_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); + pkgmgrinfo_pkginfo_h handle; + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); /*check package id */ - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_pkginfo_get_pkginfo fail"); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_pkginfo_get_pkginfo fail"); tryvm_if(handle == NULL, ret = PKGMGR_R_EINVAL, "Pkgid(%s) can not find in installed pkg DB! \n", pkgid); if (uid != GLOBAL_USER) { /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_usr_list(handle, PM_UI_APP, __app_list_cb, NULL, uid); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_UI_APP fail"); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_UI_APP, __app_list_cb, NULL, uid); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_UI_APP fail"); /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_usr_list(handle, PM_SVC_APP, __app_list_cb, NULL, uid); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_SVC_APP fail"); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_SVC_APP, __app_list_cb, NULL, uid); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_SVC_APP fail"); } else { /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, __app_list_cb, NULL); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_UI_APP fail"); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, __app_list_cb, NULL); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_UI_APP fail"); /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, __app_list_cb, NULL); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_SVC_APP fail"); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_SVC_APP, __app_list_cb, NULL); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_SVC_APP fail"); } /*check type */ - ret = pkgmgr_pkginfo_get_type(handle, &pkgtype); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_pkginfo_get_type fail"); + ret = pkgmgrinfo_pkginfo_get_type(handle, &pkgtype); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_pkginfo_get_type fail"); tryvm_if(pkgtype == NULL, ret = PKGMGR_R_ERROR, "pkgtype is NULL"); /*check removable, execpt "rpm" type */ if (strcmp(pkgtype, "rpm")) { - pkgmgr_pkginfo_is_removable(handle, &removable); + pkgmgrinfo_pkginfo_is_removable(handle, &removable); tryvm_if(removable == false, ret = PKGMGR_R_ERROR, "Pkgid(%s) can not be removed, This is non-removalbe package...\n", pkgid); } @@ -1685,7 +1686,7 @@ catch: if(args) free(args); - pkgmgr_pkginfo_destroy_pkginfo(handle); + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); return ret; } @@ -1848,36 +1849,36 @@ API int pkgmgr_client_move_usr_pkg(pkgmgr_client *pc, const char *pkg_type, /* 1. check argument */ retv_if(pkgid == NULL, PKGMGR_R_EINVAL); - pkgmgr_pkginfo_h handle; + pkgmgrinfo_pkginfo_h handle; if (uid != GLOBAL_USER) - ret = pkgmgr_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); else - ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle); + ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); /*check package id */ - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_pkginfo_get_pkginfo fail"); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_pkginfo_get_pkginfo fail"); tryvm_if(handle == NULL, ret = PKGMGR_R_EINVAL, "Pkgid(%s) can not find in installed pkg DB! \n", pkgid); if (uid != GLOBAL_USER) { /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_usr_list(handle, PM_UI_APP, __app_list_cb, NULL, uid); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_UI_APP fail"); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_UI_APP, __app_list_cb, NULL, uid); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_UI_APP fail"); /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_usr_list(handle, PM_SVC_APP, __app_list_cb, NULL, uid); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_SVC_APP fail"); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_SVC_APP, __app_list_cb, NULL, uid); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_SVC_APP fail"); } else { /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, __app_list_cb, NULL); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_UI_APP fail"); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, __app_list_cb, NULL); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_UI_APP fail"); /*check running app , terminate app if it is running*/ - ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, __app_list_cb, NULL); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_SVC_APP fail"); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_SVC_APP, __app_list_cb, NULL); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_appinfo_get_list : PMINFO_SVC_APP fail"); } /*check type */ - ret = pkgmgr_pkginfo_get_type(handle, &pkgtype); - tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_pkginfo_get_type fail"); + ret = pkgmgrinfo_pkginfo_get_type(handle, &pkgtype); + tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgrinfo_pkginfo_get_type fail"); tryvm_if(pkgtype == NULL, ret = PKGMGR_R_ERROR, "pkgtype is NULL"); /*check pkgid length */ @@ -1949,7 +1950,7 @@ catch: if(args) free(args); - pkgmgr_pkginfo_destroy_pkginfo(handle); + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); return ret; } @@ -2561,10 +2562,10 @@ API int pkgmgr_client_usr_clear_cache_dir(const char *pkgid, uid_t uid) if (strcmp(pkgid, PKG_CLEAR_ALL_CACHE) != 0) { ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); - tryvm_if(ret < 0, ret = PKGMGR_R_ENOPKG, "pkgmgr_pkginfo_get_pkginfo failed"); + tryvm_if(ret < 0, ret = PKGMGR_R_ENOPKG, "pkgmgrinfo_pkginfo_get_pkginfo failed"); ret = pkgmgrinfo_pkginfo_get_type(handle, &pkg_type); - tryvm_if(ret < 0, ret = PKGMGR_R_ESYSTEM, "pkgmgr_pkginfo_get_type failed"); + tryvm_if(ret < 0, ret = PKGMGR_R_ESYSTEM, "pkgmgrinfo_pkginfo_get_type failed"); } else { @@ -2949,355 +2950,3 @@ API int pkgmgr_info_free(pkgmgr_info * pkg_info) } #define __END_OF_OLD_API - -API int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, user_data); - return ret; -} - -API int pkgmgr_pkginfo_get_usr_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_usr_list(pkg_list_cb, user_data, uid); - return ret; -} - - -API int pkgmgr_pkginfo_get_usr_pkginfo(const char *pkgid, uid_t uid, pkgmgr_pkginfo_h *handle) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, handle); - return ret; -} - - -API int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, handle); - return ret; -} - - - -API int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_pkgname(handle, pkg_name); - return ret; -} - - -API int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_pkgid(handle, pkgid); - return ret; -} - -API int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_type(handle, type); - return ret; -} - -API int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_version(handle, version); - return ret; -} - -API int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location) -{ - int ret = 0; - pkgmgrinfo_install_location loc; - ret = pkgmgrinfo_pkginfo_get_install_location(handle, &loc); - *location = loc; - return ret; -} - -API int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_package_size(handle, size); - return ret; -} - -API int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_icon(handle, icon); - return ret; -} - -API int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_label(handle, label); - return ret; -} - -API int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_description(handle, description); - return ret; -} - -API int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_author_name(handle, author_name); - return ret; -} - -API int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_author_email(handle, author_email); - return ret; -} - -API int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_author_href(handle, author_href); - return ret; -} - -API int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_is_removable(handle, removable); - return ret; -} - -API int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_is_preload(handle, preload); - return ret; -} - -API int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_is_readonly(handle, readonly); - return ret; -} - -API int pkgmgr_pkginfo_is_for_all_users(pkgmgr_pkginfo_h handle, bool *for_all_users) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_is_for_all_users(handle, for_all_users); - return ret; -} - -API int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_is_accessible(handle, accessible); - return ret; -} - -API int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_destroy_pkginfo(handle); - return ret; -} - -API int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage) -{ - int ret = 0; - pkgmgrinfo_installed_storage sto; - ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, &sto); - *storage = sto; - return ret; -} - -API int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_installed_time(handle, installed_time); - return ret; -} - -API int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component, - pkgmgr_info_app_list_cb app_func, void *user_data) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_list(handle, component, app_func, user_data); - return ret; -} - -API int pkgmgr_appinfo_get_usr_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component, - pkgmgr_info_app_list_cb app_func, void *user_data, uid_t uid) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_usr_list(handle, component, app_func, user_data, uid); - return ret; -} - -API int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func, - void *user_data) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, user_data); - return ret; -} - -API int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_appinfo(appid, handle); - return ret; -} - -API int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h handle, char **appid) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_appid(handle, appid); - return ret; -} - -API int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h handle, char **pkg_name) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_pkgname(handle, pkg_name); - return ret; -} - -API int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h handle, char **pkgid) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_pkgid(handle, pkgid); - return ret; -} - -API int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h handle, char **icon) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_icon(handle, icon); - return ret; -} - -API int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h handle, char **label) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_label(handle, label); - return ret; -} - -API int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h handle, char **exec) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_exec(handle, exec); - return ret; -} - -API int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h handle, pkgmgr_app_component *component) -{ - int ret = 0; - pkgmgrinfo_app_component comp; - ret = pkgmgrinfo_appinfo_get_component(handle, &comp); - *component = comp; - return ret; -} - -API int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h handle, char **app_type) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_get_apptype(handle, app_type); - return ret; -} - -API int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h handle, bool *nodisplay) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_is_nodisplay(handle, nodisplay); - return ret; -} - -API int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h handle, bool *multiple) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_is_multiple(handle, multiple); - return ret; -} - -API int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h handle, bool *taskmanage) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_is_taskmanage(handle, taskmanage); - return ret; -} - -API int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h handle, pkgmgr_hwacceleration_type *hwacceleration) -{ - int ret = 0; - pkgmgrinfo_app_hwacceleration hwacc; - ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacc); - *hwacceleration = hwacc; - return ret; -} - -API int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h handle, bool *onboot) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_is_onboot(handle, onboot); - return ret; -} - -API int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h handle, bool *autorestart) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_is_autorestart(handle, autorestart); - return ret; -} - -API int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h handle) -{ - int ret = 0; - ret = pkgmgrinfo_appinfo_destroy_appinfo(handle); - return ret; -} - -API int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_create_certinfo(handle); - return ret; -} - -API int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle, uid_t uid) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle, uid); - return ret; -} - -API int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_get_cert_value(handle, cert_type, cert_value); - return ret; -} - -API int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle) -{ - int ret = 0; - ret = pkgmgrinfo_pkginfo_destroy_certinfo(handle); - return ret; -} - -API int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access) -{ - int ret = 0; - ret = pkgmgrinfo_datacontrol_get_info(providerid, type, appid, access); - return ret; -} diff --git a/include/SLP_package_manager_PG.h b/include/SLP_package_manager_PG.h deleted file mode 100644 index 3e38659..0000000 --- a/include/SLP_package_manager_PG.h +++ /dev/null @@ -1,276 +0,0 @@ -/* - * slp-pkgmgr - * - * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved. - * - * Contact: Jayoun Lee , Sewook Park , - * Jaeho Lee , Shobhit Srivastava - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - */ - - - - - -/** - - * - * @ingroup SLP_PG - * @defgroup PackageManagerClient - - -@par package manager Programming Guide - -

Introduction

-

Purpose of this document

-The purpose of this document is to describe how applications can usepackage manager APIs.\n -This document gives only programming guidelines to application engineers. - -

Scope

-The scope of this document is limited to Samsung platform package manager API usage. - -

Architecture

-

Architecture overview

-package manager is responsible for installing / uninstalling / activating application. It also support getting application list API \n - -Dbus is used for communication between frontend and package-server / package-server and client library..\n -Each type of packages have been implemented and these are used for each type of operation. - -@image html high-level.png "High-Level Architure" - -

SLP Features

-package manager has the following features:\n - - - Install /Uninstall /Activate Application (Primitive APIs) - - It can install/uninstall an application - - It can activate/deactivate application. - - - Application List - - It provides the list of applications that are installed. - - It provides the API to free the list. - - - Listen / Broadcast status - - It can listen the status broadcasted by other application. - - It can broadcast the status to other application. - -

package manager API descriptions

- SEE API manual - -

package manager features with sample code

-

Install /Uninstall /Activate an application

- -Client application -- Install request with return callback function - -@code -// the package path is "TZ_USER_APP/org.tizen.hello.deb" -#include - -int static return_cb(pkg_request_id req_id, const char *pkg_type, const char *pkg_name, const char *key, const char *val, const void *pmsg, void *data) -{ - pkgmgr_client *pc = (pkgmgr_client *)data; - - if( strcmp(key, "end") == 0) { - pkgmgr_client_free(pc); - exit(0); - } -} - -void install_func() -{ - int result = 0; - pkgmgr_client *pc = NULL; - - pc = pkgmgr_client_new(PC_REQUEST); - if(pc == NULL) { - printf("pc is NULL\n"); - return -1; - } - - result = pkgmgr_client_install(pc, NULL, des, "TZ_USER_APP/org.tizen.hello.deb", NULL, PM_DEFAULT, return_cb, pc); - if(result < 0) { - fprintf(stderr, "Install failed! %d\n", result); - return -1; - } - -} -@endcode - - -- Uninstall request with return callback function - -@code -// the package type is "deb", package name is "org.tizen.hello" -#include - -int static return_cb(pkg_request_id req_id, const char *pkg_type, const char *pkg_name, const char *key, const char *val, const void *pmsg, void *data) -{ - pkgmgr_client *pc = (pkgmgr_client *)data; - - if( strcmp(key, "end") == 0) { - pkgmgr_client_free(pc); - exit(0); - } -} - -void uninstall_func() -{ - int result = 0; - pkgmgr_client *pc = NULL; - - pc = pkgmgr_client_new(PC_REQUEST); - if(pc == NULL) { - printf("pc is NULL\n"); - return -1; - } - - result = pkgmgr_client_uninstall(pc, "deb", des, "org.tizen.hello", PM_DEFAULT, return_cb, pc); - if(result < 0) { - fprintf(stderr, "Uninstall failed! %d\n", result); - return -1; - } - -} -@endcode - - -- Activate request with return callback function - -@code -// the package type is "deb", package name is "org.tizen.hello" -#include - - -void activate_func() -{ - int result = 0; - pkgmgr_client *pc = NULL; - - pc = pkgmgr_client_new(PC_REQUEST); - if(pc == NULL) { - printf("pc is NULL\n"); - return -1; - } - - result = pkgmgr_client_activate(pc, "deb", "org.tizen.hello"); - if(result < 0) { - fprintf(stderr, "Activation failed! %d\n", result); - return -1; - } - - pkgmgr_client_free(pc); - -} -@endcode - - - -

Get Installed Application List

- -- Get/free application list -- This package manager function is used to get the list of all installed applications which can be removed. - -@code -#include - -static int __iter_fn(const char* pkg_type, const char* pkg_name, const char* version, void *data) -{ - printf("pkg_type %s, pkg_name %s, version %s\n", pkg_type, pkg_name, version); - - return 0; -} - -void getlist_func() -{ - pkgmgr_get_pkg_list(__iter_fn, NULL); -} -@endcode - - - -

Listen and broadcast the status

- -- Listen / broadcast the status -- This package manager function is used to listen the status broadcasted by other application. - -@code -#include - -int static return_cb(pkg_request_id req_id, const char *pkg_type, const char *pkg_name, const char *key, const char *val, const void *pmsg, void *data) -{ - pkgmgr_client *pc = (pkgmgr_client *)data; - - if( strcmp(key, "end") == 0) { - pkgmgr_client_free(pc); - exit(0); - } -} - -void listen_func() -{ - int result = 0; - pkgmgr_client *pc = NULL; - - pc = pkgmgr_client_new(PC_LISTENING); - if(pc == NULL) { - printf("pc is NULL\n"); - return -1; - } - - result = pkgmgr_client_listen_status(pc, return_cb, pc); - if(result < 0) - { - fprintf(stderr, "status listen failed!\n"); - return -1; - } -} -@endcode - - -- This package manager function is used to listen the status broadcasted by other application. - -@code -// the package type is "deb", package name is "org.tizen.hello", key is "key_string", val is "val_string" -#include - -void broadcast_func() -{ - int result = 0; - pkgmgr_client *pc = NULL; - - pc= pkgmgr_client_new(PC_BROADCAST); - if(pc == NULL) { - printf("pc is NULL\n"); - return -1; - } - - int result = pkgmgr_client_broadcast_status(pc, "deb", "org.tizen.hello", "key_string", "val_string"); - if(result < 0) { - fprintf(stderr, "status broadcast failed!\n"); - return -1; - } - - pkgmgr_client_free(pc); -} -@endcode - - -*/ - -/** -@} -*/ - - diff --git a/include/pkgmgr-dbinfo.h b/include/pkgmgr-dbinfo.h deleted file mode 120000 index da41362..0000000 --- a/include/pkgmgr-dbinfo.h +++ /dev/null @@ -1 +0,0 @@ -../client/include/pkgmgr-dbinfo.h \ No newline at end of file diff --git a/packaging/pkgmgr.spec b/packaging/pkgmgr.spec index 40d2899..35022a9 100644 --- a/packaging/pkgmgr.spec +++ b/packaging/pkgmgr.spec @@ -191,7 +191,6 @@ chsmack -a '*' %{TZ_SYS_RW_PACKAGES} %manifest %{name}-client-devel.manifest %defattr(-,root,root,-) %{_includedir}/package-manager.h -%{_includedir}/pkgmgr-dbinfo.h %{_libdir}/pkgconfig/pkgmgr.pc %{_libdir}/libpkgmgr-client.so diff --git a/tool/pkg_cmd.c b/tool/pkg_cmd.c index 1c61634..9ebdc07 100644 --- a/tool/pkg_cmd.c +++ b/tool/pkg_cmd.c @@ -26,7 +26,6 @@ #include #include #include -#include #include #include #include @@ -34,11 +33,13 @@ #include #include #include + #include -#include #include -#include +#include +#include +#include /* For multi-user support */ #include @@ -270,18 +271,18 @@ static int __convert_to_absolute_path(char *path) static int __is_app_installed(char *pkgid, uid_t uid) { - pkgmgr_pkginfo_h handle; + pkgmgrinfo_pkginfo_h handle; int ret; if (uid != GLOBAL_USER) - ret = pkgmgr_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); else - ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle); + ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); if(ret < 0) { printf("package is not in pkgmgr_info DB\n"); return -1; } else - pkgmgr_pkginfo_destroy_pkginfo(handle); + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); return 0; } @@ -441,7 +442,7 @@ static void __print_pkg_info(pkgmgr_info *pkg_info) } } -static int __pkgmgr_list_cb (const pkgmgr_pkginfo_h handle, void *user_data) +static int __pkgmgr_list_cb (const pkgmgrinfo_pkginfo_h handle, void *user_data) { int ret = -1; char *pkgid = NULL; @@ -453,28 +454,28 @@ static int __pkgmgr_list_cb (const pkgmgr_pkginfo_h handle, void *user_data) pkgmgrinfo_uidinfo_t *uid_info = (pkgmgrinfo_uidinfo_t *) handle; - ret = pkgmgr_pkginfo_get_pkgid(handle, &pkgid); + ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid); if (ret == -1) { - printf("Failed to get pkgmgr_pkginfo_get_pkgid\n"); + printf("Failed to get pkgmgrinfo_pkginfo_get_pkgid\n"); return ret; } - ret = pkgmgr_pkginfo_get_type(handle, &pkg_type); + ret = pkgmgrinfo_pkginfo_get_type(handle, &pkg_type); if (ret == -1) { - printf("Failed to get pkgmgr_pkginfo_get_type\n"); + printf("Failed to get pkgmgrinfo_pkginfo_get_type\n"); return ret; } - ret = pkgmgr_pkginfo_get_version(handle, &pkg_version); + ret = pkgmgrinfo_pkginfo_get_version(handle, &pkg_version); if (ret == -1) { - printf("Failed to get pkgmgr_pkginfo_get_version\n"); + printf("Failed to get pkgmgrinfo_pkginfo_get_version\n"); return ret; } - ret = pkgmgr_pkginfo_get_label(handle, &pkg_label); + ret = pkgmgrinfo_pkginfo_get_label(handle, &pkg_label); if (ret == -1) pkg_label = "(null)"; - ret = pkgmgr_pkginfo_is_for_all_users(handle, &for_all_users); + ret = pkgmgrinfo_pkginfo_is_for_all_users(handle, &for_all_users); if (ret == -1) { - printf("Failed to get pkgmgr_pkginfo_is_for_all_users\n"); + printf("Failed to get pkgmgrinfo_pkginfo_is_for_all_users\n"); return ret; } @@ -491,7 +492,7 @@ static int __pkg_list_cb (const pkgmgrinfo_pkginfo_h handle, void *user_data, ui ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid); if(ret < 0) { - printf("pkgmgr_pkginfo_get_pkgid() failed\n"); + printf("pkgmgrinfo_pkginfo_get_pkgid() failed\n"); } if (uid_info->uid != GLOBAL_USER) ret = pkgmgr_client_usr_request_service(PM_REQUEST_GET_SIZE, PM_GET_TOTAL_SIZE, (pkgmgr_client *)user_data, NULL, pkgid, uid_info->uid, NULL, NULL, NULL); @@ -819,9 +820,9 @@ static int __process_request(uid_t uid) if (data.pkg_type[0] == '\0') { ret = 0; if (uid != GLOBAL_USER) { - ret = pkgmgr_pkginfo_get_usr_list(__pkgmgr_list_cb, NULL, uid); + ret = pkgmgrinfo_pkginfo_get_usr_list(__pkgmgr_list_cb, NULL, uid); } else { - ret = pkgmgr_pkginfo_get_list(__pkgmgr_list_cb, NULL); + ret = pkgmgrinfo_pkginfo_get_list(__pkgmgr_list_cb, NULL); } if (ret == -1) printf("no packages found\n"); diff --git a/tool/pkg_info.c b/tool/pkg_info.c index 0c09f41..693dd27 100644 --- a/tool/pkg_info.c +++ b/tool/pkg_info.c @@ -27,14 +27,15 @@ #include #include #include + #include //Work around for https://bugs.tizen.org/jira/browse/TC-2399 #include #include #include + #include "package-manager.h" #include "package-manager-types.h" -#include "pkgmgr-dbinfo.h" #include "pkgmgr_installer.h" #define OWNER_ROOT 0 @@ -52,17 +53,16 @@ static int __add_app_filter(uid_t uid); static int __add_pkg_filter(uid_t uid); static int __insert_manifest_in_db(char *manifest, uid_t uid); static int __remove_manifest_from_db(char *manifest, uid_t uid); -static int __set_pkginfo_in_db(char *pkgid, uid_t uid); static int __set_certinfo_in_db(char *pkgid, uid_t uid); static int __get_certinfo_from_db(char *pkgid, uid_t uid); static int __del_certinfo_from_db(char *pkgid); static int __get_integer_input_data(void); char *__get_string_input_data(void); -static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data); +static int __pkg_list_cb (const pkgmgrinfo_pkginfo_h handle, void *user_data); static int __app_category_list_cb(const char *category_name, void *user_data); static int __app_control_list_cb(const char *operation, const char *uri, const char *mime, void *user_data); static int __app_metadata_list_cb(const char *metadata_name, const char *metadata_value, void *user_data); -int app_func(const pkgmgr_appinfo_h handle, void *user_data); +int app_func(const pkgmgrinfo_appinfo_h handle, void *user_data); static void __get_pkgmgrinfo_pkginfo(const pkgmgrinfo_pkginfo_h handle, void *user_data) { @@ -74,7 +74,7 @@ static void __get_pkgmgrinfo_pkginfo(const pkgmgrinfo_pkginfo_h handle, void *us char *author_href = NULL; char *root_path = NULL; char *mainappid = NULL; - pkgmgr_install_location location = 0; + pkgmgrinfo_install_location location = 0; char *icon = NULL; char *label = NULL; char *desc = NULL; @@ -283,8 +283,6 @@ static void __print_usage() printf("\tpkginfo --appcontrol \n\n"); printf("To insert|remove manifest info in DB\n"); printf("\tpkginfo --[imd|rmd] \n\n"); - printf("To set pkginfo in DB\n"); - printf("\tpkginfo --setdb \n\n"); printf("To set manifest validation\n"); printf("\tpkginfo --check \n\n"); printf("To set cert info in DB\n"); @@ -1062,15 +1060,15 @@ static int __get_certinfo_from_db(char *pkgid, uid_t uid) int choice = -1; int i = 0; const char *value = NULL; - pkgmgr_certinfo_h handle = NULL; - ret = pkgmgr_pkginfo_create_certinfo(&handle); + pkgmgrinfo_certinfo_h handle = NULL; + ret = pkgmgrinfo_pkginfo_create_certinfo(&handle); if (ret < 0) { - printf("pkgmgr_pkginfo_create_certinfo failed\n"); + printf("pkgmgrinfo_pkginfo_create_certinfo failed\n"); return -1; } - ret = pkgmgr_pkginfo_load_certinfo(pkgid, handle, uid); + ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle, uid); if (ret < 0) { - printf("pkgmgr_pkginfo_load_certinfo failed\n"); + printf("pkgmgrinfo_pkginfo_load_certinfo failed\n"); return -1; } while (choice != 10) @@ -1092,13 +1090,13 @@ static int __get_certinfo_from_db(char *pkgid, uid_t uid) case 0: for (i = 0; i < 9; i++) { - pkgmgr_pkginfo_get_cert_value(handle, i, &value); + pkgmgrinfo_pkginfo_get_cert_value(handle, i, &value); if (value) printf("cert type[%d] value = %s\n", i, value); } - ret = pkgmgr_pkginfo_destroy_certinfo(handle); + ret = pkgmgrinfo_pkginfo_destroy_certinfo(handle); if (ret < 0) { - printf("pkgmgr_pkginfo_destroy_certinfo failed\n"); + printf("pkgmgrinfo_pkginfo_destroy_certinfo failed\n"); return -1; } return 0; @@ -1111,14 +1109,14 @@ static int __get_certinfo_from_db(char *pkgid, uid_t uid) case 7: case 8: case 9: - ret = pkgmgr_pkginfo_get_cert_value(handle, choice - 1, &value); + ret = pkgmgrinfo_pkginfo_get_cert_value(handle, choice - 1, &value); if (value) printf("cert type[%d] value = %s\n", choice - 1, value); break; case 10: - ret = pkgmgr_pkginfo_destroy_certinfo(handle); + ret = pkgmgrinfo_pkginfo_destroy_certinfo(handle); if (ret < 0) { - printf("pkgmgr_pkginfo_destroy_certinfo failed\n"); + printf("pkgmgrinfo_pkginfo_destroy_certinfo failed\n"); return -1; } return 0; @@ -1346,227 +1344,6 @@ err: return ret; } -static int __set_pkginfo_in_db(char *pkgid, uid_t uid) -{ - if (pkgid == NULL) { - printf("pkgid is NULL\n"); - return -1; - } - int ret = 0; - int choice = -1; - int preload = -1; - int removable = -1; - int location = -1; - char *locale = NULL; - pkgmgr_pkgdbinfo_h handle = NULL; - INSTALL_LOCATION storage = 0; - - if(uid != GLOBAL_USER) - ret = pkgmgrinfo_create_pkgusrdbinfo(pkgid, uid, &handle); - else - ret = pkgmgrinfo_create_pkgdbinfo(pkgid, &handle); - if (ret < 0) { - printf("pkgmgrinfo_create_pkgdbinfo failed\n"); - return -1; - } - while (choice != 0) - { - printf("Enter the choice you want to set\n"); - printf("0 --> to set data in DB\n"); - printf("1 --> pkg type\n"); - printf("2 --> pkg version\n"); - printf("3 --> pkg instal location\n"); - printf("4 --> pkg label\n"); - printf("5 --> pkg icon\n"); - printf("6 --> pkg description\n"); - printf("7 --> pkg author\n"); - printf("8 --> pkg removable\n"); - printf("9 --> pkg preload\n"); - printf("10 --> pkg size\n"); - printf("11 --> pkg installed storage\n"); - choice = __get_integer_input_data(); - switch (choice) { - case 0: - ret = pkgmgrinfo_save_pkgdbinfo(handle); - if (ret < 0) { - printf("pkgmgrinfo_save_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - return -1; - } - ret = pkgmgrinfo_destroy_pkgdbinfo(handle); - if (ret < 0) { - printf("pkgmgrinfo_destroy_pkgdbinfo failed\n"); - return -1; - } - break; - case 1: - printf("Enter type: \n"); - char *type = __get_string_input_data(); - ret = pkgmgrinfo_set_type_to_pkgdbinfo(handle, type); - if (ret < 0) { - printf("pkgmgrinfo_set_type_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(type); - return -1; - } - free(type); - break; - case 2: - printf("Enter version: \n"); - char *version = __get_string_input_data(); - ret = pkgmgrinfo_set_version_to_pkgdbinfo(handle, version); - if (ret < 0) { - printf("pkgmgrinfo_set_version_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(version); - return -1; - } - free(version); - break; - case 3: - printf("Enter install location [0:internal | 1:external]: \n"); - location = __get_integer_input_data(); - ret = pkgmgrinfo_set_install_location_to_pkgdbinfo(handle, location); - if (ret < 0) { - printf("pkgmgrinfo_set_install_location_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - return -1; - } - break; - case 4: - printf("Enter label :\n"); - char *label = __get_string_input_data(); - printf("Enter locale ['def' for default]: \n"); - locale = __get_string_input_data(); - if (strcmp(locale, "def") == 0) - ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, label, NULL); - else - ret = pkgmgrinfo_set_label_to_pkgdbinfo(handle, label, locale); - if (ret < 0) { - printf("pkgmgrinfo_set_label_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(locale); - free(label); - return -1; - } - free(locale); - free(label); - break; - case 5: - printf("Enter icon: \n"); - char *icon = __get_string_input_data(); - printf("Enter locale ['def' for default]: \n"); - locale = __get_string_input_data(); - if (strcmp(locale, "def") == 0) - ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, icon, NULL); - else - ret = pkgmgrinfo_set_icon_to_pkgdbinfo(handle, icon, locale); - if (ret < 0) { - printf("pkgmgrinfo_set_icon_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(locale); - free(icon); - return -1; - } - free(locale); - free(icon); - break; - case 6: - printf("Enter description: \n"); - char *description = __get_string_input_data(); - printf("Enter locale ['def' for default]: \n"); - locale = __get_string_input_data(); - if (strcmp(locale, "def") == 0) - ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, description, NULL); - else - ret = pkgmgrinfo_set_description_to_pkgdbinfo(handle, description, locale); - if (ret < 0) { - printf("pkgmgrinfo_set_description_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(locale); - free(description); - return -1; - } - free(locale); - free(description); - break; - case 7: - printf("Enter author name: \n"); - char *author_name = __get_string_input_data(); - printf("Enter locale ['def' for default]: \n"); - locale = __get_string_input_data(); - printf("Enter author email: \n"); - char *author_email = __get_string_input_data(); - printf("Enter author href: \n"); - char *author_href = __get_string_input_data(); - if (strcmp(locale, "def") == 0) - ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, author_name, author_email, author_href, NULL); - else - ret = pkgmgrinfo_set_author_to_pkgdbinfo(handle, author_name, author_email, author_href, locale); - if (ret < 0) { - printf("pkgmgrinfo_set_author_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(locale); - free(author_name); - free(author_email); - free(author_href); - return -1; - } - free(locale); - free(author_name); - free(author_email); - free(author_href); - break; - case 8: - printf("Enter removable [0:false | 1:true]: \n"); - removable = __get_integer_input_data(); - ret = pkgmgrinfo_set_removable_to_pkgdbinfo(handle, removable); - if (ret < 0) { - printf("pkgmgrinfo_set_removable_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - return -1; - } - break; - case 9: - printf("Enter preload [0:false | 1:true]: \n"); - preload = __get_integer_input_data(); - ret = pkgmgrinfo_set_preload_to_pkgdbinfo(handle, preload); - if (ret < 0) { - printf("pkgmgrinfo_set_preload_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - return -1; - } - break; - case 10: - printf("Enter size in MB \n"); - char *size = __get_string_input_data(); - ret = pkgmgrinfo_set_size_to_pkgdbinfo(handle, size); - if (ret < 0) { - printf("pkgmgrinfo_set_size_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - free(size); - return -1; - } - free(size); - break; - case 11: - printf("Enter insatlled storage [ 0:INTERNAL | 1:EXTERNAL ] \n"); - storage = __get_integer_input_data(); - ret = pkgmgrinfo_set_installed_storage_to_pkgdbinfo(handle, storage); - if (ret < 0) { - printf("pkgmgrinfo_set_installed_storage_to_pkgdbinfo failed\n"); - pkgmgrinfo_destroy_pkgdbinfo(handle); - return -1; - } - break; - default: - printf("Invalid number entered\n"); - continue; - } - } - return 0; -} - static int __insert_manifest_in_db(char *manifest, uid_t uid) { int ret = 0; @@ -1623,7 +1400,7 @@ static int __remove_manifest_from_db(char *manifest, uid_t uid) return 0; } -int app_func(const pkgmgr_appinfo_h handle, void *user_data) +int app_func(const pkgmgrinfo_appinfo_h handle, void *user_data) { char *appid; char *data = NULL; @@ -1634,88 +1411,88 @@ int app_func(const pkgmgr_appinfo_h handle, void *user_data) char *exec = NULL; char *icon = NULL; char *label = NULL; - pkgmgr_app_component component = 0; + pkgmgrinfo_app_component component = 0; char *apptype = NULL; bool nodisplay = 0; bool multiple = 0; bool taskmanage = 0; - pkgmgr_hwacceleration_type hwacceleration; + pkgmgrinfo_app_hwacceleration hwacceleration; pkgmgrinfo_app_screenreader screenreader; bool onboot = 0; bool autorestart = 0; char *package = NULL; - ret = pkgmgr_appinfo_get_appid(handle, &appid); + ret = pkgmgrinfo_appinfo_get_appid(handle, &appid); if (ret < 0) { printf("Failed to get appid\n"); } if (appid) printf("Appid: %s\n", appid); - ret = pkgmgr_appinfo_get_pkgid(handle, &package); + ret = pkgmgrinfo_appinfo_get_pkgid(handle, &package); if (ret < 0) { printf("Failed to get package\n"); } if (package) printf("Package: %s\n", package); - ret = pkgmgr_appinfo_get_exec(handle, &exec); + ret = pkgmgrinfo_appinfo_get_exec(handle, &exec); if (ret < 0) { printf("Failed to get exec\n"); } if (exec) printf("Exec: %s\n", exec); - ret = pkgmgr_appinfo_get_icon(handle, &icon); + ret = pkgmgrinfo_appinfo_get_icon(handle, &icon); if (ret < 0) { printf("Failed to get icon\n"); } if (icon) printf("Icon: %s\n", icon); - ret = pkgmgr_appinfo_get_label(handle, &label); + ret = pkgmgrinfo_appinfo_get_label(handle, &label); if (ret < 0) { printf("Failed to get label\n"); } if (label) printf("Label: %s\n", label); - ret = pkgmgr_appinfo_get_component(handle, &component); + ret = pkgmgrinfo_appinfo_get_component(handle, &component); if (ret < 0) { printf("Failed to get component\n"); } - ret = pkgmgr_appinfo_get_apptype(handle, &apptype); + ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype); if (ret < 0) { printf("Failed to get apptype\n"); } if (apptype) printf("Apptype: %s\n", apptype); - if (component == PM_UI_APP) { + if (component == PMINFO_UI_APP) { printf("component: uiapp\n"); - ret = pkgmgr_appinfo_is_multiple(handle, &multiple); + ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple); if (ret < 0) { printf("Failed to get multiple\n"); } else { printf("Multiple: %d\n", multiple); } - ret = pkgmgr_appinfo_is_nodisplay(handle, &nodisplay); + ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay); if (ret < 0) { printf("Failed to get nodisplay\n"); } else { printf("Nodisplay: %d \n", nodisplay); } - ret = pkgmgr_appinfo_is_taskmanage(handle, &taskmanage); + ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage); if (ret < 0) { printf("Failed to get taskmanage\n"); } else { printf("Taskmanage: %d\n", taskmanage); } - ret = pkgmgr_appinfo_get_hwacceleration(handle, &hwacceleration); + ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration); if (ret < 0) { printf("Failed to get hwacceleration\n"); } else { @@ -1730,16 +1507,16 @@ int app_func(const pkgmgr_appinfo_h handle, void *user_data) } } - if (component == PM_SVC_APP) { + if (component == PMINFO_SVC_APP) { printf("component: svcapp\n"); - ret = pkgmgr_appinfo_is_onboot(handle, &onboot); + ret = pkgmgrinfo_appinfo_is_onboot(handle, &onboot); if (ret < 0) { printf("Failed to get onboot\n"); } else { printf("Onboot: %d\n", onboot); } - ret = pkgmgr_appinfo_is_autorestart(handle, &autorestart); + ret = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart); if (ret < 0) { printf("Failed to get autorestart\n"); } else { @@ -1753,7 +1530,7 @@ int app_func(const pkgmgr_appinfo_h handle, void *user_data) } -static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data) +static int __pkg_list_cb (const pkgmgrinfo_pkginfo_h handle, void *user_data) { char *test_data = "test data"; int ret = -1; @@ -1764,25 +1541,25 @@ static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data) int installed_time = -1; pkgmgrinfo_uidinfo_t *uid_info = (pkgmgrinfo_uidinfo_t *) handle; - ret = pkgmgr_pkginfo_get_pkgid(handle, &pkgid); + ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid); if(ret < 0) { - printf("pkgmgr_pkginfo_get_pkgid() failed\n"); + printf("pkgmgrinfo_pkginfo_get_pkgid() failed\n"); } - ret = pkgmgr_pkginfo_get_type(handle, &pkg_type); + ret = pkgmgrinfo_pkginfo_get_type(handle, &pkg_type); if(ret < 0) { - printf("pkgmgr_pkginfo_get_type() failed\n"); + printf("pkgmgrinfo_pkginfo_get_type() failed\n"); } - ret = pkgmgr_pkginfo_get_version(handle, &pkg_version); + ret = pkgmgrinfo_pkginfo_get_version(handle, &pkg_version); if(ret < 0) { - printf("pkgmgr_pkginfo_get_version() failed\n"); + printf("pkgmgrinfo_pkginfo_get_version() failed\n"); } - ret = pkgmgr_pkginfo_is_preload(handle, &preload); + ret = pkgmgrinfo_pkginfo_is_preload(handle, &preload); if(ret < 0) { - printf("pkgmgr_pkginfo_is_preload() failed\n"); + printf("pkgmgrinfo_pkginfo_is_preload() failed\n"); } - ret = pkgmgr_pkginfo_get_installed_time(handle, &installed_time); + ret = pkgmgrinfo_pkginfo_get_installed_time(handle, &installed_time); if(ret < 0) { - printf("pkgmgr_pkginfo_get_installed_time() failed\n"); + printf("pkgmgrinfo_pkginfo_get_installed_time() failed\n"); } @@ -1792,23 +1569,23 @@ static int __pkg_list_cb (const pkgmgr_pkginfo_h handle, void *user_data) if (uid_info->uid != GLOBAL_USER) { printf("**List of Ui-Apps**\n"); - ret = pkgmgr_appinfo_get_usr_list(handle, PM_UI_APP, app_func, (void *)test_data, uid_info->uid); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_UI_APP, app_func, (void *)test_data, uid_info->uid); if (ret < 0) { printf("pkgmgr_get_info_app() failed\n"); } printf("**List of Svc-Apps**\n"); - ret = pkgmgr_appinfo_get_usr_list(handle, PM_SVC_APP, app_func, (void *)test_data, uid_info->uid); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_SVC_APP, app_func, (void *)test_data, uid_info->uid); if (ret < 0) { printf("pkgmgr_get_info_app() failed\n"); } } else { printf("**List of Ui-Apps**\n"); - ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, app_func, (void *)test_data); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, (void *)test_data); if (ret < 0) { printf("pkgmgr_get_info_app() failed\n"); } printf("**List of Svc-Apps**\n"); - ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, app_func, (void *)test_data); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_SVC_APP, app_func, (void *)test_data); if (ret < 0) { printf("pkgmgr_get_info_app() failed\n"); } @@ -1822,11 +1599,11 @@ static int __get_pkg_list(uid_t uid) { int ret = -1; if (uid != GLOBAL_USER) - ret = pkgmgr_pkginfo_get_usr_list(__pkg_list_cb, NULL, uid); + ret = pkgmgrinfo_pkginfo_get_usr_list(__pkg_list_cb, NULL, uid); else - ret = pkgmgr_pkginfo_get_list(__pkg_list_cb, NULL); + ret = pkgmgrinfo_pkginfo_get_list(__pkg_list_cb, NULL); if (ret < 0) { - printf("pkgmgr_pkginfo_get_list() failed\n"); + printf("pkgmgrinfo_pkginfo_get_list() failed\n"); return -1; } return 0; @@ -1878,26 +1655,26 @@ static int __app_control_list_cb(const char *operation, const char *uri, const c static int __get_app_category_list(char *appid) { int ret = -1; - pkgmgr_appinfo_h handle; + pkgmgrinfo_appinfo_h handle; ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle); if (ret < 0) { printf("Failed to get handle\n"); return -1; } - ret = pkgmgr_appinfo_foreach_category(handle, __app_category_list_cb, NULL); + ret = pkgmgrinfo_appinfo_foreach_category(handle, __app_category_list_cb, NULL); if (ret < 0) { - printf("pkgmgr_appinfo_foreach_category() failed\n"); - pkgmgr_appinfo_destroy_appinfo(handle); + printf("pkgmgrinfo_appinfo_foreach_category() failed\n"); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return -1; } - pkgmgr_appinfo_destroy_appinfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } static int __get_app_metadata_list(char *appid) { int ret = -1; - pkgmgr_appinfo_h handle; + pkgmgrinfo_appinfo_h handle; ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle); if (ret < 0) { printf("Failed to get handle\n"); @@ -1906,17 +1683,17 @@ static int __get_app_metadata_list(char *appid) ret = pkgmgrinfo_appinfo_foreach_metadata(handle, __app_metadata_list_cb, NULL); if (ret < 0) { printf("pkgmgrinfo_appinfo_foreach_metadata() failed\n"); - pkgmgr_appinfo_destroy_appinfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return -1; } - pkgmgr_appinfo_destroy_appinfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } static int __get_app_control_list(char *appid) { int ret = -1; - pkgmgr_appinfo_h handle; + pkgmgrinfo_appinfo_h handle; ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle); if (ret < 0) { printf("Failed to get handle\n"); @@ -1925,10 +1702,10 @@ static int __get_app_control_list(char *appid) ret = pkgmgrinfo_appinfo_foreach_appcontrol(handle, __app_control_list_cb, NULL); if (ret < 0) { printf("pkgmgrinfo_appinfo_foreach_appcontrol() failed\n"); - pkgmgr_appinfo_destroy_appinfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return -1; } - pkgmgr_appinfo_destroy_appinfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } @@ -1945,41 +1722,41 @@ static int __set_app_enabled(char *appid, bool enabled) static int __get_app_list(char *pkgid, uid_t uid) { - pkgmgr_pkginfo_h handle; + pkgmgrinfo_pkginfo_h handle; int ret = -1; char *test_data = "test data"; if(uid != GLOBAL_USER) - ret = pkgmgr_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); + ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, uid, &handle); else - ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle); + ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, &handle); if (ret < 0) { printf("Failed to get handle\n"); return -1; } if (uid != GLOBAL_USER) { printf("List of Ui-Apps\n\n"); - ret = pkgmgr_appinfo_get_usr_list(handle, PM_UI_APP, app_func, (void *)test_data, uid); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_UI_APP, app_func, (void *)test_data, uid); if (ret < 0) { - printf("pkgmgr_appinfo_get_list() failed\n"); + printf("pkgmgrinfo_appinfo_get_list() failed\n"); } printf("List of Svc-Apps\n\n"); - ret = pkgmgr_appinfo_get_usr_list(handle, PM_SVC_APP, app_func, (void *)test_data, uid); + ret = pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_SVC_APP, app_func, (void *)test_data, uid); if (ret < 0) { - printf("pkgmgr_appinfo_get_list() failed\n"); + printf("pkgmgrinfo_appinfo_get_list() failed\n"); } } else { printf("List of Ui-Apps\n\n"); - ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, app_func, (void *)test_data); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_UI_APP, app_func, (void *)test_data); if (ret < 0) { - printf("pkgmgr_appinfo_get_list() failed\n"); + printf("pkgmgrinfo_appinfo_get_list() failed\n"); } printf("List of Svc-Apps\n\n"); - ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, app_func, (void *)test_data); + ret = pkgmgrinfo_appinfo_get_list(handle, PMINFO_SVC_APP, app_func, (void *)test_data); if (ret < 0) { - printf("pkgmgr_appinfo_get_list() failed\n"); + printf("pkgmgrinfo_appinfo_get_list() failed\n"); } } - pkgmgr_pkginfo_destroy_pkginfo(handle); + pkgmgrinfo_pkginfo_destroy_pkginfo(handle); return 0; } @@ -2013,17 +1790,17 @@ static int __get_app_info(char *appid) char *icon = NULL; char *label = NULL; char *package = NULL; - pkgmgr_app_component component = 0; + pkgmgrinfo_app_component component = 0; bool nodisplay = 0; bool multiple = 0; bool taskmanage = 0; - pkgmgr_hwacceleration_type hwacceleration; + pkgmgrinfo_app_hwacceleration hwacceleration; pkgmgrinfo_app_screenreader screenreader; bool onboot = 0; bool autorestart = 0; bool enabled = 0; bool preload = 0; - pkgmgr_appinfo_h handle; + pkgmgrinfo_appinfo_h handle; int ret = -1; ret = pkgmgrinfo_appinfo_get_usr_appinfo(appid, getuid(), &handle); @@ -2032,50 +1809,50 @@ static int __get_app_info(char *appid) return -1; } - ret = pkgmgr_appinfo_get_pkgid(handle, &package); + ret = pkgmgrinfo_appinfo_get_pkgid(handle, &package); if (ret < 0) { printf("Failed to get package\n"); } - ret = pkgmgr_appinfo_get_appid(handle, &app_id); + ret = pkgmgrinfo_appinfo_get_appid(handle, &app_id); if (ret < 0) { printf("Failed to get exec\n"); } - ret = pkgmgr_appinfo_get_label(handle, &label); + ret = pkgmgrinfo_appinfo_get_label(handle, &label); if (ret < 0) { printf("Failed to get label\n"); } - ret = pkgmgr_appinfo_get_icon(handle, &icon); + ret = pkgmgrinfo_appinfo_get_icon(handle, &icon); if (ret < 0) { printf("Failed to get icon\n"); } - ret = pkgmgr_appinfo_get_exec(handle, &exec); + ret = pkgmgrinfo_appinfo_get_exec(handle, &exec); if (ret < 0) { printf("Failed to get exec\n"); } - ret = pkgmgr_appinfo_get_component(handle, &component); + ret = pkgmgrinfo_appinfo_get_component(handle, &component); if (ret < 0) { printf("Failed to get component\n"); } - ret = pkgmgr_appinfo_get_apptype(handle, &apptype); + ret = pkgmgrinfo_appinfo_get_apptype(handle, &apptype); if (ret < 0) { printf("Failed to get apptype\n"); } - ret = pkgmgr_appinfo_is_nodisplay(handle, &nodisplay); + ret = pkgmgrinfo_appinfo_is_nodisplay(handle, &nodisplay); if (ret < 0) { printf("Failed to get nodisplay\n"); } - ret = pkgmgr_appinfo_is_multiple(handle, &multiple); + ret = pkgmgrinfo_appinfo_is_multiple(handle, &multiple); if (ret < 0) { printf("Failed to get multiple\n"); } - ret = pkgmgr_appinfo_is_taskmanage(handle, &taskmanage); + ret = pkgmgrinfo_appinfo_is_taskmanage(handle, &taskmanage); if (ret < 0) { printf("Failed to get taskmanage\n"); } - ret = pkgmgr_appinfo_get_hwacceleration(handle, &hwacceleration); + ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacceleration); if (ret < 0) { printf("Failed to get hwacceleration\n"); } @@ -2083,11 +1860,11 @@ static int __get_app_info(char *appid) if (ret < 0) { printf("Failed to get screenreader\n"); } - ret = pkgmgr_appinfo_is_onboot(handle, &onboot); + ret = pkgmgrinfo_appinfo_is_onboot(handle, &onboot); if (ret < 0) { printf("Failed to get onboot\n"); } - ret = pkgmgr_appinfo_is_autorestart(handle, &autorestart); + ret = pkgmgrinfo_appinfo_is_autorestart(handle, &autorestart); if (ret < 0) { printf("Failed to get autorestart\n"); } @@ -2111,7 +1888,7 @@ static int __get_app_info(char *appid) if (apptype) printf("Apptype: %s\n", apptype); - if (component == PM_UI_APP) { + if (component == PMINFO_UI_APP) { printf("component: uiapp\n"); if (icon) @@ -2124,7 +1901,7 @@ static int __get_app_info(char *appid) printf("Taskmanage: %d\n", taskmanage); printf("Hw-Acceleration: %d\n", hwacceleration); printf("Screenreader: %d\n", screenreader); - } else if (component == PM_SVC_APP) { + } else if (component == PMINFO_SVC_APP) { printf("component: svcapp\n"); if (icon) @@ -2141,7 +1918,7 @@ static int __get_app_info(char *appid) printf("Enabled: %d\n", enabled); printf("Preload: %d\n", preload); - pkgmgr_appinfo_destroy_appinfo(handle); + pkgmgrinfo_appinfo_destroy_appinfo(handle); return 0; } @@ -2321,12 +2098,6 @@ int main(int argc, char *argv[]) printf("remove from db failed\n"); goto end; } - } else if (strcmp(argv[1], "--setdb") == 0) { - ret = __set_pkginfo_in_db(argv[2], getuid()); - if (ret == -1) { - printf("set pkginfo in db failed\n"); - goto end; - } } else if (strcmp(argv[1], "--setcert") == 0) { ret = __set_certinfo_in_db(argv[2], getuid()); if (ret == -1) { -- 2.34.1