@@ -61,6 +61,19 @@ class MediaNotificationListener : NotificationListenerService() {
6161 SyncManager .checkAndSyncDeviceStatus(context, forceSync = true )
6262 }
6363
64+ fun hasSignificantMediaChange (old : MediaInfo ? , new : MediaInfo ? ): Boolean {
65+ if (old == null && new == null ) return false
66+ if (old == null || new == null ) return true
67+ return old.isPlaying != new.isPlaying ||
68+ old.title != new.title ||
69+ old.artist != new.artist ||
70+ old.albumArt != new.albumArt ||
71+ old.albumArtLite != new.albumArtLite ||
72+ old.durationMs != new.durationMs ||
73+ old.isBuffering != new.isBuffering ||
74+ old.likeStatus != new.likeStatus
75+ }
76+
6477 // In-memory cache of like status per track key
6578 private val likeStatusCache = LinkedHashMap <String , String >(32 , 0.75f , true )
6679
@@ -472,7 +485,7 @@ class MediaNotificationListener : NotificationListenerService() {
472485 updateMediaInfo()
473486
474487 // If media info changed, trigger sync
475- if (previousMediaInfo != currentMediaInfo) {
488+ if (hasSignificantMediaChange( previousMediaInfo, currentMediaInfo) ) {
476489 Log .d(TAG , " Media info changed, triggering sync" )
477490 SyncManager .onMediaStateChanged(this )
478491 }
@@ -527,7 +540,7 @@ class MediaNotificationListener : NotificationListenerService() {
527540 updateMediaInfo()
528541
529542 // If media info changed, trigger sync
530- if (previousMediaInfo != currentMediaInfo) {
543+ if (hasSignificantMediaChange( previousMediaInfo, currentMediaInfo) ) {
531544 Log .d(TAG , " Media info changed after notification removal, triggering sync" )
532545 SyncManager .onMediaStateChanged(this )
533546 }
0 commit comments