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: Kevin Rocard <krocard@google.com>
(cherry picked from commit f9f241e45e5a76458e5f5596bca495317981ca3a)
-Routing to usb was rejected due to incorrect card number
Fixes regression introduced by: f9f241e45e5a76458e5f5596bca495317981ca3a
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: Kevin Rocard <krocard@google.com>
(cherry picked from commit 1e02c88b8fa620f7a968413b21daae9cfce04c2a)
Change-Id: I148a0b35067703e6ba3ca3414d3afe9cf6718dc0
3 files changed