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

Skip to content
Commit 340bc09a authored by Hui Peng's avatar Hui Peng Committed by Cherrypicker Worker
Browse files

Fix a deadlock bug in Bluetooth Framework

Both BluetoothDevice and BluetoothAdapter maintain a reference to a
IBluetooth proxy object (sService) and each class uses a lock object
to serialize access to their own reference. These references are updated
by BluetoothManagerService with registered callbacks (IBlueoothManagerCallback).

In the current implentaion, when an app thread uses BluetoothDevice#getService
to access its reference to service proxy, with the BluetoothManager updating it
at the same time, as the order of taking the locks is different, deadlock is possible
under certain circumstances (triggered in bug 241212710).

This patch fixes the deadlock issue by removing the reference to service
proxy object in BluetoothDevice class, and accesses are via
the reference in BluetoothAdapter class instead.

Test: existing unit tests
Bug: 241212710
Tag: #stability
Change-Id: I15cd2707acf5caa04d97c6ede3bd5bedd6475c65
(cherry picked from commit 83c6281b)
Merged-In: I15cd2707acf5caa04d97c6ede3bd5bedd6475c65
parent 900f9124
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment