From b157d065f5ee2dda4f76f8cfa452af360a2c8044 Mon Sep 17 00:00:00 2001 From: "jin0.kim" Date: Fri, 5 Feb 2016 16:02:47 +0830 Subject: [PATCH] Replace non-public API Change-Id: I540a90daca920c6dc15f4770733dcf0433365fe8 --- CMakeLists.txt | 5 +- daemon/common.c | 67 +++++++++++----------- daemon/datetime/datetime.c | 4 ++ daemon/service/emergency_mode.c | 33 ++++++----- daemon/service/uninstall.c | 84 +++++++++++++--------------- daemon/settings/modules/ultra_power_saving.c | 2 +- packaging/org.tizen.quickpanel.spec | 3 +- 7 files changed, 99 insertions(+), 99 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4eb76ce..adf8a9a 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -145,8 +145,7 @@ pkg_check_modules(pkgs REQUIRED syspopup-caller minicontrol-viewer minicontrol-monitor - pkgmgr - pkgmgr-info + capi-appfw-package-manager iniparser alarm-service voice-control-setting @@ -191,7 +190,7 @@ ADD_DEFINITIONS("-DQP_SMART_ALERT_ENABLE") ADD_DEFINITIONS("-DQP_SERVICE_NOTI_LED_ENABLE") ADD_DEFINITIONS("-DQP_ANIMATED_IMAGE_ENABLE") ADD_DEFINITIONS("-DQP_REMINDER_ENABLE") -ADD_DEFINITIONS("-DQP_EMERGENCY_MODE_ENABLE") +#ADD_DEFINITIONS("-DQP_EMERGENCY_MODE_ENABLE") ADD_DEFINITIONS("-DQP_VOICE_CONTROL_ENABLE") ADD_DEFINITIONS("-DPACKAGE=\"${PACKAGE}\"") diff --git a/daemon/common.c b/daemon/common.c index f806513..e32535f 100755 --- a/daemon/common.c +++ b/daemon/common.c @@ -22,7 +22,7 @@ #include -#include +#include #include #include #include @@ -325,27 +325,25 @@ HAPI char *quickpanel_common_ui_get_pkginfo_icon(const char *pkgid) int ret = 0; char *icon_path = NULL; char *icon_ret = NULL; - retif(pkgid == NULL, NULL, "invalid parameter"); + package_info_h package_info = NULL; - pkgmgrinfo_appinfo_h appinfo_h = NULL; - - ret = pkgmgrinfo_appinfo_get_appinfo(pkgid, &appinfo_h); - if (ret < 0) { - ERR("pkgmgrinfo_appinfo_get_appinfo is failed %d", ret); + ret = package_manager_get_package_info(pkgid, &package_info); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + ERR("package_manager_get_package_info is failed id : %s %d", pkgid, ret); return NULL; } - //icon path - ret = pkgmgrinfo_appinfo_get_icon(appinfo_h, &icon_path); - if (ret < 0) { - ERR("pkgmgrinfo_appinfo_get_icon is failed %d", ret); + ret = package_info_get_icon(package_info, &icon_path); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + ERR("package_info_get_icon is failed %d", ret); + return NULL; } + if (icon_path) { icon_ret = (char*)strdup(icon_path); } - if (appinfo_h) { - pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h); - } + + package_info_destroy(package_info); return icon_ret; } @@ -354,30 +352,29 @@ HAPI char *quickpanel_common_ui_get_pkginfo_label(const char *pkgid) { int ret = 0; char *label = NULL; - char *value_ret = NULL; - retif(pkgid == NULL, NULL, "invalid parameter"); - - pkgmgrinfo_appinfo_h appinfo_h = NULL; + char *label_ret = NULL; + package_info_h package_info = NULL; - ret = pkgmgrinfo_appinfo_get_appinfo(pkgid, &appinfo_h); - if (ret < 0) { - ERR("pkgmgrinfo_appinfo_get_appinfo is failed %d", ret); + ret = package_manager_get_package_info(pkgid, &package_info); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + ERR("package_manager_get_package_info is failed %d", ret); return NULL; } - //icon path - ret = pkgmgrinfo_appinfo_get_label(appinfo_h, &label); - if (ret < 0) { - ERR("pkgmgrinfo_appinfo_get_icon is failed %d", ret); + ret = package_info_get_label(package_info, &label); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + ERR("package_info_get_label is failed %d", ret); + return NULL; } + if (label) { - value_ret = (char*)strdup(label); - } - if (appinfo_h) { - pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h); + label_ret = (char*)strdup(label); } - return value_ret; + package_info_destroy(package_info); + + return label_ret; + } HAPI int quickpanel_common_ui_is_package_exist(const char *pkgid) @@ -385,16 +382,16 @@ HAPI int quickpanel_common_ui_is_package_exist(const char *pkgid) int ret = 0; retif(pkgid == NULL, 0, "invalid parameter"); - pkgmgrinfo_appinfo_h appinfo_h = NULL; + package_info_h package_info = NULL; - ret = pkgmgrinfo_appinfo_get_appinfo(pkgid, &appinfo_h); - if (ret < 0) { + ret = package_manager_get_package_info(pkgid, &package_info); + if (ret == PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE) { DBG("package %s isn't exist", pkgid); return 0; } - if (appinfo_h) { - pkgmgrinfo_appinfo_destroy_appinfo(appinfo_h); + if (package_info) { + package_info_destroy(package_info); } return 1; diff --git a/daemon/datetime/datetime.c b/daemon/datetime/datetime.c index 2fe645c..a1674ec 100755 --- a/daemon/datetime/datetime.c +++ b/daemon/datetime/datetime.c @@ -164,13 +164,17 @@ static Evas_Object *_datetime_view_create(Evas_Object *parent) _flag_set(view, E_DATA_EDITING_VISIBILITT, 0); +#ifdef QP_EMERGENCY_MODE_ENABLE if (quickpanel_emergency_mode_is_on()) { _flag_set(view, E_DATA_TIME_N_DATE_EVENT, 0); elm_object_signal_emit(view, "timendate.click.disable", "prog"); } else { +#endif _flag_set(view, E_DATA_TIME_N_DATE_EVENT, 1); elm_object_signal_emit(view, "timendate.click.enable", "prog"); +#ifdef QP_EMERGENCY_MODE_ENABLE } +#endif evas_object_show(view); } diff --git a/daemon/service/emergency_mode.c b/daemon/service/emergency_mode.c index 5752ff6..9ced1c2 100755 --- a/daemon/service/emergency_mode.c +++ b/daemon/service/emergency_mode.c @@ -18,8 +18,11 @@ #include #include + + #include -#include + +#include #include #include #include @@ -151,11 +154,13 @@ static void _vconf_cb(keynode_t *node, void *data) } } -static int _app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data) +static bool _app_list_cb(package_info_h handle, void *user_data) { char *appid = NULL; char *permitted_appid = NULL; - pkgmgrinfo_appinfo_get_appid(handle, &appid); + + /* NEED TO CHANGE */ + package_info_get_package(handle, &appid); permitted_appid = strdup(appid); @@ -168,34 +173,36 @@ static int _app_list_cb(pkgmgrinfo_appinfo_h handle, void *user_data) static int _register_permitted_apps(void) { + DBG(""); int ret = 0; - pkgmgrinfo_appinfo_filter_h handle; + package_manager_filter_h handle; s_info.permitted_apps = eina_list_append(s_info.permitted_apps, BT_SHARE_DAEMON); s_info.permitted_apps = eina_list_append(s_info.permitted_apps, SCREEN_SHOT); s_info.permitted_apps = eina_list_append(s_info.permitted_apps, BT_SHARE_SERVER); s_info.permitted_apps = eina_list_append(s_info.permitted_apps, BT_SHARE_CLIENT); - ret = pkgmgrinfo_appinfo_filter_create(&handle); - if (ret != PMINFO_R_OK) { + ret = package_manager_filter_create(&handle); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { return -1; } #if defined(WINSYS_X11) - ret = pkgmgrinfo_appinfo_filter_add_int(handle, PMINFO_APPINFO_PROP_APP_SUPPORT_MODE, 1); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_appinfo_filter_destroy(handle); + /* NEED TO CHANGE */ + ret = package_manager_filter_add_bool(handle, PMINFO_APPINFO_PROP_APP_SUPPORT_MODE, 1); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + package_manager_filter_destroy(handle); return -1; } #endif - ret = pkgmgrinfo_appinfo_filter_foreach_appinfo(handle, _app_list_cb, NULL); - if (ret != PMINFO_R_OK) { - pkgmgrinfo_appinfo_filter_destroy(handle); + ret = package_manager_filter_foreach_package_info(handle, _app_list_cb, NULL); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + package_manager_filter_destroy(handle); return -1; } - pkgmgrinfo_appinfo_filter_destroy(handle); + package_manager_filter_destroy(handle); return 0; } diff --git a/daemon/service/uninstall.c b/daemon/service/uninstall.c index a72249b..9ae35ed 100755 --- a/daemon/service/uninstall.c +++ b/daemon/service/uninstall.c @@ -19,8 +19,7 @@ #include #include -#include -#include +#include #include #include #include @@ -28,18 +27,13 @@ #include "common.h" #include "uninstall.h" -#define QP_PKGMGR_STR_START "start" -#define QP_PKGMGR_STR_END "end" -#define QP_PKGMGR_STR_OK "ok" -#define QP_PKGMGR_STR_UNINSTALL "uninstall" - typedef struct _pkg_event { char *pkgname; int is_done; } Pkg_Event; static struct _s_info { - pkgmgr_client *client; + package_manager_h client; Eina_List *event_list; } s_info = { .client = NULL, @@ -79,68 +73,68 @@ static int _is_item_exist(const char *pkgid, int remove_if_exist) return ret; } -static int _pkgmgr_event_cb(int req_id, const char *pkg_type, const char *pkgid, const char *key, const char *val, const void *pmsg, void *priv_data) +static void _pkgmgr_event_cb(const char *type, const char *package, + package_manager_event_type_e event_type, + package_manager_event_state_e event_state, int progress, + package_manager_error_e error, void *user_data) { - if (pkgid == NULL) { - return 0; + if (error != PACKAGE_MANAGER_ERROR_NONE) { + ERR("_pkgmgr_event_cb error in cb"); + return; } - SDBG("pkg:%s key:%s val:%s", pkgid, key, val); + SDBG("package:%s event_type:%s event_state:%s", package, event_type, event_state); - if (key != NULL && val != NULL) { - if (strcasecmp(key, QP_PKGMGR_STR_START) == 0 && - strcasecmp(val, QP_PKGMGR_STR_UNINSTALL) == 0) { + if (event_type == PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL && + event_state == PACKAGE_MANAGER_EVENT_STATE_STARTED) { - ERR("Pkg:%s is being uninstalled", pkgid); + DBG("Pkg:%s is being uninstalled", package); - Pkg_Event *event = calloc(1, sizeof(Pkg_Event)); - if (event != NULL) { - event->pkgname = strdup(pkgid); - s_info.event_list = eina_list_append(s_info.event_list, event); - } else { - ERR("failed to create event item"); - } + Pkg_Event *event = calloc(1, sizeof(Pkg_Event)); + if (event != NULL) { + event->pkgname = strdup(package); + s_info.event_list = eina_list_append(s_info.event_list, event); + } else { + ERR("failed to create event item"); + } + } else if (event_type == PACKAGE_MANAGER_EVENT_TYPE_UNINSTALL && + event_state == PACKAGE_MANAGER_EVENT_STATE_COMPLETED) { - return 0; - } else if (strcasecmp(key, QP_PKGMGR_STR_END) == 0 && - strcasecmp(val, QP_PKGMGR_STR_OK) == 0) { - if (_is_item_exist(pkgid, 1) == 1) { - ERR("Pkg:%s is uninstalled, delete related resource", pkgid); - notification_delete_all_by_type(pkgid, NOTIFICATION_TYPE_NOTI); - notification_delete_all_by_type(pkgid, NOTIFICATION_TYPE_ONGOING); - badge_remove(pkgid); - } + if (_is_item_exist(package, 1) == 1) { + DBG("Pkg:%s is uninstalled, delete related resource", package); + + notification_delete_all_by_type(package, NOTIFICATION_TYPE_NOTI); + notification_delete_all_by_type(package, NOTIFICATION_TYPE_ONGOING); + badge_remove(package); } } - - return 0; } + HAPI void quickpanel_uninstall_init(void *data) { int ret = -1; - pkgmgr_client *client = pkgmgr_client_new(PC_LISTENING); - if (client != NULL) { - if ((ret = pkgmgr_client_listen_status(client, (void*)_pkgmgr_event_cb, data)) != PKGMGR_R_OK) { - ERR("Failed to listen pkgmgr event:%d", ret); + ret = package_manager_create(&s_info.client); + if (ret == PACKAGE_MANAGER_ERROR_NONE) { + if (package_manager_set_event_cb(s_info.client, (void*)_pkgmgr_event_cb, data) != PACKAGE_MANAGER_ERROR_NONE) { + ERR("Failed to set package manager event:%d", ret); } - s_info.client = client; } else { - ERR("Failed to create package manager client"); + ERR("Failed to create package manager : %d ", ret); } + } HAPI void quickpanel_uninstall_fini(void *data) { int ret = -1; + Pkg_Event *event_item = NULL; - if (s_info.client != NULL) { - if ((ret = pkgmgr_client_free(s_info.client)) != PKGMGR_R_OK) { - ERR("Failed to free pkgmgr client:%d", ret); - } - s_info.client = NULL; + ret = package_manager_destroy(s_info.client); + if (ret != PACKAGE_MANAGER_ERROR_NONE) { + ERR("Failed to destory package manager:%d", ret); } EINA_LIST_FREE(s_info.event_list, event_item) { diff --git a/daemon/settings/modules/ultra_power_saving.c b/daemon/settings/modules/ultra_power_saving.c index 89d4706..bd0f8c7 100755 --- a/daemon/settings/modules/ultra_power_saving.c +++ b/daemon/settings/modules/ultra_power_saving.c @@ -20,7 +20,7 @@ #include #include -#include +//#include #include #include #include diff --git a/packaging/org.tizen.quickpanel.spec b/packaging/org.tizen.quickpanel.spec index b7dcffc..545be53 100755 --- a/packaging/org.tizen.quickpanel.spec +++ b/packaging/org.tizen.quickpanel.spec @@ -58,9 +58,8 @@ BuildRequires: pkgconfig(elementary) BuildRequires: pkgconfig(syspopup-caller) BuildRequires: pkgconfig(minicontrol-viewer) BuildRequires: pkgconfig(minicontrol-monitor) -BuildRequires: pkgconfig(pkgmgr) -BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(iniparser) +BuildRequires: pkgconfig(capi-appfw-package-manager) BuildRequires: pkgconfig(alarm-service) %if %{with wayland} BuildRequires: pkgconfig(ecore-wayland) -- 2.7.4