diff options
author | Jeff Sharkey <jsharkey@android.com> | 2012-04-22 18:56:43 -0700 |
---|---|---|
committer | Jeff Sharkey <jsharkey@android.com> | 2012-04-22 18:56:43 -0700 |
commit | 9cbe986a446dffea2e9f59b86800f834b02d766a (patch) | |
tree | 63725587ac50668011a054f82c69f6ddf25b9248 /packages/DefaultContainerService | |
parent | 816e4f758302aaf3b115b5914d48732ed78af946 (diff) | |
download | frameworks_base-9cbe986a446dffea2e9f59b86800f834b02d766a.zip frameworks_base-9cbe986a446dffea2e9f59b86800f834b02d766a.tar.gz frameworks_base-9cbe986a446dffea2e9f59b86800f834b02d766a.tar.bz2 |
Expose statfs() through IMediaContainerService.
Bug: 6346248
Change-Id: I03ae02578f546fc9f19652cbdece56e2e0ab6a1c
Diffstat (limited to 'packages/DefaultContainerService')
-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() { |