summaryrefslogtreecommitdiffstats
path: root/services/inputflinger/EventHub.cpp
diff options
context:
space:
mode:
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 3135692..4d54d56 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",