Skip to content

Report unreadable cropper sources with the loader's error codes - #72

Merged
codenameakshay merged 1 commit into
mainfrom
fix/android-cropper-unreadable-uri
Sep 15, 2026
Merged

codenameakshay merged 1 commit into
mainfrom
fix/android-cropper-unreadable-uri

Conversation

@codenameakshay

Copy link
Copy Markdown
Owner

When systemCropper got a content URI that no longer exists, it returned failed — system-ui-failed — Unable to open the wallpaper cropper. Android resolves the crop intent by the URI's MIME type. getType returns null for a missing row, the intent lookup finds nothing, and getCropAndSetWallpaperIntent throws.

 openSystemCropper(uri)
+  getType(uri) == null       → failed · source-unavailable
+  getType(uri) not image/*   → failed · invalid-content-type
   getCropAndSetWallpaperIntent(uri) → startActivity → previewOpened

These are the same codes the direct path already uses for the same URI.

Verification

  • API 36 emulator:
    • content://media/external/images/media/1 (missing) → failed — source-unavailable — The content URI could not be read., with the same result for Home and Lock.
    • A downloaded MediaStore image still opens WallpaperCropActivity → previewOpened.
  • Tests: a JVM test covers the MIME-type mapping.
  • Local CI: pass.

🤖 Generated with Claude Code

Android resolves the crop-and-set intent by the URI's MIME type. For a
content URI that no longer exists, getType returns null, the lookup
fails, and getCropAndSetWallpaperIntent throws. The plugin reported that
as a generic system-ui-failed. It now checks the type first and returns
source-unavailable or invalid-content-type, as the direct path does.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@codenameakshay
codenameakshay merged commit 8b5bbfa into main Sep 15, 2026
6 checks passed
@codenameakshay
codenameakshay deleted the fix/android-cropper-unreadable-uri 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