Fix concurrency issues with ringtone playback.

CallAudioManager has a number of calls into Ringer.java; this code can
come from CallAudioModeStateMachine which is in turn called into via
Bluetooth callbacks.  Added synchronization using the Telecom lock on these
calls to ensure ringer operations don't have concurrency issues.

Also, in AsyncRingtonePlayer add some null checks to ensure that it is
not possible to run into the NPE reported in the bug, should concurrency
issues persist.

Test: Ran unit tests to confirm no regressions in behavior.
Test: Manual test with bluetooth headset; verify I'm seeing the session
logging for ringtone playing now.
Bug: 135997076

Change-Id: I9a119b15d2853a44d5850d040bd31340d1e34127
Merged-In: I9a119b15d2853a44d5850d040bd31340d1e34127
(cherry picked from commit bbe5d15064ecad396d11bc849805d25fa4cb829a)
4 files changed