Open dbemke opened 12 months ago
Just to clarify here: the bottom sheet appears on older Android versions (8.1 and 10), but not on the newer ones? Is the bottom sheet expected or not? Did it used to not show on Android 10/8.1 and now it does?
Just to clarify here: the bottom sheet appears on older Android versions (8.1 and 10), but not on the newer ones? Is the bottom sheet expected or not? Did it used to not show on Android 10/8.1 and now it does?
I currently can't verify (testing Central) the versions on which appeared but I guess it was introduced in #5738 and so I didn't noticed that while testing the PR or it appeared after merging. As far as I remember the PR introduced the bottom sheet in which the user can choose a camera only in image widget and it wasn't supposed to be in other widgets. I wasn't able to reproduce the issue (back then) on Android 11 ( in the video widget the default camera opened if there were other camera apps installed in the device). Szymon also wasn't able to reproduce it on Android 13.
but I guess it was introduced in https://github.com/getodk/collect/pull/5738
That PR introduces the ability to specify a custom camera app in the form, not to choose one on the fly (correct me if I'm wrong @grzesiek2010). When you get a chance, have a look at this again so we can get a sense of how this behaves in older versions of Collect.
I think I reproduced the same issue (while regression testing in 2024.1. beta 2) but with a crash of the app. The issue occurred on Android 10 ( but not Android 14 case the botton sheet to choose camera doesn't appear). The issue occurs also on 2023.3.1 on the store version. Using a different camera app to record a video in video widget which is on a field-list crashed the app.
Steps to reproduce:
@seadowg @grzesiek2010 I think it's the same issue but it would be great if you could verify and let me know if I should file a separate issue for that.
Logs of the crash:
2024-02-05 10:58:00.328 19591-21780 DatabaseUtils android.process.media E Writing exception to parcel java.lang.SecurityException: org.odk.collect.android has no access to content://media/external_primary/video/media/41863 at com.android.providers.media.MediaProvider.enforceCallingPermissionInternal(MediaProvider.java:5915) at com.android.providers.media.MediaProvider.enforceCallingPermission(MediaProvider.java:5838) at com.android.providers.media.MediaProvider.checkAccess(MediaProvider.java:5935) at com.android.providers.media.MediaProvider.openFileAndEnforcePathPermissionsHelper(MediaProvider.java:5565) at com.android.providers.media.MediaProvider.openFileCommon(MediaProvider.java:5375) at com.android.providers.media.MediaProvider.openTypedAssetFileCommon(MediaProvider.java:5407) at com.android.providers.media.MediaProvider.openTypedAssetFile(MediaProvider.java:5387) at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:516) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:307) at android.os.Binder.execTransactInternal(Binder.java:1024) at android.os.Binder.execTransact(Binder.java:997) 2024-02-05 10:58:00.332 21020-21579 AndroidRuntime org.odk.collect.android E FATAL EXCEPTION: AsyncTask #2 Process: org.odk.collect.android, PID: 21020 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.SecurityException: org.odk.collect.android has no access to content://media/external_primary/video/media/41863 at android.os.Parcel.createException(Parcel.java:2074) at android.os.Parcel.readException(Parcel.java:2042) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188) at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:151) at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705) at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1702) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1518) at android.content.ContentResolver.openInputStream(ContentResolver.java:1202) at org.odk.collect.android.utilities.FileUtils.saveAnswerFileFromUri(Unknown Source:4) at org.odk.collect.android.tasks.MediaLoadingTask.doInBackground(SourceFile:0) at org.odk.collect.android.tasks.MediaLoadingTask.doInBackground(SourceFile:0) at android.os.AsyncTask$3.call(AsyncTask.java:378) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919)
@dbemke this looks unrelated to the bottom sheet to me. I reckon it should be a separate issue. As far as I can tell, it's a match for this crash report.
this looks unrelated to the bottom sheet to me. I reckon it should be a separate issue.
@dbemke did this issue ever get filed?
@dbemke did this issue ever get filed?
Sorry it slipped my mind during regression testing. I'll file it. Thanks for reminding
I reproduced the steps from the main issue on 2022.4.4 on Andorid 10 Redmi 9T. On that version there is a crash after trying to record a video via OpenCamera app in Video widget Steps:
Logs from the crash:
2024-02-14 14:54:05.827 20726-21985 DatabaseUtils android.process.media E Writing exception to parcel java.lang.SecurityException: org.odk.collect.android has no access to content://media/external_primary/video/media/43490 at com.android.providers.media.MediaProvider.enforceCallingPermissionInternal(MediaProvider.java:5915) at com.android.providers.media.MediaProvider.enforceCallingPermission(MediaProvider.java:5838) at com.android.providers.media.MediaProvider.checkAccess(MediaProvider.java:5935) at com.android.providers.media.MediaProvider.openFileAndEnforcePathPermissionsHelper(MediaProvider.java:5565) at com.android.providers.media.MediaProvider.openFileCommon(MediaProvider.java:5375) at com.android.providers.media.MediaProvider.openTypedAssetFileCommon(MediaProvider.java:5407) at com.android.providers.media.MediaProvider.openTypedAssetFile(MediaProvider.java:5387) at android.content.ContentProvider$Transport.openTypedAssetFile(ContentProvider.java:516) at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:307) at android.os.Binder.execTransactInternal(Binder.java:1024) at android.os.Binder.execTransact(Binder.java:997) 2024-02-14 14:54:05.836 31330-31519 AndroidRuntime org.odk.collect.android E FATAL EXCEPTION: AsyncTask #1 Process: org.odk.collect.android, PID: 31330 java.lang.RuntimeException: An error occurred while executing doInBackground() at android.os.AsyncTask$4.done(AsyncTask.java:399) at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383) at java.util.concurrent.FutureTask.setException(FutureTask.java:252) at java.util.concurrent.FutureTask.run(FutureTask.java:271) at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641) at java.lang.Thread.run(Thread.java:919) Caused by: java.lang.SecurityException: org.odk.collect.android has no access to content://media/external_primary/video/media/43490 at android.os.Parcel.createException(Parcel.java:2074) at android.os.Parcel.readException(Parcel.java:2042) at android.database.DatabaseUtils.readExceptionFromParcel(DatabaseUtils.java:188) at android.database.DatabaseUtils.readExceptionWithFileNotFoundExceptionFromParcel(DatabaseUtils.java:151) at android.content.ContentProviderProxy.openTypedAssetFile(ContentProviderNative.java:705) at android.content.ContentResolver.openTypedAssetFileDescriptor(ContentResolver.java:1702) at android.content.ContentResolver.openAssetFileDescriptor(ContentResolver.java:1518) at android.content.ContentResolver.openInputStream(ContentResolver.java:1202) at org.odk.collect.android.utilities.FileUtils.saveAnswerFileFromUri(FileUtils.java:93) at org.odk.collect.android.tasks.MediaLoadingTask.doInBackground(MediaLoadingTask.java:48) at org.odk.collect.android.tasks.MediaLoadingTask.doInBackground(MediaLoadingTask.java:24)
I reproduced the steps from the main issue on 2022.4.4 on Andorid 10 Redmi 9T. On that version there is a crash after trying to record a video via OpenCamera app in Video widget
That's the same crash, so should be part of the new issue I think.
ODK Collect version
the master version c5fd96ed9a06fa7a67182347b2b6fe7c808d04da
Android version
10, 8.1
Device used
Redmi 9T, Nexus 5x
Problem description
In the Video widget there is a bottom sheet with camera apps installed in the device. If a user tries to record a video with an app different then the default camera, the video is recorded. The bottom sheet doesn’t appear on Android 11 (Samsung), Android 13 (Pixel 6a).
Steps to reproduce the problem
Expected behavior
In the video widget the bottom sheet for custom cameras shouldn’t appear.
Other information
I noticed the issue while testing the error inline PR5725 and with those changes Collect crashes after recording a video with a different app.