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

Commit 57fb5872 authored by Daniel Nishi's avatar Daniel Nishi Committed by android-build-merger
Browse files

Merge changes from topic 'cp-movies' into oc-dev

am: ff97ea2e

Change-Id: Ife4f6fb260439003a46e6510af41f8bb6c542cb7
parents 18fcf3f0 ff97ea2e
Loading
Loading
Loading
Loading
+22 −5
Original line number Diff line number Diff line
@@ -1601,17 +1601,34 @@ public class ApplicationsState {
        }
    };

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

        @Override
        public boolean filterApp(AppEntry entry) {
            boolean isMovieApp;
            synchronized(entry) {
                isMovieApp = entry.info.category == ApplicationInfo.CATEGORY_VIDEO;
            }
            return isMovieApp;
        }
    };

    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;
                        isCategorized =
                                FILTER_AUDIO.filterApp(entry)
                                        || FILTER_GAMES.filterApp(entry)
                                        || FILTER_MOVIES.filterApp(entry);
                    }
                    return !isCategorized;
                }
+21 −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);
@@ -200,4 +207,18 @@ public class ApplicationsStateTest {
        when(mEntry.info.isInstantApp()).thenReturn(true);
        assertThat(ApplicationsState.FILTER_DISABLED.filterApp(mEntry)).isFalse();
    }

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

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

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

        assertThat(ApplicationsState.FILTER_MOVIES.filterApp(mEntry)).isFalse();
    }
}
+5 −0
Original line number Diff line number Diff line
@@ -3906,6 +3906,11 @@ message MetricsEvent {
    // OS: O
    FINGERPRINT_REMOVE_SIDECAR = 934;

    // OPEN: Settings > Storage > Movies & TV
    // CATEGORY: SETTINGS
    // OS: O
    APPLICATIONS_STORAGE_MOVIES = 935;

    // ---- End O Constants, all O constants go above this line ----

    // Add new aosp constants above this line.