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

Skip to content
Commit ef9db2a1 authored by Kevin Rocard's avatar Kevin Rocard Committed by Gerrit - the friendly Code Review server
Browse files

Workaround: Do not send command to a disconnected usb subsystem



-After usb headset disconnection,
the audio policy receives two separate messages warning it of a
usb recoding device and usb playback device disconnection.

If the recording message is handled before the playback one,
the policy transiently switches from headset to headphone then speaker.
Thus temporally rerouting existing streams to a device that no longer exists.

This rerouting causes all usb commands and audio writes to freeze (for 2sec).
Delaying the subsequent routing to speaker by ~8sec.

If the unnecessary routing was to be removed this workaround might not
be necessary.

Taking the problem the other way around, an other fix would
be for the usb drivers to fail immediately if no
usb is present. This fix is targeted for the next release.

In the meantime, this commit patches the primary hal to intercept
routing requests towards a disconnected usb device
and immediately return an error.

Test: disconnect usb headset while playing video in Photo
Bug: 62815577
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
(cherry picked from commit f9f241e4)

-Routing to usb was rejected due to incorrect card number

Fixes regression introduced by: f9f241e4

The card number is updated by adev_set_parameters,
that is called after out_set_parameters.
As a result, out_set_parameters was using the wrong card number to check
for the card presence (in an attempt to ignore rerouting to an unplug
card).
Thus all routing to USB we denied.

Bug: 64532887
Test: Plug and unplug usb headset (skylab) during Photo playback,
      Youtube, Play music and voice call.
Signed-off-by: default avatarKevin Rocard <krocard@google.com>
(cherry picked from commit 1e02c88b)

Change-Id: I148a0b35067703e6ba3ca3414d3afe9cf6718dc0
parent fa00dc86
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment