Skip to content
Snippets Groups Projects
Commit a279e614 authored by Vania Januar's avatar Vania Januar Committed by Automerger Merge Worker
Browse files

Merge "Add @Nullable to BluetoothAdapter provider." into tm-qpr-dev am: f1f50ee2

parents 78095145 f1f50ee2
No related branches found
No related tags found
No related merge requests found
......@@ -636,6 +636,7 @@ public class FrameworkServicesModule {
@Provides
@Singleton
@Nullable
static BluetoothAdapter provideBluetoothAdapter(BluetoothManager bluetoothManager) {
return bluetoothManager.getAdapter();
}
......
......@@ -38,7 +38,7 @@ class StylusManager
@Inject
constructor(
private val inputManager: InputManager,
private val bluetoothAdapter: BluetoothAdapter,
private val bluetoothAdapter: BluetoothAdapter?,
@Background private val handler: Handler,
@Background private val executor: Executor,
) : InputManager.InputDeviceListener, BluetoothAdapter.OnMetadataChangedListener {
......@@ -141,7 +141,7 @@ constructor(
}
private fun onStylusBluetoothConnected(btAddress: String) {
val device: BluetoothDevice = bluetoothAdapter.getRemoteDevice(btAddress) ?: return
val device: BluetoothDevice = bluetoothAdapter?.getRemoteDevice(btAddress) ?: return
try {
bluetoothAdapter.addOnMetadataChangedListener(device, executor, this)
} catch (e: IllegalArgumentException) {
......@@ -150,7 +150,7 @@ constructor(
}
private fun onStylusBluetoothDisconnected(btAddress: String) {
val device: BluetoothDevice = bluetoothAdapter.getRemoteDevice(btAddress) ?: return
val device: BluetoothDevice = bluetoothAdapter?.getRemoteDevice(btAddress) ?: return
try {
bluetoothAdapter.removeOnMetadataChangedListener(device, this)
} catch (e: IllegalArgumentException) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment