From face3bba70d8aa9dad4cd8e04c1923a05495ab65 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Thu, 1 Jun 2017 10:22:36 -0700 Subject: Add channel group for alert windows notifications Bug: 62256269 Test: manual Change-Id: If4253cb8303124c5c6d974e9680486d77f314059 --- core/res/res/values/strings.xml | 3 +++ core/res/res/values/symbols.xml | 1 + .../core/java/com/android/server/wm/AlertWindowNotification.java | 9 +++++++++ 3 files changed, 13 insertions(+) diff --git a/core/res/res/values/strings.xml b/core/res/res/values/strings.xml index f747d3dfcba3..90ece60d324d 100644 --- a/core/res/res/values/strings.xml +++ b/core/res/res/values/strings.xml @@ -3223,6 +3223,9 @@ + + Display over other apps %s displaying over other apps diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 8d2666e7c648..bfd40bd704e1 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2946,6 +2946,7 @@ + diff --git a/services/core/java/com/android/server/wm/AlertWindowNotification.java b/services/core/java/com/android/server/wm/AlertWindowNotification.java index 972623c9478d..7eebe39f4ee4 100644 --- a/services/core/java/com/android/server/wm/AlertWindowNotification.java +++ b/services/core/java/com/android/server/wm/AlertWindowNotification.java @@ -25,6 +25,7 @@ import static android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION; import android.app.Notification; import android.app.NotificationChannel; +import android.app.NotificationChannelGroup; import android.app.NotificationManager; import android.app.PendingIntent; import android.content.Context; @@ -45,6 +46,7 @@ class AlertWindowNotification { private static final int NOTIFICATION_ID = 0; private static int sNextRequestCode = 0; + private static NotificationChannelGroup sChannelGroup; private final int mRequestCode; private final WindowManagerService mService; private String mNotificationTag; @@ -61,6 +63,12 @@ class AlertWindowNotification { mNotificationTag = CHANNEL_PREFIX + mPackageName; mRequestCode = sNextRequestCode++; mIconUtilities = new IconUtilities(mService.mContext); + if (sChannelGroup == null) { + sChannelGroup = new NotificationChannelGroup(CHANNEL_PREFIX, + mService.mContext.getString( + R.string.alert_windows_notification_channel_group_name)); + mNotificationManager.createNotificationChannelGroup(sChannelGroup); + } } void post() { @@ -142,6 +150,7 @@ class AlertWindowNotification { channel.enableLights(false); channel.enableVibration(false); channel.setBlockableSystem(true); + channel.setGroup(sChannelGroup.getId()); mNotificationManager.createNotificationChannel(channel); } -- cgit v1.2.3-59-g8ed1b