element-hq / element-hq/element-android

Crash when accessing a local file and permission is revoked

Open
#3,616 5 comments 0 reactions 0 assignees View on GitHub
O-Occasional S-Major Z-Crash
Dominant language
Kotlin
Stars
3.7k
Forks
917
Avg merge
8d 20h
Merged PRs (30d)
1

Description

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.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.