Filter on volume for category storage view.

The other storage view used a compound filter with a UUID filter and the
normal filter. The category filters were omitting the compound UUID
filter. This adds it.

Test: Settings unit test
Change-Id: Ic0118abf58dabbf430a81e1fbcefb7acfdef472c
Fixes: 37780836
This commit is contained in:
Daniel Nishi
2017-04-28 14:27:52 -07:00
parent b2d85af91e
commit 5aeb6c4fab
2 changed files with 93 additions and 8 deletions

View File

@@ -416,20 +416,28 @@ public class ManageApplications extends InstrumentedPreferenceFragment
if (mListType == LIST_TYPE_HIGH_POWER) {
mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL);
}
if (mListType == LIST_TYPE_STORAGE) {
AppFilter filter = new VolumeFilter(mVolumeUuid);
if (mStorageType == STORAGE_TYPE_MUSIC) {
// Storage filters below.
mApplications.setOverrideFilter(getStorageFilter(mListType, mStorageType, mVolumeUuid));
}
@VisibleForTesting
static AppFilter getStorageFilter(int listType, int storageType, String volumeUuid) {
AppFilter filter = new VolumeFilter(volumeUuid);
if (listType == LIST_TYPE_STORAGE) {
if (storageType == STORAGE_TYPE_MUSIC) {
filter = new CompoundFilter(ApplicationsState.FILTER_AUDIO, filter);
} else {
filter = new CompoundFilter(ApplicationsState.FILTER_OTHER_APPS, filter);
}
mApplications.setOverrideFilter(filter);
return filter;
}
if (mListType == LIST_TYPE_GAMES) {
mApplications.setOverrideFilter(ApplicationsState.FILTER_GAMES);
} else if (mListType == LIST_TYPE_MOVIES) {
mApplications.setOverrideFilter(ApplicationsState.FILTER_MOVIES);
if (listType == LIST_TYPE_GAMES) {
return new CompoundFilter(ApplicationsState.FILTER_GAMES, filter);
} else if (listType == LIST_TYPE_MOVIES) {
return new CompoundFilter(ApplicationsState.FILTER_MOVIES, filter);
}
return filter;
}
private int getDefaultFilter() {