element-android
element-android copied to clipboard
Crash when accessing a local file and permission is revoked
In airplane mode (so no network)
- Open a room
- Send an attachment (image from the gallery for instance) to the room. It won't be sent of course
- Kill the app
- Open the same room
- Long click of the pending event with the attachment
- Observe the crash:
Caused by: java.lang.SecurityException: UID 10568 does not have permission to content://com.android.providers.media.documents/document/video%3A13374 [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs
at android.os.Parcel.createException(Parcel.java:2088)
at android.os.Parcel.readException(Parcel.java:2056)
at android.os.Parcel.readException(Parcel.java:2004)
at android.app.IActivityTaskManager$Stub$Proxy.startActivity(IActivityTaskManager.java:4454)
at android.app.Instrumentation.execStartActivity(Instrumentation.java:1716)
at android.app.Activity.startActivityForResult(Activity.java:5258)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:574)
at android.app.Activity.startActivityForResult(Activity.java:5203)
at androidx.activity.ComponentActivity.startActivityForResult(ComponentActivity.java:560)
at android.app.Activity.startActivity(Activity.java:5587)
at android.app.Activity.startActivity(Activity.java:5555)
at im.vector.app.features.home.room.detail.RoomDetailFragment.openFile(RoomDetailFragment.kt:630)
at im.vector.app.features.home.room.detail.RoomDetailFragment.startOpenFileIntent(RoomDetailFragment.kt:619)
at im.vector.app.features.home.room.detail.RoomDetailFragment.access$startOpenFileIntent(RoomDetailFragment.kt:214)
at im.vector.app.features.home.room.detail.RoomDetailFragment$onViewCreated$14.invoke(RoomDetailFragment.kt:393)
at im.vector.app.features.home.room.detail.RoomDetailFragment$onViewCreated$14.invoke(RoomDetailFragment.kt:377)
- We should only use the local file to render in the bottom sheet and not the original file location.
(I cannot repro on an emulator today, will try on a real device)
@bmarty did you reproduce this issue on a real device?
We have a similar issue on Tchap
Maybe linked to : https://github.com/vector-im/element-android/issues/6377
reproduced in Element
https://github.com/element-hq/element-android/assets/1191674/99d62f86-4bc4-4292-9526-3bc49a391262
- Switch to Airplane Mode
- Open a room
- Add a PDF file in the timeline
- You can open the local file (you have the permission)
- Go back to home
- Re-Open the same room
- Click on the PDF file (you loose the permission)