Commit ea57e5d2 by bachinger Committed by kim-vde

Always pass true for ongoing with the first notification

ISSUE: #7977
PiperOrigin-RevId: 333726625
parent d1416aeb
...@@ -989,7 +989,6 @@ public class PlayerNotificationManager { ...@@ -989,7 +989,6 @@ public class PlayerNotificationManager {
Notification notification = builder.build(); Notification notification = builder.build();
notificationManager.notify(notificationId, notification); notificationManager.notify(notificationId, notification);
if (!isNotificationStarted) { if (!isNotificationStarted) {
isNotificationStarted = true;
context.registerReceiver(notificationBroadcastReceiver, intentFilter); context.registerReceiver(notificationBroadcastReceiver, intentFilter);
if (notificationListener != null) { if (notificationListener != null) {
notificationListener.onNotificationStarted(notificationId, notification); notificationListener.onNotificationStarted(notificationId, notification);
...@@ -997,8 +996,12 @@ public class PlayerNotificationManager { ...@@ -997,8 +996,12 @@ public class PlayerNotificationManager {
} }
@Nullable NotificationListener listener = notificationListener; @Nullable NotificationListener listener = notificationListener;
if (listener != null) { if (listener != null) {
listener.onNotificationPosted(notificationId, notification, ongoing); // Always pass true for ongoing with the first notification to tell a service to go into
// foreground even when paused.
listener.onNotificationPosted(
notificationId, notification, ongoing || !isNotificationStarted);
} }
isNotificationStarted = true;
} }
// We're calling a deprecated listener method that we still want to notify. // We're calling a deprecated listener method that we still want to notify.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment