Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d5d5e926 authored by Jeff Sharkey's avatar Jeff Sharkey
Browse files

Clear cache space when allocating bytes.

Fleshes out remainder of allocation implementation, where we offer
to clear cached data to satisfy the allocation request.  To prevent
abuse, we never let apps allocate into either the minimum cache space
or low storage space.

Clean up quota APIs to require the caller to pass in the path they're
interested in, and we resolve the underlying filesystem for them.

Defines settings that can be used to tweak the minimum cache space.

Test: builds, boots
Bug: 34690590
Change-Id: I85bc07399f91ee4aa568a8a54c615646bf748ad4
parent 14fd9ceb
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -31255,10 +31255,8 @@ package android.os.storage {
    method public void allocateBytes(java.io.File, long, int) throws java.io.IOException;
    method public void allocateBytes(java.io.FileDescriptor, long, int) throws java.io.IOException;
    method public long getAllocatableBytes(java.io.File, int) throws java.io.IOException;
    method public long getCacheQuotaBytes();
    method public long getCacheSizeBytes();
    method public long getExternalCacheQuotaBytes();
    method public long getExternalCacheSizeBytes();
    method public long getCacheQuotaBytes(java.io.File);
    method public long getCacheSizeBytes(java.io.File);
    method public java.lang.String getMountedObbPath(java.lang.String);
    method public android.os.storage.StorageVolume getPrimaryStorageVolume();
    method public android.os.storage.StorageVolume getStorageVolume(java.io.File);
+4 −0
Original line number Diff line number Diff line
@@ -180,6 +180,10 @@ package android.os {
package android.os.storage {

  public class StorageManager {
    method public deprecated long getCacheQuotaBytes();
    method public deprecated long getCacheSizeBytes();
    method public deprecated long getExternalCacheQuotaBytes();
    method public deprecated long getExternalCacheSizeBytes();
    method public android.os.storage.StorageVolume getPrimaryVolume();
    method public android.os.storage.StorageVolume[] getVolumeList();
  }
+2 −4
Original line number Diff line number Diff line
@@ -34139,10 +34139,8 @@ package android.os.storage {
    method public void allocateBytes(java.io.File, long, int) throws java.io.IOException;
    method public void allocateBytes(java.io.FileDescriptor, long, int) throws java.io.IOException;
    method public long getAllocatableBytes(java.io.File, int) throws java.io.IOException;
    method public long getCacheQuotaBytes();
    method public long getCacheSizeBytes();
    method public long getExternalCacheQuotaBytes();
    method public long getExternalCacheSizeBytes();
    method public long getCacheQuotaBytes(java.io.File);
    method public long getCacheSizeBytes(java.io.File);
    method public java.lang.String getMountedObbPath(java.lang.String);
    method public android.os.storage.StorageVolume getPrimaryStorageVolume();
    method public android.os.storage.StorageVolume getStorageVolume(java.io.File);
+4 −0
Original line number Diff line number Diff line
@@ -174,6 +174,10 @@ package android.os {
package android.os.storage {

  public class StorageManager {
    method public deprecated long getCacheQuotaBytes();
    method public deprecated long getCacheSizeBytes();
    method public deprecated long getExternalCacheQuotaBytes();
    method public deprecated long getExternalCacheSizeBytes();
    method public android.os.storage.StorageVolume getPrimaryVolume();
    method public android.os.storage.StorageVolume[] getVolumeList();
  }
+2 −4
Original line number Diff line number Diff line
@@ -31374,10 +31374,8 @@ package android.os.storage {
    method public void allocateBytes(java.io.File, long, int) throws java.io.IOException;
    method public void allocateBytes(java.io.FileDescriptor, long, int) throws java.io.IOException;
    method public long getAllocatableBytes(java.io.File, int) throws java.io.IOException;
    method public long getCacheQuotaBytes();
    method public long getCacheSizeBytes();
    method public long getExternalCacheQuotaBytes();
    method public long getExternalCacheSizeBytes();
    method public long getCacheQuotaBytes(java.io.File);
    method public long getCacheSizeBytes(java.io.File);
    method public java.lang.String getMountedObbPath(java.lang.String);
    method public android.os.storage.StorageVolume getPrimaryStorageVolume();
    method public android.os.storage.StorageVolume getStorageVolume(java.io.File);
Loading