mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 12:19:54 +01:00
Separate FileUtils implementations for Android and desktop builds.
The method used by Commons IO to get the available disk space fails on Android devices that lack a df binary - use the Android API instead.
This commit is contained in:
15
briar-android/src/net/sf/briar/android/AndroidFileUtils.java
Normal file
15
briar-android/src/net/sf/briar/android/AndroidFileUtils.java
Normal file
@@ -0,0 +1,15 @@
|
||||
package net.sf.briar.android;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sf.briar.api.os.FileUtils;
|
||||
import android.os.StatFs;
|
||||
|
||||
class AndroidFileUtils implements FileUtils {
|
||||
|
||||
public long getFreeSpace(File f) throws IOException {
|
||||
StatFs s = new StatFs(f.getAbsolutePath());
|
||||
return (long) s.getAvailableBlocks() * s.getBlockSize();
|
||||
}
|
||||
}
|
||||
@@ -18,6 +18,7 @@ import net.sf.briar.api.android.ReferenceManager;
|
||||
import net.sf.briar.api.crypto.CryptoComponent;
|
||||
import net.sf.briar.api.lifecycle.LifecycleManager;
|
||||
import net.sf.briar.api.lifecycle.ShutdownManager;
|
||||
import net.sf.briar.api.os.FileUtils;
|
||||
import net.sf.briar.api.plugins.PluginExecutor;
|
||||
import net.sf.briar.api.plugins.duplex.DuplexPluginConfig;
|
||||
import net.sf.briar.api.plugins.duplex.DuplexPluginFactory;
|
||||
@@ -52,6 +53,7 @@ public class AndroidModule extends AbstractModule {
|
||||
bind(AndroidExecutor.class).to(AndroidExecutorImpl.class);
|
||||
bind(ReferenceManager.class).to(
|
||||
ReferenceManagerImpl.class).in(Singleton.class);
|
||||
bind(FileUtils.class).to(AndroidFileUtils.class);
|
||||
}
|
||||
|
||||
@Provides @Singleton @DatabaseUiExecutor
|
||||
|
||||
@@ -62,8 +62,8 @@ import com.google.inject.Inject;
|
||||
|
||||
public class HomeScreenActivity extends RoboActivity {
|
||||
|
||||
// This build expires on 31 July 2013
|
||||
private static final long EXPIRY_DATE = 1375228800 * 1000L;
|
||||
// This build expires on 15 August 2013
|
||||
private static final long EXPIRY_DATE = 1376524800 * 1000L;
|
||||
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(HomeScreenActivity.class.getName());
|
||||
|
||||
Reference in New Issue
Block a user