mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Avoid using a deprecated API if possible.
This commit is contained in:
@@ -4,12 +4,15 @@ import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sf.briar.api.os.FileUtils;
|
||||
import android.os.Build;
|
||||
import android.os.StatFs;
|
||||
|
||||
class AndroidFileUtils implements FileUtils {
|
||||
|
||||
public long getFreeSpace(File f) throws IOException {
|
||||
StatFs s = new StatFs(f.getAbsolutePath());
|
||||
if(Build.VERSION.SDK_INT >= 18)
|
||||
return s.getAvailableBlocksLong() * s.getBlockSizeLong();
|
||||
return (long) s.getAvailableBlocks() * s.getBlockSize();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user