element-android icon indicating copy to clipboard operation
element-android copied to clipboard

[Bugfix] Fix crash on previewing image to upload on Android P

Open atpamat opened this issue 3 years ago • 1 comments

Type of change

  • [ ] Feature
  • [x] Bugfix
  • [ ] Technical
  • [ ] Other :

Closes #1404, closes #1851, closes #4545

Content

Use software bitmap allocation when previewing images to upload on devices with Android Pie.

Motivation and context

Using hardware bitmap allocation on Android framework versions prior to Android Q causes a crash when decoding a bitmap if GL context wasn't initialised. The issue is not documented in ImageDecoder reference but it is mentioned in the comments of glide[1] with a link to internal google discussion.

[1] https://github.com/bumptech/glide/blob/f83cc274b42cf02af6611d2a8c21e4a9b1f5d592/library/src/main/java/com/bumptech/glide/load/resource/bitmap/HardwareConfigState.java#L22

Screenshots / GIFs

Tests

  1. Sending images from within Element

    • select "send images and videos" from attachment picker
    • select image that caused a native crash on develop branch
  2. Sharing images to Element from external app

    • share an image from gallery app to Element

Tested devices

  • [x] Physical
  • [ ] Emulator
  • OS version(s): Android 9

Checklist

  • [ ] Changes has been tested on an Android device or Android emulator with API 21
  • [ ] UI change has been tested on both light and dark themes
  • [ ] Accessibility has been taken into account. See https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#accessibility
  • [x] Pull request is based on the develop branch
  • [x] Pull request includes a new file under ./changelog.d. See https://github.com/vector-im/element-android/blob/develop/CONTRIBUTING.md#changelog
  • [ ] Pull request includes screenshots or videos if containing UI changes
  • [x] Pull request includes a sign off
  • [x] You've made a self review of your PR
  • [ ] If you have modified the screen flow, or added new screens to the application, you have updated the test UiAllScreensSanityTest.allScreensTest()

atpamat avatar Sep 20 '22 12:09 atpamat

I can rebase and squash the commits it it's ready to be merged

atpamat avatar Sep 21 '22 09:09 atpamat