Status Update
Comments
wu...@google.com <wu...@google.com> #2
mw...@gmail.com <mw...@gmail.com> #3
Great! Thanks a lot, I'll look for the live updates soon!
wu...@google.com <wu...@google.com>
ch...@google.com <ch...@google.com>
ch...@google.com <ch...@google.com> #4
Update some findings first (this issue can be reproduced on Samsung sm-a325f Android 12 device in the test lab.):
- This issue happens when setting a
fused
(LocationManager.FUSED_PROVIDER) location data. If the setting location data is created with LocationManager.GPS_PROVIDER, the issue doesn't happen. - This issue won't happen if the location data is set via
.CaptureRequest.JPEG_GPS_LOCATION - This issue won't happen if an unnecessary Exif copy operation
is skipped (the latest codebase version).here
Item #3 can be done in CameraX library to avoid the issue, but we still need to clarify the real root cause with ExifInterface owner.
ch...@google.com <ch...@google.com> #5
Reported
ap...@google.com <ap...@google.com> #6
Branch: androidx-main
commit 2db6d01af84b5752190c6dd28cdea12500b701cb
Author: Charcoal Chen <charcoalchen@google.com>
Date: Fri Dec 23 10:15:10 2022
Fix JPEG image corruption issue if writing Exif location data on some Samsung Android 12 devices
This issue can be avoided in CameraX side by skipping the unnecessary Exif data copy. But there should still be some unknown reason in ExifInterface or these problematic devices to cause the issue.
Relnote: "Fixed JPEG image corruption issue if writing Exif location data on some Samsung Android 12 devices."
Bug: 263289024
Test: ImageCaptureTest
Change-Id: Ib70862aa6e654f06b9358e3f92bbb98c86cb9caf
M camera/camera-core/src/main/java/androidx/camera/core/impl/utils/Exif.java
M camera/integration-tests/coretestapp/src/androidTest/java/androidx/camera/integration/core/ImageCaptureTest.kt
ey...@gmail.com <ey...@gmail.com> #7
Additional to the devices that was reported here, we were able to reproduce the issue on Samsung M32 (SM-M325FV) with Android version 13.
As pointed above, If the setting location data is created with LocationManager.GPS_PROVIDER, the issue doesn't happen.
Since we use Fused Location API and as a temproray workaround, we simply change the "provider" field of the location data from "fused" to "gps" before passing it to ImageCapture.Metadata.
ch...@google.com <ch...@google.com> #8
Hi,
The changes CameraX can do to avoid this issue (skipping the unnecessary Exif data copy) has been merged to the mainline and also version 1.2 release branch. Once CameraX 1.3.0-alpha03 and 1.2.1 are released, you can try to use them to verify whether a FUSED_PROVIDER location can be written successfully.
I will update this issue status as Fixed. The ExifInterface side issue will be tracked by
pr...@google.com <pr...@google.com> #9
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.camera:camera-core:1.3.0-alpha03
Description
CAMERAX VERSION: 1.1.1, 1.2.0
CAMERA APPLICATION NAME AND VERSION: (Settings > Apps > (app name) > version) CameraXBasic demo 1.0.0
ANDROID OS BUILD NUMBER: (Settings > About > Build number):
SP1A.210812.016.A136U1UES2BVI1
Note that this has happened on all Android 12 variants we've tested
DEVICE NAME: Samsung A13, Samsung A32, Samsung A12 (Only with Android 12)
DESCRIPTION:
LIST ANY EXPERIMENTAL FEATURES: (As an example - @ExperimentalCamera2Interop) None
STEPS TO REPRODUCE: Using CameraXBasic Demo app:
OBSERVED RESULTS: A corrupt JPEG file is created with an invalid EXIF header. The length of the EXIF section appears to be invalid, which prevents the photo from being viewable.
In the app, the photo preview has an all black screen. The thumbnail does not show up either. In the we see Glide failing to create a thumbnail and the app is unable to get the dimensions of the photo. Inspecting these files with a hex editor, indicates an invalid EXIF header that has the wrong length field. Manually overwriting the length to match the size before the IDR block (indicated by FFD8) will allow these photos to be viewable.
EXPECTED RESULTS: Photo should be viewable. Thumbnail should be created.
REPRODUCIBILITY: (5 of 5, 1 of 100, etc)
ADDITIONAL INFORMATION: We released this code in our app and have seen thousands of corrupted photos come through on several variants of Samsung A series devices running Android 12. This problem did not reproduce with the devices with the stock version of Android they came with. These devices are supposedly tested by google test lab but it seems they must not be testing them with Android 12.
CODE FRAGMENTS (this will help us troubleshoot your issues): See:https://github.com/mwolfeaxon/cameraxdemo
This demo is the same as https://github.com/android/camera-samples/tree/master/CameraXBasic
but with a Location object added to Metadata of OutputFileOptions.
Relevant code to reproduce: