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
This commit is contained in:
Wale Ogunwale
2017-06-08 16:51:48 -07:00
parent 7925f817d0
commit 4cd3f5c519

View File

@@ -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 =