diff options
| author | 2017-04-13 18:39:53 +0000 | |
|---|---|---|
| committer | 2017-04-13 18:39:57 +0000 | |
| commit | ff97ea2eefd8cc54f09a8c4f1cab4ec3d69832e4 (patch) | |
| tree | 011a8f767f3be9a53384b70b94645b26e3516f71 | |
| parent | da97b66f41d11a701f534c34979940cf03f41ab4 (diff) | |
| parent | 140ceb1dccabe79468586a7ef74ed02ec114485c (diff) | |
Merge changes from topic 'cp-movies' into oc-dev
* changes:
Use the real filters when determining Other Apps.
Add support for movies & tv apps querying.
3 files changed, 48 insertions, 5 deletions
diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java index 8833fb8cab53..02f1162fc968 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java @@ -1601,19 +1601,36 @@ 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 isCategorized; + boolean isMovieApp; synchronized(entry) { - isCategorized = entry.info.category == ApplicationInfo.CATEGORY_AUDIO || - entry.info.category == ApplicationInfo.CATEGORY_GAME; + isMovieApp = entry.info.category == ApplicationInfo.CATEGORY_VIDEO; } - return !isCategorized; + 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 = + FILTER_AUDIO.filterApp(entry) + || FILTER_GAMES.filterApp(entry) + || FILTER_MOVIES.filterApp(entry); + } + 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 6a029f0be64d..c680b2a2ce4b 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 @@ -174,6 +174,13 @@ public class ApplicationsStateTest { } @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); assertThat(ApplicationsState.FILTER_INSTANT.filterApp(mEntry)).isTrue(); @@ -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(); + } } diff --git a/proto/src/metrics_constants.proto b/proto/src/metrics_constants.proto index 579c54cd311e..f56cbdda734b 100644 --- a/proto/src/metrics_constants.proto +++ b/proto/src/metrics_constants.proto @@ -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. |