summaryrefslogtreecommitdiff
path: root/services/inputflinger/InputReader.cpp
diff options
context:
space:
mode:
author Arthur Hung <arthurhung@google.com> 2019-09-02 16:16:58 +0800
committer Arthur Hung <arthurhung@google.com> 2019-09-12 13:48:59 +0800
commit9da14733afb5da5cb362f3c865d85d303cc62b15 (patch)
tree3e72f04923bfb4095e660cb6e31d8e25cf71bdb3 /services/inputflinger/InputReader.cpp
parentbfd9c00879b16bf782f08e7691d5490c611120e2 (diff)
Fix touch can't work after enabled the associated viewport
If a device has associated port but there is no viewport found, it would be expeced to be disabled. But for some devices, such as touch screen or joystick, they have to read the axis ranges info in InputMapper at first time configuration changed. So we have to defer disabling the device after info has been read when the device plugged. Bug: 140205788 Test: atest inputflinger_tests Change-Id: I9dd55e0016b6a020aab211dada45880195aec8dd
Diffstat (limited to 'services/inputflinger/InputReader.cpp')
-rw-r--r--services/inputflinger/InputReader.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 1cbf78eb43..d59f274ab0 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -1141,13 +1141,24 @@ void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config
}
}
- setEnabled(enabled, when);
+ if (changes) {
+ // For first-time configuration, only allow device to be disabled after mappers have
+ // finished configuring. This is because we need to read some of the properties from
+ // the device's open fd.
+ setEnabled(enabled, when);
+ }
}
for (InputMapper* mapper : mMappers) {
mapper->configure(when, config, changes);
mSources |= mapper->getSources();
}
+
+ // If a device is just plugged but it might be disabled, we need to update some info like
+ // axis range of touch from each InputMapper first, then disable it.
+ if (!changes) {
+ setEnabled(config->disabledDevices.find(mId) == config->disabledDevices.end(), when);
+ }
}
}