Ignore all errors when getting free storage space

It's not a critical check that needs to be perfomed, so in case something does not work on some device/version, let's just ignore the error.
This commit is contained in:
Stypox 2024-04-23 18:05:31 +02:00
parent c3c39a7b24
commit caa3812e13
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 3 additions and 2 deletions

View File

@ -11,7 +11,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.ParcelFileDescriptor;
import android.provider.DocumentsContract;
import android.system.ErrnoException;
import android.system.Os;
import android.system.StructStatVfs;
import android.util.Log;
@ -207,7 +206,9 @@ public class StoredDirectoryHelper {
// this is the same formula used inside the FsStat class
return stat.f_bavail * stat.f_frsize;
} catch (final IOException | ErrnoException e) {
} catch (final Throwable e) {
// ignore any error
Log.e(TAG, "Could not get free storage space", e);
return Long.MAX_VALUE;
}
}