NordicSemiconductor / Android-DFU-Library

Device Firmware Update library and Android app
http://www.nordicsemi.com/dfu
BSD 3-Clause "New" or "Revised" License
753 stars 263 forks source link

[Bug fix] Crash when access to selected file was lost #417

Closed philips77 closed 8 months ago

philips77 commented 8 months ago

It is possible to do the following:

  1. Start DFU to a selected target device
  2. Quit the app with a Back button when DFU is in progress -> this will kill the Activity and ViewModel
  3. When DFU is complete (it runs in a foreground service, so wasn't affected) open app again
  4. The app shows correctly status of the last operation
  5. Try to do DFU again to the same or other device (without modifying the file)
  6. This will cause a crash, as access to the file was granted for URI, which is no longer active

This PR fixes that by displaying an error instead. User can select the file again and repeat DFU.