AudioService: fix cross deadlock when accessing audio mode

Do not recompute the requested audio mode by calling getMode()
(which takes mDeviceBroker.mSetModeLock) when only the currently
applied mode is needed to make a decision.

This avoids from worrying about cross deadlocks between
mDeviceBroker.mSetModeLock and mDeviceBroker.mDeviceStateLock
in all code paths that read current audio mode.

Store current mode in an atomic integer.

Bug: 180517927
Test: phone calls
Change-Id: I1dae0691bde5946f2f3f7d699e5e8547c8b8d4dd
1 file changed