Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with reading on Android 13 Samsung devices #463

Open
peropavlovic opened this issue Jan 24, 2023 · 15 comments
Open

Issue with reading on Android 13 Samsung devices #463

peropavlovic opened this issue Jan 24, 2023 · 15 comments
Labels

Comments

@peropavlovic
Copy link

Hi Android-Ble-Library developers,

we have issue with readCharacteristic request on Samsung devices using Android 13. Issue occurs only when we trying to read data larger then 512. We tried changing MTU sizes but nothing solve this issue. When we try to call readCharacteristic it fails with Fail reason -100 and BLE Connection get disconnected.

Can you help us solve this issue as it's really important as Users with those devices cannot use some of fundamental features of our app.

Thanks!

@adi-pilav-sn
Copy link

@peropavlovic Have you tried requesting MTU of size 517? I had a similar issue https://issuetracker.google.com/issues/265343637 and it worked for me.

@peropavlovic
Copy link
Author

@adi-pilav-sn thanks for advice! I have tried and I'm not getting disconnected anymore but now it fails with reason 133. I checked out Device and everything looks good there.

On device scenario with MTU lower then 517 was that all chunk was sent, and on last one readCharacteristic fails and BLE get disconnected.

Now when I tried with MTU 517, only one chunk sent and readCharacteristic fails with reason 133.

Any advice what should I do next?

@adi-pilav-sn
Copy link

Can you try to paste the Android system logs here when 133 error happens? Note: if you are using Android Studio remove any tags (including package name) from the logcat and you will see the Android system logs that may give some more info about what went wrong.

@philips77
Copy link
Member

  1. How long is your data that you want to send?
  2. Are you using write with response, which would use Long Read Procedure, or write without response?

If you're using write without response you need to split the data into MTU-3 byte long packets on your own. If the size is not known on the receiver side, you need to send the length as well. Each packet can be up to MTU-3 bytes long.

If you're using write with response and the data are longer than MTU, Android will automatically use Long Read Procedure. Data will be split automatically if MTU is lower, but again, the longest packet can be 500 bytes, I think (or around that number). For longer packets I recommend write without response, as they are faster.

In the BLE library we have DataSplitter and DataMerger interfaces, which you may use.
Here you may find some useful implementations: https://github.com/NordicSemiconductor/Android-BLE-Library/tree/testing-features/test/src/main/java/no/nordicsemi/andorid/ble/test/spec
If you're connecting with device, not Android phone, you need to implement matching spitter on your own in the fw.

@philips77
Copy link
Member

For example,. the HeaderBasedPacketMerger and splitter add UINT16 length field for every message. When receiving, the other device knowns how long packet to expect, can set up a buffer and collect requests until the fill buffer is full. Splitter adds the length field, merger reads it and collects.

We also have an example of flag based splitter-merger pair, where each packet contains an information: full, start, continuation, end, and based on that the merger knows when the data are complete.

If the length of the packet is known to the merger you may just use .split() and the lib will split it into MTU-3-byte long packets automatically. Then collect packets on the receiver side until you get required number of bytes.

@philips77
Copy link
Member

If you have some specification to follow, check how that is specified there.

@peropavlovic
Copy link
Author

Hi @philips77, thanks for the info!

Our problem is reading data with readCharacteristic, not writing. Data they send to us can be different size and the one we have problem with is when that data is larger then 515 bytes (Usually its around 1000 bytes). And in that scenario, while reading data our readCharacteristic is failing.

@peropavlovic
Copy link
Author

@philips77 Just to explain a little bit better our flow.

We have gatt server written in GO.
Logic is that on server side they send us Data in chunks of MTU size. Let's say its 515 bytes. So on client (App) size, we read first chunk and ask for another.

Issue is that, when trying to read first chunk with readCharacteristic() it fails without reading it (We can see on server logs that sending is good) and usually disconnects from BLE connection.

