Skip to content

About

Vector / libxposed module that stops Bluetooth multipoint pause/resume loops with Spotify Connect on Android.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Spotify Multipoint Guard

A lightweight Vector / libxposed (API 101–102) module for Android that fixes the Bluetooth Multipoint + Spotify Connect pause/resume loop when Spotify is open on both your Android phone and another device (such as a laptop).


Why This Bug Happens

When multipoint Bluetooth headphones are connected to both your phone and your laptop with Spotify open on both:

  1. Even while your laptop is playing, Spotify on Android publishes PlaybackState.STATE_PLAYING to Android's MediaSession.
  2. Android's Bluetooth AVRCP / LE Audio stack (AvrcpTargetService & MediaControlGattService) sees STATE_PLAYING and tells your headphones "Phone is now playing".
  3. Your multipoint headphones immediately send PAUSE to your laptop (or inject dedicated KEYCODE_MEDIA_PAUSE into your phone during A2DP handoffs).
  4. Spotify Connect syncs the pause/play state back and forth between devices, causing an endless pause/resume loop whenever you lock your phone or receive notifications.

Features

  • Framework-Level Hooks (Update-Resilient): Scoped exclusively to com.spotify.music and hooks standard Android framework APIs (MediaSession, MediaSession.Callback, AudioTrack, AudioManager, AudioFocusRequest.Builder, and dynamically queried ACTION_MEDIA_BUTTON / ACTION_AUDIO_BECOMING_NOISY receivers)—no reliance on obfuscated Spotify class names.
  • Remote Playback (Spotify Connect) Protection:
    • Hide Remote STATE_PLAYING from Bluetooth: Clamps MediaSession.setPlaybackState(STATE_PLAYING / STATE_BUFFERING) to STATE_PAUSED while Spotify is playing on another device, so Bluetooth AVRCP never tricks your headphones into pausing your laptop.
    • Block Remote Media Keys, Transport Callbacks & Broadcasts: Swallows external Play/Pause/Stop commands arriving on your phone during remote playback while keeping in-app Spotify controls and local phone playback working normally.
  • Local Playback Protection (Safe by Default):
    • Pause/Resume Oscillation Loop Breaker: Detects rapid opposing Play/Pause ping-ponging (< 2.5 s) and dampens commands for a 3 s cooldown without blocking normal single pauses or earbud disconnect pausing.
    • Opt-In Advanced Overrides (OFF by default): Optional toggles to ignore dedicated local KEYCODE_MEDIA_PAUSE or transient/permanent audio focus losses if you specifically need them, with clear UI warnings.
    • Normal ACTION_AUDIO_BECOMING_NOISY and audio focus handoffs (YouTube, Instagram, putting earbuds in the case) are left completely untouched by default.
  • Modern Miuix Compose UI:
    • Built with Miuix (0.9.4), edge-to-edge layout, collapsing TopAppBar, spring overscroll, Light/Dark theme, and tactile haptics.
    • Live Vector API 102 status hero card (service.runningTargets), quick presets (Recommended, Strict, Custom), and live-synced preferences via XposedService.getRemotePreferences (no Spotify restart required when toggling settings).
    • 3-Tier Seamless Restart: Zero-root in-process Spotify restart once hooked, su force-stop on first setup if granted, or a clean dialog fallback.

Requirements

  • Rooted Android 8.1+ (API 27+) device
  • Vector (or any Xposed framework supporting libxposed API 101+ — legacy LSPosed v1.9.x API 93 is not supported)
  • Official Spotify Android app (com.spotify.music)

Package ID: io.github.realmoai.multipointguard


Installation

  1. Download or build app-release.apk and install it on your device.
  2. Open Vector Manager → Modules and enable Spotify Multipoint Guard.
  3. Confirm com.spotify.music is checked in the module scope (auto-configured via META-INF/xposed/scope.list).
  4. Open Spotify Multipoint Guard and tap Restart Spotify (or force-stop and reopen Spotify once).

Building from Source

# Run unit tests
./gradlew testDebugUnitTest

# Build debug & minified release APKs
./gradlew assembleDebug assembleRelease

APKs are written to:

  • app/build/outputs/apk/release/app-release.apk
  • app/build/outputs/apk/debug/app-debug.apk

Troubleshooting

  • Enable Verbose Logs: Toggle Verbose Xposed Logs in the module UI and inspect Vector Manager → Logs (tag: SpotifyMultipointGuard).
  • Brief 1-second audio dip when using messaging apps (e.g., Telegram): Some messaging apps open a short SoundPool/AudioTrack even when audible sound effects are muted, which causes multipoint headphones to briefly switch A2DP to your phone and back. Disable both In-App Sounds and In-Chat Sounds in the messaging app if supported.

License

MIT

About

Vector / libxposed module that stops Bluetooth multipoint pause/resume loops with Spotify Connect on Android.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages