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

Commit 89cd993a authored by Jakub Pawłowski's avatar Jakub Pawłowski Committed by Gerrit Code Review
Browse files

Merge "TbsGatt and MCS: unregister adapter state listener to prevent crash" into main

parents d395be0f 0b463845
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -1636,6 +1636,8 @@ public class MediaControlGattService implements MediaControlGattServiceInterface
            Log.d(TAG, "Destroy");
        }

        mAdapterService.unregisterBluetoothStateCallback(mBluetoothStateChangeCallback);

        if (mBluetoothGattServer == null) {
            return;
        }
+6 −2
Original line number Diff line number Diff line
@@ -254,8 +254,10 @@ public class TbsGatt {

    TbsGatt(TbsService tbsService) {
        mContext = tbsService;
        mAdapterService =  Objects.requireNonNull(AdapterService.getAdapterService(),
                "AdapterService shouldn't be null when creating MediaControlCattService");
        mAdapterService =
                Objects.requireNonNull(
                        AdapterService.getAdapterService(),
                        "AdapterService shouldn't be null when creating TbsGatt");

        mAdapterService.registerBluetoothStateCallback(
                mContext.getMainExecutor(), mBluetoothStateChangeCallback);
@@ -363,6 +365,8 @@ public class TbsGatt {
    }

    public void cleanup() {
        mAdapterService.unregisterBluetoothStateCallback(mBluetoothStateChangeCallback);

        if (mBluetoothGattServer == null) {
            return;
        }