Fix vibration race condition in Ringer.
Currently, there is a "stopped" check at the start of the play
action but this may become stale while loading the ringtone,
and specifically before starting the vibration. This can result
in starting the vibration after its stop signal, and it never
ending.
This is fixed by recording the vibration as pending ("reserving")
when it is being setup. This way, a stop and start are both covered
with checks under the same lock, and the start won't happen if its
reservation was cleared.
MUST_SLEEP to imitate slow ringtone load.
Bug: 278073224
Test: extended RingerTest
Change-Id: Ia0103ea990fe86dc4481b4b2105bf6377ff164ba
3 files changed