public void updateOfflineMaps(final Uri offlineMapToSet) {
        MapSource msToSet = null;
        MapProviderFactory.deleteOfflineMapSources();
        final Resources resources = CgeoApplication.getInstance().getResources();
        final List<ImmutablePair<String, Uri>> offlineMaps =
                CollectionStream.of(getOfflineMaps())
                        .filter(fi -> !fi.isDirectory && fi.name.toLowerCase(Locale.getDefault()).endsWith(FileUtils.MAP_FILE_EXTENSION) && isValidMapFile(fi.uri))
                        .map(fi -> new ImmutablePair<>(fi.name, fi.uri)).toList();
        Collections.sort(offlineMaps, (o1, o2) -> TextUtils.COLLATOR.compare(o1.left, o2.left));
        if (offlineMaps.size() > 1) {
            registerMapSource(new OfflineMultiMapSource(offlineMaps, this, resources.getString(R.string.map_source_osm_offline_combined)));
        }
        for (final ImmutablePair<String, Uri> mapFile : offlineMaps) {
            final String mapName = StringUtils.capitalize(StringUtils.substringBeforeLast(mapFile.left, "."));
            final OfflineMapSource offlineMapSource = new OfflineMapSource(mapFile.right, this, mapName + " (" + resources.getString(R.string.map_source_osm_offline) + ")");
            registerMapSource(offlineMapSource);
            if (offlineMapToSet != null && offlineMapToSet.equals(offlineMapSource.getMapUri())) {
                msToSet = offlineMapSource;
            }
        }
        if (msToSet != null) {
            Settings.setMapSource(msToSet);
        }
    }
Tries to open given uri as a mapfile.
If mapfile is invalid in any way (not available, not readable, wrong version, ...), then null is returned.
If mapfile is valid, then its attribution is read and returned (or a default attribution value in case attribution is null)
main/src/main/java/cgeo/geocaching/maps/mapsforge/MapsforgeMapProvider.java