4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Jayoun Lee <airjany@samsung.com>, Sewook Park <sewook7.park@samsung.com>,
7 * Jaeho Lee <jaeho81.lee@samsung.com>, Shobhit Srivastava <shobhit.s@samsung.com>
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
32 #include <dbus/dbus.h>
33 #include <dbus/dbus-glib-lowlevel.h>
38 #include <pkgmgr-info.h>
40 #include "package-manager.h"
41 #include "pkgmgr-internal.h"
42 #include "pkgmgr-api.h"
43 #include "comm_client.h"
44 #include "comm_status_broadcast_server.h"
47 static int _get_request_id()
49 static int internal_req_id = 1;
51 return internal_req_id++;
54 typedef struct _req_cb_info {
57 pkgmgr_handler event_cb;
59 struct _req_cb_info *next;
62 typedef struct _listen_cb_info {
64 pkgmgr_handler event_cb;
66 struct _listen_cb_info *next;
69 typedef struct _pkgmgr_client_t {
78 listen_cb_info *lhead;
86 typedef struct _iter_data {
87 pkgmgr_iter_fn iter_fn;
92 static void __add_op_cbinfo(pkgmgr_client_t * pc, int request_id,
93 const char *req_key, pkgmgr_handler event_cb,
100 cb_info = (req_cb_info *) calloc(1, sizeof(req_cb_info));
101 if (cb_info == NULL) {
102 _LOGD("calloc failed");
105 cb_info->request_id = request_id;
106 cb_info->req_key = strdup(req_key);
107 cb_info->event_cb = event_cb;
108 cb_info->data = data;
109 cb_info->next = NULL;
111 if (pc->info.request.rhead == NULL)
112 pc->info.request.rhead = cb_info;
114 current = prev = pc->info.request.rhead;
117 current = current->next;
120 prev->next = cb_info;
124 static req_cb_info *__find_op_cbinfo(pkgmgr_client_t *pc, const char *req_key)
128 tmp = pc->info.request.rhead;
131 _LOGE("tmp is NULL");
135 _LOGD("tmp->req_key %s, req_key %s", tmp->req_key, req_key);
138 if (strncmp(tmp->req_key, req_key, strlen(tmp->req_key)) == 0)
145 static void __remove_op_cbinfo(pkgmgr_client_t *pc, req_cb_info *info)
149 if (pc == NULL || pc->info.request.rhead == NULL || info == NULL)
152 tmp = pc->info.request.rhead;
154 if (tmp->next == info) {
155 tmp->next = info->next;
164 static void __add_stat_cbinfo(pkgmgr_client_t *pc, int request_id,
165 pkgmgr_handler event_cb, void *data)
167 listen_cb_info *cb_info;
168 listen_cb_info *current;
169 listen_cb_info *prev;
171 cb_info = (listen_cb_info *) calloc(1, sizeof(listen_cb_info));
172 if (cb_info == NULL) {
173 _LOGD("calloc failed");
176 cb_info->request_id = request_id;
177 cb_info->event_cb = event_cb;
178 cb_info->data = data;
179 cb_info->next = NULL;
181 /* TODO - check the order of callback - FIFO or LIFO => Should be changed to LIFO */
182 if (pc->info.listening.lhead == NULL)
183 pc->info.listening.lhead = cb_info;
185 current = prev = pc->info.listening.lhead;
188 current = current->next;
191 prev->next = cb_info;
195 static void __operation_callback(void *cb_data, const char *req_id,
196 const char *pkg_type, const char *pkgid,
197 const char *key, const char *val)
200 req_cb_info *cb_info;
202 _LOGD("__operation_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
203 "key[%s] val[%s]\n", req_id, pkg_type, pkgid, key, val);
205 pc = (pkgmgr_client_t *) cb_data;
207 /* find callback info */
208 cb_info = __find_op_cbinfo(pc, req_id);
212 _LOGD("__find_op_cbinfo");
215 if (cb_info->event_cb) {
216 cb_info->event_cb(cb_info->request_id, pkg_type, pkgid, key,
217 val, NULL, cb_info->data);
218 _LOGD("event_cb is called");
221 /*remove callback for last call
222 if (strcmp(key, "end") == 0) {
223 __remove_op_cbinfo(pc, cb_info);
224 _LOGD("__remove_op_cbinfo");
231 static void __status_callback(void *cb_data, const char *req_id,
232 const char *pkg_type, const char *pkgid,
233 const char *key, const char *val)
238 _LOGD("__status_callback() req_id[%s] pkg_type[%s] pkgid[%s]"
239 "key[%s] val[%s]\n", req_id, pkg_type, pkgid, key, val);
241 pc = (pkgmgr_client_t *) cb_data;
243 tmp = pc->info.listening.lhead;
245 if (tmp->event_cb(tmp->request_id, pkg_type, pkgid, key, val,
246 NULL, tmp->data) != 0)
254 API pkgmgr_client *pkgmgr_client_new(client_type ctype)
256 pkgmgr_client_t *pc = NULL;
259 if (ctype != PC_REQUEST && ctype != PC_LISTENING
260 && ctype != PC_BROADCAST)
263 /* Allocate memory for ADT:pkgmgr_client */
264 pc = calloc(1, sizeof(pkgmgr_client_t));
273 if (pc->ctype == PC_REQUEST) {
274 pc->info.request.cc = comm_client_new();
275 if (pc->info.request.cc == NULL) {
276 _LOGE("client creation failed");
279 ret = comm_client_set_status_callback(pc->info.request.cc,
280 __operation_callback, pc);
282 _LOGE("comm_client_set_status_callback() failed - %d",
286 } else if (pc->ctype == PC_LISTENING) {
287 pc->info.listening.cc = comm_client_new();
288 if (pc->info.listening.cc == NULL) {
289 _LOGE("client creation failed");
292 ret = comm_client_set_status_callback(pc->info.request.cc,
293 __status_callback, pc);
295 _LOGE("comm_client_set_status_callback() failed - %d",
299 } else if (pc->ctype == PC_BROADCAST) {
300 pc->info.broadcast.bc = comm_status_broadcast_server_connect();
301 if (pc->info.broadcast.bc == NULL) {
302 _LOGE("client creation failed");
308 return (pkgmgr_client *) pc;
316 API int pkgmgr_client_free(pkgmgr_client *pc)
319 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
322 _LOGE("Invalid argument");
323 return PKGMGR_R_EINVAL;
326 if (mpc->ctype == PC_REQUEST) {
329 for (tmp = mpc->info.request.rhead; tmp;) {
335 ret = comm_client_free(mpc->info.request.cc);
337 _LOGE("comm_client_free() failed - %d", ret);
340 } else if (mpc->ctype == PC_LISTENING) {
342 listen_cb_info *prev;
343 for (tmp = mpc->info.listening.lhead; tmp;) {
349 ret = comm_client_free(mpc->info.listening.cc);
351 _LOGE("comm_client_free() failed - %d", ret);
354 } else if (mpc->ctype == PC_BROADCAST) {
355 comm_status_broadcast_server_disconnect(mpc->info.broadcast.bc);
358 _LOGE("Invalid client type\n");
359 return PKGMGR_R_EINVAL;
371 return PKGMGR_R_ERROR;
374 static char *__get_req_key(const char *pkg_path)
378 char timestr[PKG_STRING_LEN_MAX];
382 gettimeofday(&tv, NULL);
383 curtime = tv.tv_sec * 1000000 + tv.tv_usec;
384 snprintf(timestr, sizeof(timestr), "%ld", curtime);
386 size = strlen(pkg_path) + strlen(timestr) + 2;
387 str_req_key = (char *)calloc(size, sizeof(char));
388 if (str_req_key == NULL) {
389 _LOGD("calloc failed");
392 snprintf(str_req_key, size, "%s_%s", pkg_path, timestr);
397 static char *__get_type_from_path(const char *pkg_path)
400 char mimetype[255] = { '\0', };
401 char extlist[256] = { '\0', };
404 ret = _get_mime_from_file(pkg_path, mimetype, sizeof(mimetype));
406 _LOGE("_get_mime_from_file() failed - error code[%d]\n",
411 ret = _get_mime_extension(mimetype, extlist, sizeof(extlist));
413 _LOGE("_get_mime_extension() failed - error code[%d]\n",
418 if (strlen(extlist) == 0)
421 if (strchr(extlist, ',')) {
422 extlist[strlen(extlist) - strlen(strchr(extlist, ','))] = '\0';
424 pkg_type = strchr(extlist, '.') + 1;
425 return strdup(pkg_type);
428 API int pkgmgr_client_install(pkgmgr_client * pc, const char *pkg_type,
429 const char *descriptor_path, const char *pkg_path,
430 const char *optional_file, pkgmgr_mode mode,
431 pkgmgr_handler event_cb, void *data)
434 char *installer_path;
438 char *argv[PKG_ARGC_MAX] = { NULL, };
446 /* Check for NULL value of pc */
448 _LOGD("package manager client handle is NULL\n");
449 return PKGMGR_R_EINVAL;
451 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
453 /* 0. check the pc type */
454 if (mpc->ctype != PC_REQUEST)
455 return PKGMGR_R_EINVAL;
457 /* 1. check argument */
458 if (descriptor_path) {
459 if (strlen(descriptor_path) >= PKG_STRING_LEN_MAX)
460 return PKGMGR_R_EINVAL;
462 if (access(descriptor_path, F_OK) != 0)
463 return PKGMGR_R_EINVAL;
466 if (pkg_path == NULL)
467 return PKGMGR_R_EINVAL;
469 if (strlen(pkg_path) >= PKG_STRING_LEN_MAX)
470 return PKGMGR_R_EINVAL;
472 if (access(pkg_path, F_OK) != 0)
473 return PKGMGR_R_EINVAL;
477 if (strlen(optional_file) >= PKG_STRING_LEN_MAX)
478 return PKGMGR_R_EINVAL;
481 /* 2. get installer path using pkg_path */
483 installer_path = _get_backend_path_with_type(pkg_type);
484 pkgtype = strdup(pkg_type);
486 installer_path = _get_backend_path(pkg_path);
487 pkgtype = __get_type_from_path(pkg_path);
490 if (installer_path == NULL) {
492 return PKGMGR_R_EINVAL;
495 /* 3. generate req_key */
496 req_key = __get_req_key(pkg_path);
498 /* 4. add callback info - add callback info to pkgmgr_client */
499 req_id = _get_request_id();
500 __add_op_cbinfo(mpc, req_id, req_key, event_cb, data);
502 /* 5. generate argv */
504 /* argv[0] installer path */
505 argv[argcnt++] = installer_path;
507 argv[argcnt++] = strdup("-k");
509 argv[argcnt++] = req_key;
511 argv[argcnt++] = strdup("-i");
512 /* argv[(4)] if exists */
514 argv[argcnt++] = strdup(descriptor_path);
516 argv[argcnt++] = strdup(pkg_path);
517 /* argv[(5)] if exists */
519 argv[argcnt++] = strdup("-o");
520 argv[argcnt++] = strdup(optional_file);
522 /* argv[6] -q option should be located at the end of command !! */
523 if (mode == PM_QUIET)
524 argv[argcnt++] = strdup("-q");
526 /*** add quote in all string for special charactor like '\n'*** FIX */
527 for (i = 0; i < argcnt; i++) {
528 temp = g_shell_quote(argv[i]);
529 len += (strlen(temp) + 1);
533 args = (char *)calloc(len, sizeof(char));
535 _LOGD("calloc failed");
537 for (i = 0; i < argcnt; i++)
541 return PKGMGR_R_ERROR;
543 strncpy(args, argv[0], len - 1);
545 for (i = 1; i < argcnt; i++) {
546 strncat(args, " ", strlen(" "));
547 temp = g_shell_quote(argv[i]);
548 strncat(args, temp, strlen(temp));
551 _LOGD("[args] %s [len] %d\n", args, len);
552 /******************* end of quote ************************/
554 /* 6. request install */
555 ret = comm_client_request(mpc->info.request.cc, req_key,
556 COMM_REQ_TO_INSTALLER, pkgtype, pkg_path,
559 _LOGE("request failed, ret=%d\n", ret);
561 for (i = 0; i < argcnt; i++)
565 return PKGMGR_R_ECOMM;
568 for (i = 0; i < argcnt; i++)
577 API int pkgmgr_client_reinstall(pkgmgr_client * pc, const char *pkg_type, const char *pkgid,
578 const char *optional_file, pkgmgr_mode mode,
579 pkgmgr_handler event_cb, void *data)
581 char *pkgtype = NULL;
582 char *installer_path = NULL;
583 char *req_key = NULL;
586 char *argv[PKG_ARGC_MAX] = { NULL, };
594 /* Check for NULL value of pc */
595 retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client handle is NULL\n");
597 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
599 /* 0. check the pc type */
600 retv_if(mpc->ctype != PC_REQUEST, PKGMGR_R_EINVAL);
603 /* 1. check argument */
604 retv_if(pkgid == NULL, PKGMGR_R_EINVAL);
605 retv_if(strlen(pkgid) >= PKG_STRING_LEN_MAX, PKGMGR_R_EINVAL);
607 if (strlen(optional_file) >= PKG_STRING_LEN_MAX)
608 return PKGMGR_R_EINVAL;
611 /* 2. get installer path using pkg_path */
612 installer_path = _get_backend_path_with_type(pkg_type);
613 pkgtype = strdup(pkg_type);
614 tryvm_if(installer_path == NULL, ret = PKGMGR_R_EINVAL, "installer_path is null");
616 /* 3. generate req_key */
617 req_key = __get_req_key(pkgid);
619 /* 4. add callback info - add callback info to pkgmgr_client */
620 req_id = _get_request_id();
621 __add_op_cbinfo(mpc, req_id, req_key, event_cb, data);
623 /* 5. generate argv */
625 /* argv[0] installer path */
626 argv[argcnt++] = installer_path;
628 argv[argcnt++] = strdup("-k");
630 argv[argcnt++] = req_key;
632 argv[argcnt++] = strdup("-r");
634 argv[argcnt++] = strdup(pkgid);
635 /* argv[(5)] if exists */
637 argv[argcnt++] = strdup("-o");
638 argv[argcnt++] = strdup(optional_file);
641 /* argv[5] -q option should be located at the end of command !! */
642 if (mode == PM_QUIET)
643 argv[argcnt++] = strdup("-q");
645 /*** add quote in all string for special charactor like '\n'*** FIX */
646 for (i = 0; i < argcnt; i++) {
647 temp = g_shell_quote(argv[i]);
648 len += (strlen(temp) + 1);
652 args = (char *)calloc(len, sizeof(char));
653 tryvm_if(args == NULL, ret = PKGMGR_R_ERROR, "calloc failed");
655 strncpy(args, argv[0], len - 1);
657 for (i = 1; i < argcnt; i++) {
658 strncat(args, " ", strlen(" "));
659 temp = g_shell_quote(argv[i]);
660 strncat(args, temp, strlen(temp));
663 _LOGD("[args] %s [len] %d\n", args, len);
664 /******************* end of quote ************************/
666 /* 6. request install */
667 ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkgid, args, cookie, 1);
668 tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "request failed");
673 for (i = 0; i < argcnt; i++)
682 static inline int __pkgmgr_read_proc(const char *path, char *buf, int size)
687 if (buf == NULL || path == NULL)
690 fd = open(path, O_RDONLY);
694 ret = read(fd, buf, size - 1);
706 static inline int __pkgmgr_find_pid_by_cmdline(const char *dname,
707 const char *cmdline, const char *apppath)
711 if (strncmp(cmdline, apppath, PKG_STRING_LEN_MAX-1) == 0) {
713 if (pid != getpgid(pid))
721 static int __pkgmgr_proc_iter_kill_cmdline(const char *apppath)
724 struct dirent *dentry;
727 char buf[PKG_STRING_LEN_MAX];
729 dp = opendir("/proc");
734 while ((dentry = readdir(dp)) != NULL) {
735 if (!isdigit(dentry->d_name[0]))
738 snprintf(buf, sizeof(buf), "/proc/%s/cmdline", dentry->d_name);
739 ret = __pkgmgr_read_proc(buf, buf, sizeof(buf));
743 pid = __pkgmgr_find_pid_by_cmdline(dentry->d_name, buf, apppath);
754 if (killpg(pgid, SIGKILL) < 0) {
766 static int __app_list_cb (const pkgmgr_appinfo_h handle,
770 pkgmgr_appinfo_get_exec(handle, &exec);
772 __pkgmgr_proc_iter_kill_cmdline(exec);
778 API int pkgmgr_client_uninstall(pkgmgr_client *pc, const char *pkg_type,
779 const char *pkgid, pkgmgr_mode mode,
780 pkgmgr_handler event_cb, void *data)
783 char *installer_path;
787 char *argv[PKG_ARGC_MAX] = { NULL, };
795 /* Check for NULL value of pc */
796 retvm_if(pc == NULL, PKGMGR_R_EINVAL, "package manager client handle is NULL\n");
798 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
800 /* 0. check the pc type */
801 retv_if(mpc->ctype != PC_REQUEST, PKGMGR_R_EINVAL);
803 /* 1. check argument */
804 retv_if(pkgid == NULL, PKGMGR_R_EINVAL);
806 pkgmgr_pkginfo_h handle;
807 ret = pkgmgr_pkginfo_get_pkginfo(pkgid, &handle);
809 /*check package id */
810 tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_pkginfo_get_pkginfo fail");
811 tryvm_if(handle == NULL, ret = PKGMGR_R_EINVAL, "Pkgid(%s) can not find in installed pkg DB! \n", pkgid);
813 /*check running app , terminate app if it is running*/
814 ret = pkgmgr_appinfo_get_list(handle, PM_UI_APP, __app_list_cb, NULL);
815 tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_UI_APP fail");
817 /*check running app , terminate app if it is running*/
818 ret = pkgmgr_appinfo_get_list(handle, PM_SVC_APP, __app_list_cb, NULL);
819 tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_appinfo_get_list : PM_SVC_APP fail");
822 ret = pkgmgr_pkginfo_get_type(handle, &pkgtype);
823 tryvm_if(ret < 0, ret = PKGMGR_R_EINVAL, "pkgmgr_pkginfo_get_type fail");
824 tryvm_if(pkgtype == NULL, ret = PKGMGR_R_ERROR, "pkgtype is NULL");
826 /*check pkgid length */
827 tryvm_if(strlen(pkgid) >= PKG_STRING_LEN_MAX, ret = PKGMGR_R_EINVAL, "pkgid is too long");
829 /* 2. get installer path using pkgtype */
830 installer_path = _get_backend_path_with_type(pkgtype);
831 tryvm_if(installer_path == NULL, ret = PKGMGR_R_EINVAL, "installer_path fail");
833 /* 3. generate req_key */
834 req_key = __get_req_key(pkgid);
836 /* 4. add callback info - add callback info to pkgmgr_client */
837 req_id = _get_request_id();
838 __add_op_cbinfo(mpc, req_id, req_key, event_cb, data);
840 /* 5. generate argv */
842 /* argv[0] installer path */
843 argv[argcnt++] = installer_path;
845 argv[argcnt++] = strdup("-k");
847 argv[argcnt++] = req_key;
849 argv[argcnt++] = strdup("-d");
851 argv[argcnt++] = strdup(pkgid);
852 /* argv[5] -q option should be located at the end of command !! */
853 if (mode == PM_QUIET)
854 argv[argcnt++] = strdup("-q");
856 /*** add quote in all string for special charactor like '\n'*** FIX */
857 for (i = 0; i < argcnt; i++) {
858 temp = g_shell_quote(argv[i]);
859 len += (strlen(temp) + 1);
863 args = (char *)calloc(len, sizeof(char));
864 tryvm_if(args == NULL, ret = PKGMGR_R_ERROR, "calloc failed");
866 strncpy(args, argv[0], len - 1);
868 for (i = 1; i < argcnt; i++) {
869 strncat(args, " ", strlen(" "));
870 temp = g_shell_quote(argv[i]);
871 strncat(args, temp, strlen(temp));
874 _LOGD("[args] %s [len] %d\n", args, len);
875 /******************* end of quote ************************/
877 /* 6. request install */
878 ret = comm_client_request(mpc->info.request.cc, req_key, COMM_REQ_TO_INSTALLER, pkgtype, pkgid, args, cookie, 1);
879 tryvm_if(ret < 0, ret = PKGMGR_R_ECOMM, "calloc failed");
881 for (i = 0; i < argcnt; i++)
886 pkgmgr_pkginfo_destroy_pkginfo(handle);
890 for (i = 0; i < argcnt; i++)
896 pkgmgr_pkginfo_destroy_pkginfo(handle);
901 API int pkgmgr_client_move(pkgmgr_client *pc, const char *pkg_type,
902 const char *pkgid, pkgmgr_move_type move_type, pkgmgr_mode mode)
904 const char *pkgtype = NULL;
905 char *installer_path = NULL;
906 char *req_key = NULL;
908 char *argv[PKG_ARGC_MAX] = { NULL, };
916 char buf[128] = {'\0'};
918 /* Check for NULL value of pc */
920 _LOGD("package manager client handle is NULL\n");
921 return PKGMGR_R_EINVAL;
923 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
924 /*check the pc type */
925 if (mpc->ctype != PC_REQUEST)
926 return PKGMGR_R_EINVAL;
930 return PKGMGR_R_EINVAL;
932 if (pkg_type == NULL) {
933 pkgtype = _get_pkg_type_from_desktop_file(pkgid);
935 return PKGMGR_R_EINVAL;
939 if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
940 return PKGMGR_R_EINVAL;
942 if ((move_type < PM_MOVE_TO_INTERNAL) || (move_type > PM_MOVE_TO_SDCARD))
943 return PKGMGR_R_EINVAL;
945 /* get installer path using pkg_path */
946 installer_path = _get_backend_path_with_type(pkgtype);
947 if (installer_path == NULL)
948 return PKGMGR_R_EINVAL;
950 /* generate req_key */
951 req_key = __get_req_key(pkgid);
952 req_id = _get_request_id();
955 snprintf(buf, 128, "%d", move_type);
956 /* argv[0] installer path */
957 argv[argcnt++] = installer_path;
959 argv[argcnt++] = strdup("-k");
961 argv[argcnt++] = req_key;
963 argv[argcnt++] = strdup("-m");
965 argv[argcnt++] = strdup(pkgid);
967 argv[argcnt++] = strdup("-t");
969 argv[argcnt++] = strdup(buf);
970 /* argv[7] -q option should be located at the end of command !! */
971 if (mode == PM_QUIET)
972 argv[argcnt++] = strdup("-q");
974 /*** add quote in all string for special charactor like '\n'*** FIX */
975 for (i = 0; i < argcnt; i++) {
976 temp = g_shell_quote(argv[i]);
977 len += (strlen(temp) + 1);
981 args = (char *)calloc(len, sizeof(char));
983 _LOGD("calloc failed");
985 for (i = 0; i < argcnt; i++)
988 return PKGMGR_R_ERROR;
990 strncpy(args, argv[0], len - 1);
992 for (i = 1; i < argcnt; i++) {
993 strncat(args, " ", strlen(" "));
994 temp = g_shell_quote(argv[i]);
995 strncat(args, temp, strlen(temp));
998 _LOGD("[args] %s [len] %d\n", args, len);
999 /******************* end of quote ************************/
1001 /* 6. request install */
1002 ret = comm_client_request(mpc->info.request.cc, req_key,
1003 COMM_REQ_TO_MOVER, pkgtype, pkgid,
1006 _LOGE("request failed, ret=%d\n", ret);
1008 for (i = 0; i < argcnt; i++)
1012 return PKGMGR_R_ECOMM;
1015 for (i = 0; i < argcnt; i++)
1023 API int pkgmgr_client_activate(pkgmgr_client * pc, const char *pkg_type,
1026 const char *pkgtype;
1028 char *cookie = NULL;
1030 /* Check for NULL value of pc */
1032 _LOGD("package manager client handle is NULL\n");
1033 return PKGMGR_R_EINVAL;
1035 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1037 /* 0. check the pc type */
1038 if (mpc->ctype != PC_REQUEST)
1039 return PKGMGR_R_EINVAL;
1041 /* 1. check argument */
1043 return PKGMGR_R_EINVAL;
1045 if (pkg_type == NULL) {
1046 pkgtype = _get_pkg_type_from_desktop_file(pkgid);
1047 if (pkgtype == NULL)
1048 return PKGMGR_R_EINVAL;
1052 if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
1053 return PKGMGR_R_EINVAL;
1055 /* 2. generate req_key */
1056 req_key = __get_req_key(pkgid);
1058 /* 3. request activate */
1059 ret = comm_client_request(mpc->info.request.cc, req_key,
1060 COMM_REQ_TO_ACTIVATOR, pkgtype,
1061 pkgid, "1 PKG", cookie, 1);
1063 _LOGE("request failed, ret=%d\n", ret);
1065 return PKGMGR_R_ECOMM;
1073 API int pkgmgr_client_deactivate(pkgmgr_client *pc, const char *pkg_type,
1076 const char *pkgtype;
1078 char *cookie = NULL;
1080 /* Check for NULL value of pc */
1082 _LOGD("package manager client handle is NULL\n");
1083 return PKGMGR_R_EINVAL;
1085 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1087 /* 0. check the pc type */
1088 if (mpc->ctype != PC_REQUEST)
1089 return PKGMGR_R_EINVAL;
1091 /* 1. check argument */
1093 return PKGMGR_R_EINVAL;
1095 if (pkg_type == NULL) {
1096 pkgtype = _get_pkg_type_from_desktop_file(pkgid);
1097 if (pkgtype == NULL)
1098 return PKGMGR_R_EINVAL;
1102 if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
1103 return PKGMGR_R_EINVAL;
1105 /* 2. generate req_key */
1106 req_key = __get_req_key(pkgid);
1108 /* 3. request activate */
1109 ret = comm_client_request(mpc->info.request.cc, req_key,
1110 COMM_REQ_TO_ACTIVATOR, pkgtype,
1111 pkgid, "0 PKG", cookie, 1);
1113 _LOGE("request failed, ret=%d\n", ret);
1115 return PKGMGR_R_ECOMM;
1123 API int pkgmgr_client_activate_app(pkgmgr_client * pc, const char *appid)
1125 const char *pkgtype;
1127 char *cookie = NULL;
1129 /* Check for NULL value of pc */
1131 _LOGD("package manager client handle is NULL\n");
1132 return PKGMGR_R_EINVAL;
1134 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1136 /* 0. check the pc type */
1137 if (mpc->ctype != PC_REQUEST)
1138 return PKGMGR_R_EINVAL;
1140 /* 1. check argument */
1142 return PKGMGR_R_EINVAL;
1144 if (strlen(appid) >= PKG_STRING_LEN_MAX)
1145 return PKGMGR_R_EINVAL;
1147 pkgtype = _get_pkg_type_from_desktop_file(appid);
1149 /* 2. generate req_key */
1150 req_key = __get_req_key(appid);
1152 /* 3. request activate */
1153 ret = comm_client_request(mpc->info.request.cc, req_key,
1154 COMM_REQ_TO_ACTIVATOR, pkgtype,
1155 appid, "1 APP", cookie, 1);
1157 _LOGE("request failed, ret=%d\n", ret);
1159 return PKGMGR_R_ECOMM;
1167 API int pkgmgr_client_activate_appv(pkgmgr_client * pc, const char *appid, char *const argv[])
1169 const char *pkgtype;
1171 char *cookie = NULL;
1179 /* Check for NULL value of pc */
1181 _LOGD("package manager client handle is NULL\n");
1182 return PKGMGR_R_EINVAL;
1184 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1186 /* 0. check the pc type */
1187 if (mpc->ctype != PC_REQUEST)
1188 return PKGMGR_R_EINVAL;
1190 /* 1. check argument */
1192 return PKGMGR_R_EINVAL;
1194 if (strlen(appid) >= PKG_STRING_LEN_MAX)
1195 return PKGMGR_R_EINVAL;
1197 pkgtype = _get_pkg_type_from_desktop_file(appid);
1199 /* 2. generate req_key */
1200 req_key = __get_req_key(appid);
1202 /*** add quote in all string for special charactor like '\n'*** FIX */
1204 for (i = 0; argv[i]; i++) {
1205 temp = g_shell_quote(argv[i]);
1206 len += (strlen(temp) + 1);
1212 args = (char *)calloc(len, sizeof(char));
1214 _LOGE("calloc failed");
1216 return PKGMGR_R_ERROR;
1218 strncpy(args, argv[0], len - 1);
1220 for (i = 1; i < argcnt; i++) {
1221 strncat(args, " ", strlen(" "));
1222 temp = g_shell_quote(argv[i]);
1223 strncat(args, temp, strlen(temp));
1229 argsr = (char *)calloc(strlen("1 APP")+2+len, sizeof(char));
1230 if (argsr == NULL) {
1231 _LOGE("calloc failed");
1234 return PKGMGR_R_ERROR;
1236 strncpy(argsr, "1 APP", strlen("1 APP"));
1238 strncat(argsr, " ", strlen(" "));
1239 strncat(argsr, args, strlen(args));
1242 _LOGD("argsr [%s]\n", argsr);
1243 /******************* end of quote ************************/
1245 /* 3. request activate */
1246 ret = comm_client_request(mpc->info.request.cc, req_key,
1247 COMM_REQ_TO_ACTIVATOR, pkgtype,
1248 appid, argsr, cookie, 1);
1250 _LOGE("request failed, ret=%d\n", ret);
1254 return PKGMGR_R_ECOMM;
1264 API int pkgmgr_client_deactivate_app(pkgmgr_client *pc, const char *appid)
1266 const char *pkgtype;
1268 char *cookie = NULL;
1270 /* Check for NULL value of pc */
1272 _LOGD("package manager client handle is NULL\n");
1273 return PKGMGR_R_EINVAL;
1275 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1277 /* 0. check the pc type */
1278 if (mpc->ctype != PC_REQUEST)
1279 return PKGMGR_R_EINVAL;
1281 /* 1. check argument */
1283 return PKGMGR_R_EINVAL;
1285 if (strlen(appid) >= PKG_STRING_LEN_MAX)
1286 return PKGMGR_R_EINVAL;
1288 pkgtype = _get_pkg_type_from_desktop_file(appid);
1290 /* 2. generate req_key */
1291 req_key = __get_req_key(appid);
1293 /* 3. request activate */
1294 ret = comm_client_request(mpc->info.request.cc, req_key,
1295 COMM_REQ_TO_ACTIVATOR, pkgtype,
1296 appid, "0 APP", cookie, 1);
1298 _LOGE("request failed, ret=%d\n", ret);
1300 return PKGMGR_R_ECOMM;
1309 API int pkgmgr_client_clear_user_data(pkgmgr_client *pc, const char *pkg_type,
1310 const char *appid, pkgmgr_mode mode)
1312 const char *pkgtype;
1313 char *installer_path;
1316 char *argv[PKG_ARGC_MAX] = { NULL, };
1322 char *cookie = NULL;
1324 /* Check for NULL value of pc */
1326 _LOGD("package manager client handle is NULL\n");
1327 return PKGMGR_R_EINVAL;
1329 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1331 /* 0. check the pc type */
1332 if (mpc->ctype != PC_REQUEST)
1333 return PKGMGR_R_EINVAL;
1335 /* 1. check argument */
1337 return PKGMGR_R_EINVAL;
1340 if (pkg_type == NULL) {
1341 pkgtype = _get_pkg_type_from_desktop_file(appid);
1342 if (pkgtype == NULL)
1343 return PKGMGR_R_EINVAL;
1347 if (strlen(appid) >= PKG_STRING_LEN_MAX)
1348 return PKGMGR_R_EINVAL;
1350 /* 2. get installer path using pkg_path */
1351 installer_path = _get_backend_path_with_type(pkgtype);
1352 if (installer_path == NULL)
1353 return PKGMGR_R_EINVAL;
1355 /* 3. generate req_key */
1356 req_key = __get_req_key(appid);
1358 /* 4. generate argv */
1360 /* argv[0] installer path */
1361 argv[argcnt++] = installer_path;
1363 argv[argcnt++] = strdup("-k");
1365 argv[argcnt++] = req_key;
1367 argv[argcnt++] = strdup("-c");
1369 argv[argcnt++] = strdup(appid);
1370 /* argv[5] -q option should be located at the end of command !! */
1371 if (mode == PM_QUIET)
1372 argv[argcnt++] = strdup("-q");
1374 /*** add quote in all string for special charactor like '\n'*** FIX */
1375 for (i = 0; i < argcnt; i++) {
1376 temp = g_shell_quote(argv[i]);
1377 len += (strlen(temp) + 1);
1381 args = (char *)calloc(len, sizeof(char));
1383 _LOGD("calloc failed");
1385 for (i = 0; i < argcnt; i++)
1388 return PKGMGR_R_ERROR;
1390 strncpy(args, argv[0], len - 1);
1392 for (i = 1; i < argcnt; i++) {
1393 strncat(args, " ", strlen(" "));
1394 temp = g_shell_quote(argv[i]);
1395 strncat(args, temp, strlen(temp));
1398 _LOGD("[args] %s [len] %d\n", args, len);
1399 /******************* end of quote ************************/
1401 /* 6. request clear */
1402 ret = comm_client_request(mpc->info.request.cc, req_key,
1403 COMM_REQ_TO_CLEARER, pkgtype, appid,
1406 _LOGE("request failed, ret=%d\n", ret);
1408 for (i = 0; i < argcnt; i++)
1412 return PKGMGR_R_ECOMM;
1415 for (i = 0; i < argcnt; i++)
1423 API int pkgmgr_client_listen_status(pkgmgr_client *pc, pkgmgr_handler event_cb,
1427 /* Check for NULL value of pc */
1429 _LOGD("package manager client handle is NULL\n");
1430 return PKGMGR_R_EINVAL;
1432 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1434 /* 0. check the pc type */
1435 if (mpc->ctype != PC_LISTENING)
1436 return PKGMGR_R_EINVAL;
1438 /* 1. check argument */
1439 if (event_cb == NULL)
1440 return PKGMGR_R_EINVAL;
1442 /* 2. add callback info to pkgmgr_client */
1443 req_id = _get_request_id();
1444 __add_stat_cbinfo(mpc, req_id, event_cb, data);
1449 API int pkgmgr_client_broadcast_status(pkgmgr_client *pc, const char *pkg_type,
1450 const char *pkgid, const char *key,
1453 /* Check for NULL value of pc */
1455 _LOGD("package manager client handle is NULL\n");
1456 return PKGMGR_R_EINVAL;
1458 /* Check for valid arguments. NULL parameter causes DBUS to abort */
1459 if (pkgid == NULL || pkg_type == NULL || key == NULL || val == NULL) {
1460 _LOGD("Argument supplied is NULL\n");
1461 return PKGMGR_R_EINVAL;
1463 pkgmgr_client_t *mpc = (pkgmgr_client_t *) pc;
1465 /* 0. check the pc type */
1466 if (mpc->ctype != PC_BROADCAST)
1467 return PKGMGR_R_EINVAL;
1469 comm_status_broadcast_server_send_signal(mpc->info.broadcast.bc,
1470 PKG_STATUS, pkg_type,
1476 API pkgmgr_info *pkgmgr_client_check_pkginfo_from_file(const char *pkg_path)
1478 return pkgmgr_info_new_from_file(NULL, pkg_path);
1481 API int pkgmgr_client_free_pkginfo(pkgmgr_info * pkg_info)
1483 if (pkg_info == NULL)
1484 return PKGMGR_R_EINVAL;
1486 package_manager_pkg_detail_info_t *info = (package_manager_pkg_detail_info_t *)pkg_info;
1489 free(info->icon_buf);
1491 if (info->privilege_list)
1492 g_list_free(info->privilege_list);
1500 ail_cb_ret_e __appinfo_func(const ail_appinfo_h appinfo, void *user_data)
1506 iter_data *udata = (iter_data *) user_data;
1508 ail_appinfo_get_str(appinfo, AIL_PROP_X_SLP_PACKAGETYPE_STR, &type);
1511 ail_appinfo_get_str(appinfo, AIL_PROP_PACKAGE_STR, &package);
1512 if (package == NULL)
1514 ail_appinfo_get_str(appinfo, AIL_PROP_VERSION_STR, &version);
1515 if (version == NULL)
1518 if (udata->iter_fn(type, package, version, udata->data) != 0)
1519 return AIL_CB_RET_CANCEL;
1521 return AIL_CB_RET_CONTINUE;
1526 #define __START_OF_OLD_API
1528 API int pkgmgr_get_pkg_list(pkgmgr_iter_fn iter_fn, void *data)
1531 ail_filter_h filter;
1534 if (iter_fn == NULL)
1535 return PKGMGR_R_EINVAL;
1537 ret = ail_filter_new(&filter);
1538 if (ret != AIL_ERROR_OK) {
1539 return PKGMGR_R_ERROR;
1542 ret = ail_filter_add_str(filter, AIL_PROP_TYPE_STR, "Application");
1543 if (ret != AIL_ERROR_OK) {
1544 ail_filter_destroy(filter);
1545 return PKGMGR_R_ERROR;
1548 ret = ail_filter_add_bool(filter, AIL_PROP_X_SLP_REMOVABLE_BOOL, true);
1549 if (ret != AIL_ERROR_OK) {
1550 ail_filter_destroy(filter);
1551 return PKGMGR_R_ERROR;
1554 ret = ail_filter_count_appinfo(filter, &cnt);
1555 if (ret != AIL_ERROR_OK) {
1556 ail_filter_destroy(filter);
1557 return PKGMGR_R_ERROR;
1560 iter_data *udata = calloc(1, sizeof(iter_data));
1561 if (udata == NULL) {
1562 _LOGE("calloc failed");
1563 ail_filter_destroy(filter);
1565 return PKGMGR_R_ERROR;
1567 udata->iter_fn = iter_fn;
1570 ail_filter_list_appinfo_foreach(filter, __appinfo_func, udata);
1574 ret = ail_filter_destroy(filter);
1575 if (ret != AIL_ERROR_OK) {
1576 return PKGMGR_R_ERROR;
1582 API pkgmgr_info *pkgmgr_info_new(const char *pkg_type, const char *pkgid)
1584 const char *pkgtype;
1585 pkg_plugin_set *plugin_set = NULL;
1586 package_manager_pkg_detail_info_t *pkg_detail_info = NULL;
1588 /* 1. check argument */
1592 if (pkg_type == NULL) {
1593 pkgtype = _get_pkg_type_from_desktop_file(pkgid);
1594 if (pkgtype == NULL)
1599 if (strlen(pkgid) >= PKG_STRING_LEN_MAX)
1602 pkg_detail_info = calloc(1, sizeof(package_manager_pkg_detail_info_t));
1603 if (pkg_detail_info == NULL) {
1604 _LOGE("*** Failed to alloc package_handler_info.\n");
1608 plugin_set = _package_manager_load_library(pkgtype);
1609 if (plugin_set == NULL) {
1610 _LOGE("*** Failed to load library");
1611 free(pkg_detail_info);
1615 if (plugin_set->pkg_is_installed) {
1616 if (plugin_set->pkg_is_installed(pkgid) != 0) {
1617 _LOGE("*** Failed to call pkg_is_installed()");
1618 free(pkg_detail_info);
1622 if (plugin_set->get_pkg_detail_info) {
1623 if (plugin_set->get_pkg_detail_info(pkgid,
1624 pkg_detail_info) != 0) {
1625 _LOGE("*** Failed to call get_pkg_detail_info()");
1626 free(pkg_detail_info);
1632 return (pkgmgr_info *) pkg_detail_info;
1635 API char * pkgmgr_info_get_string(pkgmgr_info * pkg_info, const char *key)
1637 package_manager_pkg_detail_info_t *pkg_detail_info;
1639 if (pkg_info == NULL)
1644 pkg_detail_info = (package_manager_pkg_detail_info_t *) pkg_info;
1646 return _get_info_string(key, pkg_detail_info);
1649 API pkgmgr_info *pkgmgr_info_new_from_file(const char *pkg_type,
1650 const char *pkg_path)
1652 pkg_plugin_set *plugin_set = NULL;
1653 package_manager_pkg_detail_info_t *pkg_detail_info = NULL;
1655 if (pkg_path == NULL) {
1656 _LOGE("pkg_path is NULL\n");
1660 if (strlen(pkg_path) > PKG_URL_STRING_LEN_MAX) {
1661 _LOGE("length of pkg_path is too long - %d.\n",
1666 pkg_detail_info = calloc(1, sizeof(package_manager_pkg_detail_info_t));
1667 if (pkg_detail_info == NULL) {
1668 _LOGE("*** Failed to alloc package_handler_info.\n");
1672 if (pkg_type == NULL)
1673 pkgtype = __get_type_from_path(pkg_path);
1675 pkgtype = strdup(pkg_type);
1677 plugin_set = _package_manager_load_library(pkgtype);
1678 if (plugin_set == NULL) {
1679 free(pkg_detail_info);
1684 if (plugin_set->get_pkg_detail_info_from_package) {
1685 if (plugin_set->get_pkg_detail_info_from_package(pkg_path,
1686 pkg_detail_info) != 0) {
1687 free(pkg_detail_info);
1694 return (pkgmgr_info *) pkg_detail_info;
1697 API int pkgmgr_info_free(pkgmgr_info * pkg_info)
1699 if (pkg_info == NULL)
1700 return PKGMGR_R_EINVAL;
1708 #define __END_OF_OLD_API
1710 API int pkgmgr_pkginfo_get_list(pkgmgr_info_pkg_list_cb pkg_list_cb, void *user_data)
1713 ret = pkgmgrinfo_pkginfo_get_list(pkg_list_cb, user_data);
1717 API int pkgmgr_pkginfo_get_pkginfo(const char *pkgid, pkgmgr_pkginfo_h *handle)
1720 ret = pkgmgrinfo_pkginfo_get_pkginfo(pkgid, handle);
1724 API int pkgmgr_pkginfo_get_pkgname(pkgmgr_pkginfo_h handle, char **pkg_name)
1727 ret = pkgmgrinfo_pkginfo_get_pkgname(handle, pkg_name);
1732 API int pkgmgr_pkginfo_get_pkgid(pkgmgr_pkginfo_h handle, char **pkgid)
1735 ret = pkgmgrinfo_pkginfo_get_pkgid(handle, pkgid);
1739 API int pkgmgr_pkginfo_get_type(pkgmgr_pkginfo_h handle, char **type)
1742 ret = pkgmgrinfo_pkginfo_get_type(handle, type);
1746 API int pkgmgr_pkginfo_get_version(pkgmgr_pkginfo_h handle, char **version)
1749 ret = pkgmgrinfo_pkginfo_get_version(handle, version);
1753 API int pkgmgr_pkginfo_get_install_location(pkgmgr_pkginfo_h handle, pkgmgr_install_location *location)
1756 pkgmgrinfo_install_location loc;
1757 ret = pkgmgrinfo_pkginfo_get_install_location(handle, &loc);
1762 API int pkgmgr_pkginfo_get_package_size(pkgmgr_pkginfo_h handle, int *size)
1765 ret = pkgmgrinfo_pkginfo_get_package_size(handle, size);
1769 API int pkgmgr_pkginfo_get_icon(pkgmgr_pkginfo_h handle, char **icon)
1772 ret = pkgmgrinfo_pkginfo_get_icon(handle, icon);
1776 API int pkgmgr_pkginfo_get_label(pkgmgr_pkginfo_h handle, char **label)
1779 ret = pkgmgrinfo_pkginfo_get_label(handle, label);
1783 API int pkgmgr_pkginfo_get_description(pkgmgr_pkginfo_h handle, char **description)
1786 ret = pkgmgrinfo_pkginfo_get_description(handle, description);
1790 API int pkgmgr_pkginfo_get_author_name(pkgmgr_pkginfo_h handle, char **author_name)
1793 ret = pkgmgrinfo_pkginfo_get_author_name(handle, author_name);
1797 API int pkgmgr_pkginfo_get_author_email(pkgmgr_pkginfo_h handle, char **author_email)
1800 ret = pkgmgrinfo_pkginfo_get_author_email(handle, author_email);
1804 API int pkgmgr_pkginfo_get_author_href(pkgmgr_pkginfo_h handle, char **author_href)
1807 ret = pkgmgrinfo_pkginfo_get_author_href(handle, author_href);
1811 API int pkgmgr_pkginfo_is_removable(pkgmgr_pkginfo_h handle, bool *removable)
1814 ret = pkgmgrinfo_pkginfo_is_removable(handle, removable);
1818 API int pkgmgr_pkginfo_is_preload(pkgmgr_pkginfo_h handle, bool *preload)
1821 ret = pkgmgrinfo_pkginfo_is_preload(handle, preload);
1825 API int pkgmgr_pkginfo_is_readonly(pkgmgr_pkginfo_h handle, bool *readonly)
1828 ret = pkgmgrinfo_pkginfo_is_readonly(handle, readonly);
1832 API int pkgmgr_pkginfo_is_accessible(pkgmgr_pkginfo_h handle, bool *accessible)
1835 ret = pkgmgrinfo_pkginfo_is_accessible(handle, accessible);
1839 API int pkgmgr_pkginfo_destroy_pkginfo(pkgmgr_pkginfo_h handle)
1842 ret = pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
1846 API int pkgmgr_pkginfo_get_installed_storage(pkgmgr_pkginfo_h handle, pkgmgr_installed_storage *storage)
1849 pkgmgrinfo_installed_storage sto;
1850 ret = pkgmgrinfo_pkginfo_get_installed_storage(handle, &sto);
1855 API int pkgmgr_pkginfo_get_installed_time(pkgmgr_pkginfo_h handle, int *installed_time)
1858 ret = pkgmgrinfo_pkginfo_get_installed_time(handle, installed_time);
1862 API int pkgmgr_appinfo_get_list(pkgmgr_pkginfo_h handle, pkgmgr_app_component component,
1863 pkgmgr_info_app_list_cb app_func, void *user_data)
1866 ret = pkgmgrinfo_appinfo_get_list(handle, component, app_func, user_data);
1870 API int pkgmgr_appinfo_foreach_category(pkgmgr_appinfo_h handle, pkgmgr_info_app_category_list_cb category_func,
1874 ret = pkgmgrinfo_appinfo_foreach_category(handle, category_func, user_data);
1878 API int pkgmgr_appinfo_get_appinfo(const char *appid, pkgmgr_appinfo_h *handle)
1881 ret = pkgmgrinfo_appinfo_get_appinfo(appid, handle);
1885 API int pkgmgr_appinfo_get_appid(pkgmgr_appinfo_h handle, char **appid)
1888 ret = pkgmgrinfo_appinfo_get_appid(handle, appid);
1892 API int pkgmgr_appinfo_get_pkgname(pkgmgr_appinfo_h handle, char **pkg_name)
1895 ret = pkgmgrinfo_appinfo_get_pkgname(handle, pkg_name);
1899 API int pkgmgr_appinfo_get_pkgid(pkgmgr_appinfo_h handle, char **pkgid)
1902 ret = pkgmgrinfo_appinfo_get_pkgid(handle, pkgid);
1906 API int pkgmgr_appinfo_get_icon(pkgmgr_appinfo_h handle, char **icon)
1909 ret = pkgmgrinfo_appinfo_get_icon(handle, icon);
1913 API int pkgmgr_appinfo_get_label(pkgmgr_appinfo_h handle, char **label)
1916 ret = pkgmgrinfo_appinfo_get_label(handle, label);
1920 API int pkgmgr_appinfo_get_exec(pkgmgr_appinfo_h handle, char **exec)
1923 ret = pkgmgrinfo_appinfo_get_exec(handle, exec);
1927 API int pkgmgr_appinfo_get_component(pkgmgr_appinfo_h handle, pkgmgr_app_component *component)
1930 pkgmgrinfo_app_component comp;
1931 ret = pkgmgrinfo_appinfo_get_component(handle, &comp);
1936 API int pkgmgr_appinfo_get_apptype(pkgmgr_appinfo_h handle, char **app_type)
1939 ret = pkgmgrinfo_appinfo_get_apptype(handle, app_type);
1943 API int pkgmgr_appinfo_is_nodisplay(pkgmgr_appinfo_h handle, bool *nodisplay)
1946 ret = pkgmgrinfo_appinfo_is_nodisplay(handle, nodisplay);
1950 API int pkgmgr_appinfo_is_multiple(pkgmgr_appinfo_h handle, bool *multiple)
1953 ret = pkgmgrinfo_appinfo_is_multiple(handle, multiple);
1957 API int pkgmgr_appinfo_is_taskmanage(pkgmgr_appinfo_h handle, bool *taskmanage)
1960 ret = pkgmgrinfo_appinfo_is_taskmanage(handle, taskmanage);
1964 API int pkgmgr_appinfo_get_hwacceleration(pkgmgr_appinfo_h handle, pkgmgr_hwacceleration_type *hwacceleration)
1967 pkgmgrinfo_app_hwacceleration hwacc;
1968 ret = pkgmgrinfo_appinfo_get_hwacceleration(handle, &hwacc);
1969 *hwacceleration = hwacc;
1973 API int pkgmgr_appinfo_is_onboot(pkgmgr_appinfo_h handle, bool *onboot)
1976 ret = pkgmgrinfo_appinfo_is_onboot(handle, onboot);
1980 API int pkgmgr_appinfo_is_autorestart(pkgmgr_appinfo_h handle, bool *autorestart)
1983 ret = pkgmgrinfo_appinfo_is_autorestart(handle, autorestart);
1987 API int pkgmgr_appinfo_destroy_appinfo(pkgmgr_appinfo_h handle)
1990 ret = pkgmgrinfo_appinfo_destroy_appinfo(handle);
1994 API int pkgmgr_pkginfo_create_certinfo(pkgmgr_certinfo_h *handle)
1997 ret = pkgmgrinfo_pkginfo_create_certinfo(handle);
2001 API int pkgmgr_pkginfo_load_certinfo(const char *pkgid, pkgmgr_certinfo_h handle)
2004 ret = pkgmgrinfo_pkginfo_load_certinfo(pkgid, handle);
2008 API int pkgmgr_pkginfo_get_cert_value(pkgmgr_certinfo_h handle, pkgmgr_cert_type cert_type, const char **cert_value)
2011 ret = pkgmgrinfo_pkginfo_get_cert_value(handle, cert_type, cert_value);
2015 API int pkgmgr_pkginfo_destroy_certinfo(pkgmgr_certinfo_h handle)
2018 ret = pkgmgrinfo_pkginfo_destroy_certinfo(handle);
2022 API int pkgmgr_datacontrol_get_info(const char *providerid, const char * type, char **appid, char **access)
2025 ret = pkgmgrinfo_datacontrol_get_info(providerid, type, appid, access);