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

Commit 364b10bc authored by Jakub Pawlowski's avatar Jakub Pawlowski Committed by Cherrypicker Worker
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\:"
(cherry picked from https://android-review.googlesource.com/q/commit:db6561f3d907c74055fe74f8e8a5b979da5cd1aa)
Merged-In: I3fabbe267a380a1eae482bb54be5551db9f0029e
Change-Id: I3fabbe267a380a1eae482bb54be5551db9f0029e
parent dcfd8ab2
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1387,12 +1387,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