Group Media Gallery: Black screen when tapping a picture s/o else sent (and no sliding possible)
I have:
- [x] searched open and closed issues for duplicates
- [x] read https://github.com/WhisperSystems/Signal-Android/wiki/Submitting-useful-bug-reports
Bug description
In the media gallery ("All media") of a signal Group, if I tap on a preview of a picture someone else has sent, the image doesn't load and show, instead a black screen appears. Also, swiping to the next picture isn't possible in that case. Note: When entering the ViewPager by tapping a picture sent by myself, I'm able to access all other pictures by sliding without any issues. It seems the ViewPager activity doesn't "find" the picture (offset) to start with (NULL?) and points to nowhere. Reproduced on all devices I tested, so should be fairly easy to reproduce on any other configuration.
Steps to reproduce
- Create a group with someone else
- Let the other person/device sent a picture in that group
- In group conversation, open media gallery ("All media") using the menu in the upper right corner
- Tap on the picture sent by the other person/device
Actual result: Picture doesn't load and show, instead a black screen appears, header doesn't show media info, swiping to slide through media doesn't work Expected result: Picture is shown, swiping to slide through media works
Screenshots
Tapping on a media gallery picture sent by someone else (doesn't work):
Tapping on a media gallery picture sent by myself (works):

Device info
Devices: Motorola Moto G, Motorola Moto G3, Lenovo Moto G4 Android versions: 4.4.4, 6.0.1, 7.0 Signal versions: 4.15.5, 4.16.2
Link to debug log
https://gist.github.com/fc419a59d8081acf29743fbe1272e3e8 09:44:00 -> Tapping on a media gallery picture sent by someone else (doesn't work) 09:48:00 -> Tapping on a media gallery picture sent by myself (works)
I can reproduce this issue and I looked into this. This is what is going on here:
Initially the conversation address (the internal group address) saved in MediaGalleryAdapter is put to the intent which is used to open MediaPreviewActivity. But here it is overwritten by the address the specific media item was sent to. In my tests it was my phone number instead of the internal group address. MediaPreviewActivity then uses this address to determine the conversation recipient and attempts to load the conversation media with this conversation recipient.
I did not investigate further, but probably some class later on looks through the loaded media to show the media item you selected. But it won't find it because it loaded the wrong set of media items.
GitHub Issue Cleanup: See #7598 for more information.