Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit f1f50ee2 authored by Vania Januar's avatar Vania Januar Committed by Android (Google) Code Review
Browse files

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

parents b4838aa9 0ed9aba0
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -636,6 +636,7 @@ public class FrameworkServicesModule {

    @Provides
    @Singleton
    @Nullable
    static BluetoothAdapter provideBluetoothAdapter(BluetoothManager bluetoothManager) {
        return bluetoothManager.getAdapter();
    }
+3 −3
Original line number Diff line number Diff line
@@ -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) {