Add filtering to notification channel settings
Allow apps that are launching this page to specify targeted subsets of settings that should be shown. Test: settings notification robotests Bug: 177246841 Change-Id: Ib491c43f1861a9775e3b25f39134cdbe105a7ff8
This commit is contained in:
@@ -20,6 +20,7 @@ import static android.app.NotificationManager.IMPORTANCE_LOW;
|
||||
import static android.app.NotificationManager.IMPORTANCE_NONE;
|
||||
import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
|
||||
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationManager;
|
||||
import android.content.Context;
|
||||
import android.widget.Switch;
|
||||
@@ -55,9 +56,17 @@ public class BlockPreferenceController extends NotificationPreferenceController
|
||||
if (mAppRow == null) {
|
||||
return false;
|
||||
}
|
||||
if (mPreferenceFilter != null && !isIncludedInFilter()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
boolean isIncludedInFilter() {
|
||||
return mPreferenceFilter.contains(NotificationChannel.EDIT_IMPORTANCE);
|
||||
}
|
||||
|
||||
public void updateState(Preference preference) {
|
||||
SettingsMainSwitchPreference bar = (SettingsMainSwitchPreference) preference;
|
||||
if (bar != null) {
|
||||
|
Reference in New Issue
Block a user