public void releaseOutdatedUriPermissions() {
        final Set<String> usedUris = new HashSet<>();
        for (PersistableFolder folder : PersistableFolder.values()) {
            if (folder.getFolder().getBaseUri() != null) {
                usedUris.add(UriUtils.toCompareString(folder.getFolder().getBaseUri()));
            }
        }
        for (PersistableUri persistedUri : PersistableUri.values()) {
            if (persistedUri.getUri() != null) {
                usedUris.add(UriUtils.toCompareString(persistedUri.getUri()));
            }
        }

        for (UriPermission uriPerm : getContext().getContentResolver().getPersistedUriPermissions()) {
            if (!usedUris.contains(UriUtils.toCompareString(uriPerm.getUri()))) {
                Log.iForce("Releasing UriPermission: " + UriUtils.uriPermissionToString(uriPerm));
                final int flags = calculateUriPermissionFlags(uriPerm.isReadPermission(), uriPerm.isWritePermission());
                getContext().getContentResolver().releasePersistableUriPermission(uriPerm.getUri(), flags);
            }
        }
        refreshUriPermissionCache();
    }
Checks and releases all Uri Permissions which are no longer needed
main/src/main/java/cgeo/geocaching/storage/DocumentContentAccessor.java