Skip to content

Feature: Advanced App Backup (v2), Native Spatializer (API 32+) & UI Polish#43

Open
YisusPineapple wants to merge 10 commits into
MrDemonc:mainfrom
YisusPineapple:feature/spatializer-refactoring-(API-32+)
Open

Feature: Advanced App Backup (v2), Native Spatializer (API 32+) & UI Polish#43
YisusPineapple wants to merge 10 commits into
MrDemonc:mainfrom
YisusPineapple:feature/spatializer-refactoring-(API-32+)

Conversation

@YisusPineapple

Copy link
Copy Markdown
Contributor

Description

This pull request significantly modernizes Lune's infrastructure by introducing a full-featured Application State Backup & Restore Engine (Backup v2) and migrating to the platform-native Spatializer API (API 32+) to resolve legacy deprecation warnings under Android 15 (targetSdk 36). It also includes UI refinements and localized Spanish corrections.


Key Enhancements

1. Advanced Application State Backup & Restore (v2)

  • Favorites & Metadata Overrides: The backup engine now serializes and restores the entire song_overrides database table [MusicDatabase.kt]. This preserves customized metadata (titles, artists, genres), custom local covers, and all liked/favorite statuses (isFavorite = true).
  • Lune Settings: Serializes the complete state of SettingsManager using a type-safe nested data model (SettingsBackupData). This prevents type-safety issues during GSON deserialization and guarantees exact recovery of audio configurations, layout preferences, and custom themes.
  • Accumulated Statistics: Packages the SQLite playback_stats table to preserve home screen cards and overall stats across device migrations.
  • Backward Compatibility: Fully guaranteed. If a legacy v1 backup (containing only playlists) is imported, the engine falls back gracefully to playlist-only restoration without throwing exceptions.

2. Material 3 Expressive Loader & Thread Safety

  • Replaced instantaneous toasts with a Material 3 non-dismissible AlertDialog during file I/O operations.
  • The loader employs the hardware-accelerated CircularWavyProgressIndicator driven by a lightweight, infinite-loop transition—providing smooth expressive rendering friendly on modest devices.
  • Implemented a step-by-step state transition ("Importing...""Finalizing restoration...") backed by a 1200ms coroutine delay. This ensures that SQLite transactional writes and journal files are fully flushed on disk before recreating the active Activity context.

3. Native Spatial Audio Engine (API 32+)

  • Dynamic Spatializer Configuration: Configures platform-native spatialization behavior on modern Android 12+ (API 32+) devices by programmatically setting setSpatializationBehavior(AudioAttributes.SPATIALIZATION_BEHAVIOR_AUTO) during MediaPlayer instantiation (playSong and performCrossfade). If disabled, it falls back cleanly to SPATIALIZATION_BEHAVIOR_NEVER.
  • Stable Fallback Pipeline: Devices running on older platform versions below API 32 continue utilizing Lune's high-fidelity Virtualizer audio effect bound to the active MediaPlayer audio session ID, maintaining stable backward compatibility and eliminating compiler deprecation warnings under API 35/36.

4. Dynamic Language & UI Hot-Reload

  • On successful import, the engine dynamically invokes AppCompatDelegate.setApplicationLocales(LocaleListCompat.forLanguageTags(code)) on the Main Thread and triggers an immediate context recreate() to apply the restored language and theme configurations without requiring a manual app restart.

5. Spanish Localization Cleanup

  • Fixed inconsistent English strings in Spanish resources (values-es/strings.xml):
    • "Cover player""Carátula del reproductor"
    • "Control player""Controles del reproductor"
    • "Export/Import Playlists""Exportar/Importar copia de seguridad"
  • Fully localized standard options (Shuffle, Timer, Lyrics, Automix, etc.) for a polished native user experience.

Technical Specifications

  • Minimum SDK: 24 (Tested and verified on Android 15 / targetSdk 36).
  • Concurrency: Heavy I/O disk writes and Room database transactions are strictly bound to Coroutines running on Dispatchers.IO to keep Dispatchers.Main lightweight and prevent frame drops.
  • R8 Minification Safety: All new backup-specific data structures are protected from obfuscation under Lune's general ProGuard rules.

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