Add support for movies & tv apps querying.
Bug: 36223441
Test: Robotest
Change-Id: Icbb9b8947112f45d37858ceb5cfb1d76f06bda32
Merged-In: Icfb34844601f87d11b7309eacf9385d49ed36338
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
index 8833fb8c..296b4d6f 100644
--- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
+++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java
@@ -1601,6 +1601,21 @@
}
};
+ 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() {
@@ -1611,7 +1626,8 @@
boolean isCategorized;
synchronized(entry) {
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;
}
diff --git a/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java b/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java
index 6a029f0..d6ab8d2 100644
--- a/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java
+++ b/packages/SettingsLib/tests/integ/src/com/android/settingslib/applications/ApplicationsStateTest.java
@@ -200,4 +200,18 @@
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();
+ }
}
diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto
index 579c54c..f56cbdd 100644
--- a/proto/src/metrics_constants.proto
+++ b/proto/src/metrics_constants.proto
@@ -3906,6 +3906,11 @@
// 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.