diff --git a/core/java/com/android/internal/notification/SystemNotificationChannels.java b/core/java/com/android/internal/notification/SystemNotificationChannels.java index 44adbb22eb7ef..59504360f3cfb 100644 --- a/core/java/com/android/internal/notification/SystemNotificationChannels.java +++ b/core/java/com/android/internal/notification/SystemNotificationChannels.java @@ -50,6 +50,7 @@ public class SystemNotificationChannels { public static String FOREGROUND_SERVICE = "FOREGROUND_SERVICE"; public static String HEAVY_WEIGHT_APP = "HEAVY_WEIGHT_APP"; public static String SYSTEM_CHANGES = "SYSTEM_CHANGES"; + public static String DO_NOT_DISTURB = "DO_NOT_DISTURB"; public static void createAll(Context context) { final NotificationManager nm = context.getSystemService(NotificationManager.class); @@ -158,6 +159,11 @@ public class SystemNotificationChannels { NotificationManager.IMPORTANCE_LOW); channelsList.add(systemChanges); + NotificationChannel dndChanges = new NotificationChannel(DO_NOT_DISTURB, + context.getString(R.string.notification_channel_do_not_disturb), + NotificationManager.IMPORTANCE_LOW); + channelsList.add(dndChanges); + nm.createNotificationChannels(channelsList); } diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index 93e765be9cced..6c0be1b24df19 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -4889,10 +4889,16 @@ Edit - + System changes - - Do Not Disturb is hiding notifications to help you focus + + Do Not Disturb + + Do Not Disturb is hiding notifications to help you focus - This is a new feature from the latest system update. Tap to change. + This is new behavior. Tap to change. + + Do Not Disturb has changed + + Tap to check what\'s blocked. diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 30193a81d7785..55e91571c8c05 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -3129,6 +3129,7 @@ + @@ -3295,6 +3296,8 @@ + + diff --git a/services/core/java/com/android/server/notification/ZenModeHelper.java b/services/core/java/com/android/server/notification/ZenModeHelper.java index 141b47d6a0282..e86253037b08f 100644 --- a/services/core/java/com/android/server/notification/ZenModeHelper.java +++ b/services/core/java/com/android/server/notification/ZenModeHelper.java @@ -1203,15 +1203,21 @@ public class ZenModeHelper { final Bundle extras = new Bundle(); extras.putString(Notification.EXTRA_SUBSTITUTE_APP_NAME, mContext.getResources().getString(R.string.global_action_settings)); - return new Notification.Builder(mContext, SystemNotificationChannels.SYSTEM_CHANGES) + int title = R.string.zen_upgrade_notification_title; + int content = R.string.zen_upgrade_notification_content; + if (NotificationManager.Policy.areAllVisualEffectsSuppressed( + getNotificationPolicy().suppressedVisualEffects)) { + title = R.string.zen_upgrade_notification_visd_title; + content = R.string.zen_upgrade_notification_visd_content; + } + return new Notification.Builder(mContext, SystemNotificationChannels.DO_NOT_DISTURB) .setSmallIcon(R.drawable.ic_settings_24dp) - .setContentTitle(mContext.getResources().getString( - R.string.zen_upgrade_notification_title)) - .setContentText(mContext.getResources().getString( - R.string.zen_upgrade_notification_content)) + .setContentTitle(mContext.getResources().getString(title)) + .setContentText(mContext.getResources().getString(content)) .setAutoCancel(true) .setLocalOnly(true) .addExtras(extras) + .setStyle(new Notification.BigTextStyle()) .setContentIntent(PendingIntent.getActivity(mContext, 0, intent, 0, null)) .build(); }