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

Commit 0e4d7f14 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Storage Settings Apps category shows image/video/audio APPs" into sc-dev

parents 964a1715 8cb6c27e
Loading
Loading
Loading
Loading
+18 −0
Original line number Diff line number Diff line
@@ -2027,6 +2027,7 @@ public class ApplicationsState {
                }
            };

    /* For the Storage Settings which shows category of app types. */
    public static final AppFilter FILTER_OTHER_APPS =
            new AppFilter() {
                @Override
@@ -2046,4 +2047,21 @@ public class ApplicationsState {
                    return !isCategorized;
                }
            };

    /* For the Storage Settings which shows category of file types. */
    public static final AppFilter FILTER_APPS_EXCEPT_GAMES =
            new AppFilter() {
                @Override
                public void init() {
                }

                @Override
                public boolean filterApp(AppEntry entry) {
                    boolean isCategorized;
                    synchronized (entry) {
                        isCategorized = FILTER_GAMES.filterApp(entry);
                    }
                    return !isCategorized;
                }
            };
}
+28 −0
Original line number Diff line number Diff line
@@ -137,6 +137,34 @@ public class ApplicationsStateTest {
        assertThat(ApplicationsState.FILTER_PHOTOS.filterApp(mEntry)).isFalse();
    }

    @Test
    public void testAppsExceptGamesFilterRejectsGame() {
        mEntry.info.category = ApplicationInfo.CATEGORY_GAME;

        assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isFalse();
    }

    @Test
    public void testAppsExceptGamesFilterAcceptsImage() {
        mEntry.info.category = ApplicationInfo.CATEGORY_IMAGE;

        assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isTrue();
    }

    @Test
    public void testAppsExceptGamesFilterAcceptsVideo() {
        mEntry.info.category = ApplicationInfo.CATEGORY_VIDEO;

        assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isTrue();
    }

    @Test
    public void testAppsExceptGamesFilterAcceptsAudio() {
        mEntry.info.category = ApplicationInfo.CATEGORY_AUDIO;

        assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isTrue();
    }

    @Test
    public void testDownloadAndLauncherAndInstantAcceptsCorrectApps() {
        // should include instant apps