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

Commit 4df18892 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioPolicyManager: Fix nullptr device check"

parents 760e6c25 f024a9eb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -129,7 +129,7 @@ void DeviceVector::refreshTypes()
ssize_t DeviceVector::indexOf(const sp<DeviceDescriptor>& item) const
{
    for (size_t i = 0; i < size(); i++) {
        if (item->equals(itemAt(i))) {
        if (itemAt(i)->equals(item)) { // item may be null sp<>, i.e. AUDIO_DEVICE_NONE
            return i;
        }
    }
+1 −1
Original line number Diff line number Diff line
@@ -5062,7 +5062,7 @@ sp<DeviceDescriptor> AudioPolicyManager::getNewInputDevice(
    }

    // If we are not in call and no client is active on this input, this methods returns
    // AUDIO_DEVICE_NONE, causing the patch on the input stream to be released.
    // a null sp<>, causing the patch on the input stream to be released.
    audio_attributes_t attributes = inputDesc->getHighestPriorityAttributes();
    if (attributes.source == AUDIO_SOURCE_DEFAULT && isInCall()) {
        attributes.source = AUDIO_SOURCE_VOICE_COMMUNICATION;