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

Commit 02b269be authored by Daniel Nishi's avatar Daniel Nishi Committed by Android (Google) Code Review
Browse files

Merge "Category breakdown size should match total size."

parents 0ef2a55b 325d3804
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -89,6 +89,8 @@ public class StorageAsyncLoader
            // code size.
            if (!app.isSystemApp() || app.isUpdatedSystemApp()) {
                attributedAppSizeInBytes += stats.getCodeBytes();
            } else {
                result.systemSize += stats.getCodeBytes();
            }
            switch (app.category) {
                case CATEGORY_GAME:
@@ -122,6 +124,7 @@ public class StorageAsyncLoader
        public long gamesSize;
        public long musicAppsSize;
        public long otherAppsSize;
        public long systemSize;
        public StorageStatsSource.ExternalStorageStats externalStats;
    }

+1 −1
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ public class StorageItemPreferenceController extends PreferenceController {
        mGamePreference.setStorageSize(data.gamesSize);
        mAppPreference.setStorageSize(data.otherAppsSize);
        if (mSystemPreference != null) {
            mSystemPreference.setStorageSize(mSystemSize);
            mSystemPreference.setStorageSize(mSystemSize + data.systemSize);
        }

        long unattributedBytes = data.externalStats.totalBytes - data.externalStats.audioBytes
+2 −1
Original line number Diff line number Diff line
@@ -216,6 +216,7 @@ public class StorageItemPreferenceControllerTest {
        result.gamesSize = KILOBYTE * 8;
        result.musicAppsSize = KILOBYTE * 4;
        result.otherAppsSize = KILOBYTE * 9;
        result.systemSize = KILOBYTE * 10;
        result.externalStats = new StorageStatsSource.ExternalStorageStats(
                KILOBYTE * 50, // total
                KILOBYTE * 10, // audio
@@ -230,7 +231,7 @@ public class StorageItemPreferenceControllerTest {
        assertThat(image.getSummary().toString()).isEqualTo("35.00KB"); // 15KB video + 20KB images
        assertThat(games.getSummary().toString()).isEqualTo("8.00KB");
        assertThat(apps.getSummary().toString()).isEqualTo("9.00KB");
        assertThat(system.getSummary().toString()).isEqualTo("6.00KB");
        assertThat(system.getSummary().toString()).isEqualTo("16.00KB");
        assertThat(files.getSummary().toString()).isEqualTo("5.00KB");
    }
}
 No newline at end of file
+2 −1
Original line number Diff line number Diff line
@@ -145,7 +145,7 @@ public class StorageAsyncLoaderTest {
    }

    @Test
    public void testSystemAppsBaseSizeIsIgnored() throws Exception {
    public void testSystemAppsBaseSizeIsAddedToSystem() throws Exception {
        ApplicationInfo systemApp =
                addPackage(PACKAGE_NAME_1, 100, 1, 10, ApplicationInfo.CATEGORY_UNDEFINED);
        systemApp.flags = ApplicationInfo.FLAG_SYSTEM;
@@ -154,6 +154,7 @@ public class StorageAsyncLoaderTest {

        assertThat(result.size()).isEqualTo(1);
        assertThat(result.get(PRIMARY_USER_ID).otherAppsSize).isEqualTo(10L);
        assertThat(result.get(PRIMARY_USER_ID).systemSize).isEqualTo(1L);
    }

    @Test