summaryrefslogtreecommitdiffstats
path: root/services/input/InputReader.cpp
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2011-06-03 15:50:27 -0700
committerJeff Brown <jeffbrown@google.com>2011-06-03 15:50:27 -0700
commit7218d830e27d81141588cd6e37f206d141a18f62 (patch)
treefae19a482a9c238fb94b1f46e7b37daf4f18a3ab /services/input/InputReader.cpp
parenta742f854901b8306d3696c9e9b7881c207130a01 (diff)
parentca2b552d981239043a575dfc9db86966492d0f9e (diff)
downloadframeworks_base-7218d830e27d81141588cd6e37f206d141a18f62.zip
frameworks_base-7218d830e27d81141588cd6e37f206d141a18f62.tar.gz
frameworks_base-7218d830e27d81141588cd6e37f206d141a18f62.tar.bz2
resolved conflicts for merge of ca2b552d to master
Change-Id: I2f3693a59042ac5aa2d7bcdc3a504c78dc99a18b
Diffstat (limited to 'services/input/InputReader.cpp')
-rw-r--r--services/input/InputReader.cpp26
1 files changed, 19 insertions, 7 deletions
diff --git a/services/input/InputReader.cpp b/services/input/InputReader.cpp
index 8c9bad8..2924d3e 100644
--- a/services/input/InputReader.cpp
+++ b/services/input/InputReader.cpp
@@ -38,6 +38,7 @@
#include "InputReader.h"
+#include <cutils/atomic.h>
#include <cutils/log.h>
#include <ui/Keyboard.h>
#include <ui/VirtualKeyMap.h>
@@ -260,10 +261,9 @@ InputReader::InputReader(const sp<EventHubInterface>& eventHub,
const sp<InputReaderPolicyInterface>& policy,
const sp<InputDispatcherInterface>& dispatcher) :
mEventHub(eventHub), mPolicy(policy), mDispatcher(dispatcher),
- mGlobalMetaState(0), mDisableVirtualKeysTimeout(LLONG_MIN), mNextTimeout(LLONG_MAX) {
- mPolicy->getReaderConfiguration(&mConfig);
-
- configureExcludedDevices();
+ mGlobalMetaState(0), mDisableVirtualKeysTimeout(LLONG_MIN), mNextTimeout(LLONG_MAX),
+ mRefreshConfiguration(0) {
+ configure(true /*firstTime*/);
updateGlobalMetaState();
updateInputConfiguration();
}
@@ -275,6 +275,11 @@ InputReader::~InputReader() {
}
void InputReader::loopOnce() {
+ if (android_atomic_acquire_load(&mRefreshConfiguration)) {
+ android_atomic_release_store(0, &mRefreshConfiguration);
+ configure(false /*firstTime*/);
+ }
+
int32_t timeoutMillis = -1;
if (mNextTimeout != LLONG_MAX) {
nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC);
@@ -495,9 +500,12 @@ void InputReader::handleConfigurationChanged(nsecs_t when) {
mDispatcher->notifyConfigurationChanged(when);
}
-void InputReader::configureExcludedDevices() {
- for (size_t i = 0; i < mConfig.excludedDeviceNames.size(); i++) {
- mEventHub->addExcludedDevice(mConfig.excludedDeviceNames[i]);
+void InputReader::configure(bool firstTime) {
+ mPolicy->getReaderConfiguration(&mConfig);
+ mEventHub->setExcludedDevices(mConfig.excludedDeviceNames);
+
+ if (!firstTime) {
+ mEventHub->reopenDevices();
}
}
@@ -718,6 +726,10 @@ bool InputReader::markSupportedKeyCodes(int32_t deviceId, uint32_t sourceMask, s
} // release device registy reader lock
}
+void InputReader::refreshConfiguration() {
+ android_atomic_release_store(1, &mRefreshConfiguration);
+}
+
void InputReader::dump(String8& dump) {
mEventHub->dump(dump);
dump.append("\n");