Skip to content

Implement SharedArtworkContentProvider to centralize and secure alb…#1683

Merged
theovilardo merged 1 commit into
masterfrom
fix/artwork-file-provider-dedicated
Apr 9, 2026
Merged

Implement SharedArtworkContentProvider to centralize and secure alb…#1683
theovilardo merged 1 commit into
masterfrom
fix/artwork-file-provider-dedicated

Conversation

@theovilardo

Copy link
Copy Markdown
Collaborator

…um art distribution across the system and external controllers.

Core Architecture & Artwork Sharing

  • SharedArtworkContentProvider: Introduced a new ContentProvider to handle artwork requests via a dedicated authority (${applicationId}.artwork). It provides read-only access to cached album art files, improving compatibility with system media style and external metadata consumers.
  • URI Resolution: Implemented robust URI building and parsing logic within the provider to handle song-specific artwork requests, including support for cache-busting tokens (?t=).
  • Manifest Integration: Registered the new provider with exported="true" to allow cross-process artwork access.

Artwork Utilities & Optimization

  • LocalArtworkUri Enhancements:
    • Added support for detecting and parsing "volatile" artwork URIs (legacy cache files and new shared content URIs).
    • Implemented extractCacheBustToken to preserve timestamp metadata during URI transformations.
    • Refactored resolveSongArtworkUri to handle transitions from volatile or legacy URIs to stable internal URI formats.
  • MediaItem Mapping: Updated MediaItemBuilder to use SharedArtworkContentProvider URIs when exposing artwork to external controllers, ensuring consistent image loading in notifications and Wear OS.

Reliability & Testing

  • Unit Tests:
    • Added SharedArtworkContentProviderTest to verify authority building, URI construction, and song ID parsing.
    • Expanded LocalArtworkUriTest to cover legacy cache filename parsing, shared URI resolution, and cache-bust token extraction.
  • Security: Restricted SharedArtworkContentProvider to read-only mode and validated file paths to ensure only legitimate cached artwork is served.

…um art distribution across the system and external controllers.

### Core Architecture & Artwork Sharing
- **SharedArtworkContentProvider**: Introduced a new `ContentProvider` to handle artwork requests via a dedicated authority (`${applicationId}.artwork`). It provides read-only access to cached album art files, improving compatibility with system media style and external metadata consumers.
- **URI Resolution**: Implemented robust URI building and parsing logic within the provider to handle song-specific artwork requests, including support for cache-busting tokens (`?t=`).
- **Manifest Integration**: Registered the new provider with `exported="true"` to allow cross-process artwork access.

### Artwork Utilities & Optimization
- **LocalArtworkUri Enhancements**:
    - Added support for detecting and parsing "volatile" artwork URIs (legacy cache files and new shared content URIs).
    - Implemented `extractCacheBustToken` to preserve timestamp metadata during URI transformations.
    - Refactored `resolveSongArtworkUri` to handle transitions from volatile or legacy URIs to stable internal URI formats.
- **MediaItem Mapping**: Updated `MediaItemBuilder` to use `SharedArtworkContentProvider` URIs when exposing artwork to external controllers, ensuring consistent image loading in notifications and Wear OS.

### Reliability & Testing
- **Unit Tests**:
    - Added `SharedArtworkContentProviderTest` to verify authority building, URI construction, and song ID parsing.
    - Expanded `LocalArtworkUriTest` to cover legacy cache filename parsing, shared URI resolution, and cache-bust token extraction.
- **Security**: Restricted `SharedArtworkContentProvider` to read-only mode and validated file paths to ensure only legitimate cached artwork is served.
@theovilardo theovilardo merged commit c8cee7e into master Apr 9, 2026
3 checks passed
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