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
Exempt-From-Owner-Approval: cherry picked from goog
Merged-In: I54962a7fd36a405e54366130b9c0a24e26fe8ebb
Change-Id: I54962a7fd36a405e54366130b9c0a24e26fe8ebb
(cherry picked from commit 68326fe017a18957419a81489b67f75831f9a674)
diff --git a/media/libaaudio/examples/utils/AAudioExampleUtils.h b/media/libaaudio/examples/utils/AAudioExampleUtils.h
index 530188b..156c7be 100644
--- a/media/libaaudio/examples/utils/AAudioExampleUtils.h
+++ b/media/libaaudio/examples/utils/AAudioExampleUtils.h
@@ -28,7 +28,8 @@
#define NANOS_PER_MILLISECOND (NANOS_PER_MICROSECOND * 1000)
#define NANOS_PER_SECOND (NANOS_PER_MILLISECOND * 1000)
-static const char *getSharingModeText(aaudio_sharing_mode_t mode) {
+template <class T = aaudio_sharing_mode_t>
+const char *getSharingModeText(aaudio_sharing_mode_t mode) {
const char *modeText = "unknown";
switch (mode) {
case AAUDIO_SHARING_MODE_EXCLUSIVE:
@@ -43,7 +44,8 @@
return modeText;
}
-static int64_t getNanoseconds(clockid_t clockId = CLOCK_MONOTONIC) {
+template <class T = clockid_t>
+int64_t getNanoseconds(clockid_t clockId = CLOCK_MONOTONIC) {
struct timespec time;
int result = clock_gettime(clockId, &time);
if (result < 0) {