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

Commit 37f6dc6a authored by William Escande's avatar William Escande
Browse files

Adapter: Lock before cleaning

mLock is used for creating mBluetoothLeAdvertiser and
mBluetoothLeScanner. It must be used at cleanup too.

Test: atest FrameworkBluetoothTests
Test: atest ServiceBluetoothTests
Bug: 291815510
Change-Id: Ib94827b0aa70d293ea98779e8e30f15aff92699b
parent 4b7bbcf6
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -3857,12 +3857,14 @@ public final class BluetoothAdapter {
                    try {
                        mService = null;
                        mLeScanClients.clear();
                        synchronized (mLock) {
                            if (mBluetoothLeAdvertiser != null) {
                                mBluetoothLeAdvertiser.cleanup();
                            }
                            if (mBluetoothLeScanner != null) {
                                mBluetoothLeScanner.cleanup();
                            }
                        }
                    } finally {
                        mServiceLock.writeLock().unlock();
                    }