mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 04:39:54 +01:00
Raised minimum Android version to 2.3 (API 9). #23
This commit is contained in:
@@ -1,31 +1,17 @@
|
||||
package org.briarproject.system;
|
||||
|
||||
import org.briarproject.api.system.FileUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.briarproject.api.system.FileUtils;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
import android.os.StatFs;
|
||||
|
||||
public class AndroidFileUtils implements FileUtils {
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public long getTotalSpace(File f) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= 9) return f.getTotalSpace();
|
||||
StatFs s = new StatFs(f.getAbsolutePath());
|
||||
// These deprecated methods are the best thing available for SDK < 9
|
||||
return (long) s.getBlockCount() * s.getBlockSize();
|
||||
return f.getTotalSpace();
|
||||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
@SuppressWarnings("deprecation")
|
||||
public long getFreeSpace(File f) throws IOException {
|
||||
if (Build.VERSION.SDK_INT >= 9) return f.getUsableSpace();
|
||||
StatFs s = new StatFs(f.getAbsolutePath());
|
||||
// These deprecated methods are the best thing available for SDK < 9
|
||||
return (long) s.getAvailableBlocks() * s.getBlockSize();
|
||||
return f.getUsableSpace();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,19 @@
|
||||
package org.briarproject.system;
|
||||
|
||||
import android.os.Build;
|
||||
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import android.annotation.SuppressLint;
|
||||
import android.os.Build;
|
||||
|
||||
class AndroidSeedProvider extends LinuxSeedProvider {
|
||||
|
||||
@Override
|
||||
@SuppressLint("NewApi")
|
||||
void writeToEntropyPool(DataOutputStream out) throws IOException {
|
||||
out.writeInt(android.os.Process.myPid());
|
||||
out.writeInt(android.os.Process.myTid());
|
||||
out.writeInt(android.os.Process.myUid());
|
||||
String fingerprint = Build.FINGERPRINT;
|
||||
if (fingerprint != null) out.writeUTF(fingerprint);
|
||||
if (Build.VERSION.SDK_INT >= 9) {
|
||||
String serial = Build.SERIAL;
|
||||
if (serial != null) out.writeUTF(serial);
|
||||
}
|
||||
if (Build.FINGERPRINT != null) out.writeUTF(Build.FINGERPRINT);
|
||||
if (Build.SERIAL != null) out.writeUTF(Build.SERIAL);
|
||||
super.writeToEntropyPool(out);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user