diff --git a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java index f180776bbe935..f046f06cc691d 100644 --- a/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java +++ b/packages/SettingsLib/src/com/android/settingslib/applications/ApplicationsState.java @@ -2027,6 +2027,7 @@ public class ApplicationsState { } }; + /* For the Storage Settings which shows category of app types. */ public static final AppFilter FILTER_OTHER_APPS = new AppFilter() { @Override @@ -2046,4 +2047,21 @@ public class ApplicationsState { return !isCategorized; } }; + + /* For the Storage Settings which shows category of file types. */ + public static final AppFilter FILTER_APPS_EXCEPT_GAMES = + new AppFilter() { + @Override + public void init() { + } + + @Override + public boolean filterApp(AppEntry entry) { + boolean isCategorized; + synchronized (entry) { + isCategorized = FILTER_GAMES.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 d9ac262f44146..f1e1e7d920ccc 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 @@ -137,6 +137,34 @@ public class ApplicationsStateTest { assertThat(ApplicationsState.FILTER_PHOTOS.filterApp(mEntry)).isFalse(); } + @Test + public void testAppsExceptGamesFilterRejectsGame() { + mEntry.info.category = ApplicationInfo.CATEGORY_GAME; + + assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isFalse(); + } + + @Test + public void testAppsExceptGamesFilterAcceptsImage() { + mEntry.info.category = ApplicationInfo.CATEGORY_IMAGE; + + assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isTrue(); + } + + @Test + public void testAppsExceptGamesFilterAcceptsVideo() { + mEntry.info.category = ApplicationInfo.CATEGORY_VIDEO; + + assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isTrue(); + } + + @Test + public void testAppsExceptGamesFilterAcceptsAudio() { + mEntry.info.category = ApplicationInfo.CATEGORY_AUDIO; + + assertThat(ApplicationsState.FILTER_APPS_EXCEPT_GAMES.filterApp(mEntry)).isTrue(); + } + @Test public void testDownloadAndLauncherAndInstantAcceptsCorrectApps() { // should include instant apps