summaryrefslogtreecommitdiff
path: root/services/inputflinger/EventHub.cpp
diff options
context:
space:
mode:
author Tim Kilbourn <tkilbourn@google.com> 2015-04-08 10:26:18 -0700
committer Tim Kilbourn <tkilbourn@google.com> 2015-04-09 10:02:16 -0700
commit063ff53d0b0a0d670ea0185e687526d8fd302820 (patch)
tree3b658ea2501e1bf1ed204570a030288b94d67d10 /services/inputflinger/EventHub.cpp
parent82f393aad651fbf06d8c6872ac10a739ff2a3e42 (diff)
Pass through availability of audio mic for input devices.
Bug: 15374820 Change-Id: Id2ca6da10165e3a887ebfbb18f663a3bf316ac79
Diffstat (limited to 'services/inputflinger/EventHub.cpp')
-rw-r--r--services/inputflinger/EventHub.cpp15
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",