OnePlus 3T自动连接到BLE设备而不被告知[Android Nougat 7.1]

时间:2017-06-30 22:37:12

标签: android bluetooth-lowenergy android-7.1-nougat

我正在开发BLE设备,当我将设备连接到安装了Android 7.1.1的OnePlus 3T然后断开连接时,Android系统将自动重新连接,保持连接几秒钟,断开连接,保持断开状态几秒钟,然后重复。我不想要这种行为。

我尝试使用自己的应用程序和第三方连接到设备,甚至直接通过蓝牙设置屏幕连接。我尝试创建一个债券,而不是创建一个债券,删除所述债券,关闭手机的蓝牙然后再打开,重新启动和重新启动手机。我已经卸载了我的应用和第三方的应用,问题仍然存在。

如果未创建绑定,则只需关闭蓝牙然后再打开将停止自动连接,直到下次手动连接到设备为止。如果有绑定,那么我必须从蓝牙设置屏幕删除绑定(忘记/取消配对),然后重启手机以停止自动连接。

此问题仅出现在此手机上。我已经在运行7.1.1的Sony Z5 Compact上进行了测试,我在另一台7.1.1手机上进行了同事测试,但这两款手机都没有出现这个问题。

我无法辨别出这是故意行为还是如何阻止它发生。

那么如何阻止系统自动连接到我的设备?

编辑7月23日至17日: 以下是显示三个自动连接/断开序列的hci日志摘要。

