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

Commit 34f30b43 authored by Ramjee Singh's avatar Ramjee Singh
Browse files

policy-hal: enable custom audio policy.

This change enable custom audio policy and also includes
the fixes that went in to audio policy manager

audio policy: add support for external audio sources
Change-Id: If5805d58a4356b2f681f1aabf54375f62b55b98a

Add setMasterMono and getMasterMono
Change-Id: I32dc1fcecf285967a61bd508af3bb299595db57d

AudioPolicy: AudioOutputDescriptor set/get for patch handle
Change-Id: I5bffecf7a157ec042d749064208bc6c279008542

AudioPolicyManager: force encoded surround setting
Change-Id: I0f7a486bf1aa7a27f15cf220e2c75ef23f8f8536

audio: several fixes in audio routing callbacks
Change-Id: Ieb0d9f92f563a40552eb31bc0499c8ac65f78ce4

audio policy: move volume table to XML file
Change-Id: I78c91bc3378b6c47202abe7b5c1c1e011ff62eed

AudioPolicy: capture sample rate 0 is route-specific default
Change-Id: I7d193640572c08ab5e5f1ecfc8ad6d31635967dd

audio policy: remove deserialization from policy objects
Change-Id: I1ce798848f4657b37e47446c9fbdc63f7ed0390e

DO NOT MERGE - audio policy: disable concurrent capture
Change-Id: I9085918f1f7b12e28430958cceb768bb29c12bdb

audio policy: select output with best sample format match
Change-Id: I31981940be5d1c06d713d52187cfb0a7bf355773

audio policy: audio sessions on input descriptors
Change-Id: I915a65989a7fd0d3cbe2fcf5a0aee2ea0df5f4f5

Call SoundTrigger::setCaptureState in AudioPoilcyManager::closeAllInputs
Change-Id: I613434ecacce3ef03a657008fd94c314948ba2b8

Change-Id: Iee8ef2647691fe1167b95f19357f17c28f54bf0e
parent efd1c719
Loading
Loading
Loading
Loading
+107 −61
Original line number Diff line number Diff line
@@ -116,7 +116,7 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d
                                                         const char *device_address,
                                                         const char *device_name)
{
    ALOGV("setDeviceConnectionStateInt() device: 0x%X, state %d, address %s name %s",
    ALOGD("setDeviceConnectionStateInt() device: 0x%X, state %d, address %s name %s",
            device, state, device_address, device_name);

    // connect/disconnect only 1 device at a time
@@ -314,6 +314,10 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d
            }
        }

        if (state == AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE) {
            cleanUpForDevice(devDesc);
        }

        mpClientInterface->onAudioPortListUpdate();
        return NO_ERROR;
    }  // end if is output device
@@ -390,6 +394,10 @@ status_t AudioPolicyManagerCustom::setDeviceConnectionStateInt(audio_devices_t d
            updateCallRouting(newDevice);
        }

        if (state == AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE) {
            cleanUpForDevice(devDesc);
        }

        mpClientInterface->onAudioPortListUpdate();
        return NO_ERROR;
    } // end if is input device
@@ -409,6 +417,11 @@ bool AudioPolicyManagerCustom::isOffloadSupported(const audio_offload_info_t& of
     offloadInfo.format,
     offloadInfo.stream_type, offloadInfo.bit_rate, offloadInfo.duration_us,
     offloadInfo.has_video);

     if (mMasterMono) {
        return false; // no offloading if mono is set.
     }

#ifdef VOICE_CONCURRENCY
    char concpropValue[PROPERTY_VALUE_MAX];
    if (property_get("voice.playback.conc.disabled", concpropValue, NULL)) {
@@ -575,12 +588,12 @@ audio_devices_t AudioPolicyManagerCustom::getNewOutputDevice(const sp<AudioOutpu
{
    audio_devices_t device = AUDIO_DEVICE_NONE;

    ssize_t index = mAudioPatches.indexOfKey(outputDesc->mPatchHandle);
    ssize_t index = mAudioPatches.indexOfKey(outputDesc->getPatchHandle());
    if (index >= 0) {
        sp<AudioPatch> patchDesc = mAudioPatches.valueAt(index);
        if (patchDesc->mUid != mUidCached) {
            ALOGV("getNewOutputDevice() device %08x forced by patch %d",
                  outputDesc->device(), outputDesc->mPatchHandle);
                  outputDesc->device(), outputDesc->getPatchHandle());
            return outputDesc->device();
        }
    }
@@ -638,7 +651,7 @@ audio_devices_t AudioPolicyManagerCustom::getNewOutputDevice(const sp<AudioOutpu

void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
{
    ALOGV("setPhoneState() state %d", state);
    ALOGD("setPhoneState() state %d", state);
    // store previous phone state for management of sonification strategy below
    audio_devices_t newDevice = AUDIO_DEVICE_NONE;
    int oldState = mEngine->getPhoneState();
@@ -714,25 +727,29 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
            audio_io_handle_t activeInput = mInputs.getActiveInput();
            if (activeInput != 0) {
               sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput);
               switch(activeDesc->mInputSource) {
               switch(activeDesc->inputSource()) {
                   case AUDIO_SOURCE_VOICE_UPLINK:
                   case AUDIO_SOURCE_VOICE_DOWNLINK:
                   case AUDIO_SOURCE_VOICE_CALL:
                       ALOGD("voice_conc:FOUND active input during call active: %d",activeDesc->mInputSource);
                       ALOGD("voice_conc:FOUND active input during call active: %d",activeDesc->inputSource());
                   break;

                   case  AUDIO_SOURCE_VOICE_COMMUNICATION:
                        if(prop_voip_enabled) {
                            ALOGD("voice_conc:CLOSING VoIP input source on call setup :%d ",activeDesc->mInputSource);
                            stopInput(activeInput, activeDesc->mSessions.itemAt(0));
                            releaseInput(activeInput, activeDesc->mSessions.itemAt(0));
                            ALOGD("voice_conc:CLOSING VoIP input source on call setup :%d ",activeDesc->inputSource());
                            AudioSessionCollection activeSessions = activeDesc->getActiveAudioSessions();
                            audio_session_t activeSession = activeSessions.keyAt(0);
                            stopInput(activeInput, activeSession);
                            releaseInput(activeInput, activeSession);
                        }
                   break;

                   default:
                       ALOGD("voice_conc:CLOSING input on call setup  for inputSource: %d",activeDesc->mInputSource);
                       stopInput(activeInput, activeDesc->mSessions.itemAt(0));
                       releaseInput(activeInput, activeDesc->mSessions.itemAt(0));
                       ALOGD("voice_conc:CLOSING input on call setup  for inputSource: %d",activeDesc->inputSource());
                       AudioSessionCollection activeSessions = activeDesc->getActiveAudioSessions();
                       audio_session_t activeSession = activeSessions.keyAt(0);
                       stopInput(activeInput, activeSession);
                       releaseInput(activeInput, activeSession);
                   break;
               }
           }
@@ -740,10 +757,12 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
            audio_io_handle_t activeInput = mInputs.getActiveInput();
            if (activeInput != 0) {
                sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput);
                if (AUDIO_SOURCE_VOICE_COMMUNICATION == activeDesc->mInputSource) {
                    ALOGD("voice_conc:CLOSING VoIP on call setup : %d",activeDesc->mInputSource);
                    stopInput(activeInput, activeDesc->mSessions.itemAt(0));
                    releaseInput(activeInput, activeDesc->mSessions.itemAt(0));
                if (AUDIO_SOURCE_VOICE_COMMUNICATION == activeDesc->inputSource()) {
                    ALOGD("voice_conc:CLOSING VoIP on call setup : %d",activeDesc->inputSource());
                    AudioSessionCollection activeSessions = activeDesc->getActiveAudioSessions();
                    audio_session_t activeSession = activeSessions.keyAt(0);
                    stopInput(activeInput, activeSession);
                    releaseInput(activeInput, activeSession);
                }
            }
        }
@@ -776,23 +795,23 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
            }

            if (AUDIO_OUTPUT_FLAG_FAST == mFallBackflag) {
                if (((!outputDesc->isDuplicated() &&outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY))
                if (((!outputDesc->isDuplicated() &&outputDesc->mProfile->getFlags() & AUDIO_OUTPUT_FLAG_PRIMARY))
                            && prop_playback_enabled) {
                    ALOGD("voice_conc:calling suspendOutput on call mode for primary output");
                    mpClientInterface->suspendOutput(mOutputs.keyAt(i));
                } //Close compress all sessions
                else if ((outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)
                else if ((outputDesc->mProfile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD)
                                &&  prop_playback_enabled) {
                    ALOGD("voice_conc:calling closeOutput on call mode for COMPRESS output");
                    closeOutput(mOutputs.keyAt(i));
                }
                else if ((outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_VOIP_RX)
                else if ((outputDesc->mProfile->getFlags() & AUDIO_OUTPUT_FLAG_VOIP_RX)
                                && prop_voip_enabled) {
                    ALOGD("voice_conc:calling closeOutput on call mode for DIRECT  output");
                    closeOutput(mOutputs.keyAt(i));
                }
            } else if (AUDIO_OUTPUT_FLAG_DEEP_BUFFER == mFallBackflag) {
                if ((outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_DIRECT)
                if ((outputDesc->mProfile->getFlags() & AUDIO_OUTPUT_FLAG_DIRECT)
                                &&  prop_playback_enabled) {
                    ALOGD("voice_conc:calling closeOutput on call mode for COMPRESS output");
                    closeOutput(mOutputs.keyAt(i));
@@ -813,7 +832,7 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
                   ALOGD("voice_conc:ouput desc / profile is NULL");
                   continue;
                }
                if (!outputDesc->isDuplicated() && outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_PRIMARY) {
                if (!outputDesc->isDuplicated() && outputDesc->mProfile->getFlags() & AUDIO_OUTPUT_FLAG_PRIMARY) {
                    ALOGD("voice_conc:calling restoreOutput after call mode for primary output");
                    mpClientInterface->restoreOutput(mOutputs.keyAt(i));
                }
@@ -862,7 +881,7 @@ void AudioPolicyManagerCustom::setPhoneState(audio_mode_t state)
                   continue;
                }

                if (outputDesc->mProfile->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
                if (outputDesc->mProfile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
                    ALOGD("calling closeOutput on call mode for COMPRESS output");
                    closeOutput(mOutputs.keyAt(i));
                }
@@ -1043,7 +1062,7 @@ status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputD
    *delayMs = 0;
    if (stream == AUDIO_STREAM_TTS) {
        ALOGV("\t found BEACON stream");
        if (mOutputs.isAnyOutputActive(AUDIO_STREAM_TTS /*streamToIgnore*/)) {
        if (!mTtsOutputAvailable && mOutputs.isAnyOutputActive(AUDIO_STREAM_TTS /*streamToIgnore*/)) {
            return INVALID_OPERATION;
        } else {
            beaconMuteLatency = handleEventForBeacon(STARTING_BEACON);
@@ -1053,6 +1072,9 @@ status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputD
        beaconMuteLatency = handleEventForBeacon(STARTING_OUTPUT);
    }

    // check active before incrementing usage count
    bool force = !outputDesc->isActive();

    // increment usage count for this stream on the requested output:
    // NOTE that the usage count is the same for duplicated output and hardware output which is
    // necessary for a correct control of hardware output routing by startOutput() and stopOutput()
@@ -1068,7 +1090,6 @@ status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputD
                            (strategy == STRATEGY_SONIFICATION_RESPECTFUL) ||
                            (beaconMuteLatency > 0);
        uint32_t waitMs = beaconMuteLatency;
        bool force = false;
        for (size_t i = 0; i < mOutputs.size(); i++) {
            sp<AudioOutputDescriptor> desc = mOutputs.valueAt(i);
            if (desc != outputDesc) {
@@ -1089,7 +1110,8 @@ status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputD
                }
            }
        }
        uint32_t muteWaitMs = setOutputDevice(outputDesc, device, force);
        uint32_t muteWaitMs;
        muteWaitMs = setOutputDevice(outputDesc, device, force);

        // handle special case for sonification while in call
        if (isInCall()) {
@@ -1098,7 +1120,7 @@ status_t AudioPolicyManagerCustom::startSource(sp<AudioOutputDescriptor> outputD

        // apply volume rules for current stream and device if necessary
        checkAndSetVolume(stream,
                          mStreams.valueFor(stream).getVolumeIndex(device),
                          mVolumeCurves->getVolumeIndex(stream, device),
                          outputDesc,
                          device);

@@ -1226,7 +1248,7 @@ status_t AudioPolicyManagerCustom::checkAndSetVolume(audio_stream_type_t stream,
        float voiceVolume;
        // Force voice volume to max for bluetooth SCO as volume is managed by the headset
        if (stream == AUDIO_STREAM_VOICE_CALL) {
            voiceVolume = (float)index/(float)mStreams.valueFor(stream).getVolumeIndexMax();
            voiceVolume = (float)index/(float)mVolumeCurves->getVolumeIndexMax(stream);
        } else {
            voiceVolume = 1.0;
        }
@@ -1314,7 +1336,6 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        const audio_offload_info_t *offloadInfo)
{
    audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
    uint32_t latency = 0;
    status_t status;

#ifdef AUDIO_POLICY_TEST
@@ -1558,7 +1579,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
    // skip direct output selection if the request can obviously be attached to a mixed output
    // and not explicitly requested
    if (((flags & (AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_DIRECT_PCM)) == 0) &&
            audio_is_linear_pcm(format) && samplingRate <= MAX_MIXER_SAMPLING_RATE &&
            audio_is_linear_pcm(format) && samplingRate <= SAMPLE_RATE_HZ_MAX &&
            audio_channel_count_from_out_mask(channelMask) <= 2) {
        goto non_direct_output;
    }
@@ -1571,7 +1592,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
    // in the background.

    if (((flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) == 0) ||
            !mEffects.isNonOffloadableEffectEnabled()) {
            !(mEffects.isNonOffloadableEffectEnabled() || mMasterMono)) {
        profile = getProfileForDirectOutput(device,
                                           samplingRate,
                                           format,
@@ -1582,7 +1603,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
    if (profile != 0) {

        if (!(flags & AUDIO_OUTPUT_FLAG_DIRECT_PCM) &&
             (profile->mFlags & AUDIO_OUTPUT_FLAG_DIRECT_PCM)) {
             (profile->getFlags() & AUDIO_OUTPUT_FLAG_DIRECT_PCM)) {
            ALOGI("got Direct_PCM without requesting ... reject ");
            profile = NULL;
            goto non_direct_output;
@@ -1596,7 +1617,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
                outputDesc = desc;
                // reuse direct output if currently open and configured with same parameters
                if ((samplingRate == outputDesc->mSamplingRate) &&
                        (format == outputDesc->mFormat) &&
                        audio_formats_match(format, outputDesc->mFormat) &&
                        (channelMask == outputDesc->mChannelMask)) {
                    outputDesc->mDirectOpenCount++;
                    ALOGV("getOutput() reusing direct output %d", mOutputs.keyAt(i));
@@ -1612,7 +1633,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        // if the selected profile is offloaded and no offload info was specified,
        // create a default one
        audio_offload_info_t defaultOffloadInfo = AUDIO_INFO_INITIALIZER;
        if ((profile->mFlags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) && !offloadInfo) {
        if ((profile->getFlags() & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) && !offloadInfo) {
            flags = (audio_output_flags_t)(flags | AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD);
            defaultOffloadInfo.sample_rate = samplingRate;
            defaultOffloadInfo.channel_mask = channelMask;
@@ -1647,7 +1668,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
        // only accept an output with the requested parameters
        if (status != NO_ERROR ||
            (samplingRate != 0 && samplingRate != config.sample_rate) ||
            (format != AUDIO_FORMAT_DEFAULT && format != config.format) ||
            (format != AUDIO_FORMAT_DEFAULT && !audio_formats_match(format, config.format)) ||
            (channelMask != 0 && channelMask != config.channel_mask)) {
            ALOGV("getOutput() failed opening direct output: output %d samplingRate %d %d,"
                    "format %d %d, channelMask %04x %04x", output, samplingRate,
@@ -1657,7 +1678,7 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
                mpClientInterface->closeOutput(output);
            }
            // fall back to mixer output if possible when the direct output could not be open
            if (audio_is_linear_pcm(format) && samplingRate <= MAX_MIXER_SAMPLING_RATE) {
            if (audio_is_linear_pcm(format) && samplingRate <= SAMPLE_RATE_HZ_MAX) {
                goto non_direct_output;
            }
            return AUDIO_IO_HANDLE_NONE;
@@ -1735,7 +1756,8 @@ status_t AudioPolicyManagerCustom::getInputForAttr(const audio_attributes_t *att
                                             audio_port_handle_t selectedDeviceId,
                                             input_type_t *inputType)
{
    audio_source_t inputSource = attr->source;
    audio_source_t inputSource;
    inputSource = attr->source;
#ifdef VOICE_CONCURRENCY

    char propValue[PROPERTY_VALUE_MAX];
@@ -1819,8 +1841,8 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
    }
    sp<AudioInputDescriptor> inputDesc = mInputs.valueAt(index);

    index = inputDesc->mSessions.indexOf(session);
    if (index < 0) {
    sp<AudioSession> audioSession = inputDesc->getAudioSession(session);
    if (audioSession == 0) {
        ALOGW("startInput() unknown session %d on input %d", session, input);
        return BAD_VALUE;
    }
@@ -1835,15 +1857,31 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
            // If the already active input uses AUDIO_SOURCE_HOTWORD then it is closed,
            // otherwise the active input continues and the new input cannot be started.
            sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput);
            if (activeDesc->mInputSource == AUDIO_SOURCE_HOTWORD) {
            if ((activeDesc->inputSource() == AUDIO_SOURCE_HOTWORD) &&
                    !activeDesc->hasPreemptedSession(session)) {
                ALOGW("startInput(%d) preempting low-priority input %d", input, activeInput);
                stopInput(activeInput, activeDesc->mSessions.itemAt(0));
                releaseInput(activeInput, activeDesc->mSessions.itemAt(0));
                //FIXME: consider all active sessions
                AudioSessionCollection activeSessions = activeDesc->getActiveAudioSessions();
                audio_session_t activeSession = activeSessions.keyAt(0);
                SortedVector<audio_session_t> sessions =
                                           activeDesc->getPreemptedSessions();
                sessions.add(activeSession);
                inputDesc->setPreemptedSessions(sessions);
                stopInput(activeInput, activeSession);
                releaseInput(activeInput, activeSession);
            } else {
                ALOGE("startInput(%d) failed: other input %d already started", input, activeInput);
                return INVALID_OPERATION;
            }
        }
        // Do not allow capture if an active voice call is using a software patch and
        // the call TX source device is on the same HW module.
        // FIXME: would be better to refine to only inputs whose profile connects to the
        // call TX device but this information is not in the audio patch
        if (mCallTxPatch != 0 &&
            inputDesc->getModuleHandle() == mCallTxPatch->mPatch.sources[0].ext.device.hw_module) {
            return INVALID_OPERATION;
        }
    }

    // Routing?
@@ -1882,7 +1920,7 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
               ALOGD("ouput desc / profile is NULL");
               continue;
            }
            if (outputDesc->mProfile->mFlags
            if (outputDesc->mProfile->getFlags()
                            & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
                // close compress  sessions
                ALOGD("calling closeOutput on record conc for COMPRESS output");
@@ -1892,7 +1930,7 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
    }
#endif

    if (inputDesc->mRefCount == 0 || mInputRoutes.hasRouteChanged(session)) {
    if (!inputDesc->isActive() || mInputRoutes.hasRouteChanged(session)) {
        // if input maps to a dynamic policy with an activity listener, notify of state change
        if ((inputDesc->mPolicyMix != NULL)
                && ((inputDesc->mPolicyMix->mCbFlags & AudioMix::kCbFlagNotifyActivity) != 0)) {
@@ -1923,9 +1961,9 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
        }
    }

    ALOGV("AudioPolicyManager::startInput() input source = %d", inputDesc->mInputSource);
    ALOGV("AudioPolicyManager::startInput() input source = %d", audioSession->inputSource());

    inputDesc->mRefCount++;
    audioSession->changeActiveCount(1);
#ifdef RECORD_PLAY_CONCURRENCY
    mIsInputRequestOnProgress = false;
#endif
@@ -1982,30 +2020,38 @@ AudioPolicyManagerCustom::AudioPolicyManagerCustom(AudioPolicyClientInterface *c
        prop_ssr_enabled = atoi(ssr_enabled) || !strncmp("true", ssr_enabled, 4);
    }

    //TODO: Check the new logic to parse policy conf and update the below code
    //      Need this when SSR encoding is enabled

    if (property_get("ro.qc.sdk.audio.ssr", ssr_enabled, NULL)) {
        prop_ssr_enabled = atoi(ssr_enabled) || !strncmp("true", ssr_enabled, 4);
    }

    for (size_t i = 0; i < mHwModules.size(); i++) {
        ALOGV("Hw module %d", i);
        ALOGV("Hw module %zu", i);
        for (size_t j = 0; j < mHwModules[i]->mInputProfiles.size(); j++) {
            const sp<IOProfile> inProfile = mHwModules[i]->mInputProfiles[j];
            ALOGV("Input profile ", j);
            for (size_t k = 0; k  < inProfile->mChannelMasks.size(); k++) {
                audio_channel_mask_t channelMask =
                    inProfile->mChannelMasks.itemAt(k);
                ALOGV("Channel Mask %x size %d", channelMask,
                    inProfile->mChannelMasks.size());
            AudioProfileVector profiles = inProfile->getAudioProfiles();
            for (size_t k = 0; k < profiles.size(); k++){
                ChannelsVector channels = profiles[k]->getChannels();
                for (size_t x = 0; x < channels.size(); x++) {
                    audio_channel_mask_t channelMask = channels[x];
                    ALOGV("Channel Mask %x size %zu", channelMask,
                         channels.size());
                    if (AUDIO_CHANNEL_IN_5POINT1 == channelMask) {
                        if (!prop_ssr_enabled) {
                            ALOGI("removing AUDIO_CHANNEL_IN_5POINT1 from"
                                " input profile as SSR(surround sound record)"
                                " is not supported on this chipset variant");
                        inProfile->mChannelMasks.removeItemsAt(k, 1);
                        ALOGV("Channel Mask size now %d",
                            inProfile->mChannelMasks.size());
                            channels.removeItemsAt(x, 1);
                            ALOGV("Channel Mask size now %zu",
                                channels.size());
                        }
                    }
                }
            }
        }
    }

#ifdef RECORD_PLAY_CONCURRENCY
    mIsInputRequestOnProgress = false;
#endif
+3 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2013-2015, The Linux Foundation. All rights reserved.
 * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
 * Not a contribution.
 *
 * Copyright (C) 2009 The Android Open Source Project
@@ -140,7 +140,9 @@ private:
                const audio_offload_info_t *offloadInfo);
        // Used for voip + voice concurrency usecase
        int mPrevPhoneState;
#ifdef VOICE_CONCURRENCY
        int mvoice_call_state;
#endif
#ifdef RECORD_PLAY_CONCURRENCY
        // Used for record + playback concurrency
        bool mIsInputRequestOnProgress;