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
Loading
Please register or sign in to comment