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.
30 #include <sys/smack.h>
31 #include <linux/limits.h>
35 #include <libxml/parser.h>
36 #include <libxml/xmlreader.h>
37 #include <libxml/xmlschemas.h>
41 #include "pkgmgr_parser.h"
42 #include "pkgmgrinfo_basic.h"
43 #include "pkgmgrinfo_private.h"
44 #include "pkgmgrinfo_debug.h"
45 #include "pkgmgr-info.h"
46 #include "pkgmgr_parser_db.h"
47 #include "pkgmgr_parser_internal.h"
49 static int _pkginfo_get_pkginfo(const char *pkgid, uid_t uid,
50 pkgmgr_pkginfo_x **pkginfo);
51 static char *_get_filtered_query(const char *query_raw,
52 pkgmgrinfo_filter_x *filter);
54 static gint __compare_func(gconstpointer data1, gconstpointer data2)
56 pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x*)data1;
57 pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x*)data2;
58 if (node1->prop == node2->prop)
60 else if (node1->prop > node2->prop)
66 static void __destroy_each_node(gpointer data, gpointer user_data)
69 pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)data;
82 static void __cleanup_pkginfo(pkgmgr_pkginfo_x *data)
86 free((void *)data->locale);
90 pkgmgrinfo_basic_free_package(data->pkg_info);
96 static int __child_element(xmlTextReaderPtr reader, int depth)
98 int ret = xmlTextReaderRead(reader);
99 int cur = xmlTextReaderDepth(reader);
102 switch (xmlTextReaderNodeType(reader)) {
103 case XML_READER_TYPE_ELEMENT:
104 if (cur == depth + 1)
107 case XML_READER_TYPE_TEXT:
108 /*text is handled by each function separately*/
109 if (cur == depth + 1)
112 case XML_READER_TYPE_END_ELEMENT:
121 ret = xmlTextReaderRead(reader);
122 cur = xmlTextReaderDepth(reader);
127 long long _pkgmgr_calculate_dir_size(char *dirname)
131 int q = 0; /*quotient*/
132 int r = 0; /*remainder*/
134 struct dirent *ep = NULL;
135 struct stat fileinfo;
136 char abs_filename[FILENAME_MAX] = { 0, };
137 retvm_if(dirname == NULL, PMINFO_R_ERROR, "dirname is NULL");
139 dp = opendir(dirname);
141 while ((ep = readdir(dp)) != NULL) {
142 if (!strcmp(ep->d_name, ".") ||
143 !strcmp(ep->d_name, "..")) {
146 snprintf(abs_filename, FILENAME_MAX, "%s/%s", dirname,
148 if (lstat(abs_filename, &fileinfo) < 0)
149 perror(abs_filename);
151 if (S_ISDIR(fileinfo.st_mode)) {
152 total += fileinfo.st_size;
153 if (strcmp(ep->d_name, ".")
154 && strcmp(ep->d_name, "..")) {
155 ret = _pkgmgr_calculate_dir_size
159 } else if (S_ISLNK(fileinfo.st_mode)) {
162 /*It is a file. Calculate the actual
163 size occupied (in terms of 4096 blocks)*/
164 q = (fileinfo.st_size / BLOCK_SIZE);
165 r = (fileinfo.st_size % BLOCK_SIZE);
169 total += q * BLOCK_SIZE;
175 _LOGE("Couldn't open the directory\n");
182 static gint __list_strcmp(gconstpointer a, gconstpointer b)
184 return strcmp((char *)a, (char *)b);
187 static int _pkginfo_get_list(sqlite3 *db, const char *locale,
188 pkgmgrinfo_filter_x *filter, GList **list)
190 static const char query_raw[] =
191 "SELECT DISTINCT package_info.package FROM package_info"
192 " LEFT OUTER JOIN package_localized_info"
193 " ON package_info.package=package_localized_info.package"
194 " AND package_localized_info.package_locale=%Q "
195 " LEFT OUTER JOIN package_privilege_info"
196 " ON package_info.package=package_privilege_info.package";
199 char *query_localized;
203 query = _get_filtered_query(query_raw, filter);
206 query_localized = sqlite3_mprintf(query, locale);
208 if (query_localized == NULL)
211 ret = sqlite3_prepare_v2(db, query_localized,
212 strlen(query_localized), &stmt, NULL);
213 sqlite3_free(query_localized);
214 if (ret != SQLITE_OK) {
215 LOGE("prepare failed: %s", sqlite3_errmsg(db));
219 while (sqlite3_step(stmt) == SQLITE_ROW) {
220 _save_column_str(stmt, 0, (const char **)&pkgid);
222 *list = g_list_insert_sorted(*list, pkgid,
226 sqlite3_finalize(stmt);
231 static int _pkginfo_get_filtered_list(pkgmgrinfo_filter_x *filter, uid_t uid,
240 locale = _get_system_locale();
242 return PMINFO_R_ERROR;
244 dbpath = getUserPkgParserDBPathUID(uid);
245 if (dbpath == NULL) {
247 return PMINFO_R_ERROR;
250 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
251 if (ret != SQLITE_OK) {
252 _LOGE("failed to open db: %d", ret);
254 return PMINFO_R_ERROR;
257 if (_pkginfo_get_list(db, locale, filter, list)) {
259 sqlite3_close_v2(db);
260 return PMINFO_R_ERROR;
262 sqlite3_close_v2(db);
264 if (uid == GLOBAL_USER) {
269 /* search again from global */
270 dbpath = getUserPkgParserDBPathUID(GLOBAL_USER);
271 if (dbpath == NULL) {
273 return PMINFO_R_ERROR;
276 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
277 if (ret != SQLITE_OK) {
278 _LOGE("failed to open db: %d", ret);
280 return PMINFO_R_ERROR;
283 if (_pkginfo_get_list(db, locale, filter, list)) {
285 sqlite3_close_v2(db);
286 return PMINFO_R_ERROR;
288 sqlite3_close_v2(db);
290 /* remove duplicate element:
291 * since the list is sorted, we can remove duplicates in linear time
293 for (tmp = *list; tmp; tmp = tmp->next) {
294 if (tmp->prev == NULL || tmp->data == NULL)
296 if (strcmp((const char *)tmp->prev->data,
297 (const char *)tmp->data) == 0)
298 *list = g_list_delete_link(*list, tmp);
305 static int _pkginfo_get_filtered_foreach_pkginfo(pkgmgrinfo_filter_x *filter,
306 pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data, uid_t uid)
309 pkgmgr_pkginfo_x *info;
315 ret = _pkginfo_get_filtered_list(filter, uid, &list);
316 if (ret != PMINFO_R_OK)
317 return PMINFO_R_ERROR;
319 for (tmp = list; tmp; tmp = tmp->next) {
320 pkgid = (char *)tmp->data;
322 ret = _pkginfo_get_pkginfo(pkgid, uid, &info);
323 if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
324 ret = _pkginfo_get_pkginfo(pkgid, GLOBAL_USER,
326 if (ret != PMINFO_R_OK) {
330 if (pkg_list_cb(info, user_data) < 0)
332 pkgmgrinfo_pkginfo_destroy_pkginfo(info);
342 API int pkgmgrinfo_pkginfo_get_usr_list(pkgmgrinfo_pkg_list_cb pkg_list_cb,
343 void *user_data, uid_t uid)
345 if (pkg_list_cb == NULL) {
346 LOGE("invalid parameter");
347 return PMINFO_R_EINVAL;
350 return _pkginfo_get_filtered_foreach_pkginfo(NULL, pkg_list_cb,
354 API int pkgmgrinfo_pkginfo_get_list(pkgmgrinfo_pkg_list_cb pkg_list_cb, void *user_data)
356 return pkgmgrinfo_pkginfo_get_usr_list(pkg_list_cb, user_data, GLOBAL_USER);
359 static int _pkginfo_get_author(sqlite3 *db, const char *pkgid,
362 static const char query_raw[] =
363 "SELECT author_name, author_email, author_href "
364 "FROM package_info WHERE package=%Q";
371 query = sqlite3_mprintf(query_raw, pkgid);
373 LOGE("out of memory");
374 return PMINFO_R_ERROR;
377 ret = sqlite3_prepare_v2(db, query, strlen(query),
380 if (ret != SQLITE_OK) {
381 LOGE("prepare failed: %s", sqlite3_errmsg(db));
382 return PMINFO_R_ERROR;
385 if (sqlite3_step(stmt) == SQLITE_ERROR) {
386 LOGE("step error: %s", sqlite3_errmsg(db));
387 sqlite3_finalize(stmt);
388 return PMINFO_R_ERROR;
391 /* one author per one package */
392 info = calloc(1, sizeof(author_x));
394 LOGE("out of memory");
395 sqlite3_finalize(stmt);
396 return PMINFO_R_ERROR;
399 _save_column_str(stmt, idx++, &info->text);
400 _save_column_str(stmt, idx++, &info->email);
401 _save_column_str(stmt, idx++, &info->href);
405 sqlite3_finalize(stmt);
410 static int _pkginfo_get_label(sqlite3 *db, const char *pkgid,
411 const char *locale, label_x **label)
413 static const char query_raw[] =
414 "SELECT package_label, package_locale "
415 "FROM package_localized_info "
416 "WHERE package=%Q AND package_locale IN (%Q, %Q)";
423 query = sqlite3_mprintf(query_raw, pkgid, locale, DEFAULT_LOCALE);
425 LOGE("out of memory");
426 return PMINFO_R_ERROR;
429 ret = sqlite3_prepare_v2(db, query, strlen(query),
432 if (ret != SQLITE_OK) {
433 LOGE("prepare failed: %s", sqlite3_errmsg(db));
434 return PMINFO_R_ERROR;
437 while (sqlite3_step(stmt) == SQLITE_ROW) {
438 info = calloc(1, sizeof(label_x));
440 LOGE("out of memory");
441 sqlite3_finalize(stmt);
443 LISTHEAD(*label, info);
446 return PMINFO_R_ERROR;
449 _save_column_str(stmt, idx++, &info->text);
450 _save_column_str(stmt, idx++, &info->lang);
451 LISTADD(*label, info);
455 LISTHEAD(*label, info);
459 sqlite3_finalize(stmt);
464 static int _pkginfo_get_icon(sqlite3 *db, const char *pkgid, const char *locale,
467 static const char query_raw[] =
468 "SELECT package_icon, package_locale "
469 "FROM package_localized_info "
470 "WHERE package=%Q AND package_locale IN (%Q, %Q)";
477 query = sqlite3_mprintf(query_raw, pkgid, locale, DEFAULT_LOCALE);
479 LOGE("out of memory");
480 return PMINFO_R_ERROR;
483 ret = sqlite3_prepare_v2(db, query, strlen(query),
486 if (ret != SQLITE_OK) {
487 LOGE("prepare failed: %s", sqlite3_errmsg(db));
488 return PMINFO_R_ERROR;
491 while (sqlite3_step(stmt) == SQLITE_ROW) {
492 info = calloc(1, sizeof(icon_x));
494 LOGE("out of memory");
495 sqlite3_finalize(stmt);
497 LISTHEAD(*icon, info);
500 return PMINFO_R_ERROR;
503 _save_column_str(stmt, idx++, &info->text);
504 _save_column_str(stmt, idx++, &info->lang);
505 LISTADD(*icon, info);
509 LISTHEAD(*icon, info);
513 sqlite3_finalize(stmt);
518 static int _pkginfo_get_description(sqlite3 *db, const char *pkgid,
519 const char *locale, description_x **description)
521 static const char query_raw[] =
522 "SELECT package_description, package_locale "
523 "FROM package_localized_info "
524 "WHERE package=%Q AND package_locale IN (%Q, %Q)";
531 query = sqlite3_mprintf(query_raw, pkgid, locale, DEFAULT_LOCALE);
533 LOGE("out of memory");
534 return PMINFO_R_ERROR;
537 ret = sqlite3_prepare_v2(db, query, strlen(query),
540 if (ret != SQLITE_OK) {
541 LOGE("prepare failed: %s", sqlite3_errmsg(db));
542 return PMINFO_R_ERROR;
545 while (sqlite3_step(stmt) == SQLITE_ROW) {
546 info = calloc(1, sizeof(description_x));
548 LOGE("out of memory");
549 sqlite3_finalize(stmt);
551 LISTHEAD(*description, info);
554 return PMINFO_R_ERROR;
557 _save_column_str(stmt, idx++, &info->text);
558 _save_column_str(stmt, idx++, &info->lang);
559 LISTADD(*description, info);
563 LISTHEAD(*description, info);
567 sqlite3_finalize(stmt);
572 static int _pkginfo_get_privilege(sqlite3 *db, const char *pkgid,
573 privileges_x **privileges)
575 static const char query_raw[] =
576 "SELECT privilege FROM package_privilege_info WHERE package=%Q";
583 /* privilege list should stored in privileges_x... */
584 p = calloc(1, sizeof(privileges_x));
586 LOGE("out of memory");
587 return PMINFO_R_ERROR;
591 query = sqlite3_mprintf(query_raw, pkgid);
593 LOGE("out of memory");
595 return PMINFO_R_ERROR;
598 ret = sqlite3_prepare_v2(db, query, strlen(query),
601 if (ret != SQLITE_OK) {
602 LOGE("prepare failed: %s", sqlite3_errmsg(db));
604 return PMINFO_R_ERROR;
607 while (sqlite3_step(stmt) == SQLITE_ROW) {
608 info = calloc(1, sizeof(privilege_x));
610 LOGE("out of memory");
611 sqlite3_finalize(stmt);
613 LISTHEAD(p->privilege, info);
616 return PMINFO_R_ERROR;
618 _save_column_str(stmt, 0, &info->text);
619 LISTADD(p->privilege, info);
623 LISTHEAD(p->privilege, info);
627 sqlite3_finalize(stmt);
632 static char *_get_filtered_query(const char *query_raw,
633 pkgmgrinfo_filter_x *filter)
635 char buf[MAX_QUERY_LEN] = { 0, };
644 strncat(buf, query_raw, MAX_QUERY_LEN - 1);
646 for (list = head; list; list = list->next) {
647 /* TODO: revise condition getter function */
648 __get_filter_condition(list->data, &condition);
649 if (condition == NULL)
651 if (buf[strlen(query_raw)] == '\0') {
652 len += strlen(" WHERE ");
653 strncat(buf, " WHERE ", MAX_QUERY_LEN - len - 1);
655 len += strlen(" AND ");
656 strncat(buf, " AND ", MAX_QUERY_LEN -len - 1);
658 len += strlen(condition);
659 strncat(buf, condition, sizeof(buf) - len - 1);
667 static int _pkginfo_get_package(sqlite3 *db, const char *pkgid,
668 const char *locale, package_x **package)
670 static const char query_raw[] =
671 "SELECT package, package_version, "
672 "install_location, package_removable, package_preload, "
673 "package_readonly, package_update, package_appsetting, "
674 "package_system, package_type, package_size, installed_time, "
675 "installed_storage, storeclient_id, mainapp_id, package_url, "
676 "root_path, csc_path, package_nodisplay, package_api_version, "
677 "package_support_disable "
678 "FROM package_info WHERE package=%Q";
685 query = sqlite3_mprintf(query_raw, pkgid);
687 LOGE("out of memory");
688 return PMINFO_R_ERROR;
691 ret = sqlite3_prepare_v2(db, query, strlen(query),
694 if (ret != SQLITE_OK) {
695 LOGE("prepare failed: %s", sqlite3_errmsg(db));
696 return PMINFO_R_ERROR;
699 ret = sqlite3_step(stmt);
700 if (ret == SQLITE_DONE) {
701 sqlite3_finalize(stmt);
702 return PMINFO_R_ENOENT;
703 } else if (ret != SQLITE_ROW) {
704 LOGE("step failed: %s", sqlite3_errmsg(db));
705 sqlite3_finalize(stmt);
706 return PMINFO_R_ERROR;
709 info = calloc(1, sizeof(package_x));
711 LOGE("out of memory");
712 sqlite3_finalize(stmt);
713 return PMINFO_R_ERROR;
716 _save_column_str(stmt, idx++, &info->package);
717 _save_column_str(stmt, idx++, &info->version);
718 _save_column_str(stmt, idx++, &info->installlocation);
719 _save_column_str(stmt, idx++, &info->removable);
720 _save_column_str(stmt, idx++, &info->preload);
721 _save_column_str(stmt, idx++, &info->readonly);
722 _save_column_str(stmt, idx++, &info->update);
723 _save_column_str(stmt, idx++, &info->appsetting);
724 _save_column_str(stmt, idx++, &info->system);
725 _save_column_str(stmt, idx++, &info->type);
726 _save_column_str(stmt, idx++, &info->package_size);
727 _save_column_str(stmt, idx++, &info->installed_time);
728 _save_column_str(stmt, idx++, &info->installed_storage);
729 _save_column_str(stmt, idx++, &info->storeclient_id);
730 _save_column_str(stmt, idx++, &info->mainapp_id);
731 _save_column_str(stmt, idx++, &info->package_url);
732 _save_column_str(stmt, idx++, &info->root_path);
733 _save_column_str(stmt, idx++, &info->csc_path);
734 _save_column_str(stmt, idx++, &info->nodisplay_setting);
735 _save_column_str(stmt, idx++, &info->api_version);
736 _save_column_str(stmt, idx++, &info->support_disable);
738 if (_pkginfo_get_author(db, info->package, &info->author)) {
739 pkgmgrinfo_basic_free_package(info);
740 sqlite3_finalize(stmt);
741 return PMINFO_R_ERROR;
744 if (_pkginfo_get_label(db, info->package, locale, &info->label)) {
745 pkgmgrinfo_basic_free_package(info);
746 sqlite3_finalize(stmt);
747 return PMINFO_R_ERROR;
750 if (_pkginfo_get_icon(db, info->package, locale, &info->icon)) {
751 pkgmgrinfo_basic_free_package(info);
752 sqlite3_finalize(stmt);
753 return PMINFO_R_ERROR;
756 if (_pkginfo_get_description(db, info->package, locale,
757 &info->description)) {
758 pkgmgrinfo_basic_free_package(info);
759 sqlite3_finalize(stmt);
760 return PMINFO_R_ERROR;
763 if (_pkginfo_get_privilege(db, info->package, &info->privileges)) {
764 pkgmgrinfo_basic_free_package(info);
765 sqlite3_finalize(stmt);
766 return PMINFO_R_ERROR;
770 sqlite3_finalize(stmt);
775 static int _pkginfo_get_pkginfo(const char *pkgid, uid_t uid,
776 pkgmgr_pkginfo_x **pkginfo)
782 pkgmgr_pkginfo_x *info;
784 dbpath = getUserPkgParserDBPathUID(uid);
786 return PMINFO_R_ERROR;
788 locale = _get_system_locale();
790 return PMINFO_R_ERROR;
792 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
793 if (ret != SQLITE_OK) {
794 _LOGE("failed to open db: %d", ret);
796 return PMINFO_R_ERROR;
799 info = calloc(1, sizeof(pkgmgr_pkginfo_x));
801 _LOGE("out of memory");
803 sqlite3_close_v2(db);
804 return PMINFO_R_ERROR;
807 ret = _pkginfo_get_package(db, pkgid, locale, &info->pkg_info);
808 if (ret == PMINFO_R_OK) {
809 info->locale = strdup(locale);
811 info->pkg_info->for_all_users = strdup(
812 uid != GLOBAL_USER ? "false" : "true");
818 sqlite3_close_v2(db);
823 API int pkgmgrinfo_pkginfo_get_usr_pkginfo(const char *pkgid, uid_t uid,
824 pkgmgrinfo_pkginfo_h *handle)
828 if (pkgid == NULL || handle == NULL) {
829 LOGE("invalid parameter");
830 return PMINFO_R_EINVAL;
833 ret = _pkginfo_get_pkginfo(pkgid, uid, (pkgmgr_pkginfo_x **)handle);
834 if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
835 ret = _pkginfo_get_pkginfo(pkgid, GLOBAL_USER,
836 (pkgmgr_pkginfo_x **)handle);
838 if (ret != PMINFO_R_OK)
839 _LOGE("failed to get pkginfo of %s for user %d", pkgid, uid);
844 API int pkgmgrinfo_pkginfo_get_pkginfo(const char *pkgid, pkgmgrinfo_pkginfo_h *handle)
846 return pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgid, GLOBAL_USER, handle);
849 API int pkgmgrinfo_pkginfo_get_pkgname(pkgmgrinfo_pkginfo_h handle, char **pkg_name)
851 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
853 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
854 retvm_if(pkg_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
856 if (info->pkg_info == NULL || info->pkg_info->package == NULL)
857 return PMINFO_R_ERROR;
859 *pkg_name = (char *)info->pkg_info->package;
864 API int pkgmgrinfo_pkginfo_get_pkgid(pkgmgrinfo_pkginfo_h handle, char **pkgid)
866 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
868 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
869 retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
871 if (info->pkg_info == NULL || info->pkg_info->package == NULL)
872 return PMINFO_R_ERROR;
874 *pkgid = (char *)info->pkg_info->package;
879 API int pkgmgrinfo_pkginfo_get_type(pkgmgrinfo_pkginfo_h handle, char **type)
881 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
883 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
884 retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
886 if (info->pkg_info == NULL || info->pkg_info->type == NULL)
887 return PMINFO_R_ERROR;
889 *type = (char *)info->pkg_info->type;
894 API int pkgmgrinfo_pkginfo_get_version(pkgmgrinfo_pkginfo_h handle, char **version)
896 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
898 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
899 retvm_if(version == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
901 if (info->pkg_info == NULL || info->pkg_info->version == NULL)
902 return PMINFO_R_ERROR;
904 *version = (char *)info->pkg_info->version;
909 API int pkgmgrinfo_pkginfo_get_install_location(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_install_location *location)
912 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
914 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
915 retvm_if(location == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
917 if (info->pkg_info == NULL || info->pkg_info->installlocation == NULL)
918 return PMINFO_R_ERROR;
920 val = (char *)info->pkg_info->installlocation;
921 if (strcmp(val, "internal-only") == 0)
922 *location = PMINFO_INSTALL_LOCATION_INTERNAL_ONLY;
923 else if (strcmp(val, "prefer-external") == 0)
924 *location = PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL;
926 *location = PMINFO_INSTALL_LOCATION_AUTO;
931 API int pkgmgrinfo_pkginfo_get_package_size(pkgmgrinfo_pkginfo_h handle, int *size)
933 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
935 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
936 retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
938 if (info->pkg_info == NULL || info->pkg_info->package_size == NULL)
939 return PMINFO_R_ERROR;
941 *size = atoi((char *)info->pkg_info->package_size);
946 API int pkgmgrinfo_pkginfo_get_total_size(pkgmgrinfo_pkginfo_h handle, int *size)
949 char device_path[PKG_STRING_LEN_MAX] = { '\0', };
950 long long rw_size = 0;
951 long long ro_size = 0;
952 long long tmp_size = 0;
953 long long total_size = 0;
954 struct stat fileinfo;
957 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
958 retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
960 ret = pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
962 return PMINFO_R_ERROR;
965 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/bin", PKG_RW_PATH, pkgid);
966 if (lstat(device_path, &fileinfo) == 0) {
967 if (!S_ISLNK(fileinfo.st_mode)) {
968 tmp_size = _pkgmgr_calculate_dir_size(device_path);
974 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/info", PKG_RW_PATH, pkgid);
975 if (lstat(device_path, &fileinfo) == 0) {
976 if (!S_ISLNK(fileinfo.st_mode)) {
977 tmp_size = _pkgmgr_calculate_dir_size(device_path);
983 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/res", PKG_RW_PATH, pkgid);
984 if (lstat(device_path, &fileinfo) == 0) {
985 if (!S_ISLNK(fileinfo.st_mode)) {
986 tmp_size = _pkgmgr_calculate_dir_size(device_path);
992 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/data", PKG_RW_PATH, pkgid);
993 if (lstat(device_path, &fileinfo) == 0) {
994 if (!S_ISLNK(fileinfo.st_mode)) {
995 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1001 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/shared", PKG_RW_PATH, pkgid);
1002 if (lstat(device_path, &fileinfo) == 0) {
1003 if (!S_ISLNK(fileinfo.st_mode)) {
1004 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1006 rw_size += tmp_size;
1010 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/setting", PKG_RW_PATH, pkgid);
1011 if (lstat(device_path, &fileinfo) == 0) {
1012 if (!S_ISLNK(fileinfo.st_mode)) {
1013 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1015 rw_size += tmp_size;
1020 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/bin", PKG_RO_PATH, pkgid);
1021 if (lstat(device_path, &fileinfo) == 0) {
1022 if (!S_ISLNK(fileinfo.st_mode)) {
1023 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1025 ro_size += tmp_size;
1029 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/info", PKG_RO_PATH, pkgid);
1030 if (lstat(device_path, &fileinfo) == 0) {
1031 if (!S_ISLNK(fileinfo.st_mode)) {
1032 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1034 ro_size += tmp_size;
1038 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/res", PKG_RO_PATH, pkgid);
1039 if (lstat(device_path, &fileinfo) == 0) {
1040 if (!S_ISLNK(fileinfo.st_mode)) {
1041 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1043 ro_size += tmp_size;
1047 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/data", PKG_RO_PATH, pkgid);
1048 if (lstat(device_path, &fileinfo) == 0) {
1049 if (!S_ISLNK(fileinfo.st_mode)) {
1050 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1052 ro_size += tmp_size;
1056 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/shared", PKG_RO_PATH, pkgid);
1057 if (lstat(device_path, &fileinfo) == 0) {
1058 if (!S_ISLNK(fileinfo.st_mode)) {
1059 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1061 ro_size += tmp_size;
1065 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/setting", PKG_RO_PATH, pkgid);
1066 if (lstat(device_path, &fileinfo) == 0) {
1067 if (!S_ISLNK(fileinfo.st_mode)) {
1068 tmp_size = _pkgmgr_calculate_dir_size(device_path);
1070 ro_size += tmp_size;
1075 total_size = rw_size + ro_size;
1076 *size = (int)total_size;
1081 API int pkgmgrinfo_pkginfo_get_data_size(pkgmgrinfo_pkginfo_h handle, int *size)
1084 char device_path[PKG_STRING_LEN_MAX] = { '\0', };
1085 long long total_size = 0;
1087 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1088 retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1090 if (pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid) < 0)
1091 return PMINFO_R_ERROR;
1093 snprintf(device_path, PKG_STRING_LEN_MAX, "%s%s/data", PKG_RW_PATH, pkgid);
1094 if (access(device_path, R_OK) == 0)
1095 total_size = _pkgmgr_calculate_dir_size(device_path);
1097 return PMINFO_R_ERROR;
1099 *size = (int)total_size;
1104 API int pkgmgrinfo_pkginfo_get_icon(pkgmgrinfo_pkginfo_h handle, char **icon)
1108 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1110 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
1111 retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1113 locale = info->locale;
1114 retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
1116 for (ptr = info->pkg_info->icon; ptr != NULL; ptr = ptr->next) {
1117 if (ptr->lang == NULL)
1120 if (strcmp(ptr->lang, locale) == 0) {
1121 *icon = (char *)ptr->text;
1122 if (strcasecmp(*icon, "(null)") == 0) {
1123 locale = DEFAULT_LOCALE;
1128 } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
1129 *icon = (char *)ptr->text;
1134 return PMINFO_R_ERROR;
1137 API int pkgmgrinfo_pkginfo_get_label(pkgmgrinfo_pkginfo_h handle, char **label)
1141 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1143 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
1144 retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1146 locale = info->locale;
1147 retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
1149 for (ptr = info->pkg_info->label; ptr != NULL; ptr = ptr->next) {
1150 if (ptr->lang == NULL)
1153 if (strcmp(ptr->lang, locale) == 0) {
1154 *label = (char *)ptr->text;
1155 if (strcasecmp(*label, "(null)") == 0) {
1156 locale = DEFAULT_LOCALE;
1161 } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
1162 *label = (char *)ptr->text;
1167 return PMINFO_R_ERROR;
1170 API int pkgmgrinfo_pkginfo_get_description(pkgmgrinfo_pkginfo_h handle, char **description)
1174 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1176 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1177 retvm_if(description == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1179 locale = info->locale;
1180 retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
1182 for (ptr = info->pkg_info->description; ptr != NULL; ptr = ptr->next) {
1183 if (ptr->lang == NULL)
1186 if (strcmp(ptr->lang, locale) == 0) {
1187 *description = (char *)ptr->text;
1188 if (strcasecmp(*description, PKGMGR_PARSER_EMPTY_STR) == 0) {
1189 locale = DEFAULT_LOCALE;
1194 } else if (strcmp(ptr->lang, DEFAULT_LOCALE) == 0) {
1195 *description = (char *)ptr->text;
1200 return PMINFO_R_ERROR;
1203 API int pkgmgrinfo_pkginfo_get_author_name(pkgmgrinfo_pkginfo_h handle, char **author_name)
1205 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1207 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1208 retvm_if(author_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1210 if (info->pkg_info == NULL || info->pkg_info->author == NULL ||
1211 info->pkg_info->author->text == NULL)
1212 return PMINFO_R_ERROR;
1214 *author_name = (char *)info->pkg_info->author->text;
1219 API int pkgmgrinfo_pkginfo_get_author_email(pkgmgrinfo_pkginfo_h handle, char **author_email)
1221 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1223 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1224 retvm_if(author_email == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1226 if (info->pkg_info == NULL || info->pkg_info->author == NULL ||
1227 info->pkg_info->author->email == NULL)
1228 return PMINFO_R_ERROR;
1230 *author_email = (char *)info->pkg_info->author->email;
1235 API int pkgmgrinfo_pkginfo_get_author_href(pkgmgrinfo_pkginfo_h handle, char **author_href)
1237 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1239 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1240 retvm_if(author_href == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1242 if (info->pkg_info == NULL || info->pkg_info->author == NULL ||
1243 info->pkg_info->author->href == NULL)
1244 return PMINFO_R_ERROR;
1246 *author_href = (char *)info->pkg_info->author->href;
1251 API int pkgmgrinfo_pkginfo_get_installed_storage(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_installed_storage *storage)
1253 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1255 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1256 retvm_if(storage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1258 if (info->pkg_info == NULL || info->pkg_info->installed_storage == NULL)
1259 return PMINFO_R_ERROR;
1261 if (strcmp(info->pkg_info->installed_storage,"installed_internal") == 0)
1262 *storage = PMINFO_INTERNAL_STORAGE;
1263 else if (strcmp(info->pkg_info->installed_storage,"installed_external") == 0)
1264 *storage = PMINFO_EXTERNAL_STORAGE;
1266 return PMINFO_R_ERROR;
1271 API int pkgmgrinfo_pkginfo_get_installed_time(pkgmgrinfo_pkginfo_h handle, int *installed_time)
1273 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1275 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1276 retvm_if(installed_time == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1278 if (info->pkg_info == NULL || info->pkg_info->installed_time == NULL)
1279 return PMINFO_R_ERROR;
1281 *installed_time = atoi(info->pkg_info->installed_time);
1286 API int pkgmgrinfo_pkginfo_get_storeclientid(pkgmgrinfo_pkginfo_h handle, char **storeclientid)
1288 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1290 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1291 retvm_if(storeclientid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1293 if (info->pkg_info == NULL || info->pkg_info->storeclient_id == NULL)
1294 return PMINFO_R_ERROR;
1296 *storeclientid = (char *)info->pkg_info->storeclient_id;
1301 API int pkgmgrinfo_pkginfo_get_mainappid(pkgmgrinfo_pkginfo_h handle, char **mainappid)
1303 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1305 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1306 retvm_if(mainappid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1308 if (info->pkg_info == NULL || info->pkg_info->mainapp_id == NULL)
1309 return PMINFO_R_ERROR;
1311 *mainappid = (char *)info->pkg_info->mainapp_id;
1316 API int pkgmgrinfo_pkginfo_get_url(pkgmgrinfo_pkginfo_h handle, char **url)
1318 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1320 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1321 retvm_if(url == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1323 if (info->pkg_info == NULL || info->pkg_info->package_url == NULL)
1324 return PMINFO_R_ERROR;
1326 *url = (char *)info->pkg_info->package_url;
1331 API int pkgmgrinfo_pkginfo_get_size_from_xml(const char *manifest, int *size)
1333 const char *val = NULL;
1334 const xmlChar *node;
1335 xmlTextReaderPtr reader;
1336 retvm_if(manifest == NULL, PMINFO_R_EINVAL, "Input argument is NULL\n");
1337 retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1340 reader = xmlReaderForFile(manifest, NULL, 0);
1343 if (__child_element(reader, -1)) {
1344 node = xmlTextReaderConstName(reader);
1346 _LOGE("xmlTextReaderConstName value is NULL\n");
1347 xmlFreeTextReader(reader);
1349 return PMINFO_R_ERROR;
1352 if (!strcmp(ASC_CHAR(node), "manifest")) {
1353 if (xmlTextReaderGetAttribute(reader, XML_CHAR("size")))
1354 val = ASC_CHAR(xmlTextReaderGetAttribute(reader, XML_CHAR("size")));
1360 _LOGE("package size is not specified\n");
1361 xmlFreeTextReader(reader);
1363 return PMINFO_R_ERROR;
1366 _LOGE("Unable to create xml reader\n");
1367 xmlFreeTextReader(reader);
1369 return PMINFO_R_ERROR;
1373 _LOGE("xmlReaderForFile value is NULL\n");
1375 return PMINFO_R_ERROR;
1378 xmlFreeTextReader(reader);
1384 API int pkgmgrinfo_pkginfo_get_location_from_xml(const char *manifest, pkgmgrinfo_install_location *location)
1386 const char *val = NULL;
1387 const xmlChar *node;
1388 xmlTextReaderPtr reader;
1389 retvm_if(manifest == NULL, PMINFO_R_EINVAL, "Input argument is NULL\n");
1390 retvm_if(location == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1393 reader = xmlReaderForFile(manifest, NULL, 0);
1396 if ( __child_element(reader, -1)) {
1397 node = xmlTextReaderConstName(reader);
1399 _LOGE("xmlTextReaderConstName value is NULL\n");
1400 xmlFreeTextReader(reader);
1402 return PMINFO_R_ERROR;
1405 if (!strcmp(ASC_CHAR(node), "manifest")) {
1406 if (xmlTextReaderGetAttribute(reader, XML_CHAR("install-location")))
1407 val = ASC_CHAR(xmlTextReaderGetAttribute(reader, XML_CHAR("install-location")));
1410 if (strcmp(val, "internal-only") == 0)
1411 *location = PMINFO_INSTALL_LOCATION_INTERNAL_ONLY;
1412 else if (strcmp(val, "prefer-external") == 0)
1413 *location = PMINFO_INSTALL_LOCATION_PREFER_EXTERNAL;
1415 *location = PMINFO_INSTALL_LOCATION_AUTO;
1418 _LOGE("Unable to create xml reader\n");
1419 xmlFreeTextReader(reader);
1421 return PMINFO_R_ERROR;
1425 _LOGE("xmlReaderForFile value is NULL\n");
1427 return PMINFO_R_ERROR;
1430 xmlFreeTextReader(reader);
1437 API int pkgmgrinfo_pkginfo_get_root_path(pkgmgrinfo_pkginfo_h handle, char **path)
1439 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1441 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1442 retvm_if(path == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1444 if (info->pkg_info == NULL || info->pkg_info->root_path == NULL)
1445 return PMINFO_R_ERROR;
1447 *path = (char *)info->pkg_info->root_path;
1452 API int pkgmgrinfo_pkginfo_get_csc_path(pkgmgrinfo_pkginfo_h handle, char **path)
1454 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1456 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1457 retvm_if(path == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1459 if (info->pkg_info == NULL || info->pkg_info->csc_path == NULL)
1460 return PMINFO_R_ERROR;
1462 *path = (char *)info->pkg_info->csc_path;
1468 API int pkgmgrinfo_pkginfo_is_accessible(pkgmgrinfo_pkginfo_h handle, bool *accessible)
1470 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1471 retvm_if(accessible == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1473 #if 0 //smack issue occured, check later
1475 pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid);
1477 _LOGD("invalid func parameters\n");
1478 return PMINFO_R_ERROR;
1480 _LOGD("pkgmgr_get_pkg_external_validation() called\n");
1483 char app_mmc_path[FILENAME_MAX] = { 0, };
1484 char app_dir_path[FILENAME_MAX] = { 0, };
1485 char app_mmc_internal_path[FILENAME_MAX] = { 0, };
1486 snprintf(app_dir_path, FILENAME_MAX,"%s%s", PKG_INSTALLATION_PATH, pkgid);
1487 snprintf(app_mmc_path, FILENAME_MAX,"%s%s", PKG_SD_PATH, pkgid);
1488 snprintf(app_mmc_internal_path, FILENAME_MAX,"%s%s/.mmc", PKG_INSTALLATION_PATH, pkgid);
1490 /*check whether application is in external memory or not */
1491 fp = fopen(app_mmc_path, "r");
1493 _LOGD(" app path in external memory not accesible\n");
1498 _LOGD("pkgmgr_get_pkg_external_validation() : SD_CARD \n");
1502 /*check whether application is in internal or not */
1503 fp = fopen(app_dir_path, "r");
1505 _LOGD(" app path in internal memory not accesible\n");
1507 return PMINFO_R_ERROR;
1510 /*check whether the application is installed in SD card
1511 but SD card is not present*/
1512 fp = fopen(app_mmc_internal_path, "r");
1515 _LOGD("pkgmgr_get_pkg_external_validation() : INTERNAL_MEM \n");
1520 _LOGD("pkgmgr_get_pkg_external_validation() : ERROR_MMC_STATUS \n");
1525 _LOGD("pkgmgr_get_pkg_external_validation() end\n");
1532 API int pkgmgrinfo_pkginfo_is_removable(pkgmgrinfo_pkginfo_h handle, bool *removable)
1535 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1537 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1538 retvm_if(removable == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1540 if (info->pkg_info == NULL || info->pkg_info->removable == NULL)
1541 return PMINFO_R_ERROR;
1543 val = (char *)info->pkg_info->removable;
1544 if (strcasecmp(val, "true") == 0)
1546 else if (strcasecmp(val, "false") == 0)
1554 API int pkgmgrinfo_pkginfo_is_movable(pkgmgrinfo_pkginfo_h handle, bool *movable)
1557 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1559 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1560 retvm_if(movable == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1562 if (info->pkg_info == NULL || info->pkg_info->installlocation == NULL)
1563 return PMINFO_R_ERROR;
1565 val = (char *)info->pkg_info->installlocation;
1566 if (strcmp(val, "internal-only") == 0)
1568 else if (strcmp(val, "prefer-external") == 0)
1576 API int pkgmgrinfo_pkginfo_is_preload(pkgmgrinfo_pkginfo_h handle, bool *preload)
1579 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1581 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1582 retvm_if(preload == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1584 if (info->pkg_info == NULL || info->pkg_info->preload == NULL)
1585 return PMINFO_R_ERROR;
1587 val = (char *)info->pkg_info->preload;
1588 if (strcasecmp(val, "true") == 0)
1590 else if (strcasecmp(val, "false") == 0)
1598 API int pkgmgrinfo_pkginfo_is_system(pkgmgrinfo_pkginfo_h handle, bool *system)
1601 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1603 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1604 retvm_if(system == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1606 if (info->pkg_info == NULL || info->pkg_info->system == NULL)
1607 return PMINFO_R_ERROR;
1609 val = (char *)info->pkg_info->system;
1610 if (strcasecmp(val, "true") == 0)
1612 else if (strcasecmp(val, "false") == 0)
1620 API int pkgmgrinfo_pkginfo_is_readonly(pkgmgrinfo_pkginfo_h handle, bool *readonly)
1623 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1625 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1626 retvm_if(readonly == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1628 if (info->pkg_info == NULL || info->pkg_info->readonly == NULL)
1629 return PMINFO_R_ERROR;
1631 val = (char *)info->pkg_info->readonly;
1632 if (strcasecmp(val, "true") == 0)
1634 else if (strcasecmp(val, "false") == 0)
1642 API int pkgmgrinfo_pkginfo_is_update(pkgmgrinfo_pkginfo_h handle, bool *update)
1645 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1647 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1648 retvm_if(update == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1650 if (info->pkg_info == NULL || info->pkg_info->update == NULL)
1651 return PMINFO_R_ERROR;
1653 val = (char *)info->pkg_info->update;
1654 if (strcasecmp(val, "true") == 0)
1656 else if (strcasecmp(val, "false") == 0)
1664 API int pkgmgrinfo_pkginfo_is_support_disable(pkgmgrinfo_pkginfo_h handle, bool *support_disable)
1667 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1669 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1670 retvm_if(support_disable == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1672 if (info->pkg_info == NULL || info->pkg_info->support_disable == NULL)
1673 return PMINFO_R_ERROR;
1675 val = (char *)info->pkg_info->support_disable;
1676 if (strcasecmp(val, "true") == 0)
1677 *support_disable = 1;
1678 else if (strcasecmp(val, "false") == 0)
1679 *support_disable = 0;
1681 *support_disable = 1;
1686 API int pkgmgrinfo_pkginfo_is_for_all_users(pkgmgrinfo_pkginfo_h handle, bool *for_all_users)
1689 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1691 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1692 retvm_if(for_all_users == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1694 if (info->pkg_info == NULL || info->pkg_info->for_all_users == NULL)
1695 return PMINFO_R_ERROR;
1697 val = (char *)info->pkg_info->for_all_users;
1698 if (strcasecmp(val, "true") == 0)
1700 else if (strcasecmp(val, "false") == 0)
1708 API int pkgmgrinfo_pkginfo_destroy_pkginfo(pkgmgrinfo_pkginfo_h handle)
1710 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1712 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL\n");
1714 __cleanup_pkginfo(info);
1719 API int pkgmgrinfo_pkginfo_filter_create(pkgmgrinfo_pkginfo_filter_h *handle)
1721 pkgmgrinfo_filter_x *filter;
1723 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle output parameter is NULL\n");
1725 filter = (pkgmgrinfo_filter_x*)calloc(1, sizeof(pkgmgrinfo_filter_x));
1726 if (filter == NULL) {
1727 _LOGE("Out of Memory!!!");
1728 return PMINFO_R_ERROR;
1736 API int pkgmgrinfo_pkginfo_filter_destroy(pkgmgrinfo_pkginfo_filter_h handle)
1738 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
1740 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1743 g_slist_foreach(filter->list, __destroy_each_node, NULL);
1744 g_slist_free(filter->list);
1752 API int pkgmgrinfo_pkginfo_filter_add_int(pkgmgrinfo_pkginfo_filter_h handle,
1753 const char *property, const int value)
1755 char buf[PKG_VALUE_STRING_LEN_MAX] = {'\0'};
1759 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
1760 pkgmgrinfo_node_x *node;
1762 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1763 retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1765 prop = _pminfo_pkginfo_convert_to_prop_int(property);
1766 if (prop < E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_INT ||
1767 prop > E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_INT) {
1768 _LOGE("Invalid Integer Property\n");
1769 return PMINFO_R_EINVAL;
1771 node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x));
1773 _LOGE("Out of Memory!!!\n");
1774 return PMINFO_R_ERROR;
1776 snprintf(buf, PKG_VALUE_STRING_LEN_MAX - 1, "%d", value);
1777 val = strndup(buf, PKG_VALUE_STRING_LEN_MAX - 1);
1779 _LOGE("Out of Memory\n");
1781 return PMINFO_R_ERROR;
1785 /*If API is called multiple times for same property, we should override the previous values.
1786 Last value set will be used for filtering.*/
1787 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
1789 filter->list = g_slist_delete_link(filter->list, link);
1790 filter->list = g_slist_append(filter->list, (gpointer)node);
1795 API int pkgmgrinfo_pkginfo_filter_add_bool(pkgmgrinfo_pkginfo_filter_h handle,
1796 const char *property, const bool value)
1801 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
1802 pkgmgrinfo_node_x *node;
1804 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1805 retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1807 prop = _pminfo_pkginfo_convert_to_prop_bool(property);
1808 if (prop < E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_BOOL ||
1809 prop > E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_BOOL) {
1810 _LOGE("Invalid Boolean Property\n");
1811 return PMINFO_R_EINVAL;
1813 node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x));
1815 _LOGE("Out of Memory!!!\n");
1816 return PMINFO_R_ERROR;
1819 val = strndup("('true','True')", 15);
1821 val = strndup("('false','False')", 17);
1823 _LOGE("Out of Memory\n");
1825 return PMINFO_R_ERROR;
1829 /*If API is called multiple times for same property, we should override the previous values.
1830 Last value set will be used for filtering.*/
1831 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
1833 filter->list = g_slist_delete_link(filter->list, link);
1834 filter->list = g_slist_append(filter->list, (gpointer)node);
1839 API int pkgmgrinfo_pkginfo_filter_add_string(pkgmgrinfo_pkginfo_filter_h handle,
1840 const char *property, const char *value)
1845 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x *)handle;
1846 pkgmgrinfo_node_x *node;
1848 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1849 retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1850 retvm_if(value == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
1852 prop = _pminfo_pkginfo_convert_to_prop_str(property);
1853 if (prop < E_PMINFO_PKGINFO_PROP_PACKAGE_MIN_STR ||
1854 prop > E_PMINFO_PKGINFO_PROP_PACKAGE_MAX_STR) {
1855 _LOGE("Invalid String Property\n");
1856 return PMINFO_R_EINVAL;
1858 node = (pkgmgrinfo_node_x *)calloc(1, sizeof(pkgmgrinfo_node_x));
1860 _LOGE("Out of Memory!!!\n");
1861 return PMINFO_R_ERROR;
1863 if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_AUTO) == 0)
1864 val = strndup("auto", PKG_STRING_LEN_MAX - 1);
1865 else if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_INTERNAL) == 0)
1866 val = strndup("internal-only", PKG_STRING_LEN_MAX - 1);
1867 else if (strcmp(value, PMINFO_PKGINFO_INSTALL_LOCATION_EXTERNAL) == 0)
1868 val = strndup("prefer-external", PKG_STRING_LEN_MAX - 1);
1869 else if (strcmp(value, "installed_internal") == 0)
1870 val = strndup("installed_internal", PKG_STRING_LEN_MAX - 1);
1871 else if (strcmp(value, "installed_external") == 0)
1872 val = strndup("installed_external", PKG_STRING_LEN_MAX - 1);
1874 val = strndup(value, PKG_STRING_LEN_MAX - 1);
1876 _LOGE("Out of Memory\n");
1878 return PMINFO_R_ERROR;
1882 /*If API is called multiple times for same property, we should override the previous values.
1883 Last value set will be used for filtering.*/
1884 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
1886 filter->list = g_slist_delete_link(filter->list, link);
1887 filter->list = g_slist_append(filter->list, (gpointer)node);
1892 API int pkgmgrinfo_pkginfo_usr_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count, uid_t uid)
1897 if (handle == NULL || count == NULL) {
1898 _LOGE("invalid parameter");
1899 return PMINFO_R_EINVAL;
1902 ret = _pkginfo_get_filtered_list((pkgmgrinfo_filter_x *)handle, uid, &list);
1903 if (ret != PMINFO_R_OK)
1904 return PMINFO_R_ERROR;
1906 *count = g_list_length(list);
1908 g_list_free_full(list, free);
1913 API int pkgmgrinfo_pkginfo_filter_count(pkgmgrinfo_pkginfo_filter_h handle, int *count)
1915 return pkgmgrinfo_pkginfo_usr_filter_count(handle, count, GLOBAL_USER);
1918 API int pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(
1919 pkgmgrinfo_pkginfo_filter_h handle,
1920 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data, uid_t uid)
1922 if (handle == NULL || pkg_cb == NULL) {
1923 LOGE("invalid parameter");
1924 return PMINFO_R_EINVAL;
1927 return _pkginfo_get_filtered_foreach_pkginfo(handle, pkg_cb, user_data,
1931 API int pkgmgrinfo_pkginfo_filter_foreach_pkginfo(pkgmgrinfo_pkginfo_filter_h handle,
1932 pkgmgrinfo_pkg_list_cb pkg_cb, void *user_data)
1934 return pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(handle, pkg_cb, user_data, GLOBAL_USER);
1937 API int pkgmgrinfo_pkginfo_foreach_privilege(pkgmgrinfo_pkginfo_h handle,
1938 pkgmgrinfo_pkg_privilege_list_cb privilege_func, void *user_data)
1940 retvm_if(handle == NULL, PMINFO_R_EINVAL, "pkginfo handle is NULL");
1941 retvm_if(privilege_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
1943 privilege_x *ptr = NULL;
1944 pkgmgr_pkginfo_x *info = (pkgmgr_pkginfo_x *)handle;
1945 ptr = info->pkg_info->privileges->privilege;
1946 for (; ptr; ptr = ptr->next) {
1948 ret = privilege_func(ptr->text, user_data);
1956 API int pkgmgrinfo_create_pkgusrdbinfo(const char *pkgid, uid_t uid, pkgmgrinfo_pkgdbinfo_h *handle)
1958 retvm_if(!pkgid, PMINFO_R_EINVAL, "pkgid is NULL");
1959 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
1961 char *manifest = NULL;
1962 manifest_x *mfx = NULL;
1964 manifest = pkgmgr_parser_get_usr_manifest_file(pkgid, uid);
1965 retvm_if(manifest == NULL, PMINFO_R_EINVAL, "pkg[%s] dont have manifest file", pkgid);
1967 mfx = pkgmgr_parser_usr_process_manifest_xml(manifest, uid);
1972 retvm_if(mfx == NULL, PMINFO_R_EINVAL, "pkg[%s] parsing fail", pkgid);
1974 *handle = (void *)mfx;
1979 API int pkgmgrinfo_create_pkgdbinfo(const char *pkgid, pkgmgrinfo_pkgdbinfo_h *handle)
1981 retvm_if(!pkgid, PMINFO_R_EINVAL, "pkgid is NULL");
1982 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
1984 char *manifest = NULL;
1985 manifest_x *mfx = NULL;
1987 manifest = pkgmgr_parser_get_manifest_file(pkgid);
1988 retvm_if(manifest == NULL, PMINFO_R_EINVAL, "pkg[%s] dont have manifest file", pkgid);
1990 mfx = pkgmgr_parser_process_manifest_xml(manifest);
1995 retvm_if(mfx == NULL, PMINFO_R_EINVAL, "pkg[%s] parsing fail", pkgid);
1997 *handle = (void *)mfx;
2002 API int pkgmgrinfo_set_type_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *type)
2005 manifest_x *mfx = (manifest_x *)handle;
2007 retvm_if(!type, PMINFO_R_EINVAL, "Argument supplied is NULL");
2008 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2011 retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
2014 free((void *)mfx->type);
2016 mfx->type = strndup(type, PKG_TYPE_STRING_LEN_MAX);
2021 API int pkgmgrinfo_set_version_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *version)
2024 manifest_x *mfx = (manifest_x *)handle;
2026 retvm_if(!version, PMINFO_R_EINVAL, "Argument supplied is NULL");
2027 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2029 len = strlen(version);
2030 retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
2033 free((void *)mfx->version);
2035 mfx->version = strndup(version, PKG_VERSION_STRING_LEN_MAX);
2039 API int pkgmgrinfo_set_install_location_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
2041 manifest_x *mfx = (manifest_x *)handle;
2043 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2044 retvm_if((location < 0) || (location > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
2046 if (mfx->installlocation)
2047 free((void *)mfx->installlocation);
2049 if (location == INSTALL_INTERNAL)
2050 mfx->installlocation = strdup("internal-only");
2051 else if (location == INSTALL_EXTERNAL)
2052 mfx->installlocation = strdup("prefer-external");
2057 API int pkgmgrinfo_set_size_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *size)
2059 manifest_x *mfx = (manifest_x *)handle;
2061 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2062 retvm_if(size == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL");
2064 if (mfx->package_size)
2065 free((void *)mfx->package_size);
2067 mfx->package_size = strdup(size);
2072 API int pkgmgrinfo_set_label_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *label_txt, const char *locale)
2075 manifest_x *mfx = (manifest_x *)handle;
2078 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2079 retvm_if(!label_txt, PMINFO_R_EINVAL, "Argument supplied is NULL");
2081 len = strlen(label_txt);
2082 retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
2084 label = calloc(1, sizeof(label_x));
2085 retvm_if(label == NULL, PMINFO_R_EINVAL, "Malloc Failed");
2087 LISTADD(mfx->label, label);
2089 mfx->label->lang = strdup(locale);
2091 mfx->label->lang = strdup(DEFAULT_LOCALE);
2092 mfx->label->text = strdup(label_txt);
2097 API int pkgmgrinfo_set_icon_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *icon_txt, const char *locale)
2100 manifest_x *mfx = (manifest_x *)handle;
2103 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2104 retvm_if(!icon_txt, PMINFO_R_EINVAL, "Argument supplied is NULL");
2106 len = strlen(icon_txt);
2107 retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
2109 icon = calloc(1, sizeof(icon_x));
2110 retvm_if(icon == NULL, PMINFO_R_EINVAL, "Malloc Failed");
2112 LISTADD(mfx->icon, icon);
2114 mfx->icon->lang = strdup(locale);
2116 mfx->icon->lang = strdup(DEFAULT_LOCALE);
2117 mfx->icon->text = strdup(icon_txt);
2122 API int pkgmgrinfo_set_description_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *desc_txt, const char *locale)
2124 int len = strlen(desc_txt);
2125 manifest_x *mfx = (manifest_x *)handle;
2126 description_x *description;
2128 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2129 retvm_if(!desc_txt, PMINFO_R_EINVAL, "Argument supplied is NULL");
2131 len = strlen(desc_txt);
2132 retvm_if(len > PKG_TYPE_STRING_LEN_MAX, PMINFO_R_EINVAL, "pkg type length exceeds the max limit");
2134 description = calloc(1, sizeof(description_x));
2135 retvm_if(description == NULL, PMINFO_R_EINVAL, "Malloc Failed");
2137 LISTADD(mfx->description, description);
2139 mfx->description->lang = strdup(locale);
2141 mfx->description->lang = strdup(DEFAULT_LOCALE);
2142 mfx->description->text = strdup(desc_txt);
2147 API int pkgmgrinfo_set_author_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, const char *author_name,
2148 const char *author_email, const char *author_href, const char *locale)
2150 manifest_x *mfx = (manifest_x *)handle;
2153 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2155 author = calloc(1, sizeof(author_x));
2156 retvm_if(author == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL");
2158 LISTADD(mfx->author, author);
2160 mfx->author->text = strdup(author_name);
2162 mfx->author->email = strdup(author_email);
2164 mfx->author->href = strdup(author_href);
2166 mfx->author->lang = strdup(locale);
2168 mfx->author->lang = strdup(DEFAULT_LOCALE);
2172 API int pkgmgrinfo_set_removable_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int removable)
2174 manifest_x *mfx = (manifest_x *)handle;
2176 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2177 retvm_if((removable < 0) || (removable > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
2180 free((void *)mfx->removable);
2183 mfx->removable = strdup("false");
2184 else if (removable == 1)
2185 mfx->removable = strdup("true");
2190 API int pkgmgrinfo_set_preload_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, int preload)
2192 manifest_x *mfx = (manifest_x *)handle;
2194 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2195 retvm_if((preload < 0) || (preload > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
2198 free((void *)mfx->preload);
2201 mfx->preload = strdup("false");
2202 else if (preload == 1)
2203 mfx->preload = strdup("true");
2208 API int pkgmgrinfo_set_installed_storage_to_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle, INSTALL_LOCATION location)
2210 manifest_x *mfx = (manifest_x *)handle;
2212 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2213 retvm_if((location < 0) || (location > 1), PMINFO_R_EINVAL, "Argument supplied is NULL");
2215 if (mfx->installed_storage)
2216 free((void *)mfx->installed_storage);
2218 if (location == INSTALL_INTERNAL)
2219 mfx->installed_storage = strdup("installed_internal");
2220 else if (location == INSTALL_EXTERNAL)
2221 mfx->installed_storage = strdup("installed_external");
2226 API int pkgmgrinfo_save_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
2229 manifest_x *mfx = (manifest_x *)handle;
2230 mfx = (manifest_x *)handle;
2232 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2234 ret = pkgmgr_parser_update_manifest_info_in_db(mfx);
2236 _LOGE("Successfully stored info in DB\n");
2239 _LOGE("Failed to store info in DB\n");
2240 return PMINFO_R_ERROR;
2244 API int pkgmgrinfo_save_pkgusrdbinfo(pkgmgrinfo_pkgdbinfo_h handle, uid_t uid)
2247 manifest_x *mfx = (manifest_x *)handle;
2249 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2251 ret = pkgmgr_parser_update_manifest_info_in_usr_db(mfx, uid);
2253 _LOGE("Successfully stored info in DB\n");
2256 _LOGE("Failed to store info in DB\n");
2257 return PMINFO_R_ERROR;
2261 API int pkgmgrinfo_destroy_pkgdbinfo(pkgmgrinfo_pkgdbinfo_h handle)
2263 manifest_x *mfx = (manifest_x *)handle;
2265 retvm_if(!handle, PMINFO_R_EINVAL, "Argument supplied is NULL");
2267 pkgmgrinfo_basic_free_package(mfx);