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

Commit db6561f3 authored by Jakub Pawlowski's avatar Jakub Pawlowski
Browse files

LE Audio: close GATT server properly

Currently we are leaking GMCS instance every time BT is restarted.

Bug: 273361967
Test: manual, restart bluetooth, observe output of:
adb shell dumpsys bluetooth_manager | grep -A 10 "Server\:"

Change-Id: I3fabbe267a380a1eae482bb54be5551db9f0029e
parent 473b3c01
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1386,12 +1386,18 @@ public class MediaControlGattService implements MediaControlGattServiceInterface
        if (DBG) {
            Log.d(TAG, "Destroy");
        }
        if (mBluetoothGattServer != null
                && mBluetoothGattServer.removeService(mGattService)) {

        if (mBluetoothGattServer == null) {
            return;
        }

        if (mBluetoothGattServer.removeService(mGattService)) {
            if (mCallbacks != null) {
                mCallbacks.onServiceInstanceUnregistered(ServiceStatus.OK);
            }
        }

        mBluetoothGattServer.close();
    }

    @VisibleForTesting