Suppress implicit-fallthrough warnings in libaudioclient.
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: Icafaff606364fe7bffaad1e9c2e763c444ea999c
diff --git a/media/libaudioclient/Android.bp b/media/libaudioclient/Android.bp
index 2df37a8..f93d44b 100644
--- a/media/libaudioclient/Android.bp
+++ b/media/libaudioclient/Android.bp
@@ -53,7 +53,10 @@
export_shared_lib_headers: ["libbinder"],
local_include_dirs: ["include/media", "aidl"],
- header_libs: ["libaudioclient_headers"],
+ header_libs: [
+ "libaudioclient_headers",
+ "libbase_headers",
+ ],
export_header_lib_headers: ["libaudioclient_headers"],
// for memory heap analysis
diff --git a/media/libaudioclient/AudioRecord.cpp b/media/libaudioclient/AudioRecord.cpp
index e2de8e7..0aabaf7 100644
--- a/media/libaudioclient/AudioRecord.cpp
+++ b/media/libaudioclient/AudioRecord.cpp
@@ -19,6 +19,7 @@
#define LOG_TAG "AudioRecord"
#include <inttypes.h>
+#include <android-base/macros.h>
#include <sys/resource.h>
#include <binder/IPCThreadState.h>
@@ -1446,7 +1447,7 @@
case NS_WHENEVER:
// Event driven: call wake() when callback notifications conditions change.
ns = INT64_MAX;
- // fall through
+ FALLTHROUGH_INTENDED;
default:
LOG_ALWAYS_FATAL_IF(ns < 0, "processAudioBuffer() returned %" PRId64, ns);
pauseInternal(ns);
diff --git a/media/libaudioclient/AudioTrack.cpp b/media/libaudioclient/AudioTrack.cpp
index 76c9bfb..4881ddc 100644
--- a/media/libaudioclient/AudioTrack.cpp
+++ b/media/libaudioclient/AudioTrack.cpp
@@ -22,6 +22,7 @@
#include <math.h>
#include <sys/resource.h>
+#include <android-base/macros.h>
#include <audio_utils/clock.h>
#include <audio_utils/primitives.h>
#include <binder/IPCThreadState.h>
@@ -2964,7 +2965,7 @@
if (mProxy->getStreamEndDone()) {
return true;
}
- // fall through
+ FALLTHROUGH_INTENDED;
case STATE_ACTIVE:
case STATE_STOPPING:
break;
@@ -3083,7 +3084,7 @@
case NS_WHENEVER:
// Event driven: call wake() when callback notifications conditions change.
ns = INT64_MAX;
- // fall through
+ FALLTHROUGH_INTENDED;
default:
LOG_ALWAYS_FATAL_IF(ns < 0, "processAudioBuffer() returned %" PRId64, ns);
pauseInternal(ns);
diff --git a/media/libaudioclient/AudioTrackShared.cpp b/media/libaudioclient/AudioTrackShared.cpp
index d40f193..01f400d 100644
--- a/media/libaudioclient/AudioTrackShared.cpp
+++ b/media/libaudioclient/AudioTrackShared.cpp
@@ -17,6 +17,7 @@
#define LOG_TAG "AudioTrackShared"
//#define LOG_NDEBUG 0
+#include <android-base/macros.h>
#include <private/media/AudioTrackShared.h>
#include <utils/Log.h>
@@ -247,7 +248,7 @@
ts = requested;
break;
}
- // fall through
+ FALLTHROUGH_INTENDED;
case TIMEOUT_CONTINUE:
// FIXME we do not retry if requested < 10ms? needs documentation on this state machine
if (!measure || requested->tv_sec < total.tv_sec ||
@@ -505,7 +506,7 @@
ts = requested;
break;
}
- // fall through
+ FALLTHROUGH_INTENDED;
case TIMEOUT_CONTINUE:
// FIXME we do not retry if requested < 10ms? needs documentation on this state machine
if (requested->tv_sec < total.tv_sec ||
diff --git a/media/libaudioclient/include/media/AudioPolicyHelper.h b/media/libaudioclient/include/media/AudioPolicyHelper.h
index 73ee0a7..fbe9546 100644
--- a/media/libaudioclient/include/media/AudioPolicyHelper.h
+++ b/media/libaudioclient/include/media/AudioPolicyHelper.h
@@ -16,6 +16,7 @@
#ifndef AUDIO_POLICY_HELPER_H_
#define AUDIO_POLICY_HELPER_H_
+#include <android-base/macros.h>
#include <system/audio.h>
static inline
@@ -81,7 +82,7 @@
break;
case AUDIO_STREAM_ENFORCED_AUDIBLE:
attr->flags |= AUDIO_FLAG_AUDIBILITY_ENFORCED;
- // intended fall through, attributes in common with STREAM_SYSTEM
+ FALLTHROUGH_INTENDED; // attributes in common with STREAM_SYSTEM
case AUDIO_STREAM_SYSTEM:
attr->content_type = AUDIO_CONTENT_TYPE_SONIFICATION;
attr->usage = AUDIO_USAGE_ASSISTANCE_SONIFICATION;