Implement quota calculation for project ID based quota.
Devices launching with R will no longer have the sdcardfs filesystem;
instead, quota tracking on external storage is implemented by project
IDs. Switch over the existing quota calculation to use project IDs when
sdcardfs is not available.
Bug: 146419093
Test: atest StorageHostTest (on devices with and without sdcardfs)
Change-Id: I17925c811b08c7c85fff02ee6e279e4d7586e3ff
diff --git a/cmds/installd/CacheTracker.cpp b/cmds/installd/CacheTracker.cpp
index 8b868fb..a61f6bf 100644
--- a/cmds/installd/CacheTracker.cpp
+++ b/cmds/installd/CacheTracker.cpp
@@ -75,8 +75,7 @@
bool CacheTracker::loadQuotaStats() {
int cacheGid = multiuser_get_cache_gid(mUserId, mAppId);
- int extCacheGid = multiuser_get_ext_cache_gid(mUserId, mAppId);
- if (IsQuotaSupported(mUuid) && cacheGid != -1 && extCacheGid != -1) {
+ if (IsQuotaSupported(mUuid) && cacheGid != -1) {
int64_t space;
if ((space = GetOccupiedSpaceForGid(mUuid, cacheGid)) != -1) {
cacheUsed += space;
@@ -84,7 +83,7 @@
return false;
}
- if ((space = GetOccupiedSpaceForGid(mUuid, extCacheGid)) != -1) {
+ if ((space = get_occupied_app_cache_space_external(mUuid, mUserId, mAppId)) != -1) {
cacheUsed += space;
} else {
return false;