Loading services/core/java/com/android/server/notification/NotificationShellCmd.java +30 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,12 @@ package com.android.server.notification; import static android.app.NotificationManager.INTERRUPTION_FILTER_ALARMS; import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL; import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE; import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY; import static android.app.NotificationManager.INTERRUPTION_FILTER_UNKNOWN; import android.app.ActivityManager; import android.app.INotificationManager; import android.app.Notification; Loading Loading @@ -47,13 +53,13 @@ import java.util.Collections; * Implementation of `cmd notification` in NotificationManagerService. */ public class NotificationShellCmd extends ShellCommand { private static final String USAGE = "usage: cmd notification SUBCMD [args]\n\n" private static final String USAGE = "usage: cmd notification SUBCMD [args]\n\n" + "SUBCMDs:\n" + " allow_listener COMPONENT [user_id (current user if not specified)]\n" + " disallow_listener COMPONENT [user_id (current user if not specified)]\n" + " allow_assistant COMPONENT [user_id (current user if not specified)]\n" + " remove_assistant COMPONENT [user_id (current user if not specified)]\n" + " set_dnd [on|none (same as on)|priority|alarms|all|off (same as all)]" + " allow_dnd PACKAGE [user_id (current user if not specified)]\n" + " disallow_dnd PACKAGE [user_id (current user if not specified)]\n" + " suspend_package PACKAGE\n" Loading Loading @@ -111,6 +117,28 @@ public class NotificationShellCmd extends ShellCommand { final PrintWriter pw = getOutPrintWriter(); try { switch (cmd.replace('-', '_')) { case "set_dnd": { String mode = getNextArgRequired(); int interruptionFilter = INTERRUPTION_FILTER_UNKNOWN; switch(mode) { case "none": case "on": interruptionFilter = INTERRUPTION_FILTER_NONE; break; case "priority": interruptionFilter = INTERRUPTION_FILTER_PRIORITY; break; case "alarms": interruptionFilter = INTERRUPTION_FILTER_ALARMS; break; case "all": case "off": interruptionFilter = INTERRUPTION_FILTER_ALL; } mBinderService.setInterruptionFilter( mDirectService.getContext().getPackageName(), interruptionFilter); } break; case "allow_dnd": { String packageName = getNextArgRequired(); int userId = ActivityManager.getCurrentUser(); Loading Loading
services/core/java/com/android/server/notification/NotificationShellCmd.java +30 −2 Original line number Diff line number Diff line Loading @@ -16,6 +16,12 @@ package com.android.server.notification; import static android.app.NotificationManager.INTERRUPTION_FILTER_ALARMS; import static android.app.NotificationManager.INTERRUPTION_FILTER_ALL; import static android.app.NotificationManager.INTERRUPTION_FILTER_NONE; import static android.app.NotificationManager.INTERRUPTION_FILTER_PRIORITY; import static android.app.NotificationManager.INTERRUPTION_FILTER_UNKNOWN; import android.app.ActivityManager; import android.app.INotificationManager; import android.app.Notification; Loading Loading @@ -47,13 +53,13 @@ import java.util.Collections; * Implementation of `cmd notification` in NotificationManagerService. */ public class NotificationShellCmd extends ShellCommand { private static final String USAGE = "usage: cmd notification SUBCMD [args]\n\n" private static final String USAGE = "usage: cmd notification SUBCMD [args]\n\n" + "SUBCMDs:\n" + " allow_listener COMPONENT [user_id (current user if not specified)]\n" + " disallow_listener COMPONENT [user_id (current user if not specified)]\n" + " allow_assistant COMPONENT [user_id (current user if not specified)]\n" + " remove_assistant COMPONENT [user_id (current user if not specified)]\n" + " set_dnd [on|none (same as on)|priority|alarms|all|off (same as all)]" + " allow_dnd PACKAGE [user_id (current user if not specified)]\n" + " disallow_dnd PACKAGE [user_id (current user if not specified)]\n" + " suspend_package PACKAGE\n" Loading Loading @@ -111,6 +117,28 @@ public class NotificationShellCmd extends ShellCommand { final PrintWriter pw = getOutPrintWriter(); try { switch (cmd.replace('-', '_')) { case "set_dnd": { String mode = getNextArgRequired(); int interruptionFilter = INTERRUPTION_FILTER_UNKNOWN; switch(mode) { case "none": case "on": interruptionFilter = INTERRUPTION_FILTER_NONE; break; case "priority": interruptionFilter = INTERRUPTION_FILTER_PRIORITY; break; case "alarms": interruptionFilter = INTERRUPTION_FILTER_ALARMS; break; case "all": case "off": interruptionFilter = INTERRUPTION_FILTER_ALL; } mBinderService.setInterruptionFilter( mDirectService.getContext().getPackageName(), interruptionFilter); } break; case "allow_dnd": { String packageName = getNextArgRequired(); int userId = ActivityManager.getCurrentUser(); Loading