DFU fails when the Android screen is off

Nordic DFU SDK version 2.5.0. Github issue here.

When the Android screen is off, the DFU fails right after starting. This appears to be because the scanner cannot find the Android device. Our app has already been granted the ACCESS_BACKGROUND_LOCATION permission, so that's not relevant in this case.

After some investigation, it seems to me like the issue was introduced here. The removal of the scan filters, obstensibly to resolve issues with the DFU working at all on some devices (as seen here), stops the bluetooth scanner from being able to find the device to perform the DFU on when the screen is off.

After downloading the source code and changing BootloaderScannerLollipop to use those filters again, I can confirm that using the filters resolves this issue.

Could an option of some sort be added to allow developers to choose to support DFUs with the screen off? It would seem silly to have to fork this SDK just to support something that it already supported two years ago.

Relevant log output:

Enabling indications...
Sending Enter Bootloader (Op Code = 1)
Response received (Op Code = 1, Status = 1)
Device disconnected
Restarting to bootloader mode
Scanning for new address finished with: null
Parents Reply Children
No Data
Related