audioflinger: only hold wakeLock when started

The AAudio MMAP streams used to hold a wakeLock from
the time they were opened until closed.
Now it is acquired when the first stream is started
and released when the first stream is stopped.

This was tested by creating shared streams using
OboeTester and write_sine_callback and input_monitor_callback and
then adding lots of logs to see when the
wakeLock was acquired and released.

Note that ~ThreadBase() calls releaseWakeLock_l() so ~MmapThread()
does not need to.

Bug: 167345722
Test: Launch OboeTester
Test: Tap TEST OUTPUT
Test: Tap OPEN
Test: Enter: adb shell dumpsys power
Test: See no MmapPlayback wakelock
Test: Tap START
Test: Enter: adb shell dumpsys power
Test: See "ACQ MmapPlayback"
Test: Tap STOP
Test: Enter: adb shell dumpsys power
Test: See "REL MmapPlayback"

Test: atest AAudioTests
Change-Id: Iad87f5ebd22f20c89699e8b1a75d8df482046360
1 file changed