Storage Settings Apps category shows image/video/audio APPs

Shows image/video/audio APPs in APPs category when there is
a file browser for Images/Videos/Audios category.

Bug: 170918505
Test: atest ApplicationsStateTest
Change-Id: Iece8596c7ed19b0a195b929297271b1e9a472021
This commit is contained in:
Arc Wang
2021-04-14 21:07:43 +08:00
parent 855f753c80
commit 8cb6c27e8e
2 changed files with 46 additions and 0 deletions

View File

@@ -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;
}
};
}

View File

@@ -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