Loading core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -10413,6 +10413,15 @@ public final class Settings { */ public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate"; /** * Displays toasts when an app posts a notification that does not specify a valid channel. * * The value 1 - enable, 0 - disable * @hide */ public static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS = "show_notification_channel_warnings"; /** * Whether cell is enabled/disabled * @hide Loading services/core/java/com/android/server/notification/NotificationManagerService.java +5 −5 Original line number Diff line number Diff line Loading @@ -3199,10 +3199,8 @@ public class NotificationManagerService extends SystemService { + ", incomingUserId=" + incomingUserId + ", notificationUid=" + notificationUid + ", notification=" + notification; // STOPSHIP TODO: should throw instead of logging or toasting. // throw new IllegalArgumentException(noChannelStr); Log.e(TAG, noChannelStr); doDebugOnlyToast("Developer warning for package \"" + pkg + "\"\n" + doChannelWarningToast("Developer warning for package \"" + pkg + "\"\n" + "Failed to post notification on channel \"" + channelId + "\"\n" + "See log for more details"); return; Loading Loading @@ -3238,8 +3236,10 @@ public class NotificationManagerService extends SystemService { mHandler.post(new EnqueueNotificationRunnable(userId, r)); } private void doDebugOnlyToast(CharSequence toastText) { if (Build.IS_DEBUGGABLE) { private void doChannelWarningToast(CharSequence toastText) { final boolean warningEnabled = Settings.System.getInt(getContext().getContentResolver(), Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0) != 0; if (warningEnabled || Build.IS_DEBUGGABLE) { try { Toast toast = Toast.makeText(getContext(), toastText, Toast.LENGTH_LONG); toast.show(); Loading Loading
core/java/android/provider/Settings.java +9 −0 Original line number Diff line number Diff line Loading @@ -10413,6 +10413,15 @@ public final class Settings { */ public static final String MAX_NOTIFICATION_ENQUEUE_RATE = "max_notification_enqueue_rate"; /** * Displays toasts when an app posts a notification that does not specify a valid channel. * * The value 1 - enable, 0 - disable * @hide */ public static final String SHOW_NOTIFICATION_CHANNEL_WARNINGS = "show_notification_channel_warnings"; /** * Whether cell is enabled/disabled * @hide Loading
services/core/java/com/android/server/notification/NotificationManagerService.java +5 −5 Original line number Diff line number Diff line Loading @@ -3199,10 +3199,8 @@ public class NotificationManagerService extends SystemService { + ", incomingUserId=" + incomingUserId + ", notificationUid=" + notificationUid + ", notification=" + notification; // STOPSHIP TODO: should throw instead of logging or toasting. // throw new IllegalArgumentException(noChannelStr); Log.e(TAG, noChannelStr); doDebugOnlyToast("Developer warning for package \"" + pkg + "\"\n" + doChannelWarningToast("Developer warning for package \"" + pkg + "\"\n" + "Failed to post notification on channel \"" + channelId + "\"\n" + "See log for more details"); return; Loading Loading @@ -3238,8 +3236,10 @@ public class NotificationManagerService extends SystemService { mHandler.post(new EnqueueNotificationRunnable(userId, r)); } private void doDebugOnlyToast(CharSequence toastText) { if (Build.IS_DEBUGGABLE) { private void doChannelWarningToast(CharSequence toastText) { final boolean warningEnabled = Settings.System.getInt(getContext().getContentResolver(), Settings.Global.SHOW_NOTIFICATION_CHANNEL_WARNINGS, 0) != 0; if (warningEnabled || Build.IS_DEBUGGABLE) { try { Toast toast = Toast.makeText(getContext(), toastText, Toast.LENGTH_LONG); toast.show(); Loading