Skip to content

fix: persist the lock screen music switches - #48

Open
slhssb wants to merge 1 commit into
ColdP:mainfrom
slhssb:fix/lockscreen-music-persist
Open

slhssb wants to merge 1 commit into
ColdP:mainfrom
slhssb:fix/lockscreen-music-persist

Conversation

@slhssb

@slhssb slhssb commented Nov 20, 2026

Copy link
Copy Markdown

What

HookSettings.write() never wrote four keys that toSettings() reads for the lock screen music switches:

  • KEY_LOCKSCREEN_MUSIC_LOCKSCREEN_ENABLED
  • KEY_LOCKSCREEN_MUSIC_LYRICS_ENABLED
  • KEY_LOCKSCREEN_MUSIC_LYRICS_HDR_ENABLED
  • KEY_LOCKSCREEN_MUSIC_LYRICS_KEEP_SCREEN_ON

Each is defined and read, but had no corresponding putBoolean in write(). This restores the write side. One file, four putBoolean calls, no logic change.

Why the switches appeared to work

update()  →  in-memory settings change → Compose redraw   (switch turns on)
          →  local.write(settings)      → keys never written
          →  SystemUI runs the feature anyway (applySettings over the probe bridge)
restart   →  HookSettingsStore → local.toSettings() → key absent → default false

That is the whole symptom: the switch is on until the settings process restarts, and the feature keeps working the entire time because SystemUI is driven by applySettings() rather than by these keys.

Reproduction

  1. Settings → 音乐锁屏, turn on 音乐锁屏 and 锁屏歌词
  2. Dismiss the settings app from recents
  3. Open it again

Both switches are off again. Locking and unlocking the screen in between does not reset them, which is what distinguishes this from a write failure.

Testing

Built and flashed on Xiaomi 17 Pro Max, HyperOS 4 (OS4.0.8.0.XPBCNXM), Android 17 (SDK 37), arm64-v8a, LSPosed 2.2.1 (API 102) + Zygisk Next 1.5.2. Scopes: 系统界面 / 壁纸 / 息屏显示.

  • Before: steps above leave both switches off
  • After: both switches stay on, and the features still run

The same symptom was reproduced on a second device (Xiaomi tablet, HyperOS 4 / Android 17), which is where this was first noticed; the fix is in shared settings code, not device-specific.

Compatibility

  • No API, scope or permission changes; write() gains four writes for fields HookSettings already carried.
  • Settings written by older builds have no such keys, so they read as false exactly as today. Users will need to turn the switches on once after updating.
  • Existing saved settings are otherwise untouched.

Note on host setting failed noise

While investigating I also hit this in module.log, several times a second while a lock screen was up:

[MCProbe] host setting failed: java.lang.IllegalStateException: Call while result is not pending

It is unrelated to this bug (it comes from HyperMusicCoverRuntimeBridge.send() re-sending an op that failed to deliver), so I left it out of this PR. Happy to open a separate issue with the logs if that is useful.

HookSettings.write() never wrote the four keys that toSettings() reads for
the lock screen music switches, so those switches could not survive a
settings-process restart.

The switches looked like they worked: update() changed the in-memory copy and
Compose redrew, and the features themselves ran because SystemUI is driven by
applySettings() over the probe bridge rather than through this file. The
saved value was simply never written to disk, so the next HookSettingsStore
construction read the default (false) and the switch came back off.

Reopening the settings app is enough to see it: turn on the music lockscreen
and lock screen lyrics switches, dismiss the settings app from recents, open
it again - both switches are off again. Verified against this fix on Xiaomi
17 Pro Max (HyperOS 4, Android 17): both stay on.

The same omission affects two related switches, fixed alongside:

- KEY_LOCKSCREEN_MUSIC_LYRICS_HDR_ENABLED
- KEY_LOCKSCREEN_MUSIC_LYRICS_KEEP_SCREEN_ON

One file, four putBoolean calls, no logic change.

This branch has not been deployed

No deployments
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