From 4cd3f5c519d55ab9631d67576db1dc8989ff5651 Mon Sep 17 00:00:00 2001 From: Wale Ogunwale Date: Thu, 8 Jun 2017 16:51:48 -0700 Subject: [PATCH] Fix deadlock when create alert window notification Don't hold WM lock when calling into notification manager which can call into activity manager. Test: Make sure alert window notification is displayed Change-Id: Id8831878093f8079f815a830ff8acdfad99d48cb Fixes: 62458061 --- .../java/com/android/server/wm/AlertWindowNotification.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/services/core/java/com/android/server/wm/AlertWindowNotification.java b/services/core/java/com/android/server/wm/AlertWindowNotification.java index 7eebe39f4ee4..3f320793826f 100644 --- a/services/core/java/com/android/server/wm/AlertWindowNotification.java +++ b/services/core/java/com/android/server/wm/AlertWindowNotification.java @@ -63,12 +63,6 @@ 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() { @@ -143,6 +137,13 @@ class AlertWindowNotification { } private void createNotificationChannel(Context context, String appName) { + if (sChannelGroup == null) { + sChannelGroup = new NotificationChannelGroup(CHANNEL_PREFIX, + mService.mContext.getString( + R.string.alert_windows_notification_channel_group_name)); + mNotificationManager.createNotificationChannelGroup(sChannelGroup); + } + final String nameChannel = context.getString(R.string.alert_windows_notification_channel_name, appName); final NotificationChannel channel = -- 2.11.0