mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-14 19:59: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 java.io.IOException;
|
||||||
|
|
||||||
import net.sf.briar.api.os.FileUtils;
|
import net.sf.briar.api.os.FileUtils;
|
||||||
|
import android.os.Build;
|
||||||
import android.os.StatFs;
|
import android.os.StatFs;
|
||||||
|
|
||||||
class AndroidFileUtils implements FileUtils {
|
class AndroidFileUtils implements FileUtils {
|
||||||
|
|
||||||
public long getFreeSpace(File f) throws IOException {
|
public long getFreeSpace(File f) throws IOException {
|
||||||
StatFs s = new StatFs(f.getAbsolutePath());
|
StatFs s = new StatFs(f.getAbsolutePath());
|
||||||
|
if(Build.VERSION.SDK_INT >= 18)
|
||||||
|
return s.getAvailableBlocksLong() * s.getBlockSizeLong();
|
||||||
return (long) s.getAvailableBlocks() * s.getBlockSize();
|
return (long) s.getAvailableBlocks() * s.getBlockSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user