+ while (sqlite3_step(stmt) == SQLITE_ROW) {
+ info = calloc(1, sizeof(application_x));
+ if (info == NULL) {
+ LOGE("out of memory");
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ idx = 0;
+ _save_column_str(stmt, idx++, &info->appid);
+ _save_column_str(stmt, idx++, &info->installed_storage);
+ _save_column_str(stmt, idx++ , &info->external_path);
+
+ if (flag & PMINFO_APPINFO_GET_BASICINFO) {
+ _save_column_str(stmt, idx++, &info->component);
+ _save_column_str(stmt, idx++, &info->exec);
+ _save_column_str(stmt, idx++, &info->nodisplay);
+ _save_column_str(stmt, idx++, &info->type);
+ _save_column_str(stmt, idx++, &info->onboot);
+ _save_column_str(stmt, idx++, &info->multiple);
+ _save_column_str(stmt, idx++, &info->autorestart);
+ _save_column_str(stmt, idx++, &info->taskmanage);
+ _save_column_str(stmt, idx++, &info->hwacceleration);
+ _save_column_str(stmt, idx++, &info->screenreader);
+ _save_column_str(stmt, idx++, &info->mainapp);
+ _save_column_str(stmt, idx++, &info->recentimage);
+ _save_column_str(stmt, idx++, &info->launchcondition);
+ _save_column_str(stmt, idx++, &info->indicatordisplay);
+ _save_column_str(stmt, idx++, &info->portraitimg);
+ _save_column_str(stmt, idx++, &info->landscapeimg);
+ _save_column_str(stmt, idx++, &info->guestmode_visibility);
+ _save_column_str(stmt, idx++, &info->permission_type);
+ _save_column_str(stmt, idx++, &info->preload);
+ _save_column_str(stmt, idx++, &info->submode);
+ _save_column_str(stmt, idx++, &info->submode_mainid);
+ _save_column_str(stmt, idx++, &info->launch_mode);
+ _save_column_str(stmt, idx++, &info->ui_gadget);
+ _save_column_str(stmt, idx++, &info->support_disable);
+ _save_column_str(stmt, idx++, &info->process_pool);
+ _save_column_str(stmt, idx++, &bg_category_str);
+ _save_column_str(stmt, idx++, &info->package_type);
+ _save_column_str(stmt, idx++, &info->root_path);
+ _save_column_str(stmt, idx++, &info->api_version);
+ _save_column_str(stmt, idx++, &info->effective_appid);
+ _save_column_str(stmt, idx++, &info->is_disabled);
+ _save_column_str(stmt, idx++, &info->splash_screen_display);
+ _save_column_str(stmt, idx++, &info->tep_name);
+ _save_column_str(stmt, idx++, &info->zip_mount_file);
+ _save_column_str(stmt, idx++, &info->component_type);
+ _save_column_str(stmt, idx++, &info->package);
+ _save_column_str(stmt, idx++, &info->package_system);
+ _save_column_str(stmt, idx++, &info->removable);
+ _save_column_str(stmt, idx++, &info->package_installed_time);
+ _save_column_str(stmt, idx++, &info->support_mode);
+ _save_column_str(stmt, idx++, &info->support_ambient);
+ _save_column_str(stmt, idx++, &info->setup_appid);
+ info->background_category = __get_background_category(
+ bg_category_str);
+ free(bg_category_str);
+ }
+
+ info->for_all_users =
+ strdup((db_uid != global_user_uid) ? "false" : "true");
+
+ if (db_uid != global_user_uid) {
+ idx = idx + 2;
+ } else {
+ tmp_record = NULL;
+ _save_column_str(stmt, idx++, &tmp_record);
+ if (tmp_record != NULL) {
+ if (strcasecmp(info->is_disabled, "false") == 0 &&
+ strcasecmp(tmp_record, "false") == 0) {
+ free(info->is_disabled);
+ info->is_disabled = tmp_record;
+ }
+ }
+ tmp_record = NULL;
+ _save_column_str(stmt, idx++, &tmp_record);
+ if (tmp_record != NULL) {
+ if (strcasecmp(info->splash_screen_display, "false") == 0 &&
+ strcasecmp(tmp_record, "false") == 0) {
+ free(info->splash_screen_display);
+ info->splash_screen_display = tmp_record;
+ }
+ }
+ }
+
+ if (flag & PMINFO_APPINFO_GET_LABEL) {
+ tmp_record = NULL;
+ _save_column_str(stmt, idx++, &tmp_record);
+ if (_add_label_info_into_list(locale, tmp_record, &info->label)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ }
+
+ if (flag & PMINFO_APPINFO_GET_ICON) {
+ tmp_record = NULL;
+ _save_column_str(stmt, idx++, &tmp_record);
+ if (_add_icon_info_into_list(locale, tmp_record, &info->icon)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ }
+
+ if (flag & PMINFO_APPINFO_GET_CATEGORY) {
+ if (_appinfo_get_category(db, info->appid,
+ &info->category)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ }
+
+ if (flag & PMINFO_APPINFO_GET_APP_CONTROL) {
+ if (_appinfo_get_app_control(db, info->appid,
+ &info->appcontrol)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ }
+
+ if (flag & PMINFO_APPINFO_GET_METADATA) {
+ if (_appinfo_get_metadata(db, info->appid,
+ &info->metadata)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ }
+
+ if (flag & PMINFO_APPINFO_GET_SPLASH_SCREEN) {
+ if (_appinfo_get_splashscreens(db, info->appid,
+ &info->splashscreens)) {
+ ret = PMINFO_R_ERROR;
+ goto catch;
+ }
+ }
+
+ if (is_check_storage &&
+ __appinfo_check_installed_storage(info) != PMINFO_R_OK) {
+ ret = PMINFO_R_ERROR;
+ pkgmgrinfo_basic_free_application(info);
+ info = NULL;
+ continue;
+ }
+
+ g_hash_table_insert(applications, (gpointer)info->appid,
+ (gpointer)info);