aaudio: fix output bugs and improve input performance, add loopback test

Support AAUDIO_PERFORMANCE_MODE in AudioStreamRecord.cpp
Fix race condition when closing a stream, which this test revealed.
Fix setting of negative notificationFrames for non-FAST tracks.

Convert test from old Oboe API to AAudio.
Add command line options to the test.
Add systrace calls.

Bug: 34093052
Bug: 38313432
Bug: 38178592
Test: loopback.cpp
Change-Id: Ib6d2995cdd3ed432937fde2f26c5394013f0d6e0
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/media/libaaudio/src/client/AudioEndpoint.h b/media/libaaudio/src/client/AudioEndpoint.h
index 46a3fc5..3a2099f 100644
--- a/media/libaaudio/src/client/AudioEndpoint.h
+++ b/media/libaaudio/src/client/AudioEndpoint.h
@@ -56,6 +56,9 @@
 
     void getEmptyRoomAvailable(android::WrappingBuffer *wrappingBuffer);
 
+    int32_t getEmptyFramesAvailable();
+    int32_t getFullFramesAvailable();
+
     void advanceWriteIndex(int32_t deltaFrames);
 
     /**
@@ -81,8 +84,6 @@
 
     int32_t getBufferCapacityInFrames() const;
 
-    int32_t getFullFramesAvailable();
-
 private:
     android::FifoBuffer    *mUpCommandQueue;
     android::FifoBuffer    *mDownDataQueue;