Move channel listing into a pref controller

And a hidden preference category. This makes
hiding/showing the list a lot cleaner and also allows more
of the code to be tested.

Also delete some unused code that no longer complied after
this refactor.

Fixes: 133443871
Test: atest
Change-Id: I4a5fe0e075019bae2df44a0a9dcec26a40ee6d12
This commit is contained in:
Julia Reynolds
2019-07-01 13:44:39 -04:00
parent b62a45e156
commit a295d71c94
12 changed files with 368 additions and 442 deletions

View File

@@ -113,25 +113,40 @@ public abstract class NotificationPreferenceController extends AbstractPreferenc
}
protected boolean isChannelBlockable() {
if (mChannel != null && mAppRow != null) {
if (mChannel.isImportanceLockedByCriticalDeviceFunction()
|| mChannel.isImportanceLockedByOEM()) {
return mChannel.getImportance() == IMPORTANCE_NONE;
return isChannelBlockable(mChannel);
}
protected boolean isChannelBlockable(NotificationChannel channel) {
if (channel != null && mAppRow != null) {
if (channel.isImportanceLockedByCriticalDeviceFunction()
|| channel.isImportanceLockedByOEM()) {
return channel.getImportance() == IMPORTANCE_NONE;
}
return mChannel.isBlockableSystem() || !mAppRow.systemApp
|| mChannel.getImportance() == IMPORTANCE_NONE;
return channel.isBlockableSystem() || !mAppRow.systemApp
|| channel.getImportance() == IMPORTANCE_NONE;
}
return false;
}
protected boolean isChannelConfigurable(NotificationChannel channel) {
if (channel != null && mAppRow != null) {
return !channel.isImportanceLockedByOEM();
}
return false;
}
protected boolean isChannelGroupBlockable() {
if (mChannelGroup != null && mAppRow != null) {
return isChannelGroupBlockable(mChannelGroup);
}
protected boolean isChannelGroupBlockable(NotificationChannelGroup group) {
if (group != null && mAppRow != null) {
if (!mAppRow.systemApp) {
return true;
}
return mChannelGroup.isBlocked();
return group.isBlocked();
}
return false;
}