Add new settings page for apps overriding dnd

Close starred contacts cursor

Test: atest ZenModeAllBypassingAppsPreferenceControllerTest
Test: atest ZenModeBypassingAppsPreferenceControllerTest
Bug: 111475013
Change-Id: I84d259aaef1bc5cc907ec5bef08beade91a8b904
This commit is contained in:
Beverly
2018-11-08 10:18:43 -05:00
parent 2ebf61cd61
commit 7973c635c9
11 changed files with 630 additions and 46 deletions

View File

@@ -0,0 +1,30 @@
package com.android.settings.notification;
import android.content.Context;
import android.os.UserHandle;
import com.android.settings.R;
import com.android.settingslib.core.lifecycle.Lifecycle;
public class ZenModeBypassingAppsPreferenceController extends AbstractZenModePreferenceController {
protected static final String KEY = "zen_mode_bypassing_apps";
private NotificationBackend mNotificationBackend = new NotificationBackend();
public ZenModeBypassingAppsPreferenceController(Context context, Lifecycle lifecycle) {
super(context, KEY, lifecycle);
}
@Override
public boolean isAvailable() {
return mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId()) != 0;
}
@Override
public String getSummary() {
final int channelsBypassing =
mNotificationBackend.getNumAppsBypassingDnd(UserHandle.getCallingUserId());
return mContext.getResources().getQuantityString(R.plurals.zen_mode_bypassing_apps_subtext,
channelsBypassing, channelsBypassing);
}
}