diff options
| author | 2015-04-09 17:06:47 +0000 | |
|---|---|---|
| committer | 2015-04-09 17:06:49 +0000 | |
| commit | abc7d3dd726deecbff60e9250b386372db4487c4 (patch) | |
| tree | caa79b90637bf55dde811bfbc5fe44d07c6e9518 /services/inputflinger/EventHub.cpp | |
| parent | 5fd5dd676a8ebf33489c9326e269b5840468566e (diff) | |
| parent | 063ff53d0b0a0d670ea0185e687526d8fd302820 (diff) | |
Merge "Pass through availability of audio mic for input devices."
Diffstat (limited to 'services/inputflinger/EventHub.cpp')
| -rw-r--r-- | services/inputflinger/EventHub.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp index 313569237a..4d54d56d8e 100644 --- a/services/inputflinger/EventHub.cpp +++ b/services/inputflinger/EventHub.cpp @@ -1279,6 +1279,11 @@ status_t EventHub::openDeviceLocked(const char *devicePath) { return -1; } + // Determine whether the device has a mic. + if (deviceHasMicLocked(device)) { + device->classes |= INPUT_DEVICE_CLASS_MIC; + } + // Determine whether the device is external or internal. if (isExternalDeviceLocked(device)) { device->classes |= INPUT_DEVICE_CLASS_EXTERNAL; @@ -1415,6 +1420,16 @@ bool EventHub::isExternalDeviceLocked(Device* device) { return device->identifier.bus == BUS_USB || device->identifier.bus == BUS_BLUETOOTH; } +bool EventHub::deviceHasMicLocked(Device* device) { + if (device->configuration) { + bool value; + if (device->configuration->tryGetProperty(String8("audio.mic"), value)) { + return value; + } + } + return false; +} + int32_t EventHub::getNextControllerNumberLocked(Device* device) { if (mControllerNumbers.isFull()) { ALOGI("Maximum number of controllers reached, assigning controller number 0 to device %s", |