783 28.109744      host                  controller            HCI_CMD  7      Sent Disconnect
784 28.111726      controller            host                  HCI_EVT  7      Rcvd Command Status (Disconnect)
785 28.136198      controller            host                  HCI_EVT  7      Rcvd Disconnect Complete
786 28.945643      host                  controller            HCI_CMD  29     Sent LE Create Connection
787 28.947549      controller            host                  HCI_EVT  7      Rcvd Command Status (LE Create Connection)
788 28.981412      controller            host                  HCI_EVT  34     Rcvd LE Meta (LE Enhanced Connection Complete)
789 28.982793      host                  controller            HCI_CMD  11     Sent LE Read Peer Resolvable Address
790 28.987577      controller            host                  HCI_EVT  13     Rcvd Command Complete (LE Read Peer Resolvable Address)
791 28.988278      host                  controller            HCI_CMD  6      Sent LE Read Remote Used Features
792 28.990039      controller            host                  HCI_EVT  7      Rcvd Command Status (LE Read Remote Used Features)
793 29.076010      controller            host                  HCI_EVT  15     Rcvd LE Meta (LE Read Remote Used Features Complete)
794 29.077472      host                  controller            HCI_CMD  6      Sent Read Remote Version Information
795 29.079962      controller            host                  HCI_EVT  7      Rcvd Command Status (Read Remote Version Information)
796 29.166053      controller            host                  HCI_EVT  14     Rcvd LE Meta (LE Data Length Change)
797 29.255723      controller            host                  HCI_EVT  11     Rcvd Read Remote Version Information Complete
798 35.265259      host                  controller            HCI_CMD  7      Sent Disconnect
799 35.273452      controller            host                  HCI_EVT  7      Rcvd Command Status (Disconnect)
800 35.291360      controller            host                  HCI_EVT  7      Rcvd Disconnect Complete
801 36.073663      host                  controller            HCI_CMD  29     Sent LE Create Connection
802 36.075588      controller            host                  HCI_EVT  7      Rcvd Command Status (LE Create Connection)
803 36.084903      controller            host                  HCI_EVT  34     Rcvd LE Meta (LE Enhanced Connection Complete)
804 36.085561      host                  controller            HCI_CMD  11     Sent LE Read Peer Resolvable Address
805 36.091173      controller            host                  HCI_EVT  13     Rcvd Command Complete (LE Read Peer Resolvable Address)
806 36.091519      host                  controller            HCI_CMD  6      Sent LE Read Remote Used Features
807 36.092606      controller            host                  HCI_EVT  7      Rcvd Command Status (LE Read Remote Used Features)
808 36.140626      controller            host                  HCI_EVT  15     Rcvd LE Meta (LE Read Remote Used Features Complete)
809 36.141902      host                  controller            HCI_CMD  6      Sent Read Remote Version Information
810 36.143513      controller            host                  HCI_EVT  7      Rcvd Command Status (Read Remote Version Information)
811 36.230720      controller            host                  HCI_EVT  14     Rcvd LE Meta (LE Data Length Change)
812 36.320761      controller            host                  HCI_EVT  11     Rcvd Read Remote Version Information Complete
813 38.134481      host                  controller            HCI_CMD  6      Sent Vendor Command 0x0157 (opcode 0xFD57)
814 38.140584      controller            host                  HCI_EVT  9      Rcvd Command Complete (Vendor Command 0x0157 [opcode 0xFD57])
815 38.142899      host                  controller            HCI_CMD  22     Sent Vendor Command 0x0157 (opcode 0xFD57)
816 38.144041      controller            host                  HCI_EVT  10     Rcvd Command Complete (Vendor Command 0x0157 [opcode 0xFD57])
817 39.593082      host                  controller            HCI_CMD  7      Sent Vendor Command 0x0157 (opcode 0xFD57)
818 39.602242      controller            host                  HCI_EVT  10     Rcvd Command Complete (Vendor Command 0x0157 [opcode 0xFD57])
819 42.330128      host                  controller            HCI_CMD  7      Sent Disconnect
820 42.340828      controller            host                  HCI_EVT  7      Rcvd Command Status (Disconnect)
821 42.356481      controller            host                  HCI_EVT  7      Rcvd Disconnect Complete
822 43.213636      host                  controller            HCI_CMD  29     Sent LE Create Connection
823 43.216004      controller            host                  HCI_EVT  7      Rcvd Command Status (LE Create Connection)
824 43.247099      controller            host                  HCI_EVT  34     Rcvd LE Meta (LE Enhanced Connection Complete)
825 43.247866      host                  controller            HCI_CMD  11     Sent LE Read Peer Resolvable Address
826 43.249314      controller            host                  HCI_EVT  13     Rcvd Command Complete (LE Read Peer Resolvable Address)
827 43.249618      host                  controller            HCI_CMD  6      Sent LE Read Remote Used Features
828 43.251012      controller            host                  HCI_EVT  7      Rcvd Command Status (LE Read Remote Used Features)
829 43.340949      controller            host                  HCI_EVT  15     Rcvd LE Meta (LE Read Remote Used Features Complete)
830 43.342388      host                  controller            HCI_CMD  6      Sent Read Remote Version Information
831 43.343952      controller            host                  HCI_EVT  7      Rcvd Command Status (Read Remote Version Information)
832 43.431927      controller            host                  HCI_EVT  14     Rcvd LE Meta (LE Data Length Change)
833 43.520136      controller            host                  HCI_EVT  11     Rcvd Read Remote Version Information Complete
834 43.958987      host                  controller            HCI_CMD  6      Sent LE Set Scan Enable
835 43.965597      controller            host                  HCI_EVT  7      Rcvd Command Complete (LE Set Scan Enable)
836 43.966261      host                  controller            HCI_CMD  15     Sent Vendor Command 0x015A (opcode 0xFD5A)
837 43.969342      controller            host                  HCI_EVT  7      Rcvd Command Complete (Vendor Command 0x015A [opcode 0xFD5A])
838 43.969515      host                  controller            HCI_CMD  7      Sent Vendor Command 0x0157 (opcode 0xFD57)
839 43.970709      controller            host                  HCI_EVT  10     Rcvd Command Complete (Vendor Command 0x0157 [opcode 0xFD57])
840 49.525115      host                  controller            HCI_CMD  7      Sent Disconnect

此处是logcat日志,仅显示包含设备MAC地址的消息。我通过nRF Connect手动连接到设备,然后手动断开连接并关闭应用程序。最后的连接/断开序列没有人为干预。

07-24 13:57:31.639 8169-8169/? W/DeviceListPreferenceFragment: createDevicePreference cachedDevice = F3:93:9C:88:3B:66
07-24 13:57:31.640 8169-8169/? D/BluetoothEventManager: DeviceFoundHandler created new CachedBluetoothDevice: F3:93:9C:88:3B:66
07-24 13:57:31.669 3483-3841/? D/BluetoothEventManager: DeviceFoundHandler created new CachedBluetoothDevice: F3:93:9C:88:3B:66
07-24 13:57:32.350 11410-11447/? D/bt_btif_config: btif_get_device_type: Device [f3:93:9c:88:3b:66] type 2 //NOTE: This message repeats 85 times. Excluded here for brevity.
07-24 13:57:57.130 11564-11564/? D/BluetoothGatt: connect() - device: F3:93:9C:88:3B:66, auto: false
07-24 13:57:57.134 11410-11482/? D/BtGatt.GattService: clientConnect() - address=F3:93:9C:88:3B:66, isDirect=true
07-24 13:57:57.134 11410-11447/? D/bt_btif_config: btif_get_address_type: Device [f3:93:9c:88:3b:66] address type 1
07-24 13:57:57.134 11410-11447/? D/bt_btif_config: btif_get_device_type: Device [f3:93:9c:88:3b:66] type 2
07-24 13:57:57.374 11410-11447/? D/bt_btif_dm: remote version info [f3:93:9c:88:3b:66]: 0, 0, 0
07-24 13:57:57.391 11410-11447/? D/BtGatt.GattService: onConnected() - clientIf=7, connId=7, address=F3:93:9C:88:3B:66
07-24 13:57:57.392 11564-11576/? D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=7 device=F3:93:9C:88:3B:66
07-24 13:57:57.408 11564-11564/? D/BluetoothGatt: discoverServices() - device: F3:93:9C:88:3B:66
07-24 13:57:57.411 11410-11421/? D/BtGatt.GattService: discoverServices() - address=F3:93:9C:88:3B:66, connId=7
07-24 13:57:57.413 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:57:58.220 11410-11447/? D/BtGatt.GattService: onGetGattDb() - address=F3:93:9C:88:3B:66
07-24 13:57:58.231 11564-11588/? D/BluetoothGatt: onSearchComplete() = Device=F3:93:9C:88:3B:66 Status=0
07-24 13:58:01.756 11564-11564/? D/BluetoothGatt: cancelOpen() - device: F3:93:9C:88:3B:66
07-24 13:58:01.766 11410-11466/? D/BtGatt.GattService: clientDisconnect() - address=F3:93:9C:88:3B:66, connId=7
07-24 13:58:01.767 11410-11460/? E/bt_btif: bta_gattc_mark_bg_conn unable to find the bg connection mask for: f3:93:9c:88:3b:66
07-24 13:58:01.767 11410-11447/? D/BtGatt.GattService: onDisconnected() - clientIf=7, connId=7, address=F3:93:9C:88:3B:66
07-24 13:58:01.768 11564-11577/? D/BluetoothGatt: onClientConnectionState() - status=0 clientIf=7 device=F3:93:9C:88:3B:66
07-24 13:58:04.591 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:05.968 11410-11447/? D/bt_btif_dm: remote version info [f3:93:9c:88:3b:66]: 0, 0, 0
07-24 13:58:06.009 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:12.884 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:13.305 11410-11447/? D/bt_btif_dm: remote version info [f3:93:9c:88:3b:66]: 0, 0, 0
07-24 13:58:13.334 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:20.226 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:20.595 11410-11447/? D/bt_btif_dm: remote version info [f3:93:9c:88:3b:66]: 0, 0, 0
07-24 13:58:20.639 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:27.512 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:27.840 11410-11447/? D/bt_btif_dm: remote version info [f3:93:9c:88:3b:66]: 0, 0, 0
07-24 13:58:27.879 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:34.760 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:35.128 11410-11447/? D/bt_btif_dm: remote version info [f3:93:9c:88:3b:66]: 0, 0, 0
07-24 13:58:35.159 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-24 13:58:42.040 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66

