Count cache in storage categories. am: b22b85b593 am: 5837a9b98b

am: 41400d022c

Change-Id: Iee95e7d07f0642aec5bc478c8929bb4b50d3d3ec
This commit is contained in:
Daniel Nishi
2017-06-23 04:37:22 +00:00
committed by android-build-merger
2 changed files with 29 additions and 5 deletions

View File

@@ -105,7 +105,17 @@ public class StorageAsyncLoader
continue;
}
long blamedSize = stats.getDataBytes() - stats.getCacheBytes();
final long dataSize = stats.getDataBytes();
final long cacheQuota = mStatsManager.getCacheQuotaBytes(mUuid, app.uid);
final long cacheBytes = stats.getCacheBytes();
long blamedSize = dataSize;
// Technically, we could overages as freeable on the storage settings screen.
// If the app is using more cache than its quota, we would accidentally subtract the
// overage from the system size (because it shows up as unused) during our attribution.
// Thus, we cap the attribution at the quota size.
if (cacheQuota < cacheBytes) {
blamedSize = blamedSize - cacheBytes + cacheQuota;
}
// This isn't quite right because it slams the first user by user id with the whole code
// size, but this ensures that we count all apps seen once.