Fix camera capture crash on devices with removable SD cards #89
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.
On Android SDK 23 devices with removable SD cards,
getExternalCacheDir()returns a path on the SD card (e.g.,/storage/1234-5678/Android/data/.../cache/), but FileProvider'sexternal-cache-pathonly maps to primary external storage, causingIllegalArgumentExceptionwhen capturing photos.Changes
IllegalArgumentExceptionfrom FileProvider and fall back to internal cache directory<cache-path>element to enable FileProvider URIs for internal cacheThe existing
getExternalDir()fallback handles null external cache; this handles valid external paths that FileProvider rejects.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
dl.google.com/usr/lib/jvm/temurin-17-jdk-amd64/bin/java /usr/lib/jvm/temurin-17-jdk-amd64/bin/java --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.lang.invoke=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.prefs/java.util.prefs=ALL-UNNAMED --add-opens=java.base/java.nio.charset=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED --add-opens=java.xml/javax.xml.namespace=ALL-UNNAMED -Xmx4608m -Dfile.encoding=UTF-8 -Duser.country -Duser.language=en -Duser.variant -cp /home/REDACTED/.gradle/wrapper/dists/gradle-8.13-bin/5xuhj0ry160q40clulazy9h7d/gradle-8.13/lib/gradle-daemon-main-8.13.jar(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>clicking the quick-camera button doesn't work</issue_title>
<issue_description>device specs:
``
device=HUAWEI CAM-L21 (CAM-L21)
android=6.0 (C403B173, CAM-L21C403B173)
sdk=23
12-17 12:20:47.761 31095 31095 🟠 X0 : onCreate(null)
12-17 12:20:47.768 31095 31095 🔵 AppCompatDelegate: You should now use the AppCompatDelegate.FEATURE_SUPPORT_ACTION_BAR_OVERLAY id when requesting this feature.
12-17 12:20:47.991 31095 31095 🔵 ConversationActivity: handleSecurityChange(false, true)
12-17 12:20:48.028 31095 31105 🔵 art : Background partial concurrent mark sweep GC freed 4461(352KB) AllocSpace objects, 12(1140KB) LOS objects, 15% free, 22MB/26MB, paused 13.507ms total 61.164ms
12-17 12:20:48.073 31095 31095 🔵 o0 : ⏰ getChatMsgs(242): 2ms
12-17 12:20:49.888 31095 31095 🔵 ConversationActivity: onConfigurationChanged(1)
12-17 12:20:50.009 31095 31095 🔵 w : rotation changed
12-17 12:20:50.009 31095 31095 🔵 w : onKeyboardClose()
12-17 12:20:50.009 31095 31095 🔵 ScaleStableImageView: Keyboard hidden
12-17 12:20:50.038 31095 31105 🔵 art : Background partial concurrent mark sweep GC freed 1714(103KB) AllocSpace objects, 3(108KB) LOS objects, 12% free, 28MB/32MB, paused 4.570ms total 102.070ms
12-17 12:20:50.539 31095 31105 🔵 art : Background sticky concurrent mark sweep GC freed 6262(363KB) AllocSpace objects, 0(0B) LOS objects, 0% free, 34MB/34MB, paused 1.743ms total 208.121ms
12-17 12:20:50.649 31095 31105 🔵 art : Background partial concurrent mark sweep GC freed 846(58KB) AllocSpace objects, 3(6MB) LOS objects, 12% free, 28MB/32MB, paused 1.823ms total 108.714ms
12-17 12:20:52.752 31095 31095 🟠 j : java.lang.IllegalArgumentException: Failed to find configured root that contains /storage/1234-5678/Android/data/chat.delta.lite/cache/1765992052741.jpg
12-17 12:20:52.752 31095 31095 🟠 j : at androidx.core.content.FileProvider$SimplePathStrategy.android.net.Uri getUriForFile(java.io.File)(FileProvider.java:867)
12-17 12:20:52.752 31095 31095 🟠 j : at androidx.core.content.FileProvider.android.net.Uri getUriForFile(android.content.Context,java.lang.String,java.io.File)(FileProvider.java:467)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.util.FileProviderUtil.android.net.Uri getUriFor(android.content.Context,java.io.File)(FileProviderUtil.java:19)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.providers.PersistentBlobProvider.android.net.Uri createForExternal(android.content.Context,java.lang.String)(PersistentBlobProvider.java:126)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.mms.AttachmentManager.void lambda$capturePhoto$4(android.app.Activity,int)(AttachmentManager.java:528)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.permissions.PermissionsRequest.void onResult(java.lang.String[],int[],boolean[])(PermissionsRequest.java:57)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.permissions.Permissions$PermissionsBuilder.void executePreGrantedPermissionsRequest(org.thoughtcrime.securesms.permissions.PermissionsRequest)(Permissions.java:166)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.permissions.Permissions$PermissionsBuilder.void execute()(Permissions.java:154)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.mms.AttachmentManager.void capturePhoto(android.app.Activity,int)(AttachmentManager.java:538)
12-17 12:20:52.752 31095 31095 🟠 j : at org.thoughtcrime.securesms.ConversationActivity.void lambda$initializeViews$14(android.view.View)(ConversationActivity.java:927)
12-17 12:20:52.752 31095 31095 🟠 j : at android.view.View.performClick(View.java:5273)
12-17 12:20:52.752 31095 31095 🟠 j : at android.view.View$PerformClick.run(View.java:21315)
12-17 12:20:52.752 31095 31095 🟠 j : at android.os.Handler.handleCallback(Handler.java:743)
12-17 12:20:52.752 31095 31095 🟠 j : at android.os.Handler.dispatchMessage(Handler.java:95)
12-17 12:20:52.752 31095 31095 🟠 j : at android.os.Looper.loop(Looper.java:150)
12-17 12:20:52.752 31095 31095 🟠 j : at android.app.ActivityThread.main(ActivityThread.java:5665)
12-17 12:20:52.752 31095 31095 🟠 j : at java.lang.reflect.Method.invoke(Native Method)
12-17 12:20:52.752 31095 31095 🟠 j : at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822)
12-17 12:20:52.752 31095 31095 🟠 j : at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)
12-17 12:20:55.785 31095 31149 🟠 DeltaChat: [accId=1] src/scheduler.rs:423: Failed inbox fetch_idle: idle: INBOX: IMAP IDLE protocol timed out: deadline has elapsed.
...
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.