Loading cmds/dumpstate/DumpstateInternal.h +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ // TODO: use functions from <chrono> instead const uint64_t NANOS_PER_SEC = 1000000000; const uint64_t NANOS_PER_MILLI = 1000000; uint64_t Nanotime(); // Switches to non-root user and group. Loading cmds/dumpstate/dumpstate.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -649,7 +649,7 @@ UserConsentResult Dumpstate::ConsentCallback::getResult() { } uint64_t Dumpstate::ConsentCallback::getElapsedTimeMs() const { return Nanotime() - start_time_; return (Nanotime() - start_time_) / NANOS_PER_MILLI; } void Dumpstate::PrintHeader() const { Loading include/android/imagedecoder.h +3 −3 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ #define ANDROID_IMAGE_DECODER_H #include "bitmap.h" #include <android/rect.h> #include <stdint.h> #ifdef __cplusplus Loading @@ -35,7 +35,6 @@ extern "C" { #endif struct AAsset; struct ARect; #if __ANDROID_API__ >= 30 Loading Loading @@ -92,7 +91,8 @@ typedef struct AImageDecoder AImageDecoder; * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value * indicating reason for the failure. */ int AImageDecoder_createFromAAsset(AAsset* asset, AImageDecoder** outDecoder) __INTRODUCED_IN(30); int AImageDecoder_createFromAAsset(struct AAsset* asset, AImageDecoder** outDecoder) __INTRODUCED_IN(30); /** * Create a new AImageDecoder from a file descriptor. Loading include/input/Input.h +24 −16 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <utils/RefBase.h> #include <utils/Timers.h> #include <utils/Vector.h> #include <array> #include <limits> #include <queue> Loading Loading @@ -258,6 +259,11 @@ const char* motionClassificationToString(MotionClassification classification); */ constexpr float AMOTION_EVENT_INVALID_CURSOR_POSITION = std::numeric_limits<float>::quiet_NaN(); /** * Invalid value of HMAC - SHA256. Any events with this HMAC value will be marked as not verified. */ constexpr std::array<uint8_t, 32> INVALID_HMAC = {0}; /* * Pointer coordinate data. */ Loading Loading @@ -356,14 +362,17 @@ public: inline void setDisplayId(int32_t displayId) { mDisplayId = displayId; } inline std::array<uint8_t, 32> getHmac() const { return mHmac; } protected: void initialize(int32_t deviceId, int32_t source, int32_t displayId); void initialize(int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac); void initialize(const InputEvent& from); int32_t mDeviceId; int32_t mSource; int32_t mDisplayId; std::array<uint8_t, 32> mHmac; }; /* Loading Loading @@ -396,17 +405,9 @@ public: static const char* getLabel(int32_t keyCode); static int32_t getKeyCodeFromLabel(const char* label); void initialize( int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, void initialize(int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, nsecs_t eventTime); void initialize(const KeyEvent& from); Loading Loading @@ -463,6 +464,10 @@ public: inline void setActionButton(int32_t button) { mActionButton = button; } inline float getXScale() const { return mXScale; } inline float getYScale() const { return mYScale; } inline float getXOffset() const { return mXOffset; } inline float getYOffset() const { return mYOffset; } Loading Loading @@ -624,9 +629,10 @@ public: ssize_t findPointerIndex(int32_t pointerId) const; void initialize(int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xOffset, void initialize(int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xScale, float yScale, float xOffset, float yOffset, float xPrecision, float yPrecision, float rawXCursorPosition, float rawYCursorPosition, nsecs_t downTime, nsecs_t eventTime, size_t pointerCount, const PointerProperties* pointerProperties, Loading Loading @@ -676,6 +682,8 @@ protected: int32_t mMetaState; int32_t mButtonState; MotionClassification mClassification; float mXScale; float mYScale; float mXOffset; float mYOffset; float mXPrecision; Loading include/input/InputTransport.h +15 −16 Original line number Diff line number Diff line Loading @@ -76,6 +76,9 @@ struct InputMessage { } header; // Body *must* be 8 byte aligned. // For keys and motions, rely on the fact that std::array takes up exactly as much space // as the underlying data. This is not guaranteed by C++, but it simplifies the conversions. static_assert(sizeof(std::array<uint8_t, 32>) == 32); union Body { struct Key { uint32_t seq; Loading @@ -84,6 +87,7 @@ struct InputMessage { int32_t deviceId; int32_t source; int32_t displayId; std::array<uint8_t, 32> hmac; int32_t action; int32_t flags; int32_t keyCode; Loading @@ -103,6 +107,7 @@ struct InputMessage { int32_t deviceId; int32_t source; int32_t displayId; std::array<uint8_t, 32> hmac; int32_t action; int32_t actionButton; int32_t flags; Loading @@ -112,6 +117,8 @@ struct InputMessage { uint8_t empty2[3]; // 3 bytes to fill gap created by classification int32_t edgeFlags; nsecs_t downTime __attribute__((aligned(8))); float xScale; float yScale; float xOffset; float yOffset; float xPrecision; Loading Loading @@ -269,19 +276,10 @@ public: * Returns BAD_VALUE if seq is 0. * Other errors probably indicate that the channel is broken. */ status_t publishKeyEvent( uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, nsecs_t eventTime); status_t publishKeyEvent(uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, nsecs_t eventTime); /* Publishes a motion event to the input channel. * Loading @@ -292,9 +290,10 @@ public: * Other errors probably indicate that the channel is broken. */ status_t publishMotionEvent(uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xOffset, float yOffset, std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xScale, float yScale, float xOffset, float yOffset, float xPrecision, float yPrecision, float xCursorPosition, float yCursorPosition, nsecs_t downTime, nsecs_t eventTime, uint32_t pointerCount, const PointerProperties* pointerProperties, Loading Loading
cmds/dumpstate/DumpstateInternal.h +1 −0 Original line number Diff line number Diff line Loading @@ -49,6 +49,7 @@ // TODO: use functions from <chrono> instead const uint64_t NANOS_PER_SEC = 1000000000; const uint64_t NANOS_PER_MILLI = 1000000; uint64_t Nanotime(); // Switches to non-root user and group. Loading
cmds/dumpstate/dumpstate.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -649,7 +649,7 @@ UserConsentResult Dumpstate::ConsentCallback::getResult() { } uint64_t Dumpstate::ConsentCallback::getElapsedTimeMs() const { return Nanotime() - start_time_; return (Nanotime() - start_time_) / NANOS_PER_MILLI; } void Dumpstate::PrintHeader() const { Loading
include/android/imagedecoder.h +3 −3 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ #define ANDROID_IMAGE_DECODER_H #include "bitmap.h" #include <android/rect.h> #include <stdint.h> #ifdef __cplusplus Loading @@ -35,7 +35,6 @@ extern "C" { #endif struct AAsset; struct ARect; #if __ANDROID_API__ >= 30 Loading Loading @@ -92,7 +91,8 @@ typedef struct AImageDecoder AImageDecoder; * @return {@link ANDROID_IMAGE_DECODER_SUCCESS} on success or a value * indicating reason for the failure. */ int AImageDecoder_createFromAAsset(AAsset* asset, AImageDecoder** outDecoder) __INTRODUCED_IN(30); int AImageDecoder_createFromAAsset(struct AAsset* asset, AImageDecoder** outDecoder) __INTRODUCED_IN(30); /** * Create a new AImageDecoder from a file descriptor. Loading
include/input/Input.h +24 −16 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ #include <utils/RefBase.h> #include <utils/Timers.h> #include <utils/Vector.h> #include <array> #include <limits> #include <queue> Loading Loading @@ -258,6 +259,11 @@ const char* motionClassificationToString(MotionClassification classification); */ constexpr float AMOTION_EVENT_INVALID_CURSOR_POSITION = std::numeric_limits<float>::quiet_NaN(); /** * Invalid value of HMAC - SHA256. Any events with this HMAC value will be marked as not verified. */ constexpr std::array<uint8_t, 32> INVALID_HMAC = {0}; /* * Pointer coordinate data. */ Loading Loading @@ -356,14 +362,17 @@ public: inline void setDisplayId(int32_t displayId) { mDisplayId = displayId; } inline std::array<uint8_t, 32> getHmac() const { return mHmac; } protected: void initialize(int32_t deviceId, int32_t source, int32_t displayId); void initialize(int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac); void initialize(const InputEvent& from); int32_t mDeviceId; int32_t mSource; int32_t mDisplayId; std::array<uint8_t, 32> mHmac; }; /* Loading Loading @@ -396,17 +405,9 @@ public: static const char* getLabel(int32_t keyCode); static int32_t getKeyCodeFromLabel(const char* label); void initialize( int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, void initialize(int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, nsecs_t eventTime); void initialize(const KeyEvent& from); Loading Loading @@ -463,6 +464,10 @@ public: inline void setActionButton(int32_t button) { mActionButton = button; } inline float getXScale() const { return mXScale; } inline float getYScale() const { return mYScale; } inline float getXOffset() const { return mXOffset; } inline float getYOffset() const { return mYOffset; } Loading Loading @@ -624,9 +629,10 @@ public: ssize_t findPointerIndex(int32_t pointerId) const; void initialize(int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xOffset, void initialize(int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xScale, float yScale, float xOffset, float yOffset, float xPrecision, float yPrecision, float rawXCursorPosition, float rawYCursorPosition, nsecs_t downTime, nsecs_t eventTime, size_t pointerCount, const PointerProperties* pointerProperties, Loading Loading @@ -676,6 +682,8 @@ protected: int32_t mMetaState; int32_t mButtonState; MotionClassification mClassification; float mXScale; float mYScale; float mXOffset; float mYOffset; float mXPrecision; Loading
include/input/InputTransport.h +15 −16 Original line number Diff line number Diff line Loading @@ -76,6 +76,9 @@ struct InputMessage { } header; // Body *must* be 8 byte aligned. // For keys and motions, rely on the fact that std::array takes up exactly as much space // as the underlying data. This is not guaranteed by C++, but it simplifies the conversions. static_assert(sizeof(std::array<uint8_t, 32>) == 32); union Body { struct Key { uint32_t seq; Loading @@ -84,6 +87,7 @@ struct InputMessage { int32_t deviceId; int32_t source; int32_t displayId; std::array<uint8_t, 32> hmac; int32_t action; int32_t flags; int32_t keyCode; Loading @@ -103,6 +107,7 @@ struct InputMessage { int32_t deviceId; int32_t source; int32_t displayId; std::array<uint8_t, 32> hmac; int32_t action; int32_t actionButton; int32_t flags; Loading @@ -112,6 +117,8 @@ struct InputMessage { uint8_t empty2[3]; // 3 bytes to fill gap created by classification int32_t edgeFlags; nsecs_t downTime __attribute__((aligned(8))); float xScale; float yScale; float xOffset; float yOffset; float xPrecision; Loading Loading @@ -269,19 +276,10 @@ public: * Returns BAD_VALUE if seq is 0. * Other errors probably indicate that the channel is broken. */ status_t publishKeyEvent( uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, nsecs_t eventTime); status_t publishKeyEvent(uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, std::array<uint8_t, 32> hmac, int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, int32_t repeatCount, nsecs_t downTime, nsecs_t eventTime); /* Publishes a motion event to the input channel. * Loading @@ -292,9 +290,10 @@ public: * Other errors probably indicate that the channel is broken. */ status_t publishMotionEvent(uint32_t seq, int32_t deviceId, int32_t source, int32_t displayId, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xOffset, float yOffset, std::array<uint8_t, 32> hmac, int32_t action, int32_t actionButton, int32_t flags, int32_t edgeFlags, int32_t metaState, int32_t buttonState, MotionClassification classification, float xScale, float yScale, float xOffset, float yOffset, float xPrecision, float yPrecision, float xCursorPosition, float yCursorPosition, nsecs_t downTime, nsecs_t eventTime, uint32_t pointerCount, const PointerProperties* pointerProperties, Loading