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

Commit 1cd9ce64 authored by Phil Burk's avatar Phil Burk
Browse files

aaudio: ignore device updates for UNSPECIFIED

We can get a device change to UNSPECIFIED sometimes
when using a duplicate device.
This can happen when using the Legacy USB HAL and
Usage ALARM or RINGTONE.
It makes no sense so we log an error and ignore it.

Bug: 343006991
Test: see bug for repro steps
Test: atest AAudioTests
Flag: EXEMPT bugfix
Change-Id: I38d1ef0629917d5f0a944996706d6d3c65762171
parent 3123806a
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -261,6 +261,11 @@ aaudio_result_t AudioStreamLegacy::getBestTimestamp(clockid_t clockId,

void AudioStreamLegacy::onAudioDeviceUpdate(audio_io_handle_t /* audioIo */,
            audio_port_handle_t deviceId) {
    // Check for an invalid deviceId. Why change to UNSPECIFIED?
    if (deviceId == AAUDIO_UNSPECIFIED) {
        ALOGE("%s(, deviceId = AAUDIO_UNSPECIFIED)! Why?", __func__);
        return;
    }
    // Device routing is a common source of errors and DISCONNECTS.
    // Please leave this log in place. If there is a bug then this might
    // get called after the stream has been deleted so log before we