AudioPolicyManager:Fix CTS testGaplessMP3AudioTrackOffload fail
getDirectPlaybackSupport return AUDIO_DIRECT_OFFLOAD_GAPLESS_SUPPORTED,
but getOffloadSupport return AUDIO_OFFLOAD_NOT_SUPPORTED cause test
fail.
solution: not return offload support when offloadPossible is false.
Test: atest AudioTrackOffloadTest#testGaplessMP3AudioTrackOffload
AudioManagerTest#testAdjustUnmuteNotificationInVibrate
AudioManagerTest#testStreamTypeAliasChange
Bug: 304449830
Change-Id: Ia68e70b98469e5c35b74e20e062519a4eb91d592
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index cc32aec..c201453 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -4328,8 +4328,8 @@
if (!mAvailableOutputDevices.containsAtLeastOne(curProfile->getSupportedDevices())) {
continue;
}
- if ((curProfile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)
- != AUDIO_OUTPUT_FLAG_NONE) {
+ if (offloadPossible && ((curProfile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)
+ != AUDIO_OUTPUT_FLAG_NONE)) {
if ((directMode & AUDIO_DIRECT_OFFLOAD_GAPLESS_SUPPORTED)
!= AUDIO_DIRECT_NOT_SUPPORTED) {
// Already reports offload gapless supported. No need to report offload support.