Merge "Don't show game and music apps in Other Apps."

This commit is contained in:
Daniel Nishi
2017-02-14 18:45:29 +00:00
committed by Android (Google) Code Review
2 changed files with 37 additions and 0 deletions

View File

@@ -1504,4 +1504,20 @@ public class ApplicationsState {
return isMusicApp;
}
};
public static final AppFilter FILTER_OTHER_APPS = new AppFilter() {
@Override
public void init() {
}
@Override
public boolean filterApp(AppEntry entry) {
boolean isCategorized;
synchronized(entry) {
isCategorized = entry.info.category == ApplicationInfo.CATEGORY_AUDIO ||
entry.info.category == ApplicationInfo.CATEGORY_GAME;
}
return !isCategorized;
}
};
}

View File

@@ -86,4 +86,25 @@ public class ApplicationsStateTest {
assertThat(ApplicationsState.FILTER_AUDIO.filterApp(mEntry)).isFalse();
}
@Test
public void testOtherAppsRejectsAudio() {
mEntry.info.category = ApplicationInfo.CATEGORY_AUDIO;
assertThat(ApplicationsState.FILTER_OTHER_APPS.filterApp(mEntry)).isFalse();
}
@Test
public void testOtherAppsRejectsGame() {
mEntry.info.category = ApplicationInfo.CATEGORY_GAME;
assertThat(ApplicationsState.FILTER_OTHER_APPS.filterApp(mEntry)).isFalse();
}
@Test
public void testOtherAppsAcceptsDefaultCategory() {
mEntry.info.category = ApplicationInfo.CATEGORY_UNDEFINED;
assertThat(ApplicationsState.FILTER_OTHER_APPS.filterApp(mEntry)).isTrue();
}
}