diff options
| author | Jeff Sharkey <jsharkey@android.com> | 2017-04-02 23:24:40 -0600 |
|---|---|---|
| committer | Jeff Sharkey <jsharkey@android.com> | 2017-04-02 23:33:38 -0600 |
| commit | dafb17e7eb9a15862ed1314dff2b82d29ad23632 (patch) | |
| tree | 768124a417e92a6b51f3844967dcc70581d81edc /core/java | |
| parent | 21a5edcc24cbca1ae3f0855d71737b22ab81ad6d (diff) | |
We really want f_frsize and f_bavail.
It's confusing, but f_bsize is not the value you're looking for; the
real block size is f_frsize. Fix all those bugs.
Also, the vast majority of clients are interested in the usable
disk space, not including reserved space.
Test: builds, boots
Bug: 36840579
Change-Id: Ib1470389afd49c14cab62282ec1e978ebb2c4791
Diffstat (limited to 'core/java')
| -rw-r--r-- | core/java/android/os/StatFs.java | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/core/java/android/os/StatFs.java b/core/java/android/os/StatFs.java index 13e9a15eedb6..d9e516cd7ecf 100644 --- a/core/java/android/os/StatFs.java +++ b/core/java/android/os/StatFs.java @@ -61,15 +61,15 @@ public class StatFs { */ @Deprecated public int getBlockSize() { - return (int) mStat.f_bsize; + return (int) mStat.f_frsize; } /** * The size, in bytes, of a block on the file system. This corresponds to - * the Unix {@code statvfs.f_bsize} field. + * the Unix {@code statvfs.f_frsize} field. */ public long getBlockSizeLong() { - return mStat.f_bsize; + return mStat.f_frsize; } /** @@ -112,7 +112,7 @@ public class StatFs { * will want to use {@link #getAvailableBytes()} instead. */ public long getFreeBytes() { - return mStat.f_bfree * mStat.f_bsize; + return mStat.f_bfree * mStat.f_frsize; } /** @@ -136,13 +136,13 @@ public class StatFs { * applications. */ public long getAvailableBytes() { - return mStat.f_bavail * mStat.f_bsize; + return mStat.f_bavail * mStat.f_frsize; } /** * The total number of bytes supported by the file system. */ public long getTotalBytes() { - return mStat.f_blocks * mStat.f_bsize; + return mStat.f_blocks * mStat.f_frsize; } } |