编辑7月25日至17日:看起来手机可能将设备视为耳机。以下日志显示来自Avrcp(音频/视频远程控制配置文件),HeadsetStateMachine和pbap(电话簿访问配置文件)的消息。 我已经确保设备的UUID服务和特性与蓝牙SIG的任何预定义的服务和特性都不匹配。我会进一步调查。

07-25 16:39:59.435 2896-3336/? V/AlarmManager: Triggering alarm #0: 2 when =859680625 package=com.google.android.gmsoperation =*walarm*:null.CONNECTION_ALARM
07-25 16:40:02.544 2896-3336/? V/AlarmManager: Triggering alarm #0: 2 when =859682773 package=com.google.android.gmsoperation =*walarm*:null.CONNECTION_ALARM
07-25 16:40:04.441 5709-5752/? W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016
07-25 16:40:04.442 5709-5752/? W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016
07-25 16:40:04.442 5709-5752/? I/bt_btm_sec: btm_sec_disconnected clearing pending flag handle:10 reason:22
07-25 16:40:04.459 5709-5709/? D/AvrcpBipRsp: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:04.460 5709-5709/? D/BluetoothMapService: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:04.472 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-25 16:40:05.181 5709-5709/? D/BluetoothPbapReceiver: PbapReceiver onReceive action = android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:05.198 5709-5709/? I/BluetoothPbapReceiver: Exit - onReceive for intent:android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:05.199 5709-5709/? D/BluetoothPbapService: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:05.214 5709-5709/? V/BluetoothFtpService: PARSE INTENT action: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:05.231 5709-5709/? D/BluetoothDunService: parseIntent: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:05.606 5709-5752/? W/bt_smp: smp_br_connect_callback is called on unexpected transport 2
07-25 16:40:05.651 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-25 16:40:06.640 2896-3336/? V/AlarmManager: Triggering alarm #0: 2 when =859687830 package=com.google.android.gmsoperation =*walarm*:null.CONNECTION_ALARM
07-25 16:40:11.641 5709-5752/? W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0016
07-25 16:40:11.642 5709-5752/? W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0016
07-25 16:40:11.642 5709-5752/? I/bt_btm_sec: btm_sec_disconnected clearing pending flag handle:11 reason:22
07-25 16:40:11.656 5709-5709/? D/AvrcpBipRsp: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:11.657 5709-5709/? D/BluetoothMapService: onReceive: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:11.666 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth disconnect broadast for Prototype-Device F3:93:9C:88:3B:66
07-25 16:40:12.342 5709-5709/? D/BluetoothPbapReceiver: PbapReceiver onReceive action = android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:12.355 5709-5709/? I/BluetoothPbapReceiver: Exit - onReceive for intent:android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:12.356 5709-5709/? D/BluetoothPbapService: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:12.370 5709-5709/? V/BluetoothFtpService: PARSE INTENT action: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:12.380 5709-5709/? D/BluetoothDunService: parseIntent: action: android.bluetooth.device.action.ACL_DISCONNECTED
07-25 16:40:12.761 5709-5752/? W/bt_smp: smp_br_connect_callback is called on unexpected transport 2
07-25 16:40:12.800 4077-4077/? I/TrustAgent.Tracker: [BluetoothConnectionTracker] Bluetooth connect broadast for Prototype-Device F3:93:9C:88:3B:66
07-25 16:40:13.790 2896-3336/? V/AlarmManager: Triggering alarm #0: 2 when =859694981 package=com.google.android.gmsoperation =*walarm*:null.CONNECTION_ALARM
07-25 16:40:15.927 2896-3336/? V/AlarmManager: Triggering alarm #0: 2 when =859697117 package=com.google.android.gmsoperation =*walarm*:null.CONNECTION_ALARM

0 个答案:

没有答案