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

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

Merge "Don't show game and music apps in Other Apps."

parents 3cb86732 bd8c6652
Loading
Loading
Loading
Loading
+16 −0
Original line number Diff line number Diff line
@@ -1504,4 +1504,20 @@ public class ApplicationsState {
            return isMusicApp;
        }
    };

    public static final AppFilter FILTER_OTHER_APPS = new AppFilter() {
        @Override
        public void init() {
        }

        @Override
        public boolean filterApp(AppEntry entry) {
            boolean isCategorized;
            synchronized(entry) {
                isCategorized = entry.info.category == ApplicationInfo.CATEGORY_AUDIO ||
                    entry.info.category == ApplicationInfo.CATEGORY_GAME;
            }
            return !isCategorized;
        }
    };
}
+21 −0
Original line number Diff line number Diff line
@@ -86,4 +86,25 @@ public class ApplicationsStateTest {

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

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

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

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

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

    @Test
    public void testOtherAppsAcceptsDefaultCategory() {
        mEntry.info.category = ApplicationInfo.CATEGORY_UNDEFINED;

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