Fixed
Status Update
Comments
ar...@google.com <ar...@google.com> #2
Can you provide the below requested information to better understand the issue:
Android build
Which Android build are you using? (e.g. KVT49L)
Device used
Which device did you use to reproduce this issue?
Steps to reproduce
What steps do others need to take in order to reproduce the issue themselves?
Frequency
How frequently does this issue occur? (e.g 100% of the time, 10% of the time)
Expected output
What do you expect to occur?
Current output
What do you see instead?
Android bug report:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
Note: Please upload the files to google drive and share the folder to android-bugreport@google.com, then share the link here.
Android build
Which Android build are you using? (e.g. KVT49L)
Device used
Which device did you use to reproduce this issue?
Steps to reproduce
What steps do others need to take in order to reproduce the issue themselves?
Frequency
How frequently does this issue occur? (e.g 100% of the time, 10% of the time)
Expected output
What do you expect to occur?
Current output
What do you see instead?
Android bug report:
After reproducing the issue, navigate to developer settings, ensure ‘USB debugging’ is enabled, then enable ‘Bug report shortcut’. To take bug report, hold the power button and select the ‘Take bug report’ option.
Note: Please upload the files to google drive and share the folder to android-bugreport@google.com, then share the link here.
em...@gmail.com <em...@gmail.com> #3
Sure! As I said, I have tried on three different devices (Sony Xperia Z3, Nexus 5X and Nexus 6). Now I followed the take bug report procedure with the Nexus 5X.
Android build:
NRD90S
Device used:
Nexus 5X
Steps to reproduce:
See description. Example with code:
1.
BluetoothGatt gatt = BluetoothAdapter.getDefaultAdapter().getRemoteDevice("80:E4:DA:70:84:2C").connectGatt(context, false, new BluetoothGattCallback(){});
try {Thread.sleep(2000);} catch (InterruptedException e) {}
gatt.close();
2. Now start advertising on that device.
The sleep time is there in order to workaroundhttps://code.google.com/p/android/issues/detail?id=223582
Frequency:
100%
Expected output / Current output:
See description
Android bug report:
https://drive.google.com/open?id=0B-kW5rSvtUYnOTR2Z1I0WTNCZVE
From the logcat there, I've extracted the interesting parts:
09-27 12:56:18.811 863 882 D BluetoothManagerService: Message: 20
09-27 12:56:18.811 863 882 D BluetoothManagerService: Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy@c59d4d2:true
09-27 12:56:18.814 5480 5480 D BluetoothGatt: connect() - device: 80:E4:DA:70:84:2C, auto: false
09-27 12:56:18.814 5480 5480 D BluetoothGatt: registerApp()
09-27 12:56:18.814 5480 5480 D BluetoothGatt: registerApp() - UUID=60a9923c-effd-494d-9f22-815cf9128519
09-27 12:56:18.817 3167 3919 D BtGatt.GattService: registerClient() - UUID=60a9923c-effd-494d-9f22-815cf9128519
09-27 12:56:18.818 3167 3295 D BtGatt.GattService: onClientRegistered() - UUID=60a9923c-effd-494d-9f22-815cf9128519, clientIf=5
09-27 12:56:18.819 5480 5493 D BluetoothGatt: onClientRegistered() - status=0 clientIf=5
09-27 12:56:18.819 3167 3186 D BtGatt.GattService: clientConnect() - address=80:E4:DA:70:84:2C, isDirect=true
09-27 12:56:18.819 3167 3295 D bt_btif_config: btif_get_address_type: Device [80:e4:da:70:84:2c] address type 0
09-27 12:56:18.819 3167 3295 D bt_btif_config: btif_get_device_type: Device [80:e4:da:70:84:2c] type 2
09-27 12:56:20.818 5480 5480 D BluetoothGatt: close()
09-27 12:56:20.818 5480 5480 D BluetoothGatt: unregisterApp() - mClientIf=5
09-27 12:56:20.820 3167 3920 D BtGatt.GattService: unregisterClient() - clientIf=5
09-27 12:56:20.820 3167 3295 D BtGatt.GattService: onDisconnected() - clientIf=5, connId=0, address=80:E4:DA:70:84:2C
09-27 12:56:20.820 3167 3295 E BtGatt.ContextMap: Context not found for ID 5
I start advertising on the peripheral and it gets connected here even though I've closed:
09-27 12:56:24.898 3167 3860 W bt_smp : smp_br_connect_callback is called on unexpected transport 2
09-27 12:56:24.898 3167 3860 W bt_btif : bta_dm_acl_change info: 0x0
09-27 12:56:24.898 3167 3295 D bt_btif_dm: remote version info [80:e4:da:70:84:2c]: 0, 0, 0
09-27 12:56:24.913 3167 3295 E BluetoothRemoteDevices: state12newState0
Android build:
NRD90S
Device used:
Nexus 5X
Steps to reproduce:
See description. Example with code:
1.
BluetoothGatt gatt = BluetoothAdapter.getDefaultAdapter().getRemoteDevice("80:E4:DA:70:84:2C").connectGatt(context, false, new BluetoothGattCallback(){});
try {Thread.sleep(2000);} catch (InterruptedException e) {}
gatt.close();
2. Now start advertising on that device.
The sleep time is there in order to workaround
Frequency:
100%
Expected output / Current output:
See description
Android bug report:
From the logcat there, I've extracted the interesting parts:
09-27 12:56:18.811 863 882 D BluetoothManagerService: Message: 20
09-27 12:56:18.811 863 882 D BluetoothManagerService: Added callback: android.bluetooth.IBluetoothManagerCallback$Stub$Proxy@c59d4d2:true
09-27 12:56:18.814 5480 5480 D BluetoothGatt: connect() - device: 80:E4:DA:70:84:2C, auto: false
09-27 12:56:18.814 5480 5480 D BluetoothGatt: registerApp()
09-27 12:56:18.814 5480 5480 D BluetoothGatt: registerApp() - UUID=60a9923c-effd-494d-9f22-815cf9128519
09-27 12:56:18.817 3167 3919 D BtGatt.GattService: registerClient() - UUID=60a9923c-effd-494d-9f22-815cf9128519
09-27 12:56:18.818 3167 3295 D BtGatt.GattService: onClientRegistered() - UUID=60a9923c-effd-494d-9f22-815cf9128519, clientIf=5
09-27 12:56:18.819 5480 5493 D BluetoothGatt: onClientRegistered() - status=0 clientIf=5
09-27 12:56:18.819 3167 3186 D BtGatt.GattService: clientConnect() - address=80:E4:DA:70:84:2C, isDirect=true
09-27 12:56:18.819 3167 3295 D bt_btif_config: btif_get_address_type: Device [80:e4:da:70:84:2c] address type 0
09-27 12:56:18.819 3167 3295 D bt_btif_config: btif_get_device_type: Device [80:e4:da:70:84:2c] type 2
09-27 12:56:20.818 5480 5480 D BluetoothGatt: close()
09-27 12:56:20.818 5480 5480 D BluetoothGatt: unregisterApp() - mClientIf=5
09-27 12:56:20.820 3167 3920 D BtGatt.GattService: unregisterClient() - clientIf=5
09-27 12:56:20.820 3167 3295 D BtGatt.GattService: onDisconnected() - clientIf=5, connId=0, address=80:E4:DA:70:84:2C
09-27 12:56:20.820 3167 3295 E BtGatt.ContextMap: Context not found for ID 5
I start advertising on the peripheral and it gets connected here even though I've closed:
09-27 12:56:24.898 3167 3860 W bt_smp : smp_br_connect_callback is called on unexpected transport 2
09-27 12:56:24.898 3167 3860 W bt_btif : bta_dm_acl_change info: 0x0
09-27 12:56:24.898 3167 3295 D bt_btif_dm: remote version info [80:e4:da:70:84:2c]: 0, 0, 0
09-27 12:56:24.913 3167 3295 E BluetoothRemoteDevices: state12newState0
ar...@google.com <ar...@google.com> #4
Can you please share an APK or sample source code with us to reproduce the issue from our end.
em...@gmail.com <em...@gmail.com> #5
Sample code:
BluetoothGatt gatt = BluetoothAdapter.getDefaultAdapter().getRemoteDevice("80:E4:DA:70:84:2C").connectGatt(context, false, new BluetoothGattCallback(){});
try {Thread.sleep(2000);} catch (InterruptedException e) {}
gatt.close();
Please change "80:E4:DA:70:84:2C" to a known device's BD Address you possess. If the device is unbonded, you might first need to take up the Bluetooth settings (in order to scan) and advertise on the peripheral so the phone learns whether the address is a random or public one, so that when the sample code later runs, it attempts to connect to the correct address.
BluetoothGatt gatt = BluetoothAdapter.getDefaultAdapter().getRemoteDevice("80:E4:DA:70:84:2C").connectGatt(context, false, new BluetoothGattCallback(){});
try {Thread.sleep(2000);} catch (InterruptedException e) {}
gatt.close();
Please change "80:E4:DA:70:84:2C" to a known device's BD Address you possess. If the device is unbonded, you might first need to take up the Bluetooth settings (in order to scan) and advertise on the peripheral so the phone learns whether the address is a random or public one, so that when the sample code later runs, it attempts to connect to the correct address.
ar...@google.com <ar...@google.com> #6
We have passed this defect on to the development team and will update this issue with more information as it becomes available.
ma...@gmail.com <ma...@gmail.com> #8
Any updates on this issue?Maybe you can suggest some workaround.This is critical for our app. BLE device which we connect to is starting to misbehave after connection is not closed properly.
is...@google.com <is...@google.com>
an...@gmail.com <an...@gmail.com> #9
I have the same issue on:
Google Nexus 5 - Android 6.0.1, Build M4B30Z
Samsung J5 (2016) - Android 7.1.1, Build NMF26x.J510FNXXS2BRA1
Xiaomi Mi5 - Android 8.0.0, Build OPR1.170623.032
Xiaomi MiA2 - Android 8.1.0, Build OPM1.171019.011.V9.6.15.0.ODIMIFE
OnePlus 6 - Android 9.0, Build ONEPLUS A6003_22_181026
Google Nexus 5 - Android 6.0.1, Build M4B30Z
Samsung J5 (2016) - Android 7.1.1, Build NMF26x.J510FNXXS2BRA1
Xiaomi Mi5 - Android 8.0.0, Build OPR1.170623.032
Xiaomi MiA2 - Android 8.1.0, Build OPM1.171019.011.V9.6.15.0.ODIMIFE
OnePlus 6 - Android 9.0, Build ONEPLUS A6003_22_181026
sa...@google.com <sa...@google.com> #10
The issue has been fixed. If you experience this issue in a current build, please file a new issue along with the latest bug report here: https://goo.gl/TbMiIO .
Description
1. Initiate a connection to a Bluetooth Low Energy device, with the autoConnect parameter set to false. Make sure the remote peripheral does not advertise at the moment.
2. After a while but before the 30s timeout, call close() on the gatt object (without calling disconnect() before). Or alternatively just swipe-close the app.
3. Now start the advertising on the peripheral (before the 30s timeout).
Expected outcome:
The peripheral should not connect since the Android device should have aborted the connection attempt.
What happens instead:
The device connects. No app is using the connection however.
This happens since Android N (version NPD56N, NPD90G, NRD90S). It did not happen earlier (in Android 6.0.1).
Note: it only happens when the autoConnect parameter is set to false.