Suppress implicit-fallthrough warnings in audioflinger etc.
Add FALLTHROUGH_INTENDED for clang compiler.
Bug: 112564944
Test: build with global -Wimplicit-fallthrough.
Change-Id: I8875bc7ed073aae84d5df97eb39c8c745ca627ef
diff --git a/media/libaudioprocessing/tests/Android.mk b/media/libaudioprocessing/tests/Android.mk
index 23e1c3a..8e081a3 100644
--- a/media/libaudioprocessing/tests/Android.mk
+++ b/media/libaudioprocessing/tests/Android.mk
@@ -78,6 +78,8 @@
liblog \
libutils \
+LOCAL_HEADER_LIBRARIES := libbase_headers
+
LOCAL_MODULE := test-resampler
LOCAL_MODULE_TAGS := optional
diff --git a/media/libaudioprocessing/tests/test-resampler.cpp b/media/libaudioprocessing/tests/test-resampler.cpp
index fbc9326..f178bde 100644
--- a/media/libaudioprocessing/tests/test-resampler.cpp
+++ b/media/libaudioprocessing/tests/test-resampler.cpp
@@ -27,6 +27,7 @@
#include <math.h>
#include <audio_utils/primitives.h>
#include <audio_utils/sndfile.h>
+#include <android-base/macros.h>
#include <utils/Vector.h>
#include <media/AudioBufferProvider.h>
#include <media/AudioResampler.h>
@@ -87,14 +88,14 @@
}
return numValues;
}
- // fall through
+ FALLTHROUGH_INTENDED;
case ',':
if (hadDigit) {
hadDigit = false;
numValues++;
break;
}
- // fall through
+ FALLTHROUGH_INTENDED;
default:
return -1;
}
diff --git a/services/audioflinger/Effects.cpp b/services/audioflinger/Effects.cpp
index a44b758..b3f5efd 100644
--- a/services/audioflinger/Effects.cpp
+++ b/services/audioflinger/Effects.cpp
@@ -248,7 +248,7 @@
switch (mState) {
case RESTART:
reset_l();
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
case STARTING:
// clear auxiliary effect input buffer for next accumulation
diff --git a/services/audioflinger/Threads.cpp b/services/audioflinger/Threads.cpp
index 4ca50d7..c2320bc 100644
--- a/services/audioflinger/Threads.cpp
+++ b/services/audioflinger/Threads.cpp
@@ -4357,7 +4357,7 @@
isActive = false;
break;
}
- // fall through
+ FALLTHROUGH_INTENDED;
case TrackBase::STOPPING_2:
case TrackBase::PAUSED:
case TrackBase::STOPPED:
diff --git a/services/audioflinger/Tracks.cpp b/services/audioflinger/Tracks.cpp
index a7c4253..6d25fb9 100644
--- a/services/audioflinger/Tracks.cpp
+++ b/services/audioflinger/Tracks.cpp
@@ -842,7 +842,7 @@
// Offloaded track was draining, we need to carry on draining when resumed
mResumeToStopping = true;
- // fall through...
+ FALLTHROUGH_INTENDED;
case ACTIVE:
case RESUMING:
mState = PAUSING;
diff --git a/services/audiopolicy/enginedefault/Android.mk b/services/audiopolicy/enginedefault/Android.mk
index cbbe306..837d5bb 100644
--- a/services/audiopolicy/enginedefault/Android.mk
+++ b/services/audiopolicy/enginedefault/Android.mk
@@ -34,6 +34,8 @@
LOCAL_MODULE := libaudiopolicyenginedefault
LOCAL_MODULE_TAGS := optional
+LOCAL_HEADER_LIBRARIES := libbase_headers
+
LOCAL_STATIC_LIBRARIES := \
libaudiopolicycomponents \
diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 267996c..3476419 100644
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -25,6 +25,7 @@
#endif
#include "Engine.h"
+#include <android-base/macros.h>
#include <AudioPolicyManagerObserver.h>
#include <AudioPort.h>
#include <IOProfile.h>
@@ -302,7 +303,7 @@
break;
}
// when in call, DTMF and PHONE strategies follow the same rules
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
case STRATEGY_PHONE:
// Force use of only devices on primary output if:
@@ -343,7 +344,7 @@
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_BLUETOOTH_SCO;
if (device) break;
// if SCO device is requested but no SCO device is available, fall back to default case
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
default: // FORCE_NONE
device = availableOutputDevicesType & AUDIO_DEVICE_OUT_HEARING_AID;
@@ -416,7 +417,7 @@
outputDeviceTypesToIgnore);
break;
}
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
case STRATEGY_ENFORCED_AUDIBLE:
// strategy STRATEGY_ENFORCED_AUDIBLE uses same routing policy as STRATEGY_SONIFICATION
@@ -466,7 +467,7 @@
}
}
// The second device used for sonification is the same as the device used by media strategy
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
case STRATEGY_ACCESSIBILITY:
if (strategy == STRATEGY_ACCESSIBILITY) {
@@ -496,7 +497,7 @@
}
}
// For other cases, STRATEGY_ACCESSIBILITY behaves like STRATEGY_MEDIA
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
// FIXME: STRATEGY_REROUTING follow STRATEGY_MEDIA for now
case STRATEGY_REROUTING:
@@ -681,7 +682,7 @@
device = AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET;
break;
}
- // FALL THROUGH
+ FALLTHROUGH_INTENDED;
default: // FORCE_NONE
if (availableDeviceTypes & AUDIO_DEVICE_IN_WIRED_HEADSET) {