summaryrefslogtreecommitdiffstats
path: root/services/input/InputReader.cpp
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@android.com>2011-06-02 17:34:03 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2011-06-02 17:34:03 -0700
commitca2b552d981239043a575dfc9db86966492d0f9e (patch)
tree5126b8a386f7aff3e19cf4ae9d253705aa0efddb /services/input/InputReader.cpp
parent56503b8ddfe5c82407da32e18061e725f668432d (diff)
parentc8812761609e532cceb400b112ed9982149c2490 (diff)
downloadframeworks_base-ca2b552d981239043a575dfc9db86966492d0f9e.zip
frameworks_base-ca2b552d981239043a575dfc9db86966492d0f9e.tar.gz
frameworks_base-ca2b552d981239043a575dfc9db86966492d0f9e.tar.bz2
am c8812761: am e1718de6: Merge "Add a preference panel for mouse speed." into honeycomb-mr2
* commit 'c8812761609e532cceb400b112ed9982149c2490': Add a preference panel for mouse speed.
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 724af39..a22ec1c 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>
@@ -219,10 +220,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();
}
@@ -234,6 +234,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);
@@ -454,9 +459,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();
}
}
@@ -677,6 +685,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");