Skip to content

Handoff to the previous media app when Fermata has nothing to resume - #845

Open
giunatale wants to merge 2 commits into
AndreyPavlenko:masterfrom
giunatale:feat/resume-previous-app
Open

giunatale wants to merge 2 commits into
AndreyPavlenko:masterfrom
giunatale:feat/resume-previous-app

Conversation

@giunatale

@giunatale giunatale commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

After watching YouTube in Fermata Auto, Android Auto keeps Fermata as its default media app, since it adopts whichever app last played. At the next start, its autoplay asks Fermata to play, Fermata has nothing to resume, and the app that was playing before (Spotify, say) never starts. This adds two settings under Playback settings, both off by default:

  • Handoff to the previous media app. Fermata remembers the app whose media session was the most recent when its own became active. When another app (Android Auto, a media button) asks it to play with nothing to resume, it asks that app to play instead, through its media session, or its media button receiver if it has none. Fermata's own play button is never handed off. Android Auto then makes it the default again by itself.
  • Handoff when leaving Fermata in the car (Fermata Auto only). When Fermata's car screen is closed with nothing left to play (no current playback and no item on the card, the state behind a greyed-out play button), Fermata resumes the app it took over from. Guards: only while Android Auto is still projecting, checked after 2 s so that disconnecting doesn't count; only if Fermata took over from that app since it last handed back; and not if that app is already playing. Local media is unaffected: a stopped song keeps its item on the card, so nothing is handed over.

Permissions. Android only lets apps with notification access see and control other apps' media sessions, so the settings include a button that opens that page. Fermata reads no notifications: the listener declares every notification type disabled (android.service.notification.disabled_filter_types), and only the main switch is needed. For APKs installed through the package installer, Android 13+ treats notification access as a restricted setting (App info → ⋮ → Allow restricted settings). It can also be granted over adb with cmd notification allow_listener <package>/me.aap.fermata.media.service.MediaSessionListener.

Tested on a OnePlus 12 (Android 16) with Android Auto 17.7: at the next car start after watching YouTube, Spotify started immediately, and so did YouTube Music as the previous app, with every notification type off; on the notification-access page those types show greyed out. Leaving the car screen with nothing left to play handed off to Spotify; leaving with a video still current didn't. Fermata's own play button never hands off, and changing settings during playback keeps the session.

@giunatale
giunatale force-pushed the feat/resume-previous-app branch from e4766db to d78620c Compare November 3, 2026 14:06
@giunatale
giunatale force-pushed the feat/resume-previous-app branch 5 times, most recently from dd9d769 to faccd92 Compare November 9, 2026 17:42
Android Auto keeps the last app that played as its default media app,
and at the next start its autoplay asks that app to play. After a
YouTube session in Fermata, Fermata has nothing to resume there, so the
app that was playing before never starts. With this option on, Fermata
remembers the app whose media session was the most recent when its own
became active, and when another app (e.g. Android Auto) asks it to play
with nothing to resume, it asks that app to play instead: through its
media session, or its media button receiver if it has none. Requests
from Fermata's own controls are never handed off. Android Auto then
makes that app the default again by itself.

Seeing and controlling other apps' media sessions requires notification
access, so the option comes with a button that opens that setting.
Fermata reads no notifications: the listener declares every notification
type disabled. Off by default.
…he car

With it on, when Fermata's car screen is closed while Fermata has
nothing left to play (no current playback and no item on the media
card, e.g. after watching a video), Fermata resumes the app it took
over from, unless that app is already playing. It only acts while
Android Auto is still projecting, checked after a short delay so that
disconnecting from the car doesn't count, and only if Fermata took over
from that app since it last handed back. Off by default.
@giunatale
giunatale force-pushed the feat/resume-previous-app branch from faccd92 to 9a531e2 Compare November 10, 2026 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant