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:
@@ -21,6 +21,7 @@ import static android.app.NotificationManager.IMPORTANCE_UNSPECIFIED;
|
||||
import android.app.INotificationManager;
|
||||
import android.app.NotificationChannel;
|
||||
import android.app.NotificationChannelGroup;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.usage.IUsageStatsManager;
|
||||
import android.app.usage.UsageEvents;
|
||||
import android.content.Context;
|
||||
@@ -38,8 +39,6 @@ import android.text.format.DateUtils;
|
||||
import android.util.IconDrawableFactory;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
import com.android.settingslib.R;
|
||||
import com.android.settingslib.Utils;
|
||||
import com.android.settingslib.utils.StringUtil;
|
||||
@@ -49,6 +48,8 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
|
||||
public class NotificationBackend {
|
||||
private static final String TAG = "NotificationBackend";
|
||||
|
||||
@@ -208,6 +209,19 @@ public class NotificationBackend {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns all notification channels associated with the package and uid that will bypass DND
|
||||
*/
|
||||
public ParceledListSlice<NotificationChannel> getNotificationChannelsBypassingDnd(String pkg,
|
||||
int uid) {
|
||||
try {
|
||||
return sINM.getNotificationChannelsBypassingDnd(pkg, uid);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return ParceledListSlice.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
public void updateChannel(String pkg, int uid, NotificationChannel channel) {
|
||||
try {
|
||||
sINM.updateNotificationChannelForPackage(pkg, uid, channel);
|
||||
@@ -260,6 +274,15 @@ public class NotificationBackend {
|
||||
}
|
||||
}
|
||||
|
||||
public int getNumAppsBypassingDnd(int uid) {
|
||||
try {
|
||||
return sINM.getAppsBypassingDndCount(uid);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, "Error calling NoMan", e);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
public List<NotifyingApp> getRecentApps() {
|
||||
try {
|
||||
return sINM.getRecentNotifyingAppsForUser(UserHandle.myUserId()).getList();
|
||||
|
Reference in New Issue
Block a user