Merge "Add 'all apps' to notification filters" into rvc-qpr-dev

This commit is contained in:
TreeHugger Robot
2020-08-03 05:55:21 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 14 deletions

View File

@@ -58,12 +58,12 @@ public class AppFilterRegistry {
// Filters will appear sorted based on their value defined here. // Filters will appear sorted based on their value defined here.
public static final int FILTER_APPS_POWER_WHITELIST = 0; public static final int FILTER_APPS_POWER_WHITELIST = 0;
public static final int FILTER_APPS_POWER_WHITELIST_ALL = 1; public static final int FILTER_APPS_POWER_WHITELIST_ALL = 1;
public static final int FILTER_APPS_ALL = 2; public static final int FILTER_APPS_RECENT = 2;
public static final int FILTER_APPS_ENABLED = 3; public static final int FILTER_APPS_FREQUENT = 3;
public static final int FILTER_APPS_INSTANT = 4; public static final int FILTER_APPS_ALL = 4;
public static final int FILTER_APPS_DISABLED = 5; public static final int FILTER_APPS_ENABLED = 5;
public static final int FILTER_APPS_RECENT = 6; public static final int FILTER_APPS_INSTANT = 6;
public static final int FILTER_APPS_FREQUENT = 7; public static final int FILTER_APPS_DISABLED = 7;
public static final int FILTER_APPS_PERSONAL = 8; public static final int FILTER_APPS_PERSONAL = 8;
public static final int FILTER_APPS_WORK = 9; public static final int FILTER_APPS_WORK = 9;
public static final int FILTER_APPS_USAGE_ACCESS = 10; public static final int FILTER_APPS_USAGE_ACCESS = 10;

View File

@@ -476,7 +476,7 @@ public class ManageApplications extends InstrumentedFragment
mFilterAdapter.enableFilter(FILTER_APPS_RECENT); mFilterAdapter.enableFilter(FILTER_APPS_RECENT);
mFilterAdapter.enableFilter(FILTER_APPS_FREQUENT); mFilterAdapter.enableFilter(FILTER_APPS_FREQUENT);
mFilterAdapter.enableFilter(FILTER_APPS_BLOCKED); mFilterAdapter.enableFilter(FILTER_APPS_BLOCKED);
mFilterAdapter.disableFilter(FILTER_APPS_ALL); mFilterAdapter.enableFilter(FILTER_APPS_ALL);
} }
if (mListType == LIST_TYPE_HIGH_POWER) { if (mListType == LIST_TYPE_HIGH_POWER) {
mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL); mFilterAdapter.enableFilter(FILTER_APPS_POWER_WHITELIST_ALL);
@@ -1089,12 +1089,16 @@ public class ManageApplications extends InstrumentedFragment
mAppFilter = appFilter; mAppFilter = appFilter;
// Notification filters require resorting the list // Notification filters require resorting the list
if (FILTER_APPS_FREQUENT == appFilter.getFilterType()) { if (mManageApplications.mListType == LIST_TYPE_NOTIFICATION) {
rebuild(R.id.sort_order_frequent_notification); if (FILTER_APPS_FREQUENT == appFilter.getFilterType()) {
} else if (FILTER_APPS_RECENT == appFilter.getFilterType()) { rebuild(R.id.sort_order_frequent_notification);
rebuild(R.id.sort_order_recent_notification); } else if (FILTER_APPS_RECENT == appFilter.getFilterType()) {
} else if (FILTER_APPS_BLOCKED == appFilter.getFilterType()) { rebuild(R.id.sort_order_recent_notification);
rebuild(R.id.sort_order_alpha); } else if (FILTER_APPS_BLOCKED == appFilter.getFilterType()) {
rebuild(R.id.sort_order_alpha);
} else {
rebuild(R.id.sort_order_alpha);
}
} else { } else {
rebuild(); rebuild();
} }

View File

@@ -570,12 +570,14 @@ public class ManageApplicationsTest {
mFragment.createHeader(); mFragment.createHeader();
assertThat(mFragment.mFilterAdapter.getCount()).isEqualTo(3); assertThat(mFragment.mFilterAdapter.getCount()).isEqualTo(4);
assertThat(mFragment.mFilterAdapter.getItem(0)).isEqualTo( assertThat(mFragment.mFilterAdapter.getItem(0)).isEqualTo(
mContext.getString(R.string.sort_order_recent_notification)); mContext.getString(R.string.sort_order_recent_notification));
assertThat(mFragment.mFilterAdapter.getItem(1)).isEqualTo( assertThat(mFragment.mFilterAdapter.getItem(1)).isEqualTo(
mContext.getString(R.string.sort_order_frequent_notification)); mContext.getString(R.string.sort_order_frequent_notification));
assertThat(mFragment.mFilterAdapter.getItem(2)).isEqualTo( assertThat(mFragment.mFilterAdapter.getItem(2)).isEqualTo(
mContext.getString(R.string.filter_all_apps));
assertThat(mFragment.mFilterAdapter.getItem(3)).isEqualTo(
mContext.getString(R.string.filter_notif_blocked_apps)); mContext.getString(R.string.filter_notif_blocked_apps));
} }