cras: Set preferred codec to msbc only if WBS is supported

Some headsets reports available codecs through AT+BAC even if AG
declares not supporting codec negotiation. This is not disallowed by the
Bluetooth HFP spec. We should check if the WBS is supported by the AG
also before setting it as our preferred codec.

The set to CVSD is required for cases that HF declares different
supported codecs after the codec negotiation is done. This case is
covered by our unittest.

BUG=b:177469064
TEST=unittest and deploy to DUT and verify the bug doesn't repro

Change-Id: Idab5c6acfbeeadb94d1c9a44753d02dbd5047382
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/adhd/+/2662796
Tested-by: En-Shuo Hsu <enshuo@chromium.org>
Reviewed-by: Hsinyu Chao <hychao@chromium.org>
Commit-Queue: En-Shuo Hsu <enshuo@chromium.org>
1 file changed