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

Commit a8f6f318 authored by Eric Laurent's avatar Eric Laurent Committed by Automerger Merge Worker
Browse files

Merge "Audio policy: fix failure to unmute strategy." into rvc-dev am:...

Merge "Audio policy: fix failure to unmute strategy." into rvc-dev am: 6b72bc88 am: e9b0bf34 am: 9906e54d am: d6e38383

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/av/+/11845532

Change-Id: Ibe40ea1d3c9eb18c85005c8cb8be10d085a932b5
parents 8129d4ee d6e38383
Loading
Loading
Loading
Loading
+11 −9
Original line number Original line Diff line number Diff line
@@ -5770,15 +5770,6 @@ uint32_t AudioPolicyManager::setOutputDevices(const sp<SwAudioOutputDescriptor>&
    DeviceVector filteredDevices = outputDesc->filterSupportedDevices(devices);
    DeviceVector filteredDevices = outputDesc->filterSupportedDevices(devices);
    DeviceVector prevDevices = outputDesc->devices();
    DeviceVector prevDevices = outputDesc->devices();


    // no need to proceed if new device is not AUDIO_DEVICE_NONE and not supported by current
    // output profile or if new device is not supported AND previous device(s) is(are) still
    // available (otherwise reset device must be done on the output)
    if (!devices.isEmpty() && filteredDevices.isEmpty() &&
            !mAvailableOutputDevices.filter(prevDevices).empty()) {
        ALOGV("%s: unsupported device %s for output", __func__, devices.toString().c_str());
        return 0;
    }

    ALOGV("setOutputDevices() prevDevice %s", prevDevices.toString().c_str());
    ALOGV("setOutputDevices() prevDevice %s", prevDevices.toString().c_str());


    if (!filteredDevices.isEmpty()) {
    if (!filteredDevices.isEmpty()) {
@@ -5793,6 +5784,17 @@ uint32_t AudioPolicyManager::setOutputDevices(const sp<SwAudioOutputDescriptor>&
        muteWaitMs = 0;
        muteWaitMs = 0;
    }
    }


    // no need to proceed if new device is not AUDIO_DEVICE_NONE and not supported by current
    // output profile or if new device is not supported AND previous device(s) is(are) still
    // available (otherwise reset device must be done on the output)
    if (!devices.isEmpty() && filteredDevices.isEmpty() &&
            !mAvailableOutputDevices.filter(prevDevices).empty()) {
        ALOGV("%s: unsupported device %s for output", __func__, devices.toString().c_str());
        // restore previous device after evaluating strategy mute state
        outputDesc->setDevices(prevDevices);
        return muteWaitMs;
    }

    // Do not change the routing if:
    // Do not change the routing if:
    //      the requested device is AUDIO_DEVICE_NONE
    //      the requested device is AUDIO_DEVICE_NONE
    //      OR the requested device is the same as current device
    //      OR the requested device is the same as current device