Simplify range check for audio_mode_t
AudioSystem::setMode previously allowed negative modes, but these were
then rejected by AudioFlinger.
Now negative modes (including AUDIO_MODE_INVALID and AUDIO_MODE_CURRENT)
are explicitly disallowed.
Change-Id: I0bac8fea737c8eb1f5b6afbb893e48739f88d745
diff --git a/services/audioflinger/AudioPolicyService.cpp b/services/audioflinger/AudioPolicyService.cpp
index f572fce..3f86d58 100644
--- a/services/audioflinger/AudioPolicyService.cpp
+++ b/services/audioflinger/AudioPolicyService.cpp
@@ -193,7 +193,7 @@
if (!checkPermission()) {
return PERMISSION_DENIED;
}
- if (state < 0 || state >= AUDIO_MODE_CNT) {
+ if (uint32_t(state) >= AUDIO_MODE_CNT) {
return BAD_VALUE;
}