diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-04-23 10:08:01 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-04-23 10:08:01 -0700 |
commit | f913d002a64b9d124ef54f3b71bcd13f4a6c2768 (patch) | |
tree | 23889918024ee8a502124e11c2de2e57011b26c5 /packages | |
parent | 03d2f292a63f3600f1f913f53f19bf783f05ef2f (diff) | |
parent | 9cbe986a446dffea2e9f59b86800f834b02d766a (diff) | |
download | frameworks_base-f913d002a64b9d124ef54f3b71bcd13f4a6c2768.zip frameworks_base-f913d002a64b9d124ef54f3b71bcd13f4a6c2768.tar.gz frameworks_base-f913d002a64b9d124ef54f3b71bcd13f4a6c2768.tar.bz2 |
Merge "Expose statfs() through IMediaContainerService."
Diffstat (limited to 'packages')
-rw-r--r-- | packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java index 113f0f7..8e3a3c5 100644 --- a/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java +++ b/packages/DefaultContainerService/src/com/android/defcontainer/DefaultContainerService.java @@ -50,6 +50,10 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import libcore.io.ErrnoException; +import libcore.io.Libcore; +import libcore.io.StructStatFs; + /* * This service copies a downloaded apk to a file passed in as * a ParcelFileDescriptor or to a newly created container specified @@ -203,6 +207,18 @@ public class DefaultContainerService extends IntentService { return 0L; } } + + @Override + public long[] getFileSystemStats(String path) { + try { + final StructStatFs stat = Libcore.os.statfs(path); + final long totalSize = stat.f_blocks * stat.f_bsize; + final long availSize = stat.f_bavail * stat.f_bsize; + return new long[] { totalSize, availSize }; + } catch (ErrnoException e) { + throw new IllegalStateException(e); + } + } }; public DefaultContainerService() { |