Use -Werror in frameworks/av/media/libaaudio

* Remove unused local variables, labels, functions, private fields.
* Fix warning of unused return result.
* Use template functions in .h file to avoid warning of unused static functions.

Bug: 66996870
Test: build with WITH_TIDY=1
Change-Id: I54962a7fd36a405e54366130b9c0a24e26fe8ebb
diff --git a/media/libaaudio/tests/Android.bp b/media/libaaudio/tests/Android.bp
index 099f416..87a4273 100644
--- a/media/libaaudio/tests/Android.bp
+++ b/media/libaaudio/tests/Android.bp
@@ -1,5 +1,14 @@
+cc_defaults {
+    name: "libaaudio_tests_defaults",
+    cflags: [
+        "-Wall",
+        "-Werror",
+    ],
+}
+
 cc_test {
     name: "test_aaudio_marshalling",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_marshalling.cpp"],
     shared_libs: [
         "libaaudio",
@@ -11,12 +20,14 @@
 
 cc_test {
     name: "test_block_adapter",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_block_adapter.cpp"],
     shared_libs: ["libaaudio"],
 }
 
 cc_test {
     name: "test_timestamps",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_timestamps.cpp"],
     header_libs: ["libaaudio_example_utils"],
     shared_libs: ["libaaudio"],
@@ -24,12 +35,14 @@
 
 cc_test {
     name: "test_linear_ramp",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_linear_ramp.cpp"],
     shared_libs: ["libaaudio"],
 }
 
 cc_test {
     name: "test_open_params",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_open_params.cpp"],
     shared_libs: [
         "libaaudio",
@@ -41,6 +54,7 @@
 
 cc_test {
     name: "test_no_close",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_no_close.cpp"],
     shared_libs: [
         "libaaudio",
@@ -52,6 +66,7 @@
 
 cc_test {
     name: "test_aaudio_recovery",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_recovery.cpp"],
     shared_libs: [
         "libaaudio",
@@ -63,6 +78,7 @@
 
 cc_test {
     name: "test_n_streams",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_n_streams.cpp"],
     shared_libs: [
         "libaaudio",
@@ -74,6 +90,7 @@
 
 cc_test {
     name: "test_bad_disconnect",
+    defaults: ["libaaudio_tests_defaults"],
     srcs: ["test_bad_disconnect.cpp"],
     shared_libs: [
         "libaaudio",