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:
parent
c3c39a7b24
commit
caa3812e13
1 changed files with 3 additions and 2 deletions
|
@ -11,7 +11,6 @@ import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.ParcelFileDescriptor;
|
import android.os.ParcelFileDescriptor;
|
||||||
import android.provider.DocumentsContract;
|
import android.provider.DocumentsContract;
|
||||||
import android.system.ErrnoException;
|
|
||||||
import android.system.Os;
|
import android.system.Os;
|
||||||
import android.system.StructStatVfs;
|
import android.system.StructStatVfs;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
@ -207,7 +206,9 @@ public class StoredDirectoryHelper {
|
||||||
|
|
||||||
// this is the same formula used inside the FsStat class
|
// this is the same formula used inside the FsStat class
|
||||||
return stat.f_bavail * stat.f_frsize;
|
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;
|
return Long.MAX_VALUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue