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

Commit 6d93713f authored by Jean-Michel Trivi's avatar Jean-Michel Trivi Committed by Android (Google) Code Review
Browse files

Merge "APM: speaker_cleanup is not a beacon usecase" into main

parents 523b6910 b0c8be80
Loading
Loading
Loading
Loading
+19 −10
Original line number Diff line number Diff line
@@ -2486,7 +2486,7 @@ status_t AudioPolicyManager::startSource(const sp<SwAudioOutputDescriptor>& outp
                                         const sp<TrackClientDescriptor>& client,
                                         uint32_t *delayMs)
{
    // cannot start playback of STREAM_TTS if any other output is being used
    // cannot start beacon playback if any other output is being used
    uint32_t beaconMuteLatency = 0;

    *delayMs = 0;
@@ -2494,6 +2494,8 @@ status_t AudioPolicyManager::startSource(const sp<SwAudioOutputDescriptor>& outp
    auto clientVolSrc = client->volumeSource();
    auto clientStrategy = client->strategy();
    auto clientAttr = client->attributes();
    // SPEAKER_CLEANUP doesn't the share the high-frequency requirements of beacons
    if (clientAttr.usage != AUDIO_USAGE_SPEAKER_CLEANUP) {
        if (stream == AUDIO_STREAM_TTS) {
            ALOGV("\t found BEACON stream");
            if (!mTtsOutputAvailable && mOutputs.isAnyOutputActive(
@@ -2506,6 +2508,9 @@ status_t AudioPolicyManager::startSource(const sp<SwAudioOutputDescriptor>& outp
            // some playback other than beacon starts
            beaconMuteLatency = handleEventForBeacon(STARTING_OUTPUT);
        }
    } else {
        // TODO handle muting of other streams outside of a11y
    }

    // force device change if the output is inactive and no audio patch is already present.
    // check active before incrementing usage count
@@ -2776,7 +2781,11 @@ status_t AudioPolicyManager::stopSource(const sp<SwAudioOutputDescriptor>& outpu
    auto clientVolSrc = client->volumeSource();
    bool wasLeUnicastActive = isLeUnicastActive();

    // speaker cleanup is not a beacon event
    // TODO handle speaker cleanup activity
    if (client->attributes().usage != AUDIO_USAGE_SPEAKER_CLEANUP) {
        handleEventForBeacon(stream == AUDIO_STREAM_TTS ? STOPPING_BEACON : STOPPING_OUTPUT);
    }

    if (outputDesc->getActivityCount(clientVolSrc) > 0) {
        if (outputDesc->getActivityCount(clientVolSrc) == 1) {