Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 975ecc0e authored by Eric Laurent's avatar Eric Laurent
Browse files

UsecaseValidator: ignore special use cases when usage is unknown

The game usecase validator must ignore special routing use cases
indicated by audio attributes flags (BT SCO, TTS...) when the usage
is unknown.

Also fix a problem in ToneGenerator where the attributes flags were
overwritten when the low latency flag was set.

Bug: 283014940
Test: repro steps in bug
Change-Id: I4d5a038436b0dd2453dd8320dafba478970bb06e
parent ef881646
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1306,7 +1306,7 @@ bool ToneGenerator::initAudioTrack() {
        streamType = AUDIO_STREAM_DTMF;
    }
    attr = AudioSystem::streamTypeToAttributes(streamType);
    attr.flags = AUDIO_FLAG_LOW_LATENCY;
    attr.flags = static_cast<audio_flags_mask_t>(attr.flags | AUDIO_FLAG_LOW_LATENCY);

    const size_t frameCount = mProcessSize;
    status_t status = mpAudioTrack->set(
+3 −0
Original line number Diff line number Diff line
@@ -142,6 +142,9 @@ class UsecaseValidatorImpl : public UsecaseValidator {

    bool areFlagsValid(audio_flags_mask_t flags) {
        ALOGV("areFlagsValid flags: %#x", flags);
        if ((flags & (AUDIO_FLAG_SCO|AUDIO_FLAG_AUDIBILITY_ENFORCED|AUDIO_FLAG_BEACON)) != 0) {
            return false;
        }
        if ((flags & AUDIO_FLAG_LOW_LATENCY) != 0) {
            return true;
        }