implementing MediaSession using MPRIS

NotificationManager will now ignore MediaStyle notifications
This commit is contained in:
Julian Winkler
2024-07-15 16:39:45 +02:00
parent eddd827e27
commit b54bed4784
9 changed files with 272 additions and 14 deletions

View File

@@ -54,6 +54,7 @@ public class Notification implements Parcelable {
PendingIntent intent;
String iconPath;
boolean ongoing;
Style style;
public String toString() {
return "Notification [" + title + ", " + text + ", " + actions + "]";
@@ -151,6 +152,7 @@ public class Notification implements Parcelable {
}
public Builder setStyle(Style style) {
notification.style = style;
if (style instanceof MediaStyle) {
notification.ongoing = true;
}

View File

@@ -1,5 +1,6 @@
package android.app;
import android.app.Notification.MediaStyle;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
@@ -10,6 +11,10 @@ public class NotificationManager {
public void cancelAll() {}
public void notify(String tag, int id, Notification notification) {
if (notification.style instanceof MediaStyle) {
return; // MPRIS is handled by MediaSession implementation
}
System.out.println("notify(" + tag + ", " + id + ", " + notification + ") called");
long builder = nativeInitBuilder();
for (Notification.Action action : notification.actions) {