Skip to content

feat(playback): pause on volume zero + OOM fix for large Telegram channels#2415

Open
Amonoman wants to merge 4 commits into
PixelPlayerHQ:masterfrom
Amonoman:master
Open

feat(playback): pause on volume zero + OOM fix for large Telegram channels#2415
Amonoman wants to merge 4 commits into
PixelPlayerHQ:masterfrom
Amonoman:master

Conversation

@Amonoman

@Amonoman Amonoman commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Changes

Pause when volume reaches zero

  • Add PAUSE_ON_VOLUME_ZERO DataStore preference to UserPreferencesRepository
  • Observe system volume via ContentObserver on Settings.System.CONTENT_URI to detect hardware volume key changes
  • Pause playback when media stream hits 0, resume is unaffected
  • ReplayGain programmatic volume adjustments are unaffected
  • Add Volume subsection with toggle to Playback settings in SettingsCategoryScreen
  • Wire pauseOnVolumeZero into SettingsViewModel uiState and setter
  • Inject settings_volume_section, settings_pause_on_volume_zero and _desc into strings_settings.xml for all 12 locales (ar, de, es, fr, in, it, ko, nb, ru, tr, zh-rCN)

OOM fix for large Telegram channels

  • Telegram sync previously loaded all songs into memory at once, exhausting the 256 MB heap on large channels (reproduced at 65k songs)
  • Songs are now processed and flushed to Room in batches of 500, keeping peak memory bounded regardless of channel size
  • Tested with 1121 songs across 3 chunks on a Pixel 8a — no crash, no OOM
  • Remove duplicate getAllArtistsListRaw() call (was called twice)

Fixes #2172

Amonoman added 3 commits June 19, 2026 19:54
- Add PAUSE_ON_VOLUME_ZERO DataStore key + flow + setter to UserPreferencesRepository
- Collect pref in MusicService and pause playback when volume hits 0
- ReplayGain programmatic volume adjustments are unaffected
- Add Python script to inject localized strings into all 12 locale files
- Add ContentObserver on Settings.System.CONTENT_URI to detect hardware
  volume key changes and pause when media stream reaches 0
- Registers observer in onCreate, unregisters in onDestroy
- Add Volume subsection with SwitchSettingItem to SettingsCategoryScreen
- Add pauseOnVolumeZero field to SettingsUiState
- Add pauseOnVolumeZeroFlow to SettingsViewModel combine() block
- Add setPauseOnVolumeZero() setter in SettingsViewModel
- Inject settings_volume_section, settings_pause_on_volume_zero and _desc
  into strings_settings.xml for all 12 locales
- Remove duplicate keys from strings.xml (AAPT2 duplicate resources fix)
- Fix rogue spaces in Korean strings_settings.xml entries
Processing all songs in a single pass exhausted the 256 MB heap on
devices with large Telegram channels (reproduced at 65k songs, PixelPlayerHQ#2172).
Songs are now processed and flushed to Room in batches of 500, keeping
peak memory bounded regardless of channel size.

- Album songCounts accumulated across all chunks; every chunk re-upserts
  albums it touches so the final count is always correct
- Deletion diff runs after all chunks using the complete synced ID set
- Deletions batched in 500s to respect SQLite variable limits
- Remove duplicate getAllArtistsListRaw() call (was called twice)

Co-authored-by: Claude <claude@anthropic.com>
@Amonoman Amonoman changed the title Add pause-on-volume-zero feature and update settings UI feat(playback): pause on volume zero + OOM fix for large Telegram channels Jun 21, 2026
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.

[Bug]: force closed

1 participant