From 115f93eeebf7f33b56ed090de70d6e8c733e5d88 Mon Sep 17 00:00:00 2001 From: Dmitry Torokhov Date: Thu, 17 Sep 2015 18:04:50 -0700 Subject: Allow defining replacement key events in keymap Currently keyboard maps allow to assign character sequences to key events and allow specifying a so-called "fallback" key events that are re-injected into input stream if target application indicates that it was not able to handle the original key event. Unfortunately there is no way to perform substitution before handing the event to applicationis. This change adds a new keymap keyword "replace" that allows users query "replacement" actions for key (if any), with the intent that such replacement happens early in the event handling process. Bug: 24504154 Change-Id: I3e6a2476c856524171df00ad22ff56f2018c1278 --- include/input/KeyCharacterMap.h | 8 ++++++++ include/input/Keyboard.h | 7 +++++++ 2 files changed, 15 insertions(+) (limited to 'include') diff --git a/include/input/KeyCharacterMap.h b/include/input/KeyCharacterMap.h index e70666a..3f0914b 100644 --- a/include/input/KeyCharacterMap.h +++ b/include/input/KeyCharacterMap.h @@ -124,6 +124,11 @@ public: * the mapping in some way. */ status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode) const; + /* Tries to find a replacement key code for a given key code and meta state + * in character map. */ + void tryRemapKey(int32_t scanCode, int32_t metaState, + int32_t* outKeyCode, int32_t* outMetaState) const; + #if HAVE_ANDROID_OS /* Reads a key map from a parcel. */ static sp readFromParcel(Parcel* parcel); @@ -151,6 +156,9 @@ private: /* The fallback keycode if the key is not handled. */ int32_t fallbackKeyCode; + + /* The replacement keycode if the key has to be replaced outright. */ + int32_t replacementKeyCode; }; struct Key { diff --git a/include/input/Keyboard.h b/include/input/Keyboard.h index 519bb22..d4903e9 100644 --- a/include/input/Keyboard.h +++ b/include/input/Keyboard.h @@ -88,6 +88,13 @@ extern bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentif extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState); /** + * Normalizes the meta state such that if either the left or right modifier + * meta state bits are set then the result will also include the universal + * bit for that modifier. + */ +extern int32_t normalizeMetaState(int32_t oldMetaState); + +/** * Returns true if a key is a meta key like ALT or CAPS_LOCK. */ extern bool isMetaKey(int32_t keyCode); -- cgit v1.1 From 552a8a5d8df32f659b8d11311a244cdc6d3b7733 Mon Sep 17 00:00:00 2001 From: Flanker Date: Mon, 7 Sep 2015 15:28:58 +0800 Subject: add number constraint for samples per MotionEvent Bug:23905002 Change-Id: Ifd24802977c3dcdd1dbc5120a78aac41beae4603 Signed-off-by: Adam Lesinski --- include/input/Input.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/input/Input.h b/include/input/Input.h index 4a67f47..92b3d36 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -111,6 +111,11 @@ enum { #define MAX_POINTERS 16 /* + * Maximum number of samples supported per motion event. + */ +#define MAX_SAMPLES UINT16_MAX + +/* * Maximum pointer id value supported in a motion event. * Smallest pointer id is 0. * (This is limited by our use of BitSet32 to track pointer assignments.) -- cgit v1.1 From 5d17838adef13062717322e79d4db0b9bb6b2395 Mon Sep 17 00:00:00 2001 From: Flanker Date: Mon, 7 Sep 2015 15:28:58 +0800 Subject: add number constraint for samples per MotionEvent Bug:23905002 Signed-off-by: Adam Lesinski (cherry picked from commit 552a8a5d8df32f659b8d11311a244cdc6d3b7733) Change-Id: I9b7ea859889b7697bee4165a2746602212120543 --- include/input/Input.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include') diff --git a/include/input/Input.h b/include/input/Input.h index e778076..97101a7 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -82,6 +82,11 @@ enum { #define MAX_POINTERS 16 /* + * Maximum number of samples supported per motion event. + */ +#define MAX_SAMPLES UINT16_MAX + +/* * Maximum pointer id value supported in a motion event. * Smallest pointer id is 0. * (This is limited by our use of BitSet32 to track pointer assignments.) -- cgit v1.1 From e2f499fb734bc30a1e1c947112caa0727349b6ed Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Tue, 20 Oct 2015 19:11:23 -0700 Subject: Track ashmem memory usage in Parcel Bug: 25004154 Change-Id: Id9d5656dd0605f1b50525596b75601309f67ebdc --- include/binder/Parcel.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 3ada1e9..220a935 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -342,9 +342,11 @@ public: private: size_t mBlobAshmemSize; + size_t mOpenAshmemSize; public: size_t getBlobAshmemSize() const; + size_t getOpenAshmemSize() const; }; // --------------------------------------------------------------------------- @@ -412,9 +414,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) // Generic acquire and release of objects. void acquire_object(const sp& proc, - const flat_binder_object& obj, const void* who); + const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void release_object(const sp& proc, - const flat_binder_object& obj, const void* who); + const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void flatten_binder(const sp& proc, const sp& binder, flat_binder_object* out); -- cgit v1.1 From 834ac204ce52d874cdd7ae921e5a4d85c5e42c52 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Thu, 22 Oct 2015 07:09:23 -0700 Subject: DO NOT MERGE: fix build breakage fix klp-dev only build breakage. frameworks/native/libs/input/Input.cpp: In member function 'android::status_t android::MotionEvent::readFromParcel(android::Parcel*)': frameworks/native/libs/input/Input.cpp:494:47: error: 'UINT16_MAX' was not declared in this scope Bug: 23905002 Change-Id: I4b6b864ca64d39a8873d045a61e0ddaea2ab9109 --- include/input/Input.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/input/Input.h b/include/input/Input.h index 97101a7..f8075e4 100644 --- a/include/input/Input.h +++ b/include/input/Input.h @@ -27,6 +27,7 @@ #include #include #include +#include /* * Additional private constants not defined in ndk/ui/input.h. -- cgit v1.1 From 6880307e8e35a6c484942443fb4ddd6173126152 Mon Sep 17 00:00:00 2001 From: Ian Pedowitz Date: Thu, 22 Oct 2015 22:08:10 +0000 Subject: Revert "Track ashmem memory usage in Parcel" This reverts commit e2f499fb734bc30a1e1c947112caa0727349b6ed. Bug: 25169267 Bug: 25191602 Bug: 25004154 Change-Id: I24bb0da4e8739ee5a0c251e4adac9904827144e0 --- include/binder/Parcel.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 220a935..3ada1e9 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -342,11 +342,9 @@ public: private: size_t mBlobAshmemSize; - size_t mOpenAshmemSize; public: size_t getBlobAshmemSize() const; - size_t getOpenAshmemSize() const; }; // --------------------------------------------------------------------------- @@ -414,9 +412,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) // Generic acquire and release of objects. void acquire_object(const sp& proc, - const flat_binder_object& obj, const void* who, size_t* outAshmemSize); + const flat_binder_object& obj, const void* who); void release_object(const sp& proc, - const flat_binder_object& obj, const void* who, size_t* outAshmemSize); + const flat_binder_object& obj, const void* who); void flatten_binder(const sp& proc, const sp& binder, flat_binder_object* out); -- cgit v1.1 From cbf3726357966539c2a685f46e61c3fc8937f19e Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 22 Oct 2015 16:12:53 -0700 Subject: Revert "Revert "Track ashmem memory usage in Parcel"" This reverts commit 6880307e8e35a6c484942443fb4ddd6173126152. Bug: 25004154 Change-Id: I9b432d1ebc39f3bbcd7afdefc403f0fb6ced8158 --- include/binder/Parcel.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 3ada1e9..220a935 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -342,9 +342,11 @@ public: private: size_t mBlobAshmemSize; + size_t mOpenAshmemSize; public: size_t getBlobAshmemSize() const; + size_t getOpenAshmemSize() const; }; // --------------------------------------------------------------------------- @@ -412,9 +414,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) // Generic acquire and release of objects. void acquire_object(const sp& proc, - const flat_binder_object& obj, const void* who); + const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void release_object(const sp& proc, - const flat_binder_object& obj, const void* who); + const flat_binder_object& obj, const void* who, size_t* outAshmemSize); void flatten_binder(const sp& proc, const sp& binder, flat_binder_object* out); -- cgit v1.1 From 6bb3114246f6f6aa406e65452dbaa12b135029ea Mon Sep 17 00:00:00 2001 From: Adrian Roos Date: Thu, 22 Oct 2015 16:46:12 -0700 Subject: Maintain Parcel ABI Makes sure we don't change the memory layout of the Parcel class to maintain binary compatibility with prebuilts linking against libbinder. Bug: 25004154 Change-Id: I656687497f08bb85cefda796aafa2341e601e30a --- include/binder/Parcel.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h index 220a935..16cd6cf 100644 --- a/include/binder/Parcel.h +++ b/include/binder/Parcel.h @@ -341,10 +341,10 @@ public: }; private: - size_t mBlobAshmemSize; size_t mOpenAshmemSize; public: + // TODO: Remove once ABI can be changed. size_t getBlobAshmemSize() const; size_t getOpenAshmemSize() const; }; @@ -414,9 +414,9 @@ inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) // Generic acquire and release of objects. void acquire_object(const sp& proc, - const flat_binder_object& obj, const void* who, size_t* outAshmemSize); + const flat_binder_object& obj, const void* who); void release_object(const sp& proc, - const flat_binder_object& obj, const void* who, size_t* outAshmemSize); + const flat_binder_object& obj, const void* who); void flatten_binder(const sp& proc, const sp& binder, flat_binder_object* out); -- cgit v1.1