NPE in BluetoothSocket#connect()
- Android version: 9
- Phone model: Huawei ANE-LX1
- Briar version: 1.2.9 (9d96ce6d)
- User feedback: "Unlocked the phone and Briar showed me this."
Stacktrace:
java.lang.NullPointerException: Attempt to read from field 'java.lang.String com.android.bluetooth.btservice.AdapterService$ConnectRecord.packageName' on a null object reference
at android.os.Parcel.createException(Parcel.java:1959)
at android.os.Parcel.readException(Parcel.java:1921)
at android.os.Parcel.readException(Parcel.java:1871)
at android.bluetooth.IBluetooth$Stub$Proxy.shouldRefuseConn(IBluetooth.java:2108)
at android.bluetooth.BluetoothSocket.connect(BluetoothSocket.java:400)
at org.briarproject.bramble.plugin.bluetooth.AndroidBluetoothPlugin.connectTo(AndroidBluetoothPlugin.java:206)
at org.briarproject.bramble.plugin.bluetooth.BluetoothPlugin.connect(BluetoothPlugin.java:318)
at org.briarproject.bramble.plugin.bluetooth.BluetoothPlugin.createConnection(BluetoothPlugin.java:337)
at org.briarproject.bramble.plugin.bluetooth.BluetoothPlugin.lambda$connect$1$BluetoothPlugin(BluetoothPlugin.java:290)
at org.briarproject.bramble.plugin.bluetooth.-$$Lambda$BluetoothPlugin$ll6XYbG2pnImYnbEJhWCfN150gw.run(Unknown Source:6)
at java.util.concurrent.ThreadPoolExecutor.processTask(ThreadPoolExecutor.java:1187)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
at java.lang.Thread.run(Thread.java:784)
Last lines of log:
08-17 23:11:37.677 I/PollerImpl: Polling plugin org.briarproject.bramble.bluetooth
08-17 23:11:37.694 I/ConnectionRegistryImpl: 2 contacts connected or better: org.briarproject.bramble.blue
tooth
08-17 23:11:37.699 I/BluetoothConnectionLimiterImpl: Can open contact connection
08-17 23:11:37.700 I/BluetoothPlugin: Connecting to A8:[scrubbed]:A9
08-17 23:11:37.702 I/BluetoothConnectionLimiterImpl: Can open contact connection
08-17 23:11:37.702 I/BluetoothPlugin: Connecting to AC:[scrubbed]:EE
08-17 23:11:37.703 I/BluetoothConnectionLimiterImpl: Can open contact connection
08-17 23:11:37.703 I/BluetoothPlugin: Connecting to 10:[scrubbed]:00
Looks like a bug in the Bluetooth stack that we could work around by catching the NPE and treating it as a failed connection attempt.