13 #include "pkgmgr-info.h"
14 #include "pkgmgrinfo_debug.h"
15 #include "pkgmgrinfo_private.h"
16 #include "pkgmgr_parser.h"
18 static bool _get_bool_value(const char *str)
22 else if (!strcasecmp(str, "true"))
28 static void __cleanup_appinfo(pkgmgr_appinfo_x *data)
30 pkgmgr_appinfo_x *info = data;
34 free((void *)info->package);
36 free((void *)info->locale);
38 pkgmgrinfo_basic_free_application(info->app_info);
44 static void __free_appinfo_list(gpointer data)
46 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)data;
47 __cleanup_appinfo(info);
50 static char *_get_filtered_query(const char *query_raw,
51 pkgmgrinfo_filter_x *filter)
53 char buf[MAX_QUERY_LEN] = { 0, };
62 strncat(buf, query_raw, MAX_QUERY_LEN - 1);
64 for (list = head; list; list = list->next) {
65 /* TODO: revise condition getter function */
66 __get_filter_condition(list->data, &condition);
67 if (condition == NULL)
69 if (buf[strlen(query_raw)] == '\0') {
70 len += strlen(" WHERE ");
71 strncat(buf, " WHERE ", MAX_QUERY_LEN - len - 1);
73 len += strlen(" AND ");
74 strncat(buf, " AND ", MAX_QUERY_LEN -len - 1);
76 len += strlen(condition);
77 strncat(buf, condition, sizeof(buf) - len - 1);
85 static gint __list_strcmp(gconstpointer a, gconstpointer b)
87 return strcmp((char *)a, (char *)b);
90 static gint _appinfo_get_list(sqlite3 *db, const char *locale,
91 pkgmgrinfo_filter_x *filter, GList **list)
93 static const char query_raw[] =
94 "SELECT DISTINCT package_app_info.app_id FROM package_app_info"
95 " LEFT OUTER JOIN package_app_localized_info"
96 " ON package_app_info.app_id=package_app_localized_info.app_id"
97 " AND package_app_localized_info.app_locale=%Q"
98 " LEFT OUTER JOIN package_app_app_category"
99 " ON package_app_info.app_id=package_app_app_category.app_id"
100 " LEFT OUTER JOIN package_app_app_control"
101 " ON package_app_info.app_id=package_app_app_control.app_id"
102 " LEFT OUTER JOIN package_app_app_metadata"
103 " ON package_app_info.app_id=package_app_app_metadata.app_id ";
106 char *query_localized;
110 query = _get_filtered_query(query_raw, filter);
112 return PMINFO_R_ERROR;
113 query_localized = sqlite3_mprintf(query, locale);
115 if (query_localized == NULL)
116 return PMINFO_R_ERROR;
118 ret = sqlite3_prepare_v2(db, query_localized,
119 strlen(query_localized), &stmt, NULL);
120 sqlite3_free(query_localized);
121 if (ret != SQLITE_OK) {
122 LOGE("prepare failed: %s", sqlite3_errmsg(db));
123 return PMINFO_R_ERROR;
126 while (sqlite3_step(stmt) == SQLITE_ROW) {
127 _save_column_str(stmt, 0, &appid);
129 *list = g_list_insert_sorted(*list, appid,
133 sqlite3_finalize(stmt);
138 static int _appinfo_get_filtered_list(pkgmgrinfo_filter_x *filter, uid_t uid,
148 locale = _get_system_locale();
150 return PMINFO_R_ERROR;
152 dbpath = getUserPkgParserDBPathUID(uid);
153 if (dbpath == NULL) {
155 return PMINFO_R_ERROR;
158 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
159 if (ret != SQLITE_OK) {
160 _LOGE("failed to open db: %d", ret);
162 return PMINFO_R_ERROR;
165 if (_appinfo_get_list(db, locale, filter, list)) {
167 sqlite3_close_v2(db);
168 return PMINFO_R_ERROR;
170 sqlite3_close_v2(db);
172 if (uid == GLOBAL_USER) {
177 /* search again from global */
178 dbpath = getUserPkgParserDBPathUID(GLOBAL_USER);
179 if (dbpath == NULL) {
181 return PMINFO_R_ERROR;
184 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
185 if (ret != SQLITE_OK) {
186 _LOGE("failed to open db: %d", ret);
188 return PMINFO_R_ERROR;
191 if (_appinfo_get_list(db, locale, filter, list)) {
193 sqlite3_close_v2(db);
194 return PMINFO_R_ERROR;
196 sqlite3_close_v2(db);
198 /* remove duplicate element:
199 * since the list is sorted, we can remove duplicates in linear time
201 for (tmp = *list, tmp2 = g_list_next(tmp); tmp;
202 tmp = tmp2, tmp2 = g_list_next(tmp)) {
203 if (tmp->prev == NULL || tmp->data == NULL)
205 if (strcmp((const char *)tmp->prev->data,
206 (const char *)tmp->data) == 0)
207 *list = g_list_delete_link(*list, tmp);
215 static int _appinfo_get_label(sqlite3 *db, const char *appid,
216 const char *locale, GList **label)
218 static const char query_raw[] =
219 "SELECT app_label, app_locale "
220 "FROM package_app_localized_info "
221 "WHERE app_id=%Q AND app_locale IN (%Q, %Q)";
228 query = sqlite3_mprintf(query_raw, appid, locale, DEFAULT_LOCALE);
230 LOGE("out of memory");
231 return PMINFO_R_ERROR;
234 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
236 if (ret != SQLITE_OK) {
237 LOGE("prepare failed: %s", sqlite3_errmsg(db));
238 return PMINFO_R_ERROR;
241 while (sqlite3_step(stmt) == SQLITE_ROW) {
242 info = calloc(1, sizeof(label_x));
244 LOGE("out of memory");
245 sqlite3_finalize(stmt);
246 return PMINFO_R_ERROR;
249 _save_column_str(stmt, idx++, &info->text);
250 _save_column_str(stmt, idx++, &info->lang);
251 *label = g_list_append(*label, info);
254 sqlite3_finalize(stmt);
259 static int _appinfo_get_icon(sqlite3 *db, const char *appid, const char *locale,
262 static const char query_raw[] =
263 "SELECT app_icon, app_locale "
264 "FROM package_app_localized_info "
265 "WHERE app_id=%Q AND app_locale IN (%Q, %Q)";
272 query = sqlite3_mprintf(query_raw, appid, locale, DEFAULT_LOCALE);
274 LOGE("out of memory");
275 return PMINFO_R_ERROR;
278 ret = sqlite3_prepare_v2(db, query, strlen(query),
281 if (ret != SQLITE_OK) {
282 LOGE("prepare failed: %s", sqlite3_errmsg(db));
283 return PMINFO_R_ERROR;
286 while (sqlite3_step(stmt) == SQLITE_ROW) {
287 info = calloc(1, sizeof(icon_x));
289 LOGE("out of memory");
290 sqlite3_finalize(stmt);
291 return PMINFO_R_ERROR;
294 _save_column_str(stmt, idx++, &info->text);
295 _save_column_str(stmt, idx++, &info->lang);
296 *icon = g_list_append(*icon, info);
299 sqlite3_finalize(stmt);
304 static int _appinfo_get_category(sqlite3 *db, const char *appid,
307 static const char query_raw[] =
308 "SELECT category FROM package_app_app_category WHERE app_id=%Q";
314 query = sqlite3_mprintf(query_raw, appid);
316 LOGE("out of memory");
317 return PMINFO_R_ERROR;
320 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
322 if (ret != SQLITE_OK) {
323 LOGE("prepare failed: %s", sqlite3_errmsg(db));
324 return PMINFO_R_ERROR;
327 while (sqlite3_step(stmt) == SQLITE_ROW) {
329 _save_column_str(stmt, 0, &val);
331 *category = g_list_append(*category, (gpointer)val);
334 sqlite3_finalize(stmt);
339 static void __parse_appcontrol(GList **appcontrol, char *appcontrol_str)
346 if (appcontrol_str == NULL)
349 dup = strdup(appcontrol_str);
351 ac = calloc(1, sizeof(appcontrol_x));
353 _LOGE("out of memory");
356 token = strtok_r(dup, "|", &ptr);
357 if (token && strcmp(token, "NULL"))
358 ac->operation = strdup(token);
359 token = strtok_r(NULL, "|", &ptr);
360 if (token && strcmp(token, "NULL"))
361 ac->uri = strdup(token);
362 token = strtok_r(NULL, "|", &ptr);
363 if (token && strcmp(token, "NULL"))
364 ac->mime = strdup(token);
365 *appcontrol = g_list_append(*appcontrol, ac);
366 } while ((token = strtok_r(NULL, ";", &ptr)));
371 static int _appinfo_get_app_control(sqlite3 *db, const char *appid,
374 static const char query_raw[] =
375 "SELECT app_control FROM package_app_app_control "
382 query = sqlite3_mprintf(query_raw, appid);
384 LOGE("out of memory");
385 return PMINFO_R_ERROR;
388 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
390 if (ret != SQLITE_OK) {
391 LOGE("prepare failed: %s", sqlite3_errmsg(db));
392 return PMINFO_R_ERROR;
395 while (sqlite3_step(stmt) == SQLITE_ROW) {
397 _save_column_str(stmt, 0, &str);
399 __parse_appcontrol(appcontrol, str);
403 sqlite3_finalize(stmt);
408 static int _appinfo_get_data_control(sqlite3 *db, const char *appid,
411 static const char query_raw[] =
412 "SELECT providerid, access, type "
413 "FROM package_app_data_control WHERE app_id=%Q";
420 query = sqlite3_mprintf(query_raw, appid);
422 LOGE("out of memory");
423 return PMINFO_R_ERROR;
426 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
428 if (ret != SQLITE_OK) {
429 LOGE("prepare failed: %s", sqlite3_errmsg(db));
430 return PMINFO_R_ERROR;
433 while (sqlite3_step(stmt) == SQLITE_ROW) {
434 info = calloc(1, sizeof(datacontrol_x));
436 LOGE("out of memory");
437 sqlite3_finalize(stmt);
438 return PMINFO_R_ERROR;
441 _save_column_str(stmt, idx++, &info->providerid);
442 _save_column_str(stmt, idx++, &info->access);
443 _save_column_str(stmt, idx++, &info->type);
444 *datacontrol = g_list_append(*datacontrol, info);
447 sqlite3_finalize(stmt);
452 static int _appinfo_get_metadata(sqlite3 *db, const char *appid,
455 static const char query_raw[] =
456 "SELECT md_key, md_value "
457 "FROM package_app_app_metadata WHERE app_id=%Q";
464 query = sqlite3_mprintf(query_raw, appid);
466 LOGE("out of memory");
467 return PMINFO_R_ERROR;
470 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
472 if (ret != SQLITE_OK) {
473 LOGE("prepare failed: %s", sqlite3_errmsg(db));
474 return PMINFO_R_ERROR;
477 while (sqlite3_step(stmt) == SQLITE_ROW) {
478 info = calloc(1, sizeof(metadata_x));
480 LOGE("out of memory");
481 sqlite3_finalize(stmt);
482 return PMINFO_R_ERROR;
485 _save_column_str(stmt, idx++, &info->key);
486 _save_column_str(stmt, idx++, &info->value);
487 *metadata = g_list_append(*metadata, info);
490 sqlite3_finalize(stmt);
496 static int _appinfo_get_splashscreens(sqlite3 *db, const char *appid,
497 GList **splashscreens)
499 static const char query_raw[] =
500 "SELECT src, type, orientation, indicatordisplay, operation "
501 "FROM package_app_splash_screen WHERE app_id=%Q";
506 splashscreen_x *info;
508 query = sqlite3_mprintf(query_raw, appid);
510 LOGE("out of memory");
511 return PMINFO_R_ERROR;
514 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
516 if (ret != SQLITE_OK) {
517 LOGE("prepare failed: %s", sqlite3_errmsg(db));
518 return PMINFO_R_ERROR;
521 while (sqlite3_step(stmt) == SQLITE_ROW) {
522 info = calloc(1, sizeof(splashscreen_x));
524 LOGE("out of memory");
525 sqlite3_finalize(stmt);
526 return PMINFO_R_ERROR;
529 _save_column_str(stmt, idx++, &info->src);
530 _save_column_str(stmt, idx++, &info->type);
531 _save_column_str(stmt, idx++, &info->orientation);
532 _save_column_str(stmt, idx++, &info->indicatordisplay);
533 _save_column_str(stmt, idx++, &info->operation);
534 *splashscreens = g_list_append(*splashscreens, info);
537 sqlite3_finalize(stmt);
542 static GList *__get_background_category(const char *value)
544 GList *category_list = NULL;
545 int convert_value = 0;
546 if (!value || strlen(value) == 0)
549 convert_value = atoi(value);
550 if (convert_value < 0)
553 if (convert_value & APP_BG_CATEGORY_USER_DISABLE_TRUE_VAL)
554 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_USER_DISABLE_TRUE_STR));
556 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_USER_DISABLE_FALSE_STR));
558 if (convert_value & APP_BG_CATEGORY_MEDIA_VAL)
559 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_MEDIA_STR));
561 if (convert_value & APP_BG_CATEGORY_DOWNLOAD_VAL)
562 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_DOWNLOAD_STR));
564 if (convert_value & APP_BG_CATEGORY_BGNETWORK_VAL)
565 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_BGNETWORK_STR));
567 if (convert_value & APP_BG_CATEGORY_LOCATION_VAL)
568 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_LOCATION_STR));
570 if (convert_value & APP_BG_CATEGORY_SENSOR_VAL)
571 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_SENSOR_STR));
573 if (convert_value & APP_BG_CATEGORY_IOTCOMM_VAL)
574 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_IOTCOMM_STR));
576 if (convert_value & APP_BG_CATEGORY_SYSTEM_VAL)
577 category_list = g_list_append(category_list, strdup(APP_BG_CATEGORY_SYSTEM));
579 return category_list;
583 static int _appinfo_get_application(sqlite3 *db, const char *appid,
584 const char *locale, application_x **application, bool is_disabled, uid_t db_uid, uid_t target_uid)
586 static const char query_raw[] =
587 "SELECT app_id, app_component, app_exec, app_nodisplay, "
588 "app_type, app_onboot, app_multiple, app_autorestart, "
589 "app_taskmanage, app_enabled, app_hwacceleration, "
590 "app_screenreader, app_mainapp, app_recentimage, "
591 "app_launchcondition, app_indicatordisplay, app_portraitimg, "
592 "app_landscapeimg, app_guestmodevisibility, "
593 "app_permissiontype, app_preload, app_submode, "
594 "app_submode_mainid, app_launch_mode, app_ui_gadget, "
595 "app_support_disable, "
596 "component_type, package, app_process_pool, app_installed_storage, "
597 "app_background_category, app_package_type, "
598 "app_root_path, app_api_version "
599 "FROM package_app_info WHERE app_id='%s' "
600 "AND (app_disable='%s' "
602 "(SELECT app_id from package_app_disable_for_user WHERE uid='%d'))";
604 char query[MAX_QUERY_LEN] = { '\0' };
608 char *bg_category_str = NULL;
609 snprintf(query, MAX_QUERY_LEN - 1, query_raw,
611 is_disabled ? "true" : "false",
612 is_disabled ? "OR" : "AND",
613 is_disabled ? "" : "NOT",
616 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
617 if (ret != SQLITE_OK) {
618 LOGE("prepare failed: %s", sqlite3_errmsg(db));
619 return PMINFO_R_ERROR;
622 ret = sqlite3_step(stmt);
623 if (ret == SQLITE_DONE) {
624 sqlite3_finalize(stmt);
625 return PMINFO_R_ENOENT;
626 } else if (ret != SQLITE_ROW) {
627 LOGE("step failed: %s", sqlite3_errmsg(db));
628 sqlite3_finalize(stmt);
629 return PMINFO_R_ERROR;
632 info = calloc(1, sizeof(application_x));
634 LOGE("out of memory");
635 sqlite3_finalize(stmt);
636 return PMINFO_R_ERROR;
639 _save_column_str(stmt, idx++, &info->appid);
640 _save_column_str(stmt, idx++, &info->component);
641 _save_column_str(stmt, idx++, &info->exec);
642 _save_column_str(stmt, idx++, &info->nodisplay);
643 _save_column_str(stmt, idx++, &info->type);
644 _save_column_str(stmt, idx++, &info->onboot);
645 _save_column_str(stmt, idx++, &info->multiple);
646 _save_column_str(stmt, idx++, &info->autorestart);
647 _save_column_str(stmt, idx++, &info->taskmanage);
648 _save_column_str(stmt, idx++, &info->enabled);
649 _save_column_str(stmt, idx++, &info->hwacceleration);
650 _save_column_str(stmt, idx++, &info->screenreader);
651 _save_column_str(stmt, idx++, &info->mainapp);
652 _save_column_str(stmt, idx++, &info->recentimage);
653 _save_column_str(stmt, idx++, &info->launchcondition);
654 _save_column_str(stmt, idx++, &info->indicatordisplay);
655 _save_column_str(stmt, idx++, &info->portraitimg);
656 _save_column_str(stmt, idx++, &info->landscapeimg);
657 _save_column_str(stmt, idx++, &info->guestmode_visibility);
658 _save_column_str(stmt, idx++, &info->permission_type);
659 _save_column_str(stmt, idx++, &info->preload);
660 _save_column_str(stmt, idx++, &info->submode);
661 _save_column_str(stmt, idx++, &info->submode_mainid);
662 _save_column_str(stmt, idx++, &info->launch_mode);
663 _save_column_str(stmt, idx++, &info->ui_gadget);
664 _save_column_str(stmt, idx++, &info->support_disable);
665 _save_column_str(stmt, idx++, &info->component_type);
666 _save_column_str(stmt, idx++, &info->package);
667 _save_column_str(stmt, idx++, &info->process_pool);
668 _save_column_str(stmt, idx++, &info->installed_storage);
669 _save_column_str(stmt, idx++, &bg_category_str);
670 _save_column_str(stmt, idx++, &info->package_type);
671 _save_column_str(stmt, idx++, &info->root_path);
672 _save_column_str(stmt, idx++, &info->api_version);
674 info->background_category = __get_background_category(bg_category_str);
675 free(bg_category_str);
677 if (_appinfo_get_label(db, info->appid, locale, &info->label)) {
678 pkgmgrinfo_basic_free_application(info);
679 sqlite3_finalize(stmt);
680 return PMINFO_R_ERROR;
683 if (_appinfo_get_icon(db, info->appid, locale, &info->icon)) {
684 pkgmgrinfo_basic_free_application(info);
685 sqlite3_finalize(stmt);
686 return PMINFO_R_ERROR;
689 if (_appinfo_get_category(db, info->appid, &info->category)) {
690 pkgmgrinfo_basic_free_application(info);
691 sqlite3_finalize(stmt);
692 return PMINFO_R_ERROR;
695 if (_appinfo_get_app_control(db, info->appid, &info->appcontrol)) {
696 pkgmgrinfo_basic_free_application(info);
697 sqlite3_finalize(stmt);
698 return PMINFO_R_ERROR;
701 if (_appinfo_get_data_control(db, info->appid, &info->datacontrol)) {
702 pkgmgrinfo_basic_free_application(info);
703 sqlite3_finalize(stmt);
704 return PMINFO_R_ERROR;
707 if (_appinfo_get_metadata(db, info->appid, &info->metadata)) {
708 pkgmgrinfo_basic_free_application(info);
709 sqlite3_finalize(stmt);
710 return PMINFO_R_ERROR;
713 if (_appinfo_get_splashscreens(db, info->appid, &info->splashscreens)) {
714 pkgmgrinfo_basic_free_application(info);
715 sqlite3_finalize(stmt);
716 return PMINFO_R_ERROR;
719 info->for_all_users = strdup((db_uid != GLOBAL_USER) ? "false" : "true");
723 sqlite3_finalize(stmt);
728 static int _appinfo_get_appinfo(const char *appid, uid_t db_uid,
729 uid_t target_uid, bool is_disabled, pkgmgr_appinfo_x **appinfo)
735 pkgmgr_appinfo_x *info;
737 dbpath = getUserPkgParserDBPathUID(db_uid);
739 return PMINFO_R_ERROR;
741 locale = _get_system_locale();
743 return PMINFO_R_ERROR;
745 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
746 if (ret != SQLITE_OK) {
747 _LOGE("failed to open db: %d", ret);
749 return PMINFO_R_ERROR;
752 info = calloc(1, sizeof(pkgmgr_appinfo_x));
754 _LOGE("out of memory");
756 sqlite3_close_v2(db);
757 return PMINFO_R_ERROR;
760 ret = _appinfo_get_application(db, appid, locale, &info->app_info, is_disabled, db_uid, target_uid);
761 if (ret != PMINFO_R_OK) {
764 sqlite3_close_v2(db);
768 info->locale = locale;
769 info->package = strdup(info->app_info->package);
773 sqlite3_close_v2(db);
778 int _appinfo_get_applist(uid_t uid, const char *locale, GHashTable **appinfo_table)
780 int ret = PMINFO_R_ERROR;
784 char *bg_category_str = NULL;
787 sqlite3_stmt *stmt = NULL;
788 pkgmgr_appinfo_x *info = NULL;
789 application_x *appinfo = NULL;
791 dbpath = getUserPkgParserDBPathUID(uid);
793 return PMINFO_R_ERROR;
795 ret = sqlite3_open_v2(dbpath, &db, SQLITE_OPEN_READONLY, NULL);
796 if (ret != SQLITE_OK) {
797 _LOGE("failed to open db: %d", ret);
798 ret = PMINFO_R_ERROR;
802 query = sqlite3_mprintf("SELECT app_id, app_exec, app_type, "
803 "app_onboot, app_multiple, app_autorestart, app_taskmanage, "
804 "app_hwacceleration, app_permissiontype, app_preload, "
805 "app_installed_storage, app_process_pool, app_launch_mode, "
806 "app_package_type, component_type, package, app_tep_name, "
807 "app_background_category, app_root_path, app_api_version "
808 "FROM package_app_info WHERE app_disable='false' AND app_id NOT IN "
809 "(SELECT app_id FROM package_app_disable_for_user WHERE uid='%d')",
813 _LOGE("Out of memory");
817 ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
818 if (ret != SQLITE_OK) {
819 LOGE("prepare failed: %s", sqlite3_errmsg(db));
820 ret = PMINFO_R_ERROR;
824 while (sqlite3_step(stmt) == SQLITE_ROW) {
825 info = calloc(1, sizeof(pkgmgr_appinfo_x));
826 appinfo = calloc(1, sizeof(application_x));
827 if (info == NULL || appinfo == NULL) {
828 LOGE("calloc failed");
829 ret = PMINFO_R_ERROR;
834 _save_column_str(stmt, idx++, &appinfo->appid);
835 _save_column_str(stmt, idx++, &appinfo->exec);
836 _save_column_str(stmt, idx++, &appinfo->type);
838 _save_column_str(stmt, idx++, &appinfo->onboot);
839 _save_column_str(stmt, idx++, &appinfo->multiple);
840 _save_column_str(stmt, idx++, &appinfo->autorestart);
841 _save_column_str(stmt, idx++, &appinfo->taskmanage);
843 _save_column_str(stmt, idx++, &appinfo->hwacceleration);
844 _save_column_str(stmt, idx++, &appinfo->permission_type);
845 _save_column_str(stmt, idx++, &appinfo->preload);
847 _save_column_str(stmt, idx++, &appinfo->installed_storage);
848 _save_column_str(stmt, idx++, &appinfo->process_pool);
849 _save_column_str(stmt, idx++, &appinfo->launch_mode);
851 _save_column_str(stmt, idx++, &appinfo->package_type);
852 _save_column_str(stmt, idx++, &appinfo->component_type);
853 _save_column_str(stmt, idx++, &appinfo->package);
854 _save_column_str(stmt, idx++, &appinfo->tep_name);
856 _save_column_str(stmt, idx++, &bg_category_str);
857 _save_column_str(stmt, idx++, &appinfo->root_path);
858 _save_column_str(stmt, idx++, &appinfo->api_version);
860 appinfo->background_category = __get_background_category(bg_category_str);
861 free(bg_category_str);
863 if (_appinfo_get_splashscreens(db, appinfo->appid, &appinfo->splashscreens)) {
864 pkgmgrinfo_basic_free_application(appinfo);
865 ret = PMINFO_R_ERROR;
869 info->locale = strdup(locale);
870 info->package = strdup(appinfo->package);
871 appinfo->for_all_users = strdup((uid != GLOBAL_USER) ? "false" : "true");
872 info->app_info = appinfo;
873 key = strdup(info->app_info->appid);
875 if (!g_hash_table_contains(*appinfo_table, (gconstpointer)key))
876 g_hash_table_insert(*appinfo_table, (gpointer)key, (gpointer)info);
878 __cleanup_appinfo(info);
885 sqlite3_finalize(stmt);
892 API int pkgmgrinfo_appinfo_get_usr_disabled_appinfo(const char *appid, uid_t uid,
893 pkgmgrinfo_appinfo_h *handle)
897 if (appid == NULL || handle == NULL) {
898 LOGE("invalid parameter");
899 return PMINFO_R_EINVAL;
902 ret = _appinfo_get_appinfo(appid, uid, uid, true, (pkgmgr_appinfo_x **)handle);
903 if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
904 ret = _appinfo_get_appinfo(appid, GLOBAL_USER, uid, true,
905 (pkgmgr_appinfo_x **)handle);
907 if (ret != PMINFO_R_OK)
908 _LOGE("failed to get appinfo of %s for user %d", appid, uid);
913 API int pkgmgrinfo_appinfo_get_disabled_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
915 return pkgmgrinfo_appinfo_get_usr_disabled_appinfo(appid, GLOBAL_USER, handle);
918 API int pkgmgrinfo_appinfo_get_usr_appinfo(const char *appid, uid_t uid,
919 pkgmgrinfo_appinfo_h *handle)
923 if (appid == NULL || handle == NULL) {
924 LOGE("invalid parameter");
925 return PMINFO_R_EINVAL;
928 ret = _appinfo_get_appinfo(appid, uid, uid, false, (pkgmgr_appinfo_x **)handle);
929 if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
930 ret = _appinfo_get_appinfo(appid, GLOBAL_USER, uid, false,
931 (pkgmgr_appinfo_x **)handle);
932 if (ret != PMINFO_R_OK)
933 _LOGE("failed to get appinfo of %s for user %d", appid, uid);
938 API int pkgmgrinfo_appinfo_get_appinfo(const char *appid, pkgmgrinfo_appinfo_h *handle)
940 return pkgmgrinfo_appinfo_get_usr_appinfo(appid, GLOBAL_USER, handle);
943 static gpointer __copy_str(gconstpointer src, gpointer data)
945 const char *tmp = (const char *)src;
948 buffer = strdup(tmp);
949 if (buffer == NULL) {
950 LOGE("memory alloc failed");
958 static gpointer __copy_label(gconstpointer src, gpointer data)
960 label_x *tmp = (label_x *)src;
963 label = calloc(1, sizeof(label_x));
965 LOGE("memory alloc failed");
971 label->name = strdup(tmp->name);
973 label->text = strdup(tmp->text);
975 label->lang = strdup(tmp->lang);
980 static gpointer __copy_icon(gconstpointer src, gpointer data)
982 icon_x *tmp = (icon_x *)src;
985 icon = calloc(1, sizeof(icon_x));
987 LOGE("memory alloc failed");
993 icon->text = strdup(tmp->text);
995 icon->lang = strdup(tmp->lang);
997 icon->section = strdup(tmp->section);
999 icon->size = strdup(tmp->size);
1000 if (tmp->resolution)
1001 icon->resolution = strdup(tmp->resolution);
1006 static gpointer __copy_metadata(gconstpointer src, gpointer data)
1008 metadata_x *tmp = (metadata_x *)src;
1009 metadata_x *metadata;
1011 metadata = calloc(1, sizeof(metadata_x));
1012 if (metadata == NULL) {
1013 LOGE("memory alloc failed");
1019 metadata->key = strdup(tmp->key);
1021 metadata->value = strdup(tmp->value);
1026 static gpointer __copy_datacontrol(gconstpointer src, gpointer data)
1028 datacontrol_x *tmp = (datacontrol_x *)src;
1029 datacontrol_x *datacontrol;
1031 datacontrol = calloc(1, sizeof(datacontrol_x));
1032 if (datacontrol == NULL) {
1033 LOGE("memory alloc failed");
1038 if (tmp->providerid)
1039 datacontrol->providerid = strdup(tmp->providerid);
1041 datacontrol->access = strdup(tmp->access);
1043 datacontrol->type = strdup(tmp->type);
1048 static gpointer __copy_appcontrol(gconstpointer src, gpointer data)
1050 appcontrol_x *tmp = (appcontrol_x *)src;
1051 appcontrol_x *appcontrol;
1053 appcontrol = calloc(1, sizeof(appcontrol_x));
1054 if (appcontrol ==NULL) {
1055 LOGE("memory alloc failed");
1061 appcontrol->operation = strdup(tmp->operation);
1063 appcontrol->uri = strdup(tmp->uri);
1065 appcontrol->mime = strdup(tmp->mime);
1070 static gpointer __copy_splashscreens(gconstpointer src, gpointer data)
1072 splashscreen_x *tmp = (splashscreen_x *)src;
1073 splashscreen_x *splashscreen;
1075 splashscreen = (splashscreen_x *)calloc(1, sizeof(splashscreen_x));
1076 if (splashscreen == NULL) {
1077 LOGE("memory alloc failed");
1083 splashscreen->src = strdup(tmp->src);
1085 splashscreen->type = strdup(tmp->type);
1086 if (tmp->orientation)
1087 splashscreen->orientation = strdup(tmp->orientation);
1088 if (tmp->indicatordisplay)
1089 splashscreen->indicatordisplay = strdup(tmp->indicatordisplay);
1091 splashscreen->operation = strdup(tmp->operation);
1093 return splashscreen;
1096 static int _appinfo_copy_appinfo(application_x **application, application_x *data)
1098 application_x *app_info;
1101 app_info = calloc(1, sizeof(application_x));
1102 if (app_info == NULL) {
1103 LOGE("memory alloc failed");
1104 return PMINFO_R_ERROR;
1107 if (data->appid != NULL)
1108 app_info->appid = strdup(data->appid);
1109 if (data->exec != NULL)
1110 app_info->exec = strdup(data->exec);
1111 if (data->nodisplay != NULL)
1112 app_info->nodisplay = strdup(data->nodisplay);
1113 if (data->multiple != NULL)
1114 app_info->multiple = strdup(data->multiple);
1115 if (data->taskmanage != NULL)
1116 app_info->taskmanage = strdup(data->taskmanage);
1117 if (data->enabled != NULL)
1118 app_info->enabled = strdup(data->enabled);
1119 if (data->type != NULL)
1120 app_info->type = strdup(data->type);
1121 if (data->categories != NULL)
1122 app_info->categories = strdup(data->categories);
1123 if (data->hwacceleration != NULL)
1124 app_info->hwacceleration = strdup(data->hwacceleration);
1125 if (data->screenreader != NULL)
1126 app_info->screenreader = strdup(data->screenreader);
1127 if (data->mainapp != NULL)
1128 app_info->mainapp = strdup(data->mainapp);
1129 if (data->package != NULL)
1130 app_info->package = strdup(data->package);
1131 if (data->recentimage != NULL)
1132 app_info->recentimage = strdup(data->recentimage);
1133 if (data->launchcondition != NULL)
1134 app_info->launchcondition = strdup(data->launchcondition);
1135 if (data->indicatordisplay != NULL)
1136 app_info->indicatordisplay = strdup(data->indicatordisplay);
1137 if (data->portraitimg != NULL)
1138 app_info->portraitimg = strdup(data->portraitimg);
1139 if (data->landscapeimg != NULL)
1140 app_info->landscapeimg = strdup(data->landscapeimg);
1141 if (data->guestmode_visibility != NULL)
1142 app_info->guestmode_visibility = strdup(data->guestmode_visibility);
1143 if (data->component != NULL)
1144 app_info->component = strdup(data->component);
1145 if (data->permission_type != NULL)
1146 app_info->permission_type = strdup(data->permission_type);
1147 if (data->component_type != NULL)
1148 app_info->component_type = strdup(data->component_type);
1149 if (data->preload != NULL)
1150 app_info->preload = strdup(data->preload);
1151 if (data->submode != NULL)
1152 app_info->submode = strdup(data->submode);
1153 if (data->submode_mainid != NULL)
1154 app_info->submode_mainid = strdup(data->submode_mainid);
1155 if (data->process_pool != NULL)
1156 app_info->process_pool = strdup(data->process_pool);
1157 if (data->installed_storage != NULL)
1158 app_info->installed_storage = strdup(data->installed_storage);
1159 if (data->autorestart != NULL)
1160 app_info->autorestart = strdup(data->autorestart);
1161 if (data->onboot != NULL)
1162 app_info->onboot = strdup(data->onboot);
1163 if (data->support_disable != NULL)
1164 app_info->support_disable = strdup(data->support_disable);
1165 if (data->ui_gadget != NULL)
1166 app_info->ui_gadget = strdup(data->ui_gadget);
1167 if (data->launch_mode != NULL)
1168 app_info->launch_mode = strdup(data->launch_mode);
1169 if (data->package_type != NULL)
1170 app_info->package_type = strdup(data->package_type);
1174 app_info->label = g_list_copy_deep(data->label, __copy_label, &ret);
1176 LOGE("memory alloc failed");
1177 pkgmgrinfo_basic_free_application(app_info);
1178 return PMINFO_R_ERROR;
1182 app_info->icon = g_list_copy_deep(data->icon, __copy_icon, &ret);
1184 LOGE("memory alloc failed");
1185 pkgmgrinfo_basic_free_application(app_info);
1186 return PMINFO_R_ERROR;
1190 app_info->category = g_list_copy_deep(data->category, __copy_str, &ret);
1192 LOGE("memory alloc failed");
1193 pkgmgrinfo_basic_free_application(app_info);
1194 return PMINFO_R_ERROR;
1198 app_info->metadata = g_list_copy_deep(data->metadata, __copy_metadata, &ret);
1200 LOGE("memory alloc failed");
1201 pkgmgrinfo_basic_free_application(app_info);
1202 return PMINFO_R_ERROR;
1206 app_info->datacontrol = g_list_copy_deep(data->datacontrol, __copy_datacontrol, &ret);
1208 LOGE("memory alloc failed");
1209 pkgmgrinfo_basic_free_application(app_info);
1210 return PMINFO_R_ERROR;
1214 app_info->appcontrol = g_list_copy_deep(data->appcontrol, __copy_appcontrol, &ret);
1216 LOGE("memory alloc failed");
1217 pkgmgrinfo_basic_free_application(app_info);
1218 return PMINFO_R_ERROR;
1222 app_info->background_category = g_list_copy_deep(data->background_category, __copy_str, &ret);
1224 LOGE("memory alloc failed");
1225 pkgmgrinfo_basic_free_application(app_info);
1226 return PMINFO_R_ERROR;
1230 app_info->splashscreens = g_list_copy_deep(data->splashscreens, __copy_splashscreens, &ret);
1232 LOGE("memory alloc failed");
1233 pkgmgrinfo_basic_free_application(app_info);
1234 return PMINFO_R_ERROR;
1237 *application = app_info;
1242 API int pkgmgrinfo_appinfo_clone_appinfo(pkgmgrinfo_appinfo_h handle,
1243 pkgmgrinfo_appinfo_h *clone)
1245 pkgmgr_appinfo_x *info;
1246 pkgmgr_appinfo_x *temp = (pkgmgr_appinfo_x *)handle;
1249 return PMINFO_R_EINVAL;
1251 info = calloc(1, sizeof(pkgmgr_appinfo_x));
1253 LOGE("memory alloc failed");
1254 return PMINFO_R_ERROR;
1257 if (temp->package != NULL)
1258 info->package = strdup(temp->package);
1259 if (temp->locale != NULL)
1260 info->locale = strdup(temp->locale);
1262 info->app_component = temp->app_component;
1264 if (_appinfo_copy_appinfo(&info->app_info, temp->app_info) < 0) {
1265 LOGE("appinfo copy failed");
1267 free((void *)info->package);
1271 return PMINFO_R_ERROR;
1279 static int _appinfo_get_filtered_foreach_appinfo(uid_t uid,
1280 pkgmgrinfo_filter_x *filter, pkgmgrinfo_app_list_cb app_list_cb,
1284 pkgmgr_appinfo_x *info;
1290 ret = _appinfo_get_filtered_list(filter, uid, &list);
1291 if (ret != PMINFO_R_OK)
1292 return PMINFO_R_ERROR;
1294 for (tmp = list; tmp; tmp = tmp->next) {
1295 appid = (char *)tmp->data;
1297 ret = _appinfo_get_appinfo(appid, uid, uid, false, &info);
1298 if (ret == PMINFO_R_ENOENT && uid != GLOBAL_USER)
1299 ret = _appinfo_get_appinfo(appid, GLOBAL_USER, uid, false,
1301 if (ret != PMINFO_R_OK) {
1305 if (app_list_cb(info, user_data) < 0)
1307 pkgmgrinfo_appinfo_destroy_appinfo(info);
1317 API int pkgmgrinfo_appinfo_get_usr_list(pkgmgrinfo_pkginfo_h handle,
1318 pkgmgrinfo_app_component component,
1319 pkgmgrinfo_app_list_cb app_func, void *user_data, uid_t uid)
1322 pkgmgrinfo_appinfo_filter_h filter;
1324 const char *comp_str = NULL;
1326 if (handle == NULL || app_func == NULL) {
1327 LOGE("invalid parameter");
1328 return PMINFO_R_EINVAL;
1331 if (pkgmgrinfo_pkginfo_get_pkgid(handle, &pkgid)) {
1332 LOGE("invalid parameter");
1333 return PMINFO_R_EINVAL;
1336 if (pkgmgrinfo_appinfo_filter_create(&filter))
1337 return PMINFO_R_ERROR;
1339 if (pkgmgrinfo_appinfo_filter_add_string(filter,
1340 PMINFO_APPINFO_PROP_APP_PACKAGE, pkgid)) {
1341 pkgmgrinfo_appinfo_filter_destroy(filter);
1342 return PMINFO_R_ERROR;
1345 if (uid == GLOBAL_USER) {
1346 if (pkgmgrinfo_appinfo_filter_add_int(filter,
1347 PMINFO_APPINFO_PROP_APP_DISABLE_FOR_USER, (int)getuid())) {
1348 pkgmgrinfo_appinfo_filter_destroy(filter);
1349 return PMINFO_R_ERROR;
1353 switch (component) {
1355 comp_str = PMINFO_APPINFO_UI_APP;
1357 case PMINFO_SVC_APP:
1358 comp_str = PMINFO_APPINFO_SVC_APP;
1365 if (pkgmgrinfo_appinfo_filter_add_string(filter,
1366 PMINFO_APPINFO_PROP_APP_COMPONENT,
1368 pkgmgrinfo_appinfo_filter_destroy(filter);
1369 return PMINFO_R_ERROR;
1373 ret = _appinfo_get_filtered_foreach_appinfo(uid, filter, app_func,
1376 pkgmgrinfo_appinfo_filter_destroy(filter);
1381 API int pkgmgrinfo_appinfo_get_list(pkgmgrinfo_pkginfo_h handle, pkgmgrinfo_app_component component,
1382 pkgmgrinfo_app_list_cb app_func, void *user_data)
1384 return pkgmgrinfo_appinfo_get_usr_list(handle, component, app_func, user_data, GLOBAL_USER);
1387 API int pkgmgrinfo_appinfo_get_usr_applist_for_amd(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data)
1389 int ret = PMINFO_R_ERROR;
1390 char *locale = NULL;
1391 GHashTable *appinfo_table;
1392 GHashTableIter iter;
1394 pkgmgr_appinfo_x *val;
1396 locale = _get_system_locale();
1398 return PMINFO_R_ERROR;
1400 appinfo_table = g_hash_table_new_full(g_str_hash, g_str_equal,
1401 free, __free_appinfo_list);
1402 if (appinfo_table == NULL) {
1407 ret = _appinfo_get_applist(uid, locale, &appinfo_table);
1408 if (ret != PMINFO_R_OK) {
1409 LOGE("failed get applist[%d]", (int)uid);
1413 if (uid != GLOBAL_USER) {
1414 ret = _appinfo_get_applist(GLOBAL_USER, locale, &appinfo_table);
1415 if (ret != PMINFO_R_OK) {
1416 LOGE("failed get applist[%d]", GLOBAL_USER);
1421 g_hash_table_iter_init(&iter, appinfo_table);
1422 while (g_hash_table_iter_next(&iter, (gpointer)&key, (gpointer)&val)) {
1423 ret = app_func((void *)val, user_data);
1424 if (ret != PMINFO_R_OK) {
1425 LOGE("callback is stopped");
1435 g_hash_table_destroy(appinfo_table);
1440 API int pkgmgrinfo_appinfo_get_applist_for_amd(pkgmgrinfo_app_list_cb app_func, void *user_data)
1442 return pkgmgrinfo_appinfo_get_usr_applist_for_amd(app_func, GLOBAL_USER, user_data);
1445 API int pkgmgrinfo_appinfo_get_usr_installed_list(pkgmgrinfo_app_list_cb app_func, uid_t uid, void *user_data)
1447 if (app_func == NULL) {
1448 LOGE("invalid parameter");
1449 return PMINFO_R_EINVAL;
1452 return _appinfo_get_filtered_foreach_appinfo(uid, NULL, app_func,
1456 API int pkgmgrinfo_appinfo_get_installed_list(pkgmgrinfo_app_list_cb app_func, void *user_data)
1458 return pkgmgrinfo_appinfo_get_usr_installed_list(app_func, GLOBAL_USER, user_data);
1461 API int pkgmgrinfo_appinfo_get_appid(pkgmgrinfo_appinfo_h handle, char **appid)
1463 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1465 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1466 retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1468 if (info->app_info == NULL || info->app_info->appid == NULL)
1469 return PMINFO_R_ERROR;
1470 *appid = (char *)info->app_info->appid;
1475 API int pkgmgrinfo_appinfo_get_pkgname(pkgmgrinfo_appinfo_h handle, char **pkg_name)
1477 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1479 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1480 retvm_if(pkg_name == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1482 if (info->package == NULL)
1483 return PMINFO_R_ERROR;
1485 *pkg_name = (char *)info->package;
1490 API int pkgmgrinfo_appinfo_get_pkgid(pkgmgrinfo_appinfo_h handle, char **pkgid)
1492 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1494 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1495 retvm_if(pkgid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1497 if (info->package == NULL)
1498 return PMINFO_R_ERROR;
1500 *pkgid = (char *)info->package;
1505 API int pkgmgrinfo_appinfo_get_pkgtype(pkgmgrinfo_appinfo_h handle, char **pkgtype)
1507 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1508 retvm_if(pkgtype == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1509 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1511 *pkgtype = (char *)info->app_info->package_type;
1516 API int pkgmgrinfo_appinfo_get_exec(pkgmgrinfo_appinfo_h handle, char **exec)
1518 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1520 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1521 retvm_if(exec == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1523 if (info->app_info == NULL || info->app_info->exec == NULL)
1524 return PMINFO_R_ERROR;
1525 *exec = (char *)info->app_info->exec;
1531 API int pkgmgrinfo_appinfo_get_icon(pkgmgrinfo_appinfo_h handle, char **icon)
1536 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1538 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1539 retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1541 locale = info->locale;
1542 retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
1544 if (info->app_info == NULL)
1545 return PMINFO_R_ERROR;
1547 for (tmp = info->app_info->icon; tmp; tmp = tmp->next) {
1548 ptr = (icon_x *)tmp->data;
1549 if (ptr == NULL || ptr->text == NULL || ptr->lang == NULL ||
1550 !strcasecmp(ptr->text, "") ||
1551 strcmp(ptr->lang, locale))
1553 *icon = (char *)ptr->text;
1557 locale = DEFAULT_LOCALE;
1558 for (tmp = info->app_info->icon; tmp; tmp = tmp->next) {
1559 ptr = (icon_x *)tmp->data;
1560 if (ptr == NULL || ptr->text == NULL || ptr->lang == NULL ||
1561 strcmp(ptr->lang, locale))
1563 *icon = (char *)ptr->text;
1567 return PMINFO_R_ERROR;
1571 API int pkgmgrinfo_appinfo_get_label(pkgmgrinfo_appinfo_h handle, char **label)
1576 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1578 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1579 retvm_if(label == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1581 locale = info->locale;
1582 retvm_if(locale == NULL, PMINFO_R_ERROR, "manifest locale is NULL");
1584 if (info->app_info == NULL)
1585 return PMINFO_R_ERROR;
1587 for (tmp = info->app_info->label; tmp; tmp = tmp->next) {
1588 ptr = (label_x *)tmp->data;
1589 if (ptr == NULL || ptr->text == NULL || ptr->lang == NULL ||
1590 strcmp(ptr->lang, locale))
1592 *label = (char *)ptr->text;
1596 locale = DEFAULT_LOCALE;
1597 for (tmp = info->app_info->label; tmp; tmp = tmp->next) {
1598 ptr = (label_x *)tmp->data;
1599 if (ptr == NULL || ptr->text == NULL || ptr->lang == NULL ||
1600 strcmp(ptr->lang, locale))
1602 *label = (char *)ptr->text;
1606 return PMINFO_R_ERROR;
1609 static char *_get_localed_label(const char *appid, const char *locale, uid_t uid)
1611 char *result = NULL;
1613 sqlite3_stmt *stmt = NULL;
1616 const char *manifest_db;
1618 manifest_db = getUserPkgParserDBPathUID(uid);
1619 if (manifest_db == NULL) {
1620 _LOGE("Failed to get manifest db path");
1624 if (sqlite3_open_v2(manifest_db, &db, SQLITE_OPEN_READONLY, NULL) != SQLITE_OK) {
1625 _LOGE("DB open fail\n");
1629 query = sqlite3_mprintf("select app_label from package_app_localized_info where app_id=%Q and app_locale=%Q", appid, locale);
1630 if (query == NULL) {
1631 _LOGE("Out of memory");
1635 if (sqlite3_prepare_v2(db, query, -1, &stmt, NULL) != SQLITE_OK) {
1636 _LOGE("prepare_v2 fail\n");
1640 if (sqlite3_step(stmt) == SQLITE_ROW) {
1641 val = (char *)sqlite3_column_text(stmt, 0);
1643 result = strdup(val);
1647 sqlite3_finalize(stmt);
1648 sqlite3_free(query);
1654 API int pkgmgrinfo_appinfo_usr_get_localed_label(const char *appid, const char *locale, uid_t uid, char **label)
1658 retvm_if(appid == NULL || locale == NULL || label == NULL, PMINFO_R_EINVAL, "Argument is NULL");
1660 val = _get_localed_label(appid, locale, uid);
1662 val = _get_localed_label(appid, DEFAULT_LOCALE, uid);
1665 return PMINFO_R_ERROR;
1672 API int pkgmgrinfo_appinfo_get_localed_label(const char *appid, const char *locale, char **label)
1674 return pkgmgrinfo_appinfo_usr_get_localed_label(appid, locale, GLOBAL_USER, label);
1677 static pkgmgrinfo_app_component __appcomponent_convert(const char *comp)
1679 if (strcasecmp(comp, "uiapp") == 0)
1680 return PMINFO_UI_APP;
1681 else if (strcasecmp(comp, "svcapp") == 0)
1682 return PMINFO_SVC_APP;
1683 else if (strcasecmp(comp, "widgetapp") == 0)
1684 return PMINFO_WIDGET_APP;
1685 else if (strcasecmp(comp, "watchapp") == 0)
1686 return PMINFO_WATCH_APP;
1691 API int pkgmgrinfo_appinfo_get_component(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_component *component)
1693 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1696 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1697 retvm_if(component == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1699 if (info->app_info == NULL)
1700 return PMINFO_R_ERROR;
1702 comp = __appcomponent_convert(info->app_info->component);
1704 return PMINFO_R_ERROR;
1711 API int pkgmgrinfo_appinfo_get_apptype(pkgmgrinfo_appinfo_h handle, char **app_type)
1713 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1715 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1716 retvm_if(app_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1718 if (info->app_info == NULL || info->app_info->type == NULL)
1719 return PMINFO_R_ERROR;
1720 *app_type = (char *)info->app_info->type;
1725 API int pkgmgrinfo_appinfo_get_operation(pkgmgrinfo_appcontrol_h handle,
1726 int *operation_count, char ***operation)
1728 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1729 retvm_if(operation == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1730 retvm_if(operation_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1731 pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
1732 *operation_count = data->operation_count;
1733 *operation = data->operation;
1737 API int pkgmgrinfo_appinfo_get_uri(pkgmgrinfo_appcontrol_h handle,
1738 int *uri_count, char ***uri)
1740 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1741 retvm_if(uri == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1742 retvm_if(uri_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1743 pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
1744 *uri_count = data->uri_count;
1749 API int pkgmgrinfo_appinfo_get_mime(pkgmgrinfo_appcontrol_h handle,
1750 int *mime_count, char ***mime)
1752 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1753 retvm_if(mime == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1754 retvm_if(mime_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1755 pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
1756 *mime_count = data->mime_count;
1761 API int pkgmgrinfo_appinfo_get_subapp(pkgmgrinfo_appcontrol_h handle,
1762 int *subapp_count, char ***subapp)
1764 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1765 retvm_if(subapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1766 retvm_if(subapp_count == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1767 pkgmgrinfo_appcontrol_x *data = (pkgmgrinfo_appcontrol_x *)handle;
1768 *subapp_count = data->subapp_count;
1769 *subapp = data->subapp;
1773 API int pkgmgrinfo_appinfo_get_setting_icon(pkgmgrinfo_appinfo_h handle, char **icon)
1778 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1780 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
1781 retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1783 if (info->app_info == NULL)
1784 return PMINFO_R_ERROR;
1786 for (tmp = info->app_info->icon; tmp; tmp = tmp->next) {
1787 ptr = (icon_x *)tmp->data;
1788 if (ptr == NULL || ptr->section == NULL)
1791 val = (char *)ptr->section;
1792 if (val && strcmp(val, "setting") == 0) {
1793 *icon = (char *)ptr->text;
1798 return PMINFO_R_ERROR;
1802 API int pkgmgrinfo_appinfo_get_notification_icon(pkgmgrinfo_appinfo_h handle, char **icon)
1807 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1809 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
1810 retvm_if(icon == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1812 if (info->app_info == NULL)
1813 return PMINFO_R_ERROR;
1815 for (tmp = info->app_info->icon; tmp; tmp = tmp->next) {
1816 ptr = (icon_x *)tmp->data;
1817 if (ptr == NULL || ptr->section == NULL)
1820 val = (char *)ptr->section;
1821 if (val && strcmp(val, "notification") == 0){
1822 *icon = (char *)ptr->text;
1827 return PMINFO_R_ERROR;
1830 API int pkgmgrinfo_appinfo_get_recent_image_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_recentimage *type)
1833 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1835 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1836 retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1838 if (info->app_info == NULL || info->app_info->recentimage == NULL)
1839 return PMINFO_R_ERROR;
1841 val = (char *)info->app_info->recentimage;
1842 if (strcasecmp(val, "capture") == 0)
1843 *type = PMINFO_RECENTIMAGE_USE_CAPTURE;
1844 else if (strcasecmp(val, "icon") == 0)
1845 *type = PMINFO_RECENTIMAGE_USE_ICON;
1847 *type = PMINFO_RECENTIMAGE_USE_NOTHING;
1852 API int pkgmgrinfo_appinfo_get_preview_image(pkgmgrinfo_appinfo_h handle, char **preview_img)
1857 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1859 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
1860 retvm_if(preview_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1862 if (info->app_info == NULL)
1863 return PMINFO_R_ERROR;
1865 for (tmp = info->app_info->image; tmp; tmp = tmp->next) {
1866 ptr = (image_x *)tmp->data;
1867 if (ptr == NULL || ptr->section == NULL)
1870 val = (char *)ptr->section;
1871 if (val && strcmp(val, "preview") == 0) {
1872 *preview_img = (char *)ptr->text;
1877 return PMINFO_R_ERROR;
1880 API int pkgmgrinfo_appinfo_get_permission_type(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_permission_type *permission)
1883 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1885 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
1886 retvm_if(permission == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
1888 val = info->app_info->permission_type;
1890 return PMINFO_R_ERROR;
1892 if (strcmp(val, "signature") == 0)
1893 *permission = PMINFO_PERMISSION_SIGNATURE;
1894 else if (strcmp(val, "privilege") == 0)
1895 *permission = PMINFO_PERMISSION_PRIVILEGE;
1897 *permission = PMINFO_PERMISSION_NORMAL;
1902 API int pkgmgrinfo_appinfo_get_component_type(pkgmgrinfo_appinfo_h handle, char **component_type)
1904 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1906 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1907 retvm_if(component_type == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1909 if (info->app_info == NULL || info->app_info->component_type == NULL)
1910 return PMINFO_R_ERROR;
1912 *component_type = (char *)info->app_info->component_type;
1917 API int pkgmgrinfo_appinfo_get_hwacceleration(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_hwacceleration *hwacceleration)
1920 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1922 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1923 retvm_if(hwacceleration == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1925 if (info->app_info == NULL || info->app_info->hwacceleration == NULL)
1926 return PMINFO_R_ERROR;
1928 val = (char *)info->app_info->hwacceleration;
1929 if (strcasecmp(val, "not-use-GL") == 0)
1930 *hwacceleration = PMINFO_HWACCELERATION_NOT_USE_GL;
1931 else if (strcasecmp(val, "use-GL") == 0)
1932 *hwacceleration = PMINFO_HWACCELERATION_USE_GL;
1934 *hwacceleration = PMINFO_HWACCELERATION_USE_SYSTEM_SETTING;
1939 API int pkgmgrinfo_appinfo_get_screenreader(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_app_screenreader *screenreader)
1942 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1944 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1945 retvm_if(screenreader == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1947 if (info->app_info == NULL || info->app_info->screenreader == NULL)
1948 return PMINFO_R_ERROR;
1950 val = (char *)info->app_info->screenreader;
1951 if (strcasecmp(val, "screenreader-off") == 0)
1952 *screenreader = PMINFO_SCREENREADER_OFF;
1953 else if (strcasecmp(val, "screenreader-on") == 0)
1954 *screenreader = PMINFO_SCREENREADER_ON;
1956 *screenreader = PMINFO_SCREENREADER_USE_SYSTEM_SETTING;
1961 API int pkgmgrinfo_appinfo_get_effectimage(pkgmgrinfo_appinfo_h handle, char **portrait_img, char **landscape_img)
1963 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1965 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
1966 retvm_if(portrait_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1967 retvm_if(landscape_img == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
1969 if (info->app_info == NULL || (info->app_info->portraitimg == NULL
1970 && info->app_info->landscapeimg == NULL))
1971 return PMINFO_R_ERROR;
1973 *portrait_img = (char *)info->app_info->portraitimg;
1974 *landscape_img = (char *)info->app_info->landscapeimg;
1979 API int pkgmgrinfo_appinfo_get_effectimage_type(pkgmgrinfo_appinfo_h handle, char **effectimage_type)
1981 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
1983 if (handle == NULL || effectimage_type == NULL) {
1984 LOGE("invalid parameter");
1985 return PMINFO_R_EINVAL;
1988 if (info->app_info == NULL || info->app_info->effectimage_type == NULL)
1989 return PMINFO_R_ERROR;
1991 *effectimage_type = (char *)info->app_info->effectimage_type;
1996 API int pkgmgrinfo_appinfo_get_submode_mainid(pkgmgrinfo_appinfo_h handle, char **submode_mainid)
1998 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2000 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2001 retvm_if(submode_mainid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2003 if (info->app_info == NULL || info->app_info->submode_mainid == NULL)
2004 return PMINFO_R_ERROR;
2006 *submode_mainid = (char *)info->app_info->submode_mainid;
2011 API int pkgmgrinfo_appinfo_get_installed_storage_location(pkgmgrinfo_appinfo_h handle, pkgmgrinfo_installed_storage *storage)
2013 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
2014 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2016 if (info->app_info && info->app_info->installed_storage){
2017 if (strcmp(info->app_info->installed_storage,"installed_internal") == 0)
2018 *storage = PMINFO_INTERNAL_STORAGE;
2019 else if (strcmp(info->app_info->installed_storage,"installed_external") == 0)
2020 *storage = PMINFO_EXTERNAL_STORAGE;
2022 return PMINFO_R_ERROR;
2024 return PMINFO_R_ERROR;
2029 API int pkgmgrinfo_appinfo_get_launch_mode(pkgmgrinfo_appinfo_h handle, char **mode)
2031 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2033 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
2034 retvm_if(mode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2036 if (info->app_info->launch_mode == NULL)
2037 return PMINFO_R_ERROR;
2039 *mode = (char *)(info->app_info->launch_mode);
2044 API int pkgmgrinfo_appinfo_get_alias_appid(pkgmgrinfo_appinfo_h handle, char **alias_appid)
2046 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2048 if (handle == NULL || alias_appid == NULL) {
2049 LOGE("invalid parameter");
2050 return PMINFO_R_EINVAL;
2053 if (info->app_info == NULL || info->app_info->alias_appid == NULL)
2054 return PMINFO_R_ERROR;
2056 *alias_appid = (char *)info->app_info->alias_appid;
2061 API int pkgmgrinfo_appinfo_get_effective_appid(pkgmgrinfo_appinfo_h handle, char **effective_appid)
2063 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2065 if (handle == NULL || effective_appid == NULL) {
2066 LOGE("invalid parameter");
2067 return PMINFO_R_EINVAL;
2070 if (info->app_info == NULL || info->app_info->effective_appid == NULL)
2071 return PMINFO_R_ERROR;
2073 *effective_appid = (char *)info->app_info->effective_appid;
2078 API int pkgmgrinfo_appinfo_get_tep_name(pkgmgrinfo_appinfo_h handle, char **tep_name)
2080 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2082 if (handle == NULL || tep_name == NULL) {
2083 LOGE("invalid parameter");
2084 return PMINFO_R_EINVAL;
2087 if (info->app_info == NULL || info->app_info->tep_name == NULL)
2088 return PMINFO_R_ERROR;
2090 *tep_name = (char *)info->app_info->tep_name;
2095 API int pkgmgrinfo_appinfo_get_root_path(pkgmgrinfo_appinfo_h handle, char **root_path)
2097 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2099 if (handle == NULL || root_path == NULL) {
2100 LOGE("invalid parameter");
2101 return PMINFO_R_EINVAL;
2104 if (info->app_info == NULL || info->app_info->root_path == NULL)
2105 return PMINFO_R_ERROR;
2107 *root_path = (char *)info->app_info->root_path;
2112 API int pkgmgrinfo_appinfo_get_api_version(pkgmgrinfo_appinfo_h handle, char **api_version)
2114 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2116 if (handle == NULL || api_version == NULL) {
2117 LOGE("invalid parameter");
2118 return PMINFO_R_EINVAL;
2121 if (info->app_info == NULL || info->app_info->api_version == NULL)
2122 return PMINFO_R_ERROR;
2124 *api_version = (char *)info->app_info->api_version;
2129 API int pkgmgrinfo_appinfo_usr_get_datacontrol_info(const char *providerid, const char *type, uid_t uid, char **appid, char **access)
2131 retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
2132 retvm_if(type == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
2133 retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2134 retvm_if(access == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2136 int ret = PMINFO_R_OK;
2138 sqlite3_stmt *stmt = NULL;
2141 ret = __open_manifest_db(uid, true);
2142 retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
2144 /*Start constructing query*/
2145 query = sqlite3_mprintf("select * from package_app_data_control where providerid=%Q and type=%Q", providerid, type);
2148 ret = sqlite3_prepare_v2(GET_DB(manifest_db), query, strlen(query), &stmt, NULL);
2149 tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
2152 ret = sqlite3_step(stmt);
2153 tryvm_if((ret != SQLITE_ROW) || (ret == SQLITE_DONE), ret = PMINFO_R_ERROR, "No records found");
2155 *appid = strdup((char *)sqlite3_column_text(stmt, 0));
2156 *access = strdup((char *)sqlite3_column_text(stmt, 2));
2161 sqlite3_free(query);
2162 sqlite3_finalize(stmt);
2163 __close_manifest_db();
2167 API int pkgmgrinfo_appinfo_get_datacontrol_info(const char *providerid, const char *type, char **appid, char **access)
2169 return pkgmgrinfo_appinfo_usr_get_datacontrol_info(providerid, type, GLOBAL_USER, appid, access);
2172 API int pkgmgrinfo_appinfo_usr_get_datacontrol_appid(const char *providerid, uid_t uid, char **appid)
2174 retvm_if(providerid == NULL, PMINFO_R_EINVAL, "Argument supplied is NULL\n");
2175 retvm_if(appid == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2177 int ret = PMINFO_R_OK;
2179 sqlite3_stmt *stmt = NULL;
2182 ret = __open_manifest_db(uid, true);
2183 retvm_if(ret != SQLITE_OK, ret = PMINFO_R_ERROR, "connect db [%s] failed!", MANIFEST_DB);
2185 /*Start constructing query*/
2186 query = sqlite3_mprintf("select * from package_app_data_control where providerid=%Q", providerid);
2189 ret = sqlite3_prepare_v2(GET_DB(manifest_db), query, strlen(query), &stmt, NULL);
2190 tryvm_if(ret != PMINFO_R_OK, ret = PMINFO_R_ERROR, "sqlite3_prepare_v2 failed[%s]\n", query);
2193 ret = sqlite3_step(stmt);
2194 tryvm_if((ret != SQLITE_ROW) || (ret == SQLITE_DONE), ret = PMINFO_R_ERROR, "No records found");
2196 *appid = strdup((char *)sqlite3_column_text(stmt, 0));
2201 sqlite3_free(query);
2202 sqlite3_finalize(stmt);
2203 __close_manifest_db();
2207 API int pkgmgrinfo_appinfo_get_datacontrol_appid(const char *providerid, char **appid)
2209 return pkgmgrinfo_appinfo_usr_get_datacontrol_appid(providerid, GLOBAL_USER, appid);
2212 API int pkgmgrinfo_appinfo_foreach_permission(pkgmgrinfo_appinfo_h handle,
2213 pkgmgrinfo_app_permission_list_cb permission_func, void *user_data)
2215 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2216 retvm_if(permission_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
2220 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2222 if (info->app_info == NULL)
2223 return PMINFO_R_ERROR;
2225 for (tmp = info->app_info->permission; tmp; tmp = tmp->next) {
2226 ptr = (permission_x *)tmp->data;
2230 ret = permission_func(ptr->value, user_data);
2238 API int pkgmgrinfo_appinfo_foreach_category(pkgmgrinfo_appinfo_h handle,
2239 pkgmgrinfo_app_category_list_cb category_func, void *user_data)
2241 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2242 retvm_if(category_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
2244 const char *category;
2246 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2248 if (info->app_info == NULL)
2249 return PMINFO_R_ERROR;
2251 for (tmp = info->app_info->category; tmp; tmp = tmp->next) {
2252 category = (const char *)tmp->data;
2254 ret = category_func(category, user_data);
2262 API int pkgmgrinfo_appinfo_foreach_metadata(pkgmgrinfo_appinfo_h handle,
2263 pkgmgrinfo_app_metadata_list_cb metadata_func, void *user_data)
2265 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2266 retvm_if(metadata_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
2270 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2272 if (info->app_info == NULL)
2273 return PMINFO_R_ERROR;
2275 for (tmp = info->app_info->metadata; tmp; tmp = tmp->next) {
2276 ptr = (metadata_x *)tmp->data;
2280 ret = metadata_func(ptr->key, ptr->value, user_data);
2288 API int pkgmgrinfo_appinfo_foreach_appcontrol(pkgmgrinfo_appinfo_h handle,
2289 pkgmgrinfo_app_control_list_cb appcontrol_func, void *user_data)
2291 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2292 retvm_if(appcontrol_func == NULL, PMINFO_R_EINVAL, "Callback function is NULL");
2294 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2295 appcontrol_x *appcontrol;
2298 if (info->app_info == NULL)
2299 return PMINFO_R_ERROR;
2301 for (tmp = info->app_info->appcontrol; tmp; tmp = tmp->next) {
2302 appcontrol = (appcontrol_x *)tmp->data;
2303 if (appcontrol == NULL)
2305 ret = appcontrol_func(appcontrol->operation, appcontrol->uri, appcontrol->mime, user_data);
2313 API int pkgmgrinfo_appinfo_foreach_background_category(
2314 pkgmgrinfo_appinfo_h handle,
2315 pkgmgrinfo_app_background_category_list_cb category_func,
2318 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2322 if (handle == NULL || category_func == NULL || info->app_info == NULL) {
2323 LOGE("invalid parameter");
2324 return PMINFO_R_EINVAL;
2327 for (tmp = info->app_info->background_category; tmp; tmp = tmp->next) {
2328 category = (char *)tmp->data;
2329 if (category == NULL)
2332 if (category_func(category, user_data) < 0)
2339 API int pkgmgrinfo_appinfo_foreach_splash_screen(pkgmgrinfo_appinfo_h handle,
2340 pkgmgrinfo_app_splash_screen_list_cb splash_screen_func,
2343 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2344 splashscreen_x *splashscreen;
2348 if (info == NULL || info->app_info == NULL
2349 || splash_screen_func == NULL) {
2350 LOGE("invalid parameter");
2351 return PMINFO_R_EINVAL;
2354 for (tmp = info->app_info->splashscreens; tmp; tmp = tmp->next) {
2355 splashscreen = (splashscreen_x *)tmp->data;
2356 if (splashscreen == NULL)
2358 ret = splash_screen_func(splashscreen->src,
2360 splashscreen->orientation,
2361 splashscreen->indicatordisplay,
2362 splashscreen->operation,
2371 API int pkgmgrinfo_appinfo_is_nodisplay(pkgmgrinfo_appinfo_h handle, bool *nodisplay)
2373 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2374 retvm_if(nodisplay == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2375 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2377 if (info->app_info == NULL || info->app_info->nodisplay == NULL)
2378 return PMINFO_R_ERROR;
2380 *nodisplay = _get_bool_value(info->app_info->nodisplay);
2385 API int pkgmgrinfo_appinfo_is_multiple(pkgmgrinfo_appinfo_h handle, bool *multiple)
2387 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2388 retvm_if(multiple == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2389 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2391 if (info->app_info == NULL || info->app_info->multiple == NULL)
2392 return PMINFO_R_ERROR;
2394 *multiple = _get_bool_value(info->app_info->multiple);
2399 API int pkgmgrinfo_appinfo_is_indicator_display_allowed(pkgmgrinfo_appinfo_h handle, bool *indicator_disp)
2401 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2402 retvm_if(indicator_disp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2403 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2405 if (info->app_info == NULL || info->app_info->indicatordisplay == NULL)
2406 return PMINFO_R_ERROR;
2408 *indicator_disp = _get_bool_value(info->app_info->indicatordisplay);
2413 API int pkgmgrinfo_appinfo_is_taskmanage(pkgmgrinfo_appinfo_h handle, bool *taskmanage)
2415 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2416 retvm_if(taskmanage == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2417 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2419 if (info->app_info == NULL || info->app_info->taskmanage == NULL)
2420 return PMINFO_R_ERROR;
2422 *taskmanage = _get_bool_value(info->app_info->taskmanage);
2427 API int pkgmgrinfo_appinfo_is_enabled(pkgmgrinfo_appinfo_h handle, bool *enabled)
2429 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2430 retvm_if(enabled == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2431 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2433 if (info->app_info == NULL || info->app_info->enabled == NULL)
2434 return PMINFO_R_ERROR;
2436 *enabled = _get_bool_value(info->app_info->enabled);
2441 API int pkgmgrinfo_appinfo_is_onboot(pkgmgrinfo_appinfo_h handle, bool *onboot)
2443 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2444 retvm_if(onboot == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2445 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2447 if (info->app_info == NULL || info->app_info->onboot == NULL)
2448 return PMINFO_R_ERROR;
2450 *onboot = _get_bool_value(info->app_info->onboot);
2455 API int pkgmgrinfo_appinfo_is_autorestart(pkgmgrinfo_appinfo_h handle, bool *autorestart)
2457 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2458 retvm_if(autorestart == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2459 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2461 if (info->app_info == NULL || info->app_info->autorestart == NULL)
2462 return PMINFO_R_ERROR;
2464 *autorestart = _get_bool_value(info->app_info->autorestart);
2469 API int pkgmgrinfo_appinfo_is_mainapp(pkgmgrinfo_appinfo_h handle, bool *mainapp)
2471 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2472 retvm_if(mainapp == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL");
2473 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2475 if (info->app_info == NULL || info->app_info->mainapp == NULL)
2476 return PMINFO_R_ERROR;
2478 *mainapp = _get_bool_value(info->app_info->mainapp);
2483 API int pkgmgrinfo_appinfo_is_preload(pkgmgrinfo_appinfo_h handle, bool *preload)
2485 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
2486 retvm_if(preload == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2487 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2489 if (info->app_info == NULL || info->app_info->preload == NULL)
2490 return PMINFO_R_ERROR;
2492 *preload = _get_bool_value(info->app_info->preload);
2497 API int pkgmgrinfo_appinfo_is_submode(pkgmgrinfo_appinfo_h handle, bool *submode)
2499 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
2500 retvm_if(submode == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2501 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2503 if (info->app_info == NULL || info->app_info->submode == NULL)
2504 return PMINFO_R_ERROR;
2506 *submode = _get_bool_value(info->app_info->submode);
2511 API int pkgmgrinfo_appinfo_is_process_pool(pkgmgrinfo_appinfo_h handle, bool *process_pool)
2513 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2515 if (handle == NULL || process_pool == NULL) {
2516 LOGE("invalid parameter");
2517 return PMINFO_R_EINVAL;
2520 if (info->app_info == NULL)
2521 return PMINFO_R_ERROR;
2523 *process_pool = _get_bool_value(info->app_info->process_pool);
2528 API int pkgmgrinfo_appinfo_is_category_exist(pkgmgrinfo_appinfo_h handle, const char *category, bool *exist)
2530 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2531 retvm_if(category == NULL, PMINFO_R_EINVAL, "category is NULL");
2532 retvm_if(exist == NULL, PMINFO_R_EINVAL, "exist is NULL");
2536 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2538 if (info->app_info == NULL)
2539 return PMINFO_R_ERROR;
2542 for (tmp = info->app_info->category; tmp; tmp = tmp->next) {
2543 val = (const char *)tmp->data;
2546 if (strcasecmp(val, category) == 0) {
2555 API int pkgmgrinfo_appinfo_is_ui_gadget(pkgmgrinfo_appinfo_h handle,
2558 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2560 if (info == NULL || info->app_info == NULL || ui_gadget == NULL) {
2561 _LOGE("invalid parameter");
2562 return PMINFO_R_EINVAL;
2565 *ui_gadget = _get_bool_value(info->app_info->ui_gadget);
2570 API int pkgmgrinfo_appinfo_is_support_disable(pkgmgrinfo_appinfo_h handle,
2571 bool *support_disable)
2573 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2575 if (info == NULL || info->app_info == NULL || support_disable == NULL) {
2576 _LOGE("invalid parameter");
2577 return PMINFO_R_EINVAL;
2580 *support_disable = _get_bool_value(info->app_info->support_disable);
2585 API int pkgmgrinfo_appinfo_is_global(pkgmgrinfo_appinfo_h handle, bool *global)
2587 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2589 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
2590 retvm_if(global == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2592 if (info->app_info == NULL || info->app_info->for_all_users == NULL)
2593 return PMINFO_R_ERROR;
2595 *global = _get_bool_value(info->app_info->for_all_users);
2601 API int pkgmgrinfo_appinfo_destroy_appinfo(pkgmgrinfo_appinfo_h handle)
2603 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL");
2604 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2605 __cleanup_appinfo(info);
2609 API int pkgmgrinfo_appinfo_filter_create(pkgmgrinfo_appinfo_filter_h *handle)
2611 return (pkgmgrinfo_pkginfo_filter_create(handle));
2614 API int pkgmgrinfo_appinfo_filter_destroy(pkgmgrinfo_appinfo_filter_h handle)
2616 return (pkgmgrinfo_pkginfo_filter_destroy(handle));
2619 static gint __compare_func(gconstpointer data1, gconstpointer data2)
2621 pkgmgrinfo_node_x *node1 = (pkgmgrinfo_node_x*)data1;
2622 pkgmgrinfo_node_x *node2 = (pkgmgrinfo_node_x*)data2;
2623 if (node1->prop == node2->prop)
2625 else if (node1->prop > node2->prop)
2631 API int pkgmgrinfo_appinfo_filter_add_int(pkgmgrinfo_appinfo_filter_h handle,
2632 const char *property, const int value)
2634 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2635 retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2636 char buf[PKG_VALUE_STRING_LEN_MAX] = {'\0'};
2638 GSList *link = NULL;
2640 prop = _pminfo_appinfo_convert_to_prop_int(property);
2641 if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_INT ||
2642 prop > E_PMINFO_APPINFO_PROP_APP_MAX_INT) {
2643 _LOGE("Invalid Integer Property\n");
2644 return PMINFO_R_EINVAL;
2646 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
2647 pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
2649 _LOGE("Out of Memory!!!\n");
2650 return PMINFO_R_ERROR;
2652 snprintf(buf, PKG_VALUE_STRING_LEN_MAX - 1, "%d", value);
2653 val = strndup(buf, PKG_VALUE_STRING_LEN_MAX - 1);
2655 _LOGE("Out of Memory\n");
2658 return PMINFO_R_ERROR;
2662 /*If API is called multiple times for same property, we should override the previous values.
2663 Last value set will be used for filtering.*/
2664 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
2666 filter->list = g_slist_delete_link(filter->list, link);
2667 filter->list = g_slist_append(filter->list, (gpointer)node);
2672 API int pkgmgrinfo_appinfo_filter_add_bool(pkgmgrinfo_appinfo_filter_h handle,
2673 const char *property, const bool value)
2675 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2676 retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2678 GSList *link = NULL;
2680 prop = _pminfo_appinfo_convert_to_prop_bool(property);
2681 if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_BOOL ||
2682 prop > E_PMINFO_APPINFO_PROP_APP_MAX_BOOL) {
2683 _LOGE("Invalid Boolean Property\n");
2684 return PMINFO_R_EINVAL;
2686 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
2687 pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
2689 _LOGE("Out of Memory!!!\n");
2690 return PMINFO_R_ERROR;
2693 val = strndup("('true','True')", 15);
2695 val = strndup("('false','False')", 17);
2697 _LOGE("Out of Memory\n");
2700 return PMINFO_R_ERROR;
2704 /*If API is called multiple times for same property, we should override the previous values.
2705 Last value set will be used for filtering.*/
2706 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
2708 filter->list = g_slist_delete_link(filter->list, link);
2709 filter->list = g_slist_append(filter->list, (gpointer)node);
2714 API int pkgmgrinfo_appinfo_filter_add_string(pkgmgrinfo_appinfo_filter_h handle,
2715 const char *property, const char *value)
2717 retvm_if(handle == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2718 retvm_if(property == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2719 retvm_if(value == NULL, PMINFO_R_EINVAL, "Filter handle input parameter is NULL\n");
2721 pkgmgrinfo_node_x *ptr = NULL;
2722 char prev[PKG_STRING_LEN_MAX] = {'\0'};
2723 char temp[PKG_STRING_LEN_MAX] = {'\0'};
2724 GSList *link = NULL;
2726 prop = _pminfo_appinfo_convert_to_prop_str(property);
2727 if (prop < E_PMINFO_APPINFO_PROP_APP_MIN_STR ||
2728 prop > E_PMINFO_APPINFO_PROP_APP_MAX_STR) {
2729 _LOGE("Invalid String Property\n");
2730 return PMINFO_R_EINVAL;
2732 pkgmgrinfo_filter_x *filter = (pkgmgrinfo_filter_x*)handle;
2733 pkgmgrinfo_node_x *node = (pkgmgrinfo_node_x*)calloc(1, sizeof(pkgmgrinfo_node_x));
2735 _LOGE("Out of Memory!!!\n");
2736 return PMINFO_R_ERROR;
2740 case E_PMINFO_APPINFO_PROP_APP_COMPONENT:
2741 if (strcmp(value, PMINFO_APPINFO_UI_APP) == 0)
2742 val = strndup("uiapp", PKG_STRING_LEN_MAX - 1);
2744 val = strndup("svcapp", PKG_STRING_LEN_MAX - 1);
2746 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
2748 filter->list = g_slist_delete_link(filter->list, link);
2749 filter->list = g_slist_append(filter->list, (gpointer)node);
2751 case E_PMINFO_APPINFO_PROP_APP_CATEGORY:
2752 case E_PMINFO_APPINFO_PROP_APP_OPERATION:
2753 case E_PMINFO_APPINFO_PROP_APP_URI:
2754 case E_PMINFO_APPINFO_PROP_APP_MIME:
2755 val = (char *)calloc(1, PKG_STRING_LEN_MAX);
2757 _LOGE("Out of Memory\n");
2760 return PMINFO_R_ERROR;
2762 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
2764 ptr = (pkgmgrinfo_node_x *)link->data;
2765 strncpy(prev, ptr->value, PKG_STRING_LEN_MAX - 1);
2766 _LOGE("Previous value is %s\n", prev);
2767 filter->list = g_slist_delete_link(filter->list, link);
2768 snprintf(temp, PKG_STRING_LEN_MAX - 1, "%s , '%s'", prev, value);
2769 strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
2770 _LOGE("New value is %s\n", val);
2772 filter->list = g_slist_append(filter->list, (gpointer)node);
2773 memset(temp, '\0', PKG_STRING_LEN_MAX);
2775 snprintf(temp, PKG_STRING_LEN_MAX - 1, "'%s'", value);
2776 strncpy(val, temp, PKG_STRING_LEN_MAX - 1);
2777 _LOGE("First value is %s\n", val);
2779 filter->list = g_slist_append(filter->list, (gpointer)node);
2780 memset(temp, '\0', PKG_STRING_LEN_MAX);
2784 node->value = strndup(value, PKG_STRING_LEN_MAX - 1);
2785 link = g_slist_find_custom(filter->list, (gconstpointer)node, __compare_func);
2787 filter->list = g_slist_delete_link(filter->list, link);
2788 filter->list = g_slist_append(filter->list, (gpointer)node);
2794 API int pkgmgrinfo_appinfo_usr_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count, uid_t uid)
2799 if (handle == NULL || count == NULL) {
2800 _LOGE("invalid parameter");
2801 return PMINFO_R_EINVAL;
2804 ret = _appinfo_get_filtered_list(handle, uid, &list);
2805 if (ret != PMINFO_R_OK)
2806 return PMINFO_R_ERROR;
2808 *count = g_list_length(list);
2810 g_list_free_full(list, free);
2815 API int pkgmgrinfo_appinfo_filter_count(pkgmgrinfo_appinfo_filter_h handle, int *count)
2817 return pkgmgrinfo_appinfo_usr_filter_count(handle, count, GLOBAL_USER);
2820 API int pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(
2821 pkgmgrinfo_appinfo_filter_h handle,
2822 pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid)
2824 if (handle == NULL || app_cb == NULL) {
2825 LOGE("invalid parameter");
2826 return PMINFO_R_EINVAL;
2829 return _appinfo_get_filtered_foreach_appinfo(uid, handle, app_cb,
2833 API int pkgmgrinfo_appinfo_filter_foreach_appinfo(pkgmgrinfo_appinfo_filter_h handle,
2834 pkgmgrinfo_app_list_cb app_cb, void * user_data)
2836 return pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, app_cb, user_data, GLOBAL_USER);
2839 API int pkgmgrinfo_appinfo_metadata_filter_create(pkgmgrinfo_appinfo_metadata_filter_h *handle)
2841 return (pkgmgrinfo_pkginfo_filter_create(handle));
2844 API int pkgmgrinfo_appinfo_metadata_filter_destroy(pkgmgrinfo_appinfo_metadata_filter_h handle)
2846 return (pkgmgrinfo_pkginfo_filter_destroy(handle));
2849 API int pkgmgrinfo_appinfo_metadata_filter_add(
2850 pkgmgrinfo_appinfo_metadata_filter_h handle,
2851 const char *key, const char *value)
2855 ret = pkgmgrinfo_appinfo_filter_add_string(handle,
2856 PMINFO_APPINFO_PROP_APP_METADATA_KEY, key);
2857 if (ret != PMINFO_R_OK)
2860 /* value can be NULL.
2861 * In that case all apps with specified key should be displayed
2864 ret = pkgmgrinfo_appinfo_filter_add_string(handle,
2865 PMINFO_APPINFO_PROP_APP_METADATA_VALUE, value);
2866 if (ret != PMINFO_R_OK)
2873 API int pkgmgrinfo_appinfo_usr_metadata_filter_foreach(
2874 pkgmgrinfo_appinfo_metadata_filter_h handle,
2875 pkgmgrinfo_app_list_cb app_cb, void *user_data, uid_t uid)
2877 if (handle == NULL || app_cb == NULL) {
2878 LOGE("invalid parameter");
2879 return PMINFO_R_EINVAL;
2882 return _appinfo_get_filtered_foreach_appinfo(uid, handle, app_cb,
2886 API int pkgmgrinfo_appinfo_metadata_filter_foreach(
2887 pkgmgrinfo_appinfo_metadata_filter_h handle,
2888 pkgmgrinfo_app_list_cb app_cb, void *user_data)
2890 return pkgmgrinfo_appinfo_usr_metadata_filter_foreach(handle, app_cb,
2891 user_data, GLOBAL_USER);
2894 API int pkgmgrinfo_appinfo_is_guestmode_visibility(pkgmgrinfo_appinfo_h handle, bool *status)
2897 pkgmgr_appinfo_x *info = (pkgmgr_appinfo_x *)handle;
2899 retvm_if(handle == NULL, PMINFO_R_EINVAL, "appinfo handle is NULL\n");
2900 retvm_if(status == NULL, PMINFO_R_EINVAL, "Argument supplied to hold return value is NULL\n");
2902 val = info->app_info->guestmode_visibility;
2903 *status = _get_bool_value(val);