Merge "Don't show game and music apps in Other Apps."
This commit is contained in:
@@ -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;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user