Repository navigation
Conversation
LibreCamera registers for IMAGE_CAPTURE / IMAGE_CAPTURE_SECURE but never read the launching intent, so apps requesting a photo (e.g. via ActivityResultContracts.TakePicture) never got a result and the camera just behaved like a normal launch. When started with one of these actions, the processed JPEG is now written to EXTRA_OUTPUT (or returned as a small "data" bitmap if no output URI is given), RESULT_OK is set and the activity finishes. The photo is not saved to the gallery in that case, matching the behavior of other camera apps. The camera is released before finishing to avoid preview frames hitting the detached Flutter engine. VIDEO_CAPTURE has the same problem and is not handled yet. Related: iakdis#82 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
LibreCamera registers for
IMAGE_CAPTURE/IMAGE_CAPTURE_SECUREin the manifest, but never reads the launching intent. Apps that request a photo (e.g. viaActivityResultContracts.TakePicture) can pick LibreCamera, but it behaves like a normal launch: the photo goes to the gallery and nothing is returned to the caller.Changes
MainActivity.kt: two new calls on the existingmedia_storechannelisCaptureRequest: whether the activity was started withIMAGE_CAPTURE(_SECURE)finishCapture: writes the JPEG toEXTRA_OUTPUT, or returns a small bitmap in thedataextra if no output URI was given, thensetResult(RESULT_OK)+finish(). Falls back toRESULT_CANCELEDif writing fails.onNewIntentupdates the intent (activity issingleTop).camera_page.dart: in capture mode,takePicture()hands the processed JPEG tofinishCaptureinstead of saving it to the gallery. This matches what other camera apps do. The camera is released first; otherwise late preview frames hit the detached Flutter engine afterfinish()and crash the app.Normal launches are unchanged.
Testing
Tested on a Pixel 8 Pro (Android 17), debug and release builds:
am start -a android.media.action.IMAGE_CAPTURE→ activity finishes after capture, no gallery entryTakePicture()→ photo arrives in the calling app, no crashNot covered
VIDEO_CAPTUREhas the same issue and is not handled here.FlutterJNI is not attached to native(same root cause as above, but on master).Related to #82
🤖 Generated with Claude Code