Merge "Remove the cache size from internal size." into qt-dev am: 10f78591a7

am: 9460e54abc

Change-Id: Ief3de89f73908a3b1a8a3461233b32d24c798c68
This commit is contained in:
Daniel Nishi
2019-05-08 12:38:11 -07:00
committed by android-build-merger
2 changed files with 6 additions and 3 deletions

View File

@@ -706,7 +706,9 @@ public class ApplicationsState {
private long getTotalInternalSize(PackageStats ps) {
if (ps != null) {
return ps.codeSize + ps.dataSize;
// We subtract the cache size because the system can clear it automatically and
// |dataSize| is a superset of |cacheSize|.
return ps.codeSize + ps.dataSize - ps.cacheSize;
}
return SIZE_INVALID;
}
@@ -714,7 +716,7 @@ public class ApplicationsState {
private long getTotalExternalSize(PackageStats ps) {
if (ps != null) {
// We also include the cache size here because for non-emulated
// we don't automtically clean cache files.
// we don't automatically clean cache files.
return ps.externalCodeSize + ps.externalDataSize
+ ps.externalCacheSize
+ ps.externalMediaSize + ps.externalObbSize;

View File

@@ -191,8 +191,9 @@ public class ApplicationsStateRoboTest {
shadowContext.setSystemService(Context.STORAGE_STATS_SERVICE, mStorageStatsManager);
StorageStats storageStats = new StorageStats();
storageStats.codeBytes = 10;
storageStats.dataBytes = 20;
storageStats.cacheBytes = 30;
// Data bytes are a superset of cache bytes.
storageStats.dataBytes = storageStats.cacheBytes + 20;
when(mStorageStatsManager.queryStatsForPackage(any(UUID.class),
anyString(), any(UserHandle.class))).thenReturn(storageStats);