Refine the sync in CachedBluetoothDevice

SystemUi uses multi-thread to access CachedBluetoothDevice. If one thread
is traversing the mProfiles while another thread is updating this
mProifles, it will crash with ConcurrentModificationException.

This CL adds lock to mProfiles manually to avoid this case.

Bug: 117122392
Test: Manual
Change-Id: I5d90cd6e35a18f1e782e766b7c448088243d27cf
2 files changed