1 package com.android.settings.notification; 2 3 import android.content.Context; 4 import android.os.UserHandle; 5 6 import com.android.settings.R; 7 import com.android.settingslib.core.lifecycle.Lifecycle; 8 9 public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePreferenceController { 10 11 protected static final String KEY = "zen_mode_bypassing_apps"; 12 private NotificationBackend mNotificationBackend = new NotificationBackend(); 13 ZenModeBypassingAppsPreferenceController(Context context, Lifecycle lifecycle)14 public ZenModeBypassingAppsPreferenceController(Context context, Lifecycle lifecycle) { 15 super(context, KEY, lifecycle); 16 } 17 18 @Override isAvailable()19 public boolean isAvailable() { 20 return mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()) != 0; 21 } 22 23 @Override getSummary()24 public String getSummary() { 25 final int channelsBypassing = 26 mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()); 27 return mContext.getResources().getQuantityString(R.plurals.zen_mode_bypassing_apps_subtext, 28 channelsBypassing, channelsBypassing); 29 } 30 } 31