From d5d5e926eb8ff2541a845d6a5657cee5e5c6e7b6 Mon Sep 17 00:00:00 2001 From: Jeff Sharkey Date: Tue, 21 Feb 2017 10:51:23 -0700 Subject: 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 --- .../java/com/android/server/usage/StorageStatsService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'services/usage/java') diff --git a/services/usage/java/com/android/server/usage/StorageStatsService.java b/services/usage/java/com/android/server/usage/StorageStatsService.java index 68269751efc1..f3e02e2f6ce9 100644 --- a/services/usage/java/com/android/server/usage/StorageStatsService.java +++ b/services/usage/java/com/android/server/usage/StorageStatsService.java @@ -114,6 +114,17 @@ public class StorageStatsService extends IStorageStatsManager.Stub { } } + @Override + public boolean isQuotaSupported(String volumeUuid, String callingPackage) { + enforcePermission(Binder.getCallingUid(), callingPackage); + + try { + return mInstaller.isQuotaSupported(volumeUuid); + } catch (InstallerException e) { + throw new IllegalStateException(e); + } + } + @Override public long getTotalBytes(String volumeUuid, String callingPackage) { enforcePermission(Binder.getCallingUid(), callingPackage); -- cgit v1.2.3-59-g8ed1b