Add audio_source combinations to usb hal
This allows android auto and accessory hid
to both work, and matches functionality
on other device in O.
Bug: 74172000
Test: auto starts
Change-Id: I786cd66bed015c5ad2a4ca668f0d0fbc9c8af507
diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp
index 5644745..603afbb 100644
--- a/usb/UsbGadget.cpp
+++ b/usb/UsbGadget.cpp
@@ -390,6 +390,27 @@
ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
ret = setVidPid("0x18d1", "0x2d01");
break;
+ case static_cast<uint64_t>(GadgetFunction::AUDIO_SOURCE):
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d02");
+ break;
+ case GadgetFunction::ADB | GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d03");
+ break;
+ case GadgetFunction::ACCESSORY | GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d04");
+ break;
+ case GadgetFunction::ADB | GadgetFunction::ACCESSORY |
+ GadgetFunction::AUDIO_SOURCE:
+ if (!(vendorFunctions == "user" || vendorFunctions == ""))
+ ALOGE("Invalid vendorFunctions set: %s", vendorFunctions.c_str());
+ ret = setVidPid("0x18d1", "0x2d05");
+ break;
default:
ALOGE("Combination not supported");
ret = Status::CONFIGURATION_NOT_SUPPORTED;
@@ -453,6 +474,11 @@
if (linkFunction("accessory.gs2", i++)) return Status::ERROR;
}
+ if ((functions & GadgetFunction::AUDIO_SOURCE) != 0) {
+ ALOGI("setCurrentUsbFunctions Audio Source");
+ if (linkFunction("audio_source.gs3", i++)) return Status::ERROR;
+ }
+
if ((functions & GadgetFunction::RNDIS) != 0) {
ALOGI("setCurrentUsbFunctions rndis");
if (linkFunction("gsi.rndis", i++)) return Status::ERROR;