summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2019-03-11 09:13:29 -0700
committerXin Li <delphij@google.com>2019-03-11 09:13:29 -0700
commitb126899aa4a6aaf004abdb747fd4337b9c0f4108 (patch)
treeab1e1ecdb49cad82b20d749ac9091eb9d2badf51 /include
parentea7255933ea33b4da6e0c55103b3166ab57eb8d7 (diff)
parentcc4b88e324d0b3903cb622534c68dbdb682bfee0 (diff)
downloadandroid_frameworks_native-b126899aa4a6aaf004abdb747fd4337b9c0f4108.tar.gz
android_frameworks_native-b126899aa4a6aaf004abdb747fd4337b9c0f4108.tar.bz2
android_frameworks_native-b126899aa4a6aaf004abdb747fd4337b9c0f4108.zip
DO NOT MERGE - Merge PPRL.190305.001 into master
Bug: 127812889 Change-Id: I1cb1c38609ee26bb7c3e7343a9ed4c85fb4fb0a6
Diffstat (limited to 'include')
-rw-r--r--include/input/InputTransport.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/input/InputTransport.h b/include/input/InputTransport.h
index 1ea2c2cc0..ecdc075ac 100644
--- a/include/input/InputTransport.h
+++ b/include/input/InputTransport.h
@@ -41,6 +41,13 @@ namespace android {
*
* Note that this structure is used for IPCs so its layout must be identical
* on 64 and 32 bit processes. This is tested in StructLayout_test.cpp.
+ *
+ * Since the struct must be aligned to an 8-byte boundary, there could be uninitialized bytes
+ * in-between the defined fields. This padding data should be explicitly accounted for by adding
+ * "empty" fields into the struct. This data is memset to zero before sending the struct across
+ * the socket. Adding the explicit fields ensures that the memset is not optimized away by the
+ * compiler. When a new field is added to the struct, the corresponding change
+ * in StructLayout_test should be made.
*/
struct InputMessage {
enum {
@@ -61,6 +68,7 @@ struct InputMessage {
union Body {
struct Key {
uint32_t seq;
+ uint32_t empty1;
nsecs_t eventTime __attribute__((aligned(8)));
int32_t deviceId;
int32_t source;
@@ -71,6 +79,7 @@ struct InputMessage {
int32_t scanCode;
int32_t metaState;
int32_t repeatCount;
+ uint32_t empty2;
nsecs_t downTime __attribute__((aligned(8)));
inline size_t size() const {
@@ -80,6 +89,7 @@ struct InputMessage {
struct Motion {
uint32_t seq;
+ uint32_t empty1;
nsecs_t eventTime __attribute__((aligned(8)));
int32_t deviceId;
int32_t source;
@@ -90,12 +100,14 @@ struct InputMessage {
int32_t metaState;
int32_t buttonState;
int32_t edgeFlags;
+ uint32_t empty2;
nsecs_t downTime __attribute__((aligned(8)));
float xOffset;
float yOffset;
float xPrecision;
float yPrecision;
uint32_t pointerCount;
+ uint32_t empty3;
// Note that PointerCoords requires 8 byte alignment.
struct Pointer {
PointerProperties properties;
@@ -126,6 +138,7 @@ struct InputMessage {
bool isValid(size_t actualSize) const;
size_t size() const;
+ void getSanitizedCopy(InputMessage* msg) const;
};
/*