This issue was working good on all device and Android versions, except Samsung devices with Android 13.

@philips77
Copy link
Member

I think I may know the issue then. As far as I remember, starting from Android 13 the OS is now correctly handling too long values. For Long Read or Long Write there's a limit for length is 512 bytes:

The maximum length of an attribute value shall be 512 octets.

Core Bluetooth 5.2, Vol 3, Part F, 3.2.9.

Before it was "somehow working", but since 13 the limit is checked.
You need to split the value into smaller chunks and indicate somehow when the value is fully received.

Btw, in the BLE library you may set a merger to readCharacteristic as well. It will perform number of reads until the merger returns true. But you need to modify the server side to match the behavior.

@peropavlovic
Copy link
Author

peropavlovic commented Feb 2, 2023

Hi @philips77 I still have this issue and trying to figure it out how to solve it. My users keep pushing me as they cannot use this major feature because of this issue.

So we found out it occurs on Samsung devices with Android 13. But not all of them, just some of it, usually on those devices:

Samsung s20 - Android 13
Samsung a52 - Android 13
Samsung Z fold - Android 13
So it fail as of Fail reason -100 and BLE get disconnected. And it always occurs before last or last few byte transferred.

Here is some filtered Bluetooth logs if it can helps figuring out the issue.


16:00:23.359 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10392, appPid: 19088, appName: com.bellatrix.iweech
16:00:23.365 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=d6db85bb-5aa6-442f-8463-d10d87917ead, scannerId=10, status=0
16:00:23.383 BtGatt.GattService      com.android.bluetooth       W  unfreezeScan() - No AppScanStats found with uid: 10340
16:00:23.387 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:00:23.387 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.bellatrix.iweech, scannerId: 10, reportDelayMillis=0
16:00:23.399 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:00:23.399 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:00:24.686 BtGatt.GattService      com.android.bluetooth       D  onScanResult to scannerId: 10- eventType=0x1b, addressType=0, address=B827EB_4, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-60, periodicAdvInt=0x0
16:00:24.690 BtGatt.GattService      com.android.bluetooth       D  onScanResult to scannerId: 10- eventType=0x1b, addressType=0, address=B827EB_4, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-60, periodicAdvInt=0x0
16:00:24.718 BtGatt.ContextMap       com.android.bluetooth       D  remove() - id: 10
16:00:24.718 BtGatt.ContextMap       com.android.bluetooth       E  remove() - removed: 10
16:00:24.746 BtGatt.GattService      com.android.bluetooth       D  registerClient(com.bellatrix.iweech) - UUID=5be2b9e1-5e17-4d78-be4f-efb12b83e38b
16:00:24.748 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10392, appPid: 19088, appName: com.bellatrix.iweech
16:00:24.749 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:00:24.749 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_STOP, appName: com.bellatrix.iweech, scannerId: 10, reportDelayMillis=0
16:00:24.754 BtGatt.GattService      com.android.bluetooth       D  onClientRegistered() - UUID=5be2b9e1-5e17-4d78-be4f-efb12b83e38b, clientIf=7
16:00:24.763 BtGatt.GattService      com.android.bluetooth       D  clientConnect(com.bellatrix.iweech) - address = B827EB_4, isDirect=true transport =2 set own addr = false own addr type:0, clientIf: 7, opportunistic=false, phy: 1
16:00:25.074 BtGatt.GattService      com.android.bluetooth       D  onConnected() - clientIf=7, connId=7, status=0, address=B827EB_4
16:00:25.079 BtGatt.GattService      com.android.bluetooth       D  onConnected() - adding permit for address=B827EB_4
16:00:33.095 BtGatt.GattService      com.android.bluetooth       D  writeCharacteristic() - trying to acquire permit.
16:00:33.098 BtGatt.GattService      com.android.bluetooth       D  onWriteCharacteristic() - increasing permit for address=B827EB_4
16:00:33.099 BtGatt.GattService      com.android.bluetooth       D  onWriteCharacteristic() - address=B827EB_4, status=0
16:00:57.365 BtGatt.GattService      com.android.bluetooth       D  unregisterClient(com.android.bluetooth) - clientIf=7
16:00:57.366 BtGatt.ContextMap       com.android.bluetooth       D  remove() - id: 7
16:00:57.366 BtGatt.ContextMap       com.android.bluetooth       E  remove() - removed: 7
16:00:57.372 BtGatt.GattService      com.android.bluetooth       D  onDisconnected() - clientIf=7, connId=7, status=0, address=B827EB_4
16:00:57.372 BtGatt.ContextMap       com.android.bluetooth       E  Context not found for ID 7
16:00:57.372 BtGatt.GattService      com.android.bluetooth       D  onDisconnected() - removing permit for address=B827EB_4
16:01:02.999 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10392, appPid: 10070, appName: com.bellatrix.iweech
16:01:03.000 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=b31a4d7f-ca66-4de0-bb76-19399ca45d4e, scannerId=10, status=0
16:01:03.014 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:03.014 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.bellatrix.iweech, scannerId: 10, reportDelayMillis=0
16:01:03.016 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:03.016 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:03.470 BtGatt.GattService      com.android.bluetooth       D  onScanResult to scannerId: 10- eventType=0x1b, addressType=0, address=B827EB_4, primaryPhy=1, secondaryPhy=0, advertisingSid=0xff, txPower=127, rssi=-69, periodicAdvInt=0x0
16:01:03.487 BtGatt.ContextMap       com.android.bluetooth       D  remove() - id: 10
16:01:03.487 BtGatt.ContextMap       com.android.bluetooth       E  remove() - removed: 10
16:01:03.499 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:03.499 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_STOP, appName: com.bellatrix.iweech, scannerId: 10, reportDelayMillis=0
16:01:03.503 BtGatt.GattService      com.android.bluetooth       D  registerClient(com.bellatrix.iweech) - UUID=0e5918c8-8846-4b23-a43b-27eb94015d73
16:01:03.505 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10392, appPid: 10070, appName: com.bellatrix.iweech
16:01:03.505 BtGatt.GattService      com.android.bluetooth       D  onClientRegistered() - UUID=0e5918c8-8846-4b23-a43b-27eb94015d73, clientIf=7
16:01:03.508 BtGatt.GattService      com.android.bluetooth       D  clientConnect(com.bellatrix.iweech) - address = B827EB_4, isDirect=true transport =2 set own addr = false own addr type:0, clientIf: 7, opportunistic=false, phy: 1
16:01:03.697 BtGatt.GattService      com.android.bluetooth       D  onConnected() - clientIf=7, connId=7, status=0, address=B827EB_4
16:01:03.698 BtGatt.GattService      com.android.bluetooth       D  onConnected() - adding permit for address=B827EB_4
16:01:12.053 BtGatt.GattService      com.android.bluetooth       D  writeCharacteristic() - trying to acquire permit.
16:01:12.057 BtGatt.GattService      com.android.bluetooth       D  onWriteCharacteristic() - increasing permit for address=B827EB_4
16:01:12.058 BtGatt.GattService      com.android.bluetooth       D  onWriteCharacteristic() - address=B827EB_4, status=0
16:01:12.681 BtGatt.GattService      com.android.bluetooth       D  writeCharacteristic() - trying to acquire permit.
16:01:12.685 BtGatt.GattService      com.android.bluetooth       D  onWriteCharacteristic() - increasing permit for address=B827EB_4
16:01:12.685 BtGatt.GattService      com.android.bluetooth       D  onWriteCharacteristic() - address=B827EB_4, status=0
16:01:13.261 bt_stack       com.android.bluetooth       A  [FATAL:btif_gatt_client.cc(646)] Check failed: len <= BTGATT_MAX_ATTR_LEN. 
                                              #00 0x00000079aa578b93 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b04b93
                                              #01 0x00000079a9f31cf7 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x00000000004bdcf7
                                              #02 0x00000079a9e4a04b /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x00000000003d604b
                                              #03 0x00000079a9e4c9cf /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x00000000003d89cf
                                              #04 0x00000079a9dccaab /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000358aab
                                              #05 0x00000079aa581d5f /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b0dd5f
                                              #06 0x00000079aa580ff7 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b0cff7
                                              #07 0x00000079aa5813cb /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b0d3cb
                                              #08 0x00000079aa5846e7 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b106e7
                                              #09 0x00000079aa5ad333 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b39333
                                              #10 0x00000079aa0ff72f /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x000000000068b72f
                                              #11 0x00000079aa0ff113 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x000000000068b113
                                              #12 0x00000079aa0ffc8f /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x000000000068bc8f
                                              #13 0x0000007cee2ef5ab /apex/com.android.runtime/lib64/bionic/libc.so+0x00000000000ba5ab
                                              #14 0x0000007cee288e9f /apex/com.android.runtime/lib64/bionic/libc.so+0x0000000000053e9f
16:01:14.363 DEBUG          crash_dump64                A  Abort message: '[FATAL:btif_gatt_client.cc(646)] Check failed: len <= BTGATT_MAX_ATTR_LEN. 
                                              #00 0x00000079aa578b93 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b04b93
                                              #01 0x00000079a9f31cf7 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x00000000004bdcf7
                                              #02 0x00000079a9e4a04b /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x00000000003d604b
                                              #03 0x00000079a9e4c9cf /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x00000000003d89cf
                                              #04 0x00000079a9dccaab /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000358aab
                                              #05 0x00000079aa581d5f /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b0dd5f
                                              #06 0x00000079aa580ff7 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b0cff7
                                              #07 0x00000079aa5813cb /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b0d3cb
                                              #08 0x00000079aa5846e7 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b106e7
                                              #09 0x00000079aa5ad333 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x0000000000b39333
                                              #10 0x00000079aa0ff72f /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x000000000068b72f
                                              #11 0x00000079aa0ff113 /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x000000000068b113
                                              #12 0x00000079aa0ffc8f /apex/com.android.btservices/lib64/libbluetooth_jni.so+0x000000000068bc8f
                                              #13 0x0000007cee2ef5ab /apex/com.android.runtime/lib64/bionic/libc.so+0x00000000000ba5ab
                                              #14 0x0000007cee288e9f /apex/com.android.runtime/lib64/bionic/libc.so+0x0000000000053e9f'
16:01:15.010 BtGatt.JNI              pid-10577                   I  classInitNative(L1201): classInitNative: Success!
16:01:15.230 BtGatt.DebugUtils       pid-10577                   D  handleDebugAction() action=null
16:01:15.250 BtGatt.Cus...iceManager pid-10577                   W  init() - built-in not found
16:01:15.262 BtGatt.Cus...iceManager pid-10577                   D  init() - retrieved built-in.address: null
16:01:15.265 BtGatt.GattService      pid-10577                   D  initQuickScanSet
16:01:15.266 BtGatt.GattService      pid-10577                   D  [GSIM LOG]: loadAppInfo
16:01:15.267 BtGatt.ScanManager      pid-10577                   W  QuickScan, ScanMode : 0 enable : true LCD On Window/Intarval : 202500/1860625 LCD Off Window/Interval : 160000/3120000
16:01:15.267 BtGatt.ScanManager      pid-10577                   W  QuickScan, ScanMode : 1 enable : true LCD On Window/Intarval : 191250/958125 LCD Off Window/Interval : 191250/958125
16:01:15.267 BtGatt.ScanManager      pid-10577                   W  QuickScan, ScanMode : 2 enable : true LCD On Window/Intarval : 4096000/4096000 LCD Off Window/Interval : 158750/305625
16:01:15.268 BtGatt.ScanManager      pid-10577                   W  QuickScan, ScanMode : 3 enable : false LCD On Window/Intarval : 128000/640000 LCD Off Window/Interval : 128000/640000
16:01:15.279 BtGatt.GattService      pid-10577                   W  checkToReportData before boot completed
16:01:16.753 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 5006, appPid: 19999, appName: android.uid.bcmgr
16:01:16.753 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=2f4d635a-ec47-4c2b-a1bf-e850bb9905d9, scannerId=1, status=0
16:01:16.758 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10229, appPid: 30934, appName: com.google.uid.shared
16:01:16.759 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=f641ebd2-857e-4f0f-8f36-0a4fd8587fbf, scannerId=2, status=0
16:01:16.771 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:16.771 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: android.uid.bcmgr, scannerId: 1, reportDelayMillis=0
16:01:16.775 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.776 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.779 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.779 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.781 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.781 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.781 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.781 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.782 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.782 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.783 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.783 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.786 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.786 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.793 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.793 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.794 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.794 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.794 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.794 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.794 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.794 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.796 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.796 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.796 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.796 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.797 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.797 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.801 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.801 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.801 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.801 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.806 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:16.806 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.google.uid.shared, scannerId: 2, reportDelayMillis=0
16:01:16.808 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.808 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.813 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 5025, appPid: 20369, appName: android.uid.mdxkit
16:01:16.813 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=9e738380-bc33-4891-be84-017247b56473, scannerId=3, status=0
16:01:16.821 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:16.822 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: android.uid.mdxkit, scannerId: 3, reportDelayMillis=0
16:01:16.824 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:16.824 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:16.969 BtGatt.GattService      com.android.bluetooth       D  refreshQuickScanSet
16:01:16.973 BtGatt.GattService      com.android.bluetooth       D  refreshAbusiveScanPackages
16:01:16.973 BtGatt.ScanManager      com.android.bluetooth       W  QuickScan, ScanMode : 0 enable : true LCD On Window/Intarval : 202500/1860625 LCD Off Window/Interval : 160000/31200000
16:01:16.973 BtGatt.ScanManager      com.android.bluetooth       W  QuickScan, ScanMode : 1 enable : true LCD On Window/Intarval : 191250/958125 LCD Off Window/Interval : 191250/958125
16:01:16.973 BtGatt.ScanManager      com.android.bluetooth       W  QuickScan, ScanMode : 2 enable : true LCD On Window/Intarval : 4096000/4096000 LCD Off Window/Interval : 158750/305625
16:01:16.973 BtGatt.ScanManager      com.android.bluetooth       W  QuickScan, ScanMode : 3 enable : true LCD On Window/Intarval : 128000/640000 LCD Off Window/Interval : 128000/640000
16:01:16.977 BtGatt.GattService      com.android.bluetooth       D  refreshAbusiveScanValue()
16:01:16.982 BtGatt.GattService      com.android.bluetooth       D  refreshAppScanBlackList
16:01:17.134 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10100, appPid: 5286, appName: com.samsung.android.mcfserver
16:01:17.134 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=478cf21f-f5d0-4b5c-a47b-f7f973e96d36, scannerId=4, status=0
16:01:17.140 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:17.140 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.samsung.android.mcfserver, scannerId: 4, reportDelayMillis=0
16:01:17.140 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:17.140 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:17.830 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10100, appPid: 5286, appName: com.samsung.android.mcfserver
16:01:17.831 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=409e1e98-c7a4-4d25-9f31-a0e10c7e7cec, scannerId=5, status=0
16:01:17.851 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:17.851 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.samsung.android.mcfserver, scannerId: 5, reportDelayMillis=0
16:01:17.854 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:17.854 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_
16:01:18.251 BtGatt.GattService      com.android.bluetooth       D  registerClient(com.garmin.android.apps.connectmobile) - UUID=9322df7d-b92d-47a5-b471-73c7ea47d78a
16:01:18.254 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10250, appPid: 10185, appName: com.garmin.android.apps.connectmobile
16:01:18.256 BtGatt.GattService      com.android.bluetooth       D  onClientRegistered() - UUID=9322df7d-b92d-47a5-b471-73c7ea47d78a, clientIf=6
16:01:18.263 BtGatt.GattService      com.android.bluetooth       D  clientConnect(com.garmin.android.apps.connectmobile) - address = C19D26_8, isDirect=false transport =2 set own addr = false own addr type:0, clientIf: 6, opportunistic=false, phy: 1
16:01:21.030 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10229, appPid: 30934, appName: com.google.uid.shared
16:01:21.031 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=91527b9e-d48b-4748-ab60-91f0f28c9428, scannerId=6, status=0
16:01:21.044 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:21.044 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.google.uid.shared, scannerId: 6, reportDelayMillis=0
16:01:21.044 BtGatt.GattService      com.android.bluetooth       W  [GSIM LOG]: this is opportunistic scan, do not update DB
16:01:22.801 BtGatt.ContextMap       com.android.bluetooth       D  remove() - id: 2
16:01:22.801 BtGatt.ContextMap       com.android.bluetooth       E  remove() - removed: 2
16:01:22.808 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:22.809 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_STOP, appName: com.google.uid.shared, scannerId: 2, reportDelayMillis=0
16:01:22.823 BtGatt.ContextMap       com.android.bluetooth       D  add() - appUid: 10229, appPid: 30934, appName: com.google.uid.shared
16:01:22.826 BtGatt.GattService      com.android.bluetooth       D  onScannerRegistered() - UUID=e3da49a2-72a3-4976-abf8-c7857433477e, scannerId=2, status=0
16:01:22.838 BtGatt.GattService      com.android.bluetooth       W  checkToReportData before boot completed
16:01:22.838 BtGatt.GattService      com.android.bluetooth       E  [GSIM LOG]: gsimLogHandler, msg: MESSAGE_SCAN_START, appName: com.google.uid.shared, scannerId: 2, reportDelayMillis=0
16:01:22.840 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : onFoundTimeout | onLostTimeout | onFoundCount | numOfTrackingEntries | scanFilterRssiThreshold | trackableScanFilterRssiThreshold | matchMode
16:01:22.840 BtGatt.ScanManager      com.android.bluetooth       D  configureFilterParamter() : __________500__|________10000__|___________1__|___________________0__|___________________-128__|____________________________-128__|________1_

And here is BLE Manager Logs:


my.package    V    BLE MANAGER - Reading characteristic 20000001-0000-1000-8000-08805f9b34fb
my.package    V    BLE MANAGER - gatt.readCharacteristic (20000801-800-1000-8000-80885f9b34fb)
my.package    V    [Broadcast] Action received: android.bluetooth.adapter.action.STATE_CHANGED, state changed to TURNING OFF
my.package    V    BLE MANAGER - Disconnected
my.package    V    BLE MANAGER - gatt.close()

@Islomov49
Copy link

@peropavlovic have you solved this issue? I've faced with that as well

@adi-pilav-sn
Copy link

@peropavlovic Just an FYI: while you are trying to figure out what the issue is here, try using the lowest value for the MTU of 27 as a workaround. It worked for me, though it did slow down the BLE communication drastically. If it does not work for you, then it is more likely that the issue is on the peripheral device.

@peropavlovic
Copy link
Author

@adi-pilav-sn thanks, I tried that.
@Islomov49 I did not find solution for the issue but I fixed it with different implementation on server side as a workaround. Its not perfect but its working for now.

@johnnyzen
Copy link

@peropavlovic please can you share your fix?

@deepak9705
Copy link

Can you please share the fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants