Use a concurrent hash map to access VolumeDialogControllerImpl's callbacks
The issue is that the VolumeDialogControllerImpl.C's mCallbackMap is accessed from two different threads. Instrumentation shows that via add() and remove() it is modified on the main thread, and methods like C.onConfigurationChanged() are called from VolumeDialogControllerImpl.Receiver, which registers with on a handler tied to a background thread (VolumeDialogControllerImpl.W/mWorker). C.onConfigurationChanged() is called directly from that thread. Use a concurrent hash map in place of hash map to avoid the concurrent modification exception. Test: manual. Ensure device boots. Ensure basic volume control functions. Ensure a configuration change (via locale change) does not result in any crash. Bug: https://issuetracker.google.com/issues/150402778 Change-Id: I26bb8533c30d57e48f500e6863d0f522e1559567
Loading
Please register or sign in to comment