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

Commit f024a9eb authored by Andy Hung's avatar Andy Hung
Browse files

AudioPolicyManager: Fix nullptr device check

Regression from commit 11d30104

Test: CTS AudioRecordTest passes
Bug: 123597808
Change-Id: I3b1de479ebd8a279309d33f58db3e40b851f98e4
parent a3e4fe3f
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;