LeAudioService: Use ReentrantReadWriteLock
Currently, in LeAudioService we use synchronized blocks to acces mGroupDescriptors list. Gradually, as we wrapped more and more code in synchronized blocks, deadlocks and TimeoutExceptions started popping around. Examples include BT stack calling AF from synchronized block, and then AF calling BT stack back, to check some property of LE Audio device. mGroupDescriptors are modified just in 3 places, so accessing it is perfect candidate for usage of ReentrantReadWriteLock - it should solve all the deadlocks. Bug: 325674688 Bug: 326295400 Test: atest BluetoothInstrumentationTests Test: 1. Bond, unbond, reconnect LE Audio device, preferably one using CSIP. 2. Observe logcat output and verify no TimeoutException is thrown from LeAudioService Change-Id: Icdb944981ddceca39df95694933d05ffe78ee72e
Loading
Please register or sign in to comment