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

Commit bd8c6652 authored by Daniel Nishi's avatar Daniel Nishi
Browse files

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

Bug: 35143240
Test: SettingsLib Robotest
Change-Id: Ifaa086373d27dc81203137d20fa1617df21f6093
parent d5015bec
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();
    }
}