From f454524ed08330e709141c24d696d2837c67cb6e Mon Sep 17 00:00:00 2001 From: Sangyoon Jang Date: Tue, 2 Jun 2015 15:50:58 +0900 Subject: [PATCH] Remove notification from pkgmgr-server TC-2519 remove notification dependency (don't create popup by pkgmgr-server) Change-Id: Ief86ac12d936b13e453d6164fca2ff535c8c5c30 Signed-off-by: Sangyoon Jang --- client/src/pkgmgr.c | 23 --- comm/CMakeLists.txt | 2 +- comm/pkgmgr_installer.c | 9 +- comm/pkgmgr_installer_config.h | 1 - packaging/pkgmgr.spec | 1 - server/CMakeLists.txt | 3 +- server/src/pkgmgr-server.c | 355 ++--------------------------------------- tool/pkg_cmd.c | 49 ++---- 8 files changed, 31 insertions(+), 412 deletions(-) diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c index 687ae74..edbdec6 100644 --- a/client/src/pkgmgr.c +++ b/client/src/pkgmgr.c @@ -909,8 +909,6 @@ static int __move_pkg_process(pkgmgr_client * pc, const char *pkgid, uid_t uid, argv[argcnt++] = strdup("-t"); /* argv[6] */ argv[argcnt++] = strdup(buf); - /* argv[7] */ - argv[argcnt++] = strdup("-q"); /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { @@ -1375,11 +1373,6 @@ API int pkgmgr_client_usr_install(pkgmgr_client * pc, const char *pkg_type, argv[argcnt++] = strdup(caller_pkgid); } - -/* argv[6] -q option should be located at the end of command !! */ - if (mode == PM_QUIET) - argv[argcnt++] = strdup("-q"); - /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { temp = g_shell_quote(argv[i]); @@ -1503,10 +1496,6 @@ API int pkgmgr_client_usr_reinstall(pkgmgr_client * pc, const char *pkg_type, co argv[argcnt++] = strdup(optional_file); } - /* argv[5] -q option should be located at the end of command !! */ - if (mode == PM_QUIET) - argv[argcnt++] = strdup("-q"); - /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { temp = g_shell_quote(argv[i]); @@ -1651,9 +1640,6 @@ API int pkgmgr_client_usr_uninstall(pkgmgr_client *pc, const char *pkg_type, argv[argcnt++] = strdup("-p"); argv[argcnt++] = caller_pkgid; } - /* argv[5] -q option should be located at the end of command !! */ - if (mode == PM_QUIET) - argv[argcnt++] = strdup("-q"); /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { @@ -1767,9 +1753,6 @@ API int pkgmgr_client_usr_move(pkgmgr_client *pc, const char *pkg_type, argv[argcnt++] = strdup("-t"); /* argv[6] */ argv[argcnt++] = strdup(buf); - /* argv[7] -q option should be located at the end of command !! */ - if (mode == PM_QUIET) - argv[argcnt++] = strdup("-q"); /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { @@ -1921,9 +1904,6 @@ API int pkgmgr_client_move_usr_pkg(pkgmgr_client *pc, const char *pkg_type, argv[argcnt++] = strdup("-t"); /* argv[6] */ argv[argcnt++] = strdup(buf); - /* argv[5] -q option should be located at the end of command !! */ - if (mode == PM_QUIET) - argv[argcnt++] = strdup("-q"); /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { @@ -2286,9 +2266,6 @@ API int pkgmgr_client_usr_clear_user_data(pkgmgr_client *pc, const char *pkg_typ argv[argcnt++] = strdup("-c"); /* argv[4] */ argv[argcnt++] = strdup(appid); - /* argv[5] -q option should be located at the end of command !! */ - if (mode == PM_QUIET) - argv[argcnt++] = strdup("-q"); /*** add quote in all string for special charactor like '\n'*** FIX */ for (i = 0; i < argcnt; i++) { diff --git a/comm/CMakeLists.txt b/comm/CMakeLists.txt index b921408..23015a4 100644 --- a/comm/CMakeLists.txt +++ b/comm/CMakeLists.txt @@ -40,7 +40,7 @@ foreach(flag ${broadcast_server_pkgs_CFLAGS}) set(broadcast_server_pkgs_CFLAGS_str "${broadcast_server_pkgs_CFLAGS_str} ${flag}") endforeach() -pkg_check_modules(installer_pkgs REQUIRED dbus-1 dlog pkgmgr-info) +pkg_check_modules(installer_pkgs REQUIRED glib-2.0 dbus-1 dlog pkgmgr-info) foreach(flag ${installer_pkgs_CFLAGS}) set(installer_pkgs_CFLAGS_str "${installer_pkgs_CFLAGS_str} ${flag}") endforeach() diff --git a/comm/pkgmgr_installer.c b/comm/pkgmgr_installer.c index 6d5a454..4a9c7d0 100644 --- a/comm/pkgmgr_installer.c +++ b/comm/pkgmgr_installer.c @@ -51,7 +51,6 @@ /* ADT */ struct pkgmgr_installer { int request_type; - int quiet; int move_type; char *pkgmgr_info; char *session_id; @@ -124,7 +123,6 @@ API pkgmgr_installer *pkgmgr_installer_new(void) return ERR_PTR(-ENOMEM); pi->request_type = PKGMGR_REQ_INVALID; - pi->quiet = 0; return pi; } @@ -249,10 +247,6 @@ pkgmgr_installer_receive_request(pkgmgr_installer *pi, pi->move_type = atoi(optarg); break; - case 'q': /* quiet mode */ - pi->quiet = 1; - break; - case 'p': /* caller pkgid*/ if (pi->caller_pkgid) free(pi->caller_pkgid); @@ -322,8 +316,7 @@ API const char *pkgmgr_installer_get_optional_data(pkgmgr_installer *pi) API int pkgmgr_installer_is_quiet(pkgmgr_installer *pi) { - CHK_PI_RET(PKGMGR_REQ_INVALID); - return pi->quiet; + return 1; } API int pkgmgr_installer_get_move_type(pkgmgr_installer *pi) diff --git a/comm/pkgmgr_installer_config.h b/comm/pkgmgr_installer_config.h index 7163d72..f3ae324 100644 --- a/comm/pkgmgr_installer_config.h +++ b/comm/pkgmgr_installer_config.h @@ -45,7 +45,6 @@ const struct option long_opts[] = { { "reinstall", 0, NULL, 'r' }, { "caller-pkgid", 1, NULL, 'p' }, { "smack", 1, NULL, 's' }, - { "quiet", 1, NULL, 'q' }, { 0, 0, 0, 0 } /* sentinel */ }; diff --git a/packaging/pkgmgr.spec b/packaging/pkgmgr.spec index 97cfbf5..5770bbe 100644 --- a/packaging/pkgmgr.spec +++ b/packaging/pkgmgr.spec @@ -30,7 +30,6 @@ BuildRequires: pkgconfig(bundle) BuildRequires: pkgconfig(appcore-efl) BuildRequires: pkgconfig(pkgmgr-info) BuildRequires: pkgconfig(iniparser) -BuildRequires: pkgconfig(notification) BuildRequires: pkgconfig(libtzplatform-config) BuildRequires: pkgconfig(security-manager) BuildRequires: pkgconfig(db-util) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 1917b47..a146fa4 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -9,8 +9,7 @@ pkg_check_modules(SERVER_DEPS REQUIRED ail pkgmgr-parser pkgmgr-info - libtzplatform-config - notification) + libtzplatform-config) FOREACH(SERVER_FLAGS ${SERVER_DEPS_CFLAGS}) SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SERVER_FLAGS}") ENDFOREACH(SERVER_FLAGS) diff --git a/server/src/pkgmgr-server.c b/server/src/pkgmgr-server.c index 85a3fee..41cf761 100644 --- a/server/src/pkgmgr-server.c +++ b/server/src/pkgmgr-server.c @@ -26,9 +26,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -45,9 +43,6 @@ /* For multi-user support */ #include -/* For notification popups */ -#include - #include "pkgmgr_installer.h" #include "comm_pkg_mgr_server.h" #include "pkgmgr-server.h" @@ -60,7 +55,6 @@ #define NO_MATCHING_FILE 11 static int backend_flag = 0; /* 0 means that backend process is not running */ -static int drawing_popup = 0; /* 0 means that pkgmgr-server has no popup now */ typedef struct { char **env; @@ -69,12 +63,6 @@ typedef struct { } user_ctx; -/* For pkgs with no desktop file, inotify callback wont be called. -* To handle that case ail_db_update is initialized as 1 -* This flag will be used to ensure that pkgmgr server does not exit -* before the db is updated. */ -int ail_db_update = 1; - /* 8 bit value to represent maximum 8 backends. Each bit position corresponds to a queue slot which @@ -122,11 +110,6 @@ typedef enum { PMSVC_SVC_APP }pkgmgr_svc_app_component; -struct appdata { - pm_dbus_msg *item; - OPERATION_TYPE op_type; -}; - static int __check_backend_status_for_exit(); static int __check_queue_status_for_exit(); static int __check_backend_mode(); @@ -136,9 +119,6 @@ static void __set_backend_free(int position); static int __is_backend_mode_quiet(int position); static void __set_backend_mode(int position); static void __unset_backend_mode(int position); -static void response_cb1(void *data, void *event_info); -static void response_cb2(void *data, void *event_info); -static int create_popup(struct appdata *ad); static void sighandler(int signo); static int __get_position_from_pkg_type(char *pkgtype); static int __is_efl_tpk_app(char *pkgpath); @@ -396,103 +376,6 @@ err: return ret; } -static -void response_cb1(void *data, void *event_info) -{ - struct appdata *ad = (struct appdata *)data; - int p = 0; - int ret = 0; - DBG("start of response_cb()\n"); - - /* YES */ - DBG("Uninstalling... [%s]\n", ad->item->pkgid); - - if (strlen(ad->item->pkgid) == 0) { - DBG("package_name is empty\n"); - } - - if (strlen(ad->item->pkg_type) == 0) { - DBG("Fail : Uninstalling... [%s]\n", - ad->item->pkgid); - free(ad->item); - drawing_popup = 0; - - return; - } - - DBG("pkg_type = [%s]\n", ad->item->pkg_type); - - ret = _pm_queue_push(ad->item); - p = __get_position_from_pkg_type(ad->item->pkg_type); - __unset_backend_mode(p); - - /* Free resource */ - free(ad->item); - /***************/ - if (ret) - ERR("failed to push queue item"); - - DBG("end of response_cb()\n"); - - drawing_popup = 0; - - return; -} - -static -void response_cb2(void *data, void *event_info) -{ - int p = 0; - struct appdata *ad = (struct appdata *)data; - - DBG("start of response_cb()\n"); - - /* NO */ - pkgmgr_installer *pi; - gboolean ret_parse; - gint argcp; - gchar **argvp; - GError *gerr = NULL; - - pi = pkgmgr_installer_new(); - if (!pi) { - DBG("Failure in creating the pkgmgr_installer object"); - return; - } - - ret_parse = g_shell_parse_argv(ad->item->args, - &argcp, &argvp, &gerr); - if (FALSE == ret_parse) { - DBG("Failed to split args: %s", ad->item->args); - DBG("messsage: %s", gerr->message); - pkgmgr_installer_free(pi); - return; - } - - pkgmgr_installer_receive_request(pi, argcp, argvp); - - pkgmgr_installer_send_signal(pi, ad->item->pkg_type, - ad->item->pkgid, "end", - "cancel"); - - pkgmgr_installer_free(pi); - p = __get_position_from_pkg_type(ad->item->pkg_type); - __set_backend_mode(p); - - /* Free resource */ - free(ad->item); - /***************/ - /* queue_job should be called for every request that is pushed - into queue. In "NO" case, request is not pushed so no need of - calling queue_job*/ - - DBG("end of response_cb()\n"); - - drawing_popup = 0; - - return; -} - #if 0 static char *__get_exe_path(const char *pkgid) { @@ -532,163 +415,6 @@ static char *__get_exe_path(const char *pkgid) } #endif -static -int create_popup(struct appdata *ad) -{ - DBG("start of create_popup()\n"); - - drawing_popup = 1; - - char sentence[MAX_PKG_ARGS_LEN] = { '\0' }; - char *pkgid = NULL; - char app_name[MAX_PKG_NAME_LEN] = { '\0' }; - - notification_h noti = NULL; - notification_error_e err = NOTIFICATION_ERROR_NONE; - - noti = notification_create(NOTIFICATION_TYPE_NOTI); - if (!noti) { - DBG("Failed to create a popup notification\n"); - drawing_popup = 0; - return -1; - } - - /* Sentence of popup */ - int ret; - - pkgid = strrchr(ad->item->pkgid, '/') == NULL ? - ad->item->pkgid : strrchr(ad->item->pkgid, '/') + 1; - - if (ad->op_type == OPERATION_INSTALL) { - snprintf(sentence, sizeof(sentence) - 1, "Install?"); - } else if (ad->op_type == OPERATION_UNINSTALL) { - char *label = NULL; - pkgmgrinfo_pkginfo_h handle; - ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, ad->item->uid, &handle); - - if (ret < 0){ - drawing_popup = 0; - notification_delete(noti); - return -1; - } - ret = pkgmgrinfo_pkginfo_get_label(handle, &label); - if (ret < 0){ - drawing_popup = 0; - notification_delete(noti); - return -1; - } - - snprintf(app_name, sizeof(app_name) - 1, label); - ret = pkgmgrinfo_pkginfo_destroy_pkginfo(handle); - if (ret < 0){ - drawing_popup = 0; - notification_delete(noti); - return -1; - } - - pkgid = app_name; - - snprintf(sentence, sizeof(sentence) - 1, "Uninstall?"); - } else if (ad->op_type == OPERATION_REINSTALL) { - snprintf(sentence, sizeof(sentence) - 1, "Reinstall?"); - } else - snprintf(sentence, sizeof(sentence) - 1, "Invalid request"); - - /***********************************/ - - err = notification_set_text(noti, - NOTIFICATION_TEXT_TYPE_TITLE, pkgid, - NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - if (err != NOTIFICATION_ERROR_NONE) { - DBG("Failed to set popup notification title\n"); - drawing_popup = 0; - notification_delete(noti); - return -1; - } - - err = notification_set_text(noti, - NOTIFICATION_TEXT_TYPE_CONTENT, sentence, - NULL, NOTIFICATION_VARIABLE_TYPE_NONE); - if (err != NOTIFICATION_ERROR_NONE) { - DBG("Failed to set popup notification sentence\n"); - drawing_popup = 0; - notification_delete(noti); - return -1; - } - - /* Details of popup (timeout, buttons...) */ - bundle *b = NULL; - - b = bundle_create(); - if (!b) { - DBG("Failed to set popup notification details\n"); - drawing_popup = 0; - notification_delete(noti); - return -1; - } - - /* TRANSLATION DOES NOT WORK ; TO FIX ? - char *button1_text = dgettext("sys_string", "IDS_COM_SK_YES"); - char *button2_text = dgettext("sys_string", "IDS_COM_SK_NO"); - */ - char *timeout_text = "10"; - char *button1_text = "Yes"; - char *button2_text = "No"; - char *buttons_text = malloc(strlen(button1_text) + - strlen(button2_text) + 2); - strcpy(buttons_text, button1_text); - strcat(buttons_text, ","); - strcat(buttons_text, button2_text); - - bundle_add (b, "timeout", timeout_text); - bundle_add (b, "noresize", "1"); - bundle_add (b, "buttons", buttons_text); - - free(buttons_text); - - err = notification_set_execute_option (noti, - NOTIFICATION_EXECUTE_TYPE_RESPONDING, - NULL, NULL, b); - if (err != NOTIFICATION_ERROR_NONE) { - DBG("Failed to set popup notification as interactive\n"); - drawing_popup = 0; - bundle_free(b); - notification_delete(noti); - return -1; - } - - /* Show the popup */ - err = notification_insert (noti, NULL); - if (err != NOTIFICATION_ERROR_NONE) { - DBG("Failed to set popup notification sentence\n"); - drawing_popup = 0; - bundle_free(b); - notification_delete(noti); - return -1; - } - - /* Catch user response */ - int button; - - err = notification_wait_response (noti, atoi(timeout_text), &button, NULL); - if (err != NOTIFICATION_ERROR_NONE) { - DBG("Failed to wait for user response, defaulting to 'no'\n"); - button = 2; - } - - if (button == 1) { - response_cb1(ad, NULL); - } else if (button == 2) { - response_cb2(ad, NULL); - } - - bundle_free(b); - notification_delete(noti); - - DBG("end of create_popup()\n"); - return 0; -} - static void send_fail_signal(char *pname, char *ptype, char *args) { DBG("send_fail_signal start\n"); @@ -834,8 +560,6 @@ void req_cb(void *cb_data, uid_t uid, const char *req_id, const int req_type, DBG(">> in callback >> Got request: [%s] [%d] [%s] [%s] [%s] [%s] [%s] [%s]", req_id, req_type, pkg_type, pkgid, args, client, session, user); - struct appdata *ad = (struct appdata *)cb_data; - pm_dbus_msg *item = calloc(1, sizeof(pm_dbus_msg)); memset(item, 0x00, sizeof(pm_dbus_msg)); @@ -869,10 +593,7 @@ void req_cb(void *cb_data, uid_t uid, const char *req_id, const int req_type, } g_idle_add(queue_job, NULL); - DBG("req_type=(%d) drawing_popup=(%d) backend_flag=(%d)\n", req_type, - drawing_popup, backend_flag); - - char *quiet = NULL; + DBG("req_type=(%d) backend_flag=(%d)\n", req_type, backend_flag); if (__check_privilege_by_cynara(client, session, user, item->req_type)) { *ret = PKGMGR_R_EPRIV; @@ -881,58 +602,17 @@ void req_cb(void *cb_data, uid_t uid, const char *req_id, const int req_type, switch (item->req_type) { case COMM_REQ_TO_INSTALLER: - /* -q option should be located at the end of command !! */ - if (((quiet = strstr(args, " -q")) && - (quiet[strlen(quiet)] == '\0')) || - ((quiet = strstr(args, " '-q'")) && - (quiet[strlen(quiet)] == '\0'))) { - /* quiet mode */ - if (_pm_queue_push(item)) { - ERR("failed to push queue item"); - *ret = COMM_RET_ERROR; - goto err; - } - p = __get_position_from_pkg_type(item->pkg_type); - __set_backend_mode(p); - /* Free resource */ - free(item); - *ret = COMM_RET_OK; - } else { - /* non quiet mode */ - p = __get_position_from_pkg_type(item->pkg_type); - if (drawing_popup == 0 && - !__is_backend_busy(p) && - __check_backend_mode()) { - /* if there is no popup */ - ad->item = item; - - if (strstr(args, " -i ") - || strstr(args, " '-i' ")) - ad->op_type = OPERATION_INSTALL; - else if (strstr(args, " -d ") - || strstr(args, " '-d' ")) { - ad->op_type = OPERATION_UNINSTALL; - } else if (strstr(args, " -r ") - || strstr(args, " '-r' ")) - ad->op_type = OPERATION_REINSTALL; - else - ad->op_type = OPERATION_MAX; - - if (create_popup(ad)) { - *ret = COMM_RET_ERROR; - DBG("create popup failed\n"); - goto err; - } else { - *ret = COMM_RET_OK; - } - } else { - DBG("info drawing_popup:%d, __is_backend_busy(p):%d, __check_backend_mode():%d\n", - drawing_popup, __is_backend_busy(p), __check_backend_mode()); - /* if popup is already being drawn */ - *ret = COMM_RET_ERROR; - goto err; - } + /* quiet mode */ + if (_pm_queue_push(item)) { + ERR("failed to push queue item"); + *ret = COMM_RET_ERROR; + goto err; } + p = __get_position_from_pkg_type(item->pkg_type); + __set_backend_mode(p); + /* Free resource */ + free(item); + *ret = COMM_RET_OK; break; case COMM_REQ_TO_ACTIVATOR: /* In case of activate, there is no popup */ @@ -980,8 +660,7 @@ void req_cb(void *cb_data, uid_t uid, const char *req_id, const int req_type, *ret = COMM_RET_OK; break; case COMM_REQ_CANCEL: - ad->item = item; - _pm_queue_delete(ad->item); + _pm_queue_delete(item); p = __get_position_from_pkg_type(item->pkg_type); __unset_backend_mode(p); free(item); @@ -1130,9 +809,8 @@ gboolean exit_server(void *data) { DBG("exit_server Start\n"); if (__check_backend_status_for_exit() && - __check_queue_status_for_exit() && - drawing_popup == 0) { - if (!getenv("PMS_STANDALONE") && ail_db_update) { + __check_queue_status_for_exit()) { + if (!getenv("PMS_STANDALONE")) { g_main_loop_quit(mainloop); return FALSE; } @@ -1876,18 +1554,15 @@ int main(int argc, char *argv[]) return -1; } - struct appdata ad; - DBG("Main loop is created."); PkgMgrObject *pkg_mgr; pkg_mgr = g_object_new(PKG_MGR_TYPE_OBJECT, NULL); - pkg_mgr_set_request_callback(pkg_mgr, req_cb, &ad); + pkg_mgr_set_request_callback(pkg_mgr, req_cb, NULL); DBG("pkg_mgr object is created, and request callback is registered."); g_main_loop_run(mainloop); - DBG("Quit main loop."); _pm_queue_final(); __fini_backend_info(); diff --git a/tool/pkg_cmd.c b/tool/pkg_cmd.c index e0cfd68..1d99640 100644 --- a/tool/pkg_cmd.c +++ b/tool/pkg_cmd.c @@ -114,7 +114,6 @@ struct pm_tool_args_t { char pkgid[PKG_NAME_STRING_LEN_MAX]; char des_path[PKG_NAME_STRING_LEN_MAX]; char label[PKG_NAME_STRING_LEN_MAX]; - int quiet; int global; int type; int result; @@ -307,18 +306,17 @@ static void __print_usage() printf("-n, --package-name provide package name\n"); printf("-t, --package-type provide package type\n"); printf("-T, --move-type provide move type [0 : move to internal /1: move to external]\n"); - printf("-q, --quiet quiet mode operation\n"); printf("-G, --global Global Mode [Warning user should be privilegied to use this mode] \n"); printf("-h, --help . print this help\n\n"); - printf("Usage: pkgcmd [options] (--quiet)\n"); - printf("pkgcmd -i -t (-d ) -p (-G) (-q)\n"); - printf("pkgcmd -u -n (-G) (-q)\n"); + printf("Usage: pkgcmd [options]\n"); + printf("pkgcmd -i -t (-d ) -p (-G)\n"); + printf("pkgcmd -u -n (-G)\n"); printf("pkgcmd -r -t -n (-G) \n"); printf("pkgcmd -l (-t ) \n"); - printf("pkgcmd -s -t -p (-q)\n"); - printf("pkgcmd -s -t -n (-q)\n"); - printf("pkgcmd -m -t -T -n (-q)\n\n"); + printf("pkgcmd -s -t -p \n"); + printf("pkgcmd -s -t -n \n"); + printf("pkgcmd -m -t -T -n \n\n"); printf("pkgcmd -g -T -n \n"); printf("pkgcmd -C -n \n"); printf("pkgcmd -k -n \n"); @@ -514,7 +512,6 @@ static int __pkg_list_cb (const pkgmgrinfo_pkginfo_h handle, void *user_data, ui static int __process_request(uid_t uid) { int ret = -1; - int mode = PM_DEFAULT; pkgmgr_client *pc = NULL; char buf[1024] = {'\0'}; int pid = -1; @@ -534,21 +531,17 @@ static int __process_request(uid_t uid) data.result = PKGCMD_ERR_FATAL_ERROR; break; } - if (data.quiet == 0) - mode = PM_DEFAULT; - else - mode = PM_QUIET; if (data.des_path[0] == '\0') { ret = pkgmgr_client_usr_install(pc, data.pkg_type, NULL, - data.pkg_path, NULL, mode, + data.pkg_path, NULL, PM_QUIET, __return_cb, pc, uid); }else{ ret = pkgmgr_client_usr_install(pc, data.pkg_type, data.des_path, data.pkg_path, - NULL, mode, __return_cb, pc, uid); + NULL, PM_QUIET, __return_cb, pc, uid); } if (ret < 0){ @@ -576,11 +569,6 @@ static int __process_request(uid_t uid) data.result = PKGCMD_ERR_FATAL_ERROR; break; } - if (data.quiet == 0) - mode = PM_DEFAULT; - else - mode = PM_QUIET; - //if global ret = __is_app_installed(data.pkgid, uid); if (ret == -1) { @@ -590,7 +578,7 @@ static int __process_request(uid_t uid) ret = pkgmgr_client_usr_uninstall(pc, data.pkg_type, data.pkgid, - mode, __return_cb, NULL,uid); + PM_QUIET, __return_cb, NULL,uid); if (ret < 0){ data.result = PKGCMD_ERR_FATAL_ERROR; if (access(data.pkg_path, F_OK) != 0) @@ -617,8 +605,7 @@ static int __process_request(uid_t uid) break; } - mode = PM_QUIET; - ret = pkgmgr_client_usr_reinstall(pc, data.pkg_type, data.pkgid, NULL, mode, __return_cb, pc, uid); + ret = pkgmgr_client_usr_reinstall(pc, data.pkg_type, data.pkgid, NULL, PM_QUIET, __return_cb, pc, uid); if (ret < 0){ data.result = PKGCMD_ERR_FATAL_ERROR; if (access(data.pkg_path, F_OK) != 0) @@ -643,17 +630,13 @@ static int __process_request(uid_t uid) ret = -1; break; } - if (data.quiet == 0) - mode = PM_DEFAULT; - else - mode = PM_QUIET; ret = __is_app_installed(data.pkgid, uid); if (ret == -1) { printf("package is not installed\n"); break; } ret = pkgmgr_client_usr_clear_user_data(pc, data.pkg_type, - data.pkgid, mode, uid); + data.pkgid, PM_QUIET, uid); if (ret < 0) break; ret = data.result; @@ -744,16 +727,12 @@ static int __process_request(uid_t uid) ret = -1; break; } - mode = PM_QUIET; ret = __is_app_installed(data.pkgid, uid); if (ret == -1) { printf("package is not installed\n"); break; } - if (data.quiet == 0) - ret = pkgmgr_client_usr_move(pc, data.pkg_type, data.pkgid, data.type, mode, uid); - else - ret = pkgmgr_client_usr_request_service(PM_REQUEST_MOVE, data.type, pc, NULL, data.pkgid, uid, NULL, NULL, NULL); + ret = pkgmgr_client_usr_request_service(PM_REQUEST_MOVE, data.type, pc, NULL, data.pkgid, uid, NULL, NULL, NULL); printf("pkg[%s] move result = %d\n", data.pkgid, ret); @@ -1000,7 +979,6 @@ int main(int argc, char *argv[]) memset(data.pkgid, '\0', PKG_NAME_STRING_LEN_MAX); memset(data.pkg_type, '\0', PKG_TYPE_STRING_LEN_MAX); memset(data.label, '\0', PKG_TYPE_STRING_LEN_MAX); - data.quiet = 0; data.global = 0; //By default pkg_cmd will manage for the current user data.result = 0; data.type = -1; @@ -1118,8 +1096,7 @@ int main(int argc, char *argv[]) data.request = HELP_REQ; break; - case 'q': /* quiet mode */ - data.quiet = 1; + case 'q': /* quiet mode is removed */ break; /* Otherwise */ -- 2.7.4