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

Commit ebc9e3f3 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "AudioPolicyManager: Handle error from setInputDevice in startInput"

parents 8cfe8f7b 480ffee4
Loading
Loading
Loading
Loading
+16 −5
Original line number Diff line number Diff line
@@ -2247,9 +2247,15 @@ status_t AudioPolicyManager::startInput(audio_port_handle_t portId)
    // indicate active capture to sound trigger service if starting capture from a mic on
    // primary HW module
    sp<DeviceDescriptor> device = getNewInputDevice(inputDesc);
    setInputDevice(input, device, true /* force */);
    if (device != nullptr) {
        status = setInputDevice(input, device, true /* force */);
    } else {
        ALOGW("%s no new input device can be found for descriptor %d",
                __FUNCTION__, inputDesc->getId());
        status = BAD_VALUE;
    }

    if (inputDesc->activeCount()  == 1) {
    if (status == NO_ERROR && inputDesc->activeCount() == 1) {
        sp<AudioPolicyMix> policyMix = inputDesc->mPolicyMix.promote();
        // if input maps to a dynamic policy with an activity listener, notify of state change
        if ((policyMix != NULL)
@@ -2280,11 +2286,16 @@ status_t AudioPolicyManager::startInput(audio_port_handle_t portId)
                        address, "remote-submix", AUDIO_FORMAT_DEFAULT);
            }
        }
    } else if (status != NO_ERROR) {
        // Restore client activity state.
        inputDesc->setClientActive(client, false);
        inputDesc->stop();
    }

    ALOGV("%s input %d source = %d exit", __FUNCTION__, input, client->source());
    ALOGV("%s input %d source = %d status = %d exit",
            __FUNCTION__, input, client->source(), status);

    return NO_ERROR;
    return status;
}

status_t AudioPolicyManager::stopInput(audio_port_handle_t portId)