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

Commit 140ceb1d authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Use the real filters when determining Other Apps.

This fixes a bug where an app could be classified twice.

Fixes: 36535527
Test: SettingsLib Unit Test
Change-Id: I830a76fa33680b1dd71b285d9419139f84f1d60d
parent 45c23fa6
Loading
Loading
Loading
Loading
+17 −16
Original line number Diff line number Diff line
@@ -1616,18 +1616,19 @@ public class ApplicationsState {
        }
    };

    public static final AppFilter FILTER_OTHER_APPS = new AppFilter() {
    public static final AppFilter FILTER_OTHER_APPS =
            new AppFilter() {
                @Override
        public void init() {
        }
                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 ||
                    entry.info.category == ApplicationInfo.CATEGORY_VIDEO;
                        isCategorized =
                                FILTER_AUDIO.filterApp(entry)
                                        || FILTER_GAMES.filterApp(entry)
                                        || FILTER_MOVIES.filterApp(entry);
                    }
                    return !isCategorized;
                }
+7 −0
Original line number Diff line number Diff line
@@ -173,6 +173,13 @@ public class ApplicationsStateTest {
                .isTrue();
    }

    @Test
    public void testOtherAppsRejectsLegacyGame() {
        mEntry.info.flags = ApplicationInfo.FLAG_IS_GAME;

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

    @Test
    public void testInstantFilterAcceptsInstantApp() {
        when(mEntry.info.isInstantApp()).thenReturn(true);