aaudio examples: handle disconnect in write_sine_callback

Automatically reopen the stream if we get disconnected.
Add a futex based signaling class so that the error callback can
immediately inform a waiting thread.

This can be used to prevent the system from playing an unpleasant sound
after the stream is disconnected.

Bug: 63342351
Test: plug and unplug headphones while running write_sine_callback
Change-Id: I3ea4fb24106156a29d2f302f3eb614f25f1b758a
4 files changed