Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 54d85c4b authored by Tyler Gunn's avatar Tyler Gunn
Browse files

InCallTonePlayer concurrency improvements.

We've seen a number of issues lately where incall tones are not reporting
back to CallAudioManager when the tone is no longer playing.  This has
caused issues with the CallAudioModeStateMachine setting the mode back
to NORMAL.

To remedy this situation, implemented the following concurrency changes:
1) Removed the use of synchronized(this) as a means of providing a way for
a playing tone to be interrupted the InCallTonePlayer#stopTone; replaced
this in favor of using a CountDownLatch.
2) Removed synchronization primitives for mState since these are always
operations on the main thread.
3) Replaced integer sTonesPlaying with an AtomicInteger; there was no
locking on that instance and it was possible for concurrently playing
InCallTonePlayer instances to make conflicting updates.

Another optimization was moving the state change and media player cleanup
from within the media player onCompletion callback into a finally block
which takes place after we're done waiting on the playback completion.

Test: Performed manual testing on device on a carrier with ringback; verified that ringback plays and stops as expected.
Test: Performed manual testing on device by disconneting calls and verifying that the audio mode changes to MODE_NORMAL.  Also verified through log inspection that the locks and latches are performing as expected.
Test: Wrote new unit tests for InCallTonePlayer to verify that tone interruption results in signaling to CallAudioManager of the tone stop.
Fixes: 227404845
Change-Id: Ib90d1015887e0b6580950fff1c223f91e8490fb0
parent e3dfe2d9
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment