add support for /very/ low space situations
@@ -46,6 +46,11 @@ public class StatFsHelper {
public static final long DEFAULT_DISK_YELLOW_LEVEL_IN_BYTES =
DEFAULT_DISK_YELLOW_LEVEL_IN_MB * 1024 * 1024;
+ public static final int DEFAULT_DISK_RED_LEVEL_IN_MB = 100;
+
+ public static final long DEFAULT_DISK_RED_LEVEL_IN_BYTES =
+ DEFAULT_DISK_RED_LEVEL_IN_MB * 1024 * 1024;
+
private static StatFsHelper sStatsFsHelper;
// Time interval for updating disk information
@@ -207,6 +212,11 @@ public class StatFsHelper {
< DEFAULT_DISK_YELLOW_LEVEL_IN_BYTES;
}
+ public boolean isVeryLowSpaceCondition() {
+ return getAvailableStorageSpace(StatFsHelper.StorageType.INTERNAL)
+ < DEFAULT_DISK_RED_LEVEL_IN_BYTES;
+ }
+
/**
* Thread-safe call to update disk stats. Update occurs if the thread is able to acquire the lock
* (i.e., no other thread is updating it at the same time), and it has been at least
