From 49a4d5a5d0a648ec42a439a46592ec665e39da5e Mon Sep 17 00:00:00 2001 From: Jorgeprdz Date: Wed, 14 Oct 2026 10:03:29 -0600 Subject: [PATCH 1/2] fix(nowbar): open Pixel Ambient Music history when Live Update is tapped --- ...roidLiveUpdateNowPlayingSurfacePublisher.kt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisher.kt b/app/src/main/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisher.kt index 829cf79..f221b6e 100644 --- a/app/src/main/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisher.kt +++ b/app/src/main/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisher.kt @@ -12,8 +12,8 @@ import android.os.Build import androidx.core.app.NotificationCompat import androidx.core.app.NotificationManagerCompat import androidx.core.content.ContextCompat +import com.kieronquinn.app.ambientmusicmod.PACKAGE_NAME_PAM import com.kieronquinn.app.ambientmusicmod.R -import com.kieronquinn.app.ambientmusicmod.ui.activities.MainActivity interface NowPlayingSurfacePublisher { fun publish(event: NowPlayingSurfaceEvent) @@ -54,6 +54,18 @@ class AndroidLiveUpdateNowPlayingSurfacePublisher( ) } + /** + * The paired Pixel Ambient Music APK exports Now Playing History using this action. + * It has no verified public per-track deep link, so do not invent track extras. + * Keep the notification destination in Pixel Ambient Music, not AMM settings. + */ + fun buildHistoryIntent(): Intent { + return Intent("com.google.intelligence.sense.NOW_PLAYING_HISTORY").apply { + `package` = PACKAGE_NAME_PAM + addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP) + } + } + fun buildCandidateNotification( event: NowPlayingSurfaceEvent, requestPromotion: Boolean @@ -61,9 +73,7 @@ class AndroidLiveUpdateNowPlayingSurfacePublisher( val contentIntent = PendingIntent.getActivity( context, NOTIFICATION_ID, - Intent(context, MainActivity::class.java).apply { - addFlags(Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TOP) - }, + buildHistoryIntent(), PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE ) return NotificationCompat.Builder(context, CHANNEL_ID) From 8657e57d472d76f5ef6b3d51dd07a09bd4888e7d Mon Sep 17 00:00:00 2001 From: Jorgeprdz Date: Wed, 14 Oct 2026 10:03:32 -0600 Subject: [PATCH 2/2] test(nowbar): assert history intent targets paired PAM package --- ...ndroidLiveUpdateNowPlayingSurfacePublisherTest.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/src/androidTest/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisherTest.kt b/app/src/androidTest/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisherTest.kt index 945cd32..395b45a 100644 --- a/app/src/androidTest/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisherTest.kt +++ b/app/src/androidTest/java/com/kieronquinn/app/ambientmusicmod/components/nowplayingsurface/AndroidLiveUpdateNowPlayingSurfacePublisherTest.kt @@ -15,6 +15,18 @@ import org.junit.runner.RunWith @RunWith(AndroidJUnit4::class) class AndroidLiveUpdateNowPlayingSurfacePublisherTest { + @Test + fun tapOpensPairedPixelAmbientHistoryInsteadOfModSettings() { + val context = ApplicationProvider.getApplicationContext() + val publisher = AndroidLiveUpdateNowPlayingSurfacePublisher(context) + val intent = publisher.buildHistoryIntent() + + assertEquals("com.google.intelligence.sense.NOW_PLAYING_HISTORY", intent.action) + assertEquals("com.kieronquinn.app.pixelambientmusic", intent.`package`) + assertNull(intent.component) + assertTrue((intent.flags and android.content.Intent.FLAG_ACTIVITY_NEW_TASK) != 0) + } + @Test fun candidateUsesVerifiedM0BShape() { val context = ApplicationProvider.getApplicationContext()