Allow to block/unblock Conversation Notifications from Settings

The user can end up in a state where the Channel of a Conversation is
blocked (has an importance of 0).
Currently there was no way to unblock it, because we didn't allow it from
the Settings. Therefore now the option to block/unblock is added to the
Conversation Settings page.

Fixes: 255062535
Test: Block/Unblock a Conversation from Settings
Test: Mark a notification blocked and conversation by clicking the “Show
notifications” toggle and the “This is a conversation” button at once.
Now unblock it from the Settings.

Change-Id: I06778d259155d87d6af4bdb7013cd3b6c9a2e5ee
diff --git a/res/xml/conversation_notification_settings.xml b/res/xml/conversation_notification_settings.xml
index af82140..9078e2d 100644
--- a/res/xml/conversation_notification_settings.xml
+++ b/res/xml/conversation_notification_settings.xml
@@ -25,6 +25,9 @@
         android:layout="@layout/settings_entity_header"
         settings:allowDividerBelow="true"/>
 
+    <com.android.settings.widget.SettingsMainSwitchPreference
+        android:key="block" />
+
     <!-- important conversation -->
     <com.android.settings.notification.app.ConversationPriorityPreference
         android:key="priority"
diff --git a/src/com/android/settings/notification/app/ConversationNotificationSettings.java b/src/com/android/settings/notification/app/ConversationNotificationSettings.java
index ec9c65f..b452309 100644
--- a/src/com/android/settings/notification/app/ConversationNotificationSettings.java
+++ b/src/com/android/settings/notification/app/ConversationNotificationSettings.java
@@ -83,6 +83,7 @@
     protected List<AbstractPreferenceController> createPreferenceControllers(Context context) {
         mControllers = new ArrayList<>();
         mControllers.add(new ConversationHeaderPreferenceController(context, this));
+        mControllers.add(new BlockPreferenceController(context, mDependentFieldListener, mBackend));
         mControllers.add(new ConversationPriorityPreferenceController(
                 context, mBackend, mDependentFieldListener));
         mControllers.add(new HighImportancePreferenceController(