ronnie
2022-10-23 eadd9db01b24ccde96a129dafa989d4ec436cdfd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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);
    }
}