Skip to content

fix(originos): keep lyrics on the Origin Island and match the lyrics screen - #651

Open
JacksonJones2003 wants to merge 1 commit into
Clash-Projects:mainfrom
JacksonJones2003:feat/originos-card-lyrics-refresh
Open

JacksonJones2003 wants to merge 1 commit into
Clash-Projects:mainfrom
JacksonJones2003:feat/originos-card-lyrics-refresh

Conversation

@JacksonJones2003

Copy link
Copy Markdown
Contributor

Summary

Follow-up to the OriginOS music card lyrics (802b4d5). On a vivo phone, the lyrics showed on the music card in the notification shade, but often not on the Origin Island or the lock screen, and the card sometimes showed a different, worse version of the lyrics than LastWave's own lyrics screen. This change fixes both.

The same behaviour has been running on a vivo phone (OriginOS, com.vivo.musicwidgetmix 17.0.8.3) as a patch to LastWave 5.2.1, through several days of testing. This PR is that behaviour written into the app.

What was wrong

  1. The island forgets the lyrics. The island and the lock screen widget drop the lyrics whenever they are drawn again (the screen locks, the island collapses and expands), and the card never asks the app for them again. The card in the notification shade keeps its own copy, which is why lyrics showed there and not on the island. Resending every 25 s left the island empty for up to 25 s each time.
  2. The card's lyrics differed from the lyrics screen. The service fetched lyrics as soon as the track changed, usually before the duration was known, and sent the provider's lines as they came. Some providers then returned another cut of the song (one stopped halfway through Bohemian Rhapsody; another left a 40 s gap). The lyrics screen waits for the duration, and sanitizes and re-times the lines.
  3. The lyrics restarted. The lyrics screen publishes each provider's answer as it arrives (three versions within 5 s for one song). The card starts the lyrics over with every one it gets.

Changes

  • OriginOsMusicCard.LYRICS_RESEND_INTERVAL_MS: 25 s → 4 s.
  • OriginOsMusicCard.playerLyrics: the lines the lyrics screen shows, published from PlayerViewModel.publishLyrics for synced lyrics, keyed by the track (trackKeyOf, the identity mediaIdOf already used).
  • publishOriginOsLyrics now sends the lyrics screen's lines once they have not changed for 2 s (PLAYER_LYRICS_SETTLE_MS). Until then, or when no screen is open, it uses its own fetch.
  • The service's own fetch (fetchOriginOsLrc) waits up to 8 s for the track's duration, as the lyrics screen does, and prepares the lines with LyricsSanitizer.sanitize and LyricsRepository.normalizeLyricTiming. Instrumental results are skipped.
  • One new unit test for trackKeyOf.

Testing

  • ./gradlew :app:testDebugUnitTest --tests '*OriginOsMusicCardTest': 12 tests pass (on main at b457952 with this change).
  • Not run on a device as this source change. The same behaviour (4 s resend, preferring the lyrics screen's lines after they settle) was tested on the phone as a patch of LastWave 5.2.1.
  • Known limitation, not fixable from the app: after LastWave is reinstalled or updated while the card still lists it as the current app, the card does not reconnect to MusicPlaybackService until the card is opened (or one of its buttons is pressed), and the island shows no lyrics until then. Apple Music behaves the same way on this phone.

🤖 Generated with Claude Code

…screen

- Resend the card lyrics every 4 s instead of 25 s: the island and the lock
  screen widget forget them each time they are drawn again and never ask the
  app again, while the card in the notification shade keeps its own copy.
- Prefer the lines the lyrics screen settled on (sanitized, re-timed, from the
  provider the user picked), 2 s after its last update, as the card starts the
  lyrics over with every provider that answers.
- The service's own fetch, used until then or with no screen open, waits for
  the track's duration like the lyrics screen and prepares the lines the same
  way; without the duration some providers return another cut of the song.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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