Add a default behavior setting for VICs

Test: atest
Bug: 149696991
Change-Id: Ica06f80a02d65294a7b503fd3556add644c61bd7
This commit is contained in:
Julia Reynolds
2020-02-17 21:58:08 -05:00
parent 1ee9dce20c
commit 8949d87be7
25 changed files with 343 additions and 72 deletions

View File

@@ -16,7 +16,10 @@
package com.android.settings.notification.app;
import static android.provider.Settings.Secure.BUBBLE_IMPORTANT_CONVERSATIONS;
import android.content.Context;
import android.provider.Settings;
import androidx.preference.Preference;
@@ -29,10 +32,12 @@ public class ConversationImportantPreferenceController extends NotificationPrefe
private static final String TAG = "ConvoImpPC";
private static final String KEY = "important";
private final NotificationSettings.DependentFieldListener mDependentFieldListener;
public ConversationImportantPreferenceController(Context context,
NotificationBackend backend) {
NotificationBackend backend, NotificationSettings.DependentFieldListener listener) {
super(context, backend);
mDependentFieldListener = listener;
}
@Override
@@ -67,8 +72,17 @@ public class ConversationImportantPreferenceController extends NotificationPrefe
}
final boolean value = (Boolean) newValue;
mChannel.setImportantConversation(value);
if (value && bubbleImportantConversations()) {
mChannel.setAllowBubbles(true);
mDependentFieldListener.onFieldValueChanged();
}
saveChannel();
return true;
}
private boolean bubbleImportantConversations() {
return Settings.Secure.getInt(mContext.getContentResolver(),
BUBBLE_IMPORTANT_CONVERSATIONS, 1) == 1;
}
}