Skip to content

Reload live wallpapers when the same component is set again - #73

Merged
codenameakshay merged 1 commit into
mainfrom
fix/android-live-wallpaper-reapply
Sep 15, 2026
Merged

codenameakshay merged 1 commit into
mainfrom
fix/android-live-wallpaper-reapply

Conversation

@codenameakshay

Copy link
Copy Markdown
Owner

When the plugin's video wallpaper was already active, setting a new video (prepare, preview, Set wallpaper) showed the new video in the preview, but the home screen kept playing the old one. Android 11+ does not rebind the same component. It sends the running engine android.wallpaper.reapply, and neither engine handled that command. The OpenGL engine had the same gap for a new shader configuration.

sequenceDiagram
    participant User
    participant WMS as WallpaperManagerService
    participant Home as Running home engine
    User->>WMS: Set wallpaper (same component)
    WMS-->>Home: onCommand("android.wallpaper.reapply")
    Note over Home: before: ignored, old video keeps playing
    Home->>Home: after: replace player / swap OpenGL configuration
Loading

Before: the preview shows video B, but home still plays A.

After: home with A, then the B preview, then home with B.

Limitation: Android 10 and older never send the command, so there the new content appears once the surface is recreated. The Android guide says so.

Verification

  • API 36 emulator: switching from video A to video B now changes the home screen to B, and the frames keep advancing. OpenGL set and re-set still render.
  • Tests: JVM tests cover the playback state machine on reapply and pin the command string.
  • Local CI: pass.

🤖 Generated with Claude Code

When the plugin's live wallpaper is already active and the user sets it
again, Android 11+ keeps the running engine and sends it the
"android.wallpaper.reapply" command instead of rebinding. Neither the
video nor the OpenGL engine handled that command, so the home screen
kept playing the previous video or shader even though the preview had
shown the new one.

The video engine now replaces its player, and the OpenGL render thread
swaps in the saved configuration, when the command arrives. Android 10
and older never send it; the docs say so.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codenameakshay
codenameakshay merged commit 62cd180 into main Sep 15, 2026
6 checks passed
@codenameakshay
codenameakshay deleted the fix/android-live-wallpaper-reapply branch September 16, 2026 09:44
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