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

Commit 7baa50c0 authored by Daniel Nishi's avatar Daniel Nishi
Browse files

Add support for movies & tv apps querying.

Bug: 36223441
Test: Robotest
Change-Id: Icfb34844601f87d11b7309eacf9385d49ed36338
parent 198327ad
Loading
Loading
Loading
Loading
+17 −1
Original line number Original line Diff line number Diff line
@@ -1582,6 +1582,21 @@ public class ApplicationsState {
        }
        }
    };
    };


    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() {
    public static final AppFilter FILTER_OTHER_APPS = new AppFilter() {
        @Override
        @Override
        public void init() {
        public void init() {
@@ -1592,7 +1607,8 @@ public class ApplicationsState {
            boolean isCategorized;
            boolean isCategorized;
            synchronized(entry) {
            synchronized(entry) {
                isCategorized = entry.info.category == ApplicationInfo.CATEGORY_AUDIO ||
                isCategorized = entry.info.category == ApplicationInfo.CATEGORY_AUDIO ||
                    entry.info.category == ApplicationInfo.CATEGORY_GAME;
                    entry.info.category == ApplicationInfo.CATEGORY_GAME ||
                    entry.info.category == ApplicationInfo.CATEGORY_VIDEO;
            }
            }
            return !isCategorized;
            return !isCategorized;
        }
        }
+14 −0
Original line number Original line Diff line number Diff line
@@ -136,4 +136,18 @@ public class ApplicationsStateTest {
        when(mEntry.info.isInstantApp()).thenReturn(true);
        when(mEntry.info.isInstantApp()).thenReturn(true);
        assertThat(ApplicationsState.FILTER_DISABLED.filterApp(mEntry)).isFalse();
        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 Original line Diff line number Diff line
@@ -3892,6 +3892,11 @@ message MetricsEvent {
    // ACTION: QS -> Click date
    // ACTION: QS -> Click date
    ACTION_QS_DATE = 930;
    ACTION_QS_DATE = 930;


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

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


    // Add new aosp constants above this line.
    // Add new aosp constants above this line.