Deprecate StatFs methods returning small values.
Bug: 8656794
Change-Id: Ic904bd1bc016ef48b5a304b7c68250afe23e98bc
diff --git a/api/current.txt b/api/current.txt
index f5c48c9..eb82fb2 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -17523,16 +17523,17 @@
public class StatFs {
ctor public StatFs(java.lang.String);
- method public int getAvailableBlocks();
+ method public deprecated int getAvailableBlocks();
method public long getAvailableBlocksLong();
method public long getAvailableBytes();
- method public int getBlockCount();
+ method public deprecated int getBlockCount();
method public long getBlockCountLong();
- method public int getBlockSize();
+ method public deprecated int getBlockSize();
method public long getBlockSizeLong();
- method public int getFreeBlocks();
+ method public deprecated int getFreeBlocks();
method public long getFreeBlocksLong();
method public long getFreeBytes();
+ method public long getTotalBytes();
method public void restat(java.lang.String);
}
diff --git a/core/java/android/os/StatFs.java b/core/java/android/os/StatFs.java
index 60ec0d7..2314057 100644
--- a/core/java/android/os/StatFs.java
+++ b/core/java/android/os/StatFs.java
@@ -57,9 +57,9 @@
}
/**
- * The size, in bytes, of a block on the file system. This corresponds to
- * the Unix {@code statfs.f_bsize} field.
+ * @deprecated Use {@link #getBlockSizeLong()} instead.
*/
+ @Deprecated
public int getBlockSize() {
return (int) mStat.f_bsize;
}
@@ -73,27 +73,25 @@
}
/**
- * The total number of blocks on the file system. This corresponds to the
- * Unix {@code statfs.f_blocks} field.
+ * @deprecated Use {@link #getBlockCountLong()} instead.
*/
+ @Deprecated
public int getBlockCount() {
return (int) mStat.f_blocks;
}
/**
- * The size, in bytes, of a block on the file system. This corresponds to
- * the Unix {@code statfs.f_bsize} field.
+ * The total number of blocks on the file system. This corresponds to the
+ * Unix {@code statfs.f_blocks} 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
- * will want to use {@link #getAvailableBlocks()} instead.
+ * @deprecated Use {@link #getFreeBlocksLong()} instead.
*/
+ @Deprecated
public int getFreeBlocks() {
return (int) mStat.f_bfree;
}
@@ -109,17 +107,18 @@
}
/**
- * The number of bytes that are free on the file system, including
- * reserved blocks (that are not available to normal applications).
+ * The number of bytes that are free on the file system, including reserved
+ * blocks (that are not available to normal applications). Most applications
+ * will want to use {@link #getAvailableBytes()} instead.
*/
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.
+ * @deprecated Use {@link #getAvailableBlocksLong()} instead.
*/
+ @Deprecated
public int getAvailableBlocks() {
return (int) mStat.f_bavail;
}
@@ -139,4 +138,11 @@
public long getAvailableBytes() {
return mStat.f_bavail * mStat.f_bsize;
}
+
+ /**
+ * The total number of bytes supported by the file system.
+ */
+ public long getTotalBytes() {
+ return mStat.f_blocks * mStat.f_bsize;
+ }
}