summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSteve Kondik <steve@cyngn.com>2015-12-07 17:07:16 -0800
committerSteve Kondik <steve@cyngn.com>2015-12-07 17:07:16 -0800
commit4951bcc16e99daafc44581e4222f012f9d419ae0 (patch)
tree7be00878227a20b4610649a7d455db2d9cb3463c /services
parent53602ffde5527c476a1d7d39da12ecd7f58917f4 (diff)
parenta78c2e65e13cace4fdbb0295beca5b11de9fde06 (diff)
downloadframeworks_native-4951bcc16e99daafc44581e4222f012f9d419ae0.zip
frameworks_native-4951bcc16e99daafc44581e4222f012f9d419ae0.tar.gz
frameworks_native-4951bcc16e99daafc44581e4222f012f9d419ae0.tar.bz2
Merge tag 'android-6.0.1_r3' of https://android.googlesource.com/platform/frameworks/native into cm-13.0
Android 6.0.1 release 3 Change-Id: I437aaf148d440a8144afe1454948980fc3b40cca
Diffstat (limited to 'services')
-rw-r--r--services/inputflinger/EventHub.cpp30
-rw-r--r--services/inputflinger/EventHub.h10
-rw-r--r--services/inputflinger/InputReader.cpp34
-rw-r--r--services/inputflinger/InputReader.h3
-rw-r--r--services/inputflinger/tests/InputReader_test.cpp8
-rw-r--r--services/sensorservice/SensorService.cpp13
6 files changed, 67 insertions, 31 deletions
diff --git a/services/inputflinger/EventHub.cpp b/services/inputflinger/EventHub.cpp
index 6b60c7c..5859606 100644
--- a/services/inputflinger/EventHub.cpp
+++ b/services/inputflinger/EventHub.cpp
@@ -438,10 +438,12 @@ bool EventHub::markSupportedKeyCodes(int32_t deviceId, size_t numCodes,
return false;
}
-status_t EventHub::mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
- int32_t* outKeycode, uint32_t* outFlags) const {
+status_t EventHub::mapKey(int32_t deviceId,
+ int32_t scanCode, int32_t usageCode, int32_t metaState,
+ int32_t* outKeycode, int32_t* outMetaState, uint32_t* outFlags) const {
AutoMutex _l(mLock);
Device* device = getDeviceLocked(deviceId);
+ status_t status = NAME_NOT_FOUND;
if (device) {
// Check the key character map first.
@@ -449,22 +451,34 @@ status_t EventHub::mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
if (kcm != NULL) {
if (!kcm->mapKey(scanCode, usageCode, outKeycode)) {
*outFlags = 0;
- return NO_ERROR;
+ status = NO_ERROR;
}
}
// Check the key layout next.
- if (device->keyMap.haveKeyLayout()) {
+ if (status != NO_ERROR && device->keyMap.haveKeyLayout()) {
if (!device->keyMap.keyLayoutMap->mapKey(
scanCode, usageCode, outKeycode, outFlags)) {
- return NO_ERROR;
+ status = NO_ERROR;
+ }
+ }
+
+ if (status == NO_ERROR) {
+ if (kcm != NULL) {
+ kcm->tryRemapKey(*outKeycode, metaState, outKeycode, outMetaState);
+ } else {
+ *outMetaState = metaState;
}
}
}
- *outKeycode = 0;
- *outFlags = 0;
- return NAME_NOT_FOUND;
+ if (status != NO_ERROR) {
+ *outKeycode = 0;
+ *outFlags = 0;
+ *outMetaState = metaState;
+ }
+
+ return status;
}
status_t EventHub::mapAxis(int32_t deviceId, int32_t scanCode, AxisInfo* outAxisInfo) const {
diff --git a/services/inputflinger/EventHub.h b/services/inputflinger/EventHub.h
index 3ec4910..0f94c77 100644
--- a/services/inputflinger/EventHub.h
+++ b/services/inputflinger/EventHub.h
@@ -197,8 +197,9 @@ public:
virtual bool hasInputProperty(int32_t deviceId, int property) const = 0;
- virtual status_t mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
- int32_t* outKeycode, uint32_t* outFlags) const = 0;
+ virtual status_t mapKey(int32_t deviceId,
+ int32_t scanCode, int32_t usageCode, int32_t metaState,
+ int32_t* outKeycode, int32_t *outMetaState, uint32_t* outFlags) const = 0;
virtual status_t mapAxis(int32_t deviceId, int32_t scanCode,
AxisInfo* outAxisInfo) const = 0;
@@ -285,8 +286,9 @@ public:
virtual bool hasInputProperty(int32_t deviceId, int property) const;
- virtual status_t mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
- int32_t* outKeycode, uint32_t* outFlags) const;
+ virtual status_t mapKey(int32_t deviceId,
+ int32_t scanCode, int32_t usageCode, int32_t metaState,
+ int32_t* outKeycode, int32_t *outMetaState, uint32_t* outFlags) const;
virtual status_t mapAxis(int32_t deviceId, int32_t scanCode,
AxisInfo* outAxisInfo) const;
diff --git a/services/inputflinger/InputReader.cpp b/services/inputflinger/InputReader.cpp
index 3813d9b..53ff155 100644
--- a/services/inputflinger/InputReader.cpp
+++ b/services/inputflinger/InputReader.cpp
@@ -2193,13 +2193,7 @@ void KeyboardInputMapper::process(const RawEvent* rawEvent) {
mCurrentHidUsage = 0;
if (isKeyboardOrGamepadKey(scanCode)) {
- int32_t keyCode;
- uint32_t flags;
- if (getEventHub()->mapKey(getDeviceId(), scanCode, usageCode, &keyCode, &flags)) {
- keyCode = AKEYCODE_UNKNOWN;
- flags = 0;
- }
- processKey(rawEvent->when, rawEvent->value != 0, keyCode, scanCode, flags);
+ processKey(rawEvent->when, rawEvent->value != 0, scanCode, usageCode);
}
break;
}
@@ -2224,8 +2218,18 @@ bool KeyboardInputMapper::isKeyboardOrGamepadKey(int32_t scanCode) {
|| (scanCode >= BTN_JOYSTICK && scanCode < BTN_DIGI);
}
-void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
- int32_t scanCode, uint32_t policyFlags) {
+void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t scanCode,
+ int32_t usageCode) {
+ int32_t keyCode;
+ int32_t keyMetaState;
+ uint32_t policyFlags;
+
+ if (getEventHub()->mapKey(getDeviceId(), scanCode, usageCode, mMetaState,
+ &keyCode, &keyMetaState, &policyFlags)) {
+ keyCode = AKEYCODE_UNKNOWN;
+ keyMetaState = mMetaState;
+ policyFlags = 0;
+ }
if (down) {
// Rotate key codes according to orientation if needed.
@@ -2278,6 +2282,12 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
if (metaStateChanged) {
mMetaState = newMetaState;
updateLedState(false);
+
+ // If global meta state changed send it along with the key.
+ // If it has not changed then we'll use what keymap gave us,
+ // since key replacement logic might temporarily reset a few
+ // meta bits for given key.
+ keyMetaState = newMetaState;
}
nsecs_t downTime = mDownTime;
@@ -2305,7 +2315,7 @@ void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t keyCode,
NotifyKeyArgs args(when, getDeviceId(), mSource, policyFlags,
down ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP,
- AKEY_EVENT_FLAG_FROM_SYSTEM, keyCode, scanCode, newMetaState, downTime);
+ AKEY_EVENT_FLAG_FROM_SYSTEM, keyCode, scanCode, keyMetaState, downTime);
getListener()->notifyKey(&args);
}
@@ -3568,8 +3578,10 @@ void TouchInputMapper::configureVirtualKeys() {
virtualKey.scanCode = virtualKeyDefinition.scanCode;
int32_t keyCode;
+ int32_t dummyKeyMetaState;
uint32_t flags;
- if (getEventHub()->mapKey(getDeviceId(), virtualKey.scanCode, 0, &keyCode, &flags)) {
+ if (getEventHub()->mapKey(getDeviceId(), virtualKey.scanCode, 0, 0,
+ &keyCode, &dummyKeyMetaState, &flags)) {
ALOGW(INDENT "VirtualKey %d: could not obtain key code, ignoring",
virtualKey.scanCode);
mVirtualKeys.pop(); // drop the key
diff --git a/services/inputflinger/InputReader.h b/services/inputflinger/InputReader.h
index 9a46fb8..e480350 100644
--- a/services/inputflinger/InputReader.h
+++ b/services/inputflinger/InputReader.h
@@ -1175,8 +1175,7 @@ private:
bool isKeyboardOrGamepadKey(int32_t scanCode);
- void processKey(nsecs_t when, bool down, int32_t keyCode, int32_t scanCode,
- uint32_t policyFlags);
+ void processKey(nsecs_t when, bool down, int32_t scanCode, int32_t usageCode);
ssize_t findKeyDown(int32_t scanCode);
diff --git a/services/inputflinger/tests/InputReader_test.cpp b/services/inputflinger/tests/InputReader_test.cpp
index f34b810..42bc865 100644
--- a/services/inputflinger/tests/InputReader_test.cpp
+++ b/services/inputflinger/tests/InputReader_test.cpp
@@ -518,8 +518,9 @@ private:
return false;
}
- virtual status_t mapKey(int32_t deviceId, int32_t scanCode, int32_t usageCode,
- int32_t* outKeycode, uint32_t* outFlags) const {
+ virtual status_t mapKey(int32_t deviceId,
+ int32_t scanCode, int32_t usageCode, int32_t metaState,
+ int32_t* outKeycode, int32_t *outMetaState, uint32_t* outFlags) const {
Device* device = getDevice(deviceId);
if (device) {
const KeyInfo* key = getKey(device, scanCode, usageCode);
@@ -530,6 +531,9 @@ private:
if (outFlags) {
*outFlags = key->flags;
}
+ if (outMetaState) {
+ *outMetaState = metaState;
+ }
return OK;
}
}
diff --git a/services/sensorservice/SensorService.cpp b/services/sensorservice/SensorService.cpp
index 9c67be2..28af943 100644
--- a/services/sensorservice/SensorService.cpp
+++ b/services/sensorservice/SensorService.cpp
@@ -913,11 +913,16 @@ status_t SensorService::enable(const sp<SensorEventConnection>& connection,
status_t err = sensor->batch(connection.get(), handle, 0, samplingPeriodNs,
maxBatchReportLatencyNs);
- // Call flush() before calling activate() on the sensor. Wait for a first flush complete
- // event before sending events on this connection. Ignore one-shot sensors which don't
- // support flush(). Also if this sensor isn't already active, don't call flush().
+ // Call flush() before calling activate() on the sensor. Wait for a first
+ // flush complete event before sending events on this connection. Ignore
+ // one-shot sensors which don't support flush(). Ignore on-change sensors
+ // to maintain the on-change logic (any on-change events except the initial
+ // one should be trigger by a change in value). Also if this sensor isn't
+ // already active, don't call flush().
const SensorDevice& device(SensorDevice::getInstance());
- if (err == NO_ERROR && sensor->getSensor().getReportingMode() != AREPORTING_MODE_ONE_SHOT &&
+ if (err == NO_ERROR &&
+ sensor->getSensor().getReportingMode() != AREPORTING_MODE_ONE_SHOT &&
+ sensor->getSensor().getReportingMode() != AREPORTING_MODE_ON_CHANGE &&
rec->getNumConnections() > 1) {
if (device.getHalDeviceVersion() >= SENSORS_DEVICE_API_VERSION_1_1) {
connection->setFirstFlushPending(handle, true);