Loading include/audiomanager/AudioManager.h +8 −0 Original line number Diff line number Diff line Loading @@ -40,8 +40,16 @@ typedef enum { PLAYER_UPDATE_DEVICE_ID = 5, PLAYER_UPDATE_PORT_ID = 6, PLAYER_UPDATE_MUTED = 7, PLAYER_UPDATE_FORMAT = 8, } player_state_t; static constexpr char kExtraPlayerEventSpatializedKey[] = "android.media.extra.PLAYER_EVENT_SPATIALIZED"; static constexpr char kExtraPlayerEventSampleRateKey[] = "android.media.extra.PLAYER_EVENT_SAMPLE_RATE"; static constexpr char kExtraPlayerEventChannelMaskKey[] = "android.media.extra.PLAYER_EVENT_CHANNEL_MASK"; static constexpr char kExtraPlayerEventMuteKey[] = "android.media.extra.PLAYER_EVENT_MUTE"; enum { Loading include/input/Input.h +7 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,13 @@ class Parcel; */ vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy); /* * Transform an angle on the x-y plane. An angle of 0 radians corresponds to "north" or * pointing upwards in the negative Y direction, a positive angle points towards the right, and a * negative angle points towards the left. */ float transformAngle(const ui::Transform& transform, float angleRadians); const char* inputEventTypeToString(int32_t type); std::string inputEventSourceToString(int32_t source); Loading libs/input/Input.cpp +19 −19 Original line number Diff line number Diff line Loading @@ -46,25 +46,6 @@ namespace android { namespace { float transformAngle(const ui::Transform& transform, float angleRadians) { // Construct and transform a vector oriented at the specified clockwise angle from vertical. // Coordinate system: down is increasing Y, right is increasing X. float x = sinf(angleRadians); float y = -cosf(angleRadians); vec2 transformedPoint = transform.transform(x, y); // Determine how the origin is transformed by the matrix so that we // can transform orientation vectors. const vec2 origin = transform.transform(0, 0); transformedPoint.x -= origin.x; transformedPoint.y -= origin.y; // Derive the transformed vector's clockwise angle from vertical. // The return value of atan2f is in range [-pi, pi] which conforms to the orientation API. return atan2f(transformedPoint.x, -transformedPoint.y); } bool shouldDisregardTransformation(uint32_t source) { // Do not apply any transformations to axes from joysticks, touchpads, or relative mice. return isFromSource(source, AINPUT_SOURCE_CLASS_JOYSTICK) || Loading Loading @@ -172,6 +153,25 @@ vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy) return transformedXy - transformedOrigin; } float transformAngle(const ui::Transform& transform, float angleRadians) { // Construct and transform a vector oriented at the specified clockwise angle from vertical. // Coordinate system: down is increasing Y, right is increasing X. float x = sinf(angleRadians); float y = -cosf(angleRadians); vec2 transformedPoint = transform.transform(x, y); // Determine how the origin is transformed by the matrix so that we // can transform orientation vectors. const vec2 origin = transform.transform(0, 0); transformedPoint.x -= origin.x; transformedPoint.y -= origin.y; // Derive the transformed vector's clockwise angle from vertical. // The return value of atan2f is in range [-pi, pi] which conforms to the orientation API. return atan2f(transformedPoint.x, -transformedPoint.y); } const char* inputEventTypeToString(int32_t type) { switch (type) { case AINPUT_EVENT_TYPE_KEY: { Loading libs/nativewindow/AHardwareBuffer.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -617,15 +617,27 @@ bool AHardwareBuffer_isValidPixelFormat(uint32_t format) { static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::R_8) == AHARDWAREBUFFER_FORMAT_R8_UNORM, "HAL and AHardwareBuffer pixel format don't match"); static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::R_16_UINT) == AHARDWAREBUFFER_FORMAT_R16_UINT, "HAL and AHardwareBuffer pixel format don't match"); static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::RG_1616_UINT) == AHARDWAREBUFFER_FORMAT_R16G16_UINT, "HAL and AHardwareBuffer pixel format don't match"); static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::RGBA_10101010) == AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM, "HAL and AHardwareBuffer pixel format don't match"); switch (format) { case AHARDWAREBUFFER_FORMAT_R8_UNORM: case AHARDWAREBUFFER_FORMAT_R16_UINT: case AHARDWAREBUFFER_FORMAT_R16G16_UINT: case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: case AHARDWAREBUFFER_FORMAT_BLOB: case AHARDWAREBUFFER_FORMAT_D16_UNORM: case AHARDWAREBUFFER_FORMAT_D24_UNORM: Loading Loading @@ -677,6 +689,7 @@ uint32_t AHardwareBuffer_bytesPerPixel(uint32_t format) { return 1; case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: case AHARDWAREBUFFER_FORMAT_D16_UNORM: case AHARDWAREBUFFER_FORMAT_R16_UINT: return 2; case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: case AHARDWAREBUFFER_FORMAT_D24_UNORM: Loading @@ -686,8 +699,10 @@ uint32_t AHardwareBuffer_bytesPerPixel(uint32_t format) { case AHARDWAREBUFFER_FORMAT_D32_FLOAT: case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT: case AHARDWAREBUFFER_FORMAT_R16G16_UINT: return 4; case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: return 8; default: return 0; Loading libs/nativewindow/include/android/hardware_buffer.h +21 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,27 @@ enum AHardwareBuffer_Format { * OpenGL ES: GR_GL_R8 */ AHARDWAREBUFFER_FORMAT_R8_UNORM = 0x38, /** * Corresponding formats: * Vulkan: VK_FORMAT_R16_UINT * OpenGL ES: GR_GL_R16UI */ AHARDWAREBUFFER_FORMAT_R16_UINT = 0x39, /** * Corresponding formats: * Vulkan: VK_FORMAT_R16G16_UINT * OpenGL ES: GR_GL_RG16UI */ AHARDWAREBUFFER_FORMAT_R16G16_UINT = 0x3a, /** * Corresponding formats: * Vulkan: VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 * OpenGL ES: N/A */ AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM = 0x3b, }; /** Loading Loading
include/audiomanager/AudioManager.h +8 −0 Original line number Diff line number Diff line Loading @@ -40,8 +40,16 @@ typedef enum { PLAYER_UPDATE_DEVICE_ID = 5, PLAYER_UPDATE_PORT_ID = 6, PLAYER_UPDATE_MUTED = 7, PLAYER_UPDATE_FORMAT = 8, } player_state_t; static constexpr char kExtraPlayerEventSpatializedKey[] = "android.media.extra.PLAYER_EVENT_SPATIALIZED"; static constexpr char kExtraPlayerEventSampleRateKey[] = "android.media.extra.PLAYER_EVENT_SAMPLE_RATE"; static constexpr char kExtraPlayerEventChannelMaskKey[] = "android.media.extra.PLAYER_EVENT_CHANNEL_MASK"; static constexpr char kExtraPlayerEventMuteKey[] = "android.media.extra.PLAYER_EVENT_MUTE"; enum { Loading
include/input/Input.h +7 −0 Original line number Diff line number Diff line Loading @@ -203,6 +203,13 @@ class Parcel; */ vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy); /* * Transform an angle on the x-y plane. An angle of 0 radians corresponds to "north" or * pointing upwards in the negative Y direction, a positive angle points towards the right, and a * negative angle points towards the left. */ float transformAngle(const ui::Transform& transform, float angleRadians); const char* inputEventTypeToString(int32_t type); std::string inputEventSourceToString(int32_t source); Loading
libs/input/Input.cpp +19 −19 Original line number Diff line number Diff line Loading @@ -46,25 +46,6 @@ namespace android { namespace { float transformAngle(const ui::Transform& transform, float angleRadians) { // Construct and transform a vector oriented at the specified clockwise angle from vertical. // Coordinate system: down is increasing Y, right is increasing X. float x = sinf(angleRadians); float y = -cosf(angleRadians); vec2 transformedPoint = transform.transform(x, y); // Determine how the origin is transformed by the matrix so that we // can transform orientation vectors. const vec2 origin = transform.transform(0, 0); transformedPoint.x -= origin.x; transformedPoint.y -= origin.y; // Derive the transformed vector's clockwise angle from vertical. // The return value of atan2f is in range [-pi, pi] which conforms to the orientation API. return atan2f(transformedPoint.x, -transformedPoint.y); } bool shouldDisregardTransformation(uint32_t source) { // Do not apply any transformations to axes from joysticks, touchpads, or relative mice. return isFromSource(source, AINPUT_SOURCE_CLASS_JOYSTICK) || Loading Loading @@ -172,6 +153,25 @@ vec2 transformWithoutTranslation(const ui::Transform& transform, const vec2& xy) return transformedXy - transformedOrigin; } float transformAngle(const ui::Transform& transform, float angleRadians) { // Construct and transform a vector oriented at the specified clockwise angle from vertical. // Coordinate system: down is increasing Y, right is increasing X. float x = sinf(angleRadians); float y = -cosf(angleRadians); vec2 transformedPoint = transform.transform(x, y); // Determine how the origin is transformed by the matrix so that we // can transform orientation vectors. const vec2 origin = transform.transform(0, 0); transformedPoint.x -= origin.x; transformedPoint.y -= origin.y; // Derive the transformed vector's clockwise angle from vertical. // The return value of atan2f is in range [-pi, pi] which conforms to the orientation API. return atan2f(transformedPoint.x, -transformedPoint.y); } const char* inputEventTypeToString(int32_t type) { switch (type) { case AINPUT_EVENT_TYPE_KEY: { Loading
libs/nativewindow/AHardwareBuffer.cpp +15 −0 Original line number Diff line number Diff line Loading @@ -617,15 +617,27 @@ bool AHardwareBuffer_isValidPixelFormat(uint32_t format) { static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::R_8) == AHARDWAREBUFFER_FORMAT_R8_UNORM, "HAL and AHardwareBuffer pixel format don't match"); static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::R_16_UINT) == AHARDWAREBUFFER_FORMAT_R16_UINT, "HAL and AHardwareBuffer pixel format don't match"); static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::RG_1616_UINT) == AHARDWAREBUFFER_FORMAT_R16G16_UINT, "HAL and AHardwareBuffer pixel format don't match"); static_assert(static_cast<int>(aidl::android::hardware::graphics::common::PixelFormat::RGBA_10101010) == AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM, "HAL and AHardwareBuffer pixel format don't match"); switch (format) { case AHARDWAREBUFFER_FORMAT_R8_UNORM: case AHARDWAREBUFFER_FORMAT_R16_UINT: case AHARDWAREBUFFER_FORMAT_R16G16_UINT: case AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM: case AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM: case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: case AHARDWAREBUFFER_FORMAT_BLOB: case AHARDWAREBUFFER_FORMAT_D16_UNORM: case AHARDWAREBUFFER_FORMAT_D24_UNORM: Loading Loading @@ -677,6 +689,7 @@ uint32_t AHardwareBuffer_bytesPerPixel(uint32_t format) { return 1; case AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM: case AHARDWAREBUFFER_FORMAT_D16_UNORM: case AHARDWAREBUFFER_FORMAT_R16_UINT: return 2; case AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM: case AHARDWAREBUFFER_FORMAT_D24_UNORM: Loading @@ -686,8 +699,10 @@ uint32_t AHardwareBuffer_bytesPerPixel(uint32_t format) { case AHARDWAREBUFFER_FORMAT_D32_FLOAT: case AHARDWAREBUFFER_FORMAT_R10G10B10A2_UNORM: case AHARDWAREBUFFER_FORMAT_D24_UNORM_S8_UINT: case AHARDWAREBUFFER_FORMAT_R16G16_UINT: return 4; case AHARDWAREBUFFER_FORMAT_R16G16B16A16_FLOAT: case AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM: return 8; default: return 0; Loading
libs/nativewindow/include/android/hardware_buffer.h +21 −0 Original line number Diff line number Diff line Loading @@ -173,6 +173,27 @@ enum AHardwareBuffer_Format { * OpenGL ES: GR_GL_R8 */ AHARDWAREBUFFER_FORMAT_R8_UNORM = 0x38, /** * Corresponding formats: * Vulkan: VK_FORMAT_R16_UINT * OpenGL ES: GR_GL_R16UI */ AHARDWAREBUFFER_FORMAT_R16_UINT = 0x39, /** * Corresponding formats: * Vulkan: VK_FORMAT_R16G16_UINT * OpenGL ES: GR_GL_RG16UI */ AHARDWAREBUFFER_FORMAT_R16G16_UINT = 0x3a, /** * Corresponding formats: * Vulkan: VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 * OpenGL ES: N/A */ AHARDWAREBUFFER_FORMAT_R10G10B10A10_UNORM = 0x3b, }; /** Loading