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

Commit 53d7f70e authored by Ashish Jain's avatar Ashish Jain Committed by Gerrit - the friendly Code Review server
Browse files

policy_hal: Update policy hal with latest AOSP refresh.

This change updates policy HAL with latest AOSP refresh.

AudioPolicyManager: remove unnecessary device reconnection
Change-Id: I2182b205c2b72cebff657a7bbee95df97f97eb55

audio policy: fix HW A/V sync rerouting
Change-Id: I1f080232e439a410ded25ca8e461113a96687a3b

Dynamic policies: support for device selection
Change-Id: I71584081e7f1b2b5252fb6c4659fdeb464f7d282

Change-Id: I8e2812f1386aa7349f4470f25bf67ce88982ab74
parent 0f23f620
Loading
Loading
Loading
Loading
+9 −29
Original line number Diff line number Diff line
@@ -954,7 +954,6 @@ void AudioPolicyManagerCustom::setForceUse(audio_policy_force_use_t usage,
{
    ALOGD("setForceUse() usage %d, config %d, mPhoneState %d", usage, config, mEngine->getPhoneState());

    audio_policy_forced_cfg_t originalConfig = mEngine->getForceUse(usage);
    if (mEngine->setForceUse(usage, config) != NO_ERROR) {
        ALOGW("setForceUse() could not set force cfg %d for usage %d", config, usage);
        return;
@@ -968,32 +967,6 @@ void AudioPolicyManagerCustom::setForceUse(audio_policy_force_use_t usage,
    checkOutputForAllStrategies();
    updateDevicesAndOutputs();

    // Did surround forced use change?
    if ((usage == AUDIO_POLICY_FORCE_FOR_ENCODED_SURROUND)
            && (originalConfig != config)) {
        const char *device_address  = "";
        // Is it currently connected? If so then cycle the connection
        // so that the supported surround formats will be reloaded.
        //
        // FIXME As S/PDIF is not a removable device we have to handle this differently.
        // Probably by updating the device descriptor directly and manually
        // tearing down active playback on S/PDIF
        if (getDeviceConnectionState(AUDIO_DEVICE_OUT_HDMI, device_address) ==
                                             AUDIO_POLICY_DEVICE_STATE_AVAILABLE) {
            // Disconnect and reconnect output devices so that the surround
            // encodings can be updated.
            const char *device_name = "";
            // disconnect
            setDeviceConnectionStateInt(AUDIO_DEVICE_OUT_HDMI,
                        AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE,
                        device_address, device_name);
            // reconnect
            setDeviceConnectionStateInt(AUDIO_DEVICE_OUT_HDMI,
                        AUDIO_POLICY_DEVICE_STATE_AVAILABLE,
                        device_address, device_name);
        }
    }

    if (mEngine->getPhoneState() == AUDIO_MODE_IN_CALL && hasPrimaryOutput()) {
        audio_devices_t newDevice = getNewOutputDevice(mPrimaryOutput, true /*fromCache*/);
        updateCallRouting(newDevice);
@@ -1734,6 +1707,13 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
    }

non_direct_output:

    // A request for HW A/V sync cannot fallback to a mixed output because time
    // stamps are embedded in audio data
    if ((flags & AUDIO_OUTPUT_FLAG_HW_AV_SYNC) != 0) {
        return AUDIO_IO_HANDLE_NONE;
    }

    // ignoring channel mask due to downmix capability in mixer

    // open a non direct output
@@ -1944,7 +1924,7 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
        // 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)) {
            mpClientInterface->onDynamicPolicyMixStateUpdate(inputDesc->mPolicyMix->mRegistrationId,
            mpClientInterface->onDynamicPolicyMixStateUpdate(inputDesc->mPolicyMix->mDeviceAddress,
                    MIX_STATE_MIXING);
        }

@@ -1961,7 +1941,7 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input,
            if (inputDesc->mPolicyMix == NULL) {
                address = String8("0");
            } else if (inputDesc->mPolicyMix->mMixType == MIX_TYPE_PLAYERS) {
                address = inputDesc->mPolicyMix->mRegistrationId;
                address = inputDesc->mPolicyMix->mDeviceAddress;
            }
            if (address != "") {
                setDeviceConnectionStateInt(AUDIO_DEVICE_OUT_REMOTE_SUBMIX,