summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorJeff Sharkey <jsharkey@android.com>2013-02-14 23:46:00 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2013-02-14 23:46:01 +0000
commit7ee9f636284584affa54b9735ccf157375b1c065 (patch)
tree521358c8c4aa480ed11e835e016881f2b4d2fb91 /core/java
parentbfcae3595900b79401d635022bd6d30a5b5a6576 (diff)
parentb65ce57675ecd983c85dd4d755fe0167f33ecc87 (diff)
downloadframeworks_base-7ee9f636284584affa54b9735ccf157375b1c065.zip
frameworks_base-7ee9f636284584affa54b9735ccf157375b1c065.tar.gz
frameworks_base-7ee9f636284584affa54b9735ccf157375b1c065.tar.bz2
Merge "Expose longer statfs values, add derived values."
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/os/StatFs.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/core/java/android/os/StatFs.java b/core/java/android/os/StatFs.java
index ca7fdba..60ec0d7 100644
--- a/core/java/android/os/StatFs.java
+++ b/core/java/android/os/StatFs.java
@@ -65,6 +65,14 @@ public class StatFs {
}
/**
+ * The size, in bytes, of a block on the file system. This corresponds to
+ * the Unix {@code statfs.f_bsize} field.
+ */
+ public long getBlockSizeLong() {
+ return mStat.f_bsize;
+ }
+
+ /**
* The total number of blocks on the file system. This corresponds to the
* Unix {@code statfs.f_blocks} field.
*/
@@ -73,6 +81,14 @@ public class StatFs {
}
/**
+ * The size, in bytes, of a block on the file system. This corresponds to
+ * the Unix {@code statfs.f_bsize} field.
+ */
+ public long getBlockCountLong() {
+ return mStat.f_blocks;
+ }
+
+ /**
* The total number of blocks that are free on the file system, including
* reserved blocks (that are not available to normal applications). This
* corresponds to the Unix {@code statfs.f_bfree} field. Most applications
@@ -83,10 +99,44 @@ public class StatFs {
}
/**
+ * The total number of blocks that are free on the file system, including
+ * reserved blocks (that are not available to normal applications). This
+ * corresponds to the Unix {@code statfs.f_bfree} field. Most applications
+ * will want to use {@link #getAvailableBlocks()} instead.
+ */
+ public long getFreeBlocksLong() {
+ return mStat.f_bfree;
+ }
+
+ /**
+ * The number of bytes that are free on the file system, including
+ * reserved blocks (that are not available to normal applications).
+ */
+ public long getFreeBytes() {
+ return mStat.f_bfree * mStat.f_bsize;
+ }
+
+ /**
* The number of blocks that are free on the file system and available to
* applications. This corresponds to the Unix {@code statfs.f_bavail} field.
*/
public int getAvailableBlocks() {
return (int) mStat.f_bavail;
}
+
+ /**
+ * The number of blocks that are free on the file system and available to
+ * applications. This corresponds to the Unix {@code statfs.f_bavail} field.
+ */
+ public long getAvailableBlocksLong() {
+ return mStat.f_bavail;
+ }
+
+ /**
+ * The number of bytes that are free on the file system and available to
+ * applications.
+ */
+ public long getAvailableBytes() {
+ return mStat.f_bavail * mStat.f_bsize;
+ }
}