OpenTracksApp / OpenTracks

OpenTracks is a sport tracking application that completely respects your privacy.
https://OpenTracksApp.com
Apache License 2.0
1.04k stars 189 forks source link

Setting of Bluetooth Sensors causes crash #1637

Closed khao-soi closed 1 year ago

khao-soi commented 1 year ago

Describe the bug App crashes when clicking on Heart Rate and other stuff

To Reproduce

  1. Have no bluetooth device connected
  2. Go to Settings - Bluetooth Sensors
  3. Click on Heart Reate, Cadence or Power
  4. See error below

Technical information

Error:

App information

Device information

Firmware

Cause of error

Exception in thread "main": java.lang.SecurityException: Need android.permission.BLUETOOTH_SCAN permission for AttributionSource { uid = 10187, packageName = de.dennisguse.opentracks, attributionTag = null, token = android.os.BinderProxy@f6097c5, next = null }: AdapterService isDiscovering
    at com.android.bluetooth.Utils.checkPermissionForDataDelivery(Utils.java:486)
    at com.android.bluetooth.Utils.checkScanPermissionForDataDelivery(Utils.java:545)
    at com.android.bluetooth.btservice.AdapterService$AdapterServiceBinder.isDiscovering(AdapterService.java:2105)
    at com.android.bluetooth.btservice.AdapterService$AdapterServiceBinder.isDiscovering(AdapterService.java:2096)
    at android.bluetooth.IBluetooth$Stub.onTransact(IBluetooth.java:613)
    at android.os.Binder.execTransactInternal(Binder.java:1285)
    at android.os.Binder.execTransact(Binder.java:1244)
dennisguse commented 1 year ago

Was the permission initially granted and then later on revoked?

We are not that precise on checking that the permission is still granted.

khao-soi commented 1 year ago

Was the permission initially granted and then later on revoked?

I don't think so, but I can't guarantee that. Still, the app shouldn't crash here =)