Prevent deadlock on BluetoothManagerService during a user switch.
During a user switch, BluetoothManagerService restarts its profiles via BMS.unbindAllBluetoothProfileServices method. This method calls mContext.unbindService(psc) for each bound bluetooth profile while holding mProfileServices lock. But unbinding the bluetooth profile eventually gets BMS.onServiceDisconnected method to be called, where the same mProfileServices lock will be tried to get acquired, on a different thread, which will cause a deadlock. This CL makes necessary changes to prevent the deadlock. Detailed analysis document is attached to the bug. Bug: 300421828 Test: Manual comparison of perfetto traces Test: atest ServiceBluetoothTests (cherry picked from https://googleplex-android-review.googlesource.com/q/commit:9fe127742e2d1d9d37b89cb606733ff310c31149) Merged-In: I289b1bea610c24f8d39a1b5e39221721152219d1 Change-Id: I289b1bea610c24f8d39a1b5e39221721152219d1
Loading
Please register or sign in to comment