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

Commit 521934f6 authored by Karthik Reddy Katta's avatar Karthik Reddy Katta Committed by Gerrit - the friendly Code Review server
Browse files

alsa_sound: call voice volume api for direct output also

- Voip volume is not applied on direct output and as a result
  volume cannot be adjusted for some voicemail applications
  which opens direct output stream with mode set to IN_CALL.
- Voice volume is applied only for primary output and volume
  command is not sent to HAL for direct output.
- Call voice volume api for direct output as well from policy
  manager.

Change-Id: Iad6dc31ba628408958e4d693b99062f502210a56
CRs-Fixed: 676599
parent bfe73608
Loading
Loading
Loading
Loading
+13 −1
Original line number Original line Diff line number Diff line
@@ -924,6 +924,17 @@ AudioPolicyManager::device_category AudioPolicyManager::getDeviceCategory(audio_
    }
    }
}
}


bool AudioPolicyManager::isDirectOutput(audio_io_handle_t output) {
    for (size_t i = 0; i < mOutputs.size(); i++) {
        audio_io_handle_t curOutput = mOutputs.keyAt(i);
        AudioOutputDescriptor *desc = mOutputs.valueAt(i);
        if ((curOutput == output) && (desc->mFlags & AUDIO_OUTPUT_FLAG_DIRECT)) {
            return true;
        }
    }
    return false;
}

status_t AudioPolicyManager::checkAndSetVolume(int stream,
status_t AudioPolicyManager::checkAndSetVolume(int stream,
                                               int index,
                                               int index,
                                               audio_io_handle_t output,
                                               audio_io_handle_t output,
@@ -986,7 +997,8 @@ status_t AudioPolicyManager::checkAndSetVolume(int stream,
            // Force voice volume to max for bluetooth SCO as volume is managed by the headset
            // Force voice volume to max for bluetooth SCO as volume is managed by the headset
            voiceVolume = 1.0;
            voiceVolume = 1.0;


        if (voiceVolume != mLastVoiceVolume && output == mPrimaryOutput) {
        if (voiceVolume != mLastVoiceVolume && ((output == mPrimaryOutput) ||
            isDirectOutput(output))) {
            mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
            mpClientInterface->setVoiceVolume(voiceVolume, delayMs);
            mLastVoiceVolume = voiceVolume;
            mLastVoiceVolume = voiceVolume;
        }
        }
+3 −0
Original line number Original line Diff line number Diff line
@@ -80,6 +80,9 @@ protected:
        // returns the category the device belongs to with regard to volume curve management
        // returns the category the device belongs to with regard to volume curve management
        static device_category getDeviceCategory(audio_devices_t device);
        static device_category getDeviceCategory(audio_devices_t device);


        // returns true if give output is direct output
        bool isDirectOutput(audio_io_handle_t output);

        static const char* HDMI_SPKR_STR;
        static const char* HDMI_SPKR_STR;


        //parameter indicates of HDMI speakers disabled from the Qualcomm settings
        //parameter indicates of HDMI speakers disabled from the Qualcomm settings