diff --git a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h index 622846a301..f023fd2063 100644 --- a/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h +++ b/automotive/vehicle/aidl/impl/default_config/include/DefaultConfig.h @@ -167,7 +167,15 @@ const std::vector kVehicleProperties = { .maxSampleRate = 10.0f, }, .initialValue = {.floatValues = {0.0f}}}, - + {.config = + { + .prop = toInt(VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY), + .access = VehiclePropertyAccess::READ, + .changeMode = VehiclePropertyChangeMode::CONTINUOUS, + .minSampleRate = 1.0f, + .maxSampleRate = 10.0f, + }, + .initialValue = {.floatValues = {0.0f}}}, {.config = { .prop = toInt(VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS), @@ -177,7 +185,7 @@ const std::vector kVehicleProperties = { toInt(VehicleUnit::MILES_PER_HOUR), toInt(VehicleUnit::KILOMETERS_PER_HOUR)}, }, - .initialValue = {.int32Values = {toInt(VehicleUnit::KILOMETERS_PER_HOUR)}}}, + .initialValue = {.int32Values = {toInt(VehicleUnit::MILES_PER_HOUR)}}}, {.config = { @@ -1025,7 +1033,7 @@ const std::vector kVehicleProperties = { .changeMode = VehiclePropertyChangeMode::ON_CHANGE, .configArray = {(int)VehicleUnit::LITER, (int)VehicleUnit::US_GALLON}, }, - .initialValue = {.int32Values = {(int)VehicleUnit::LITER}}}, + .initialValue = {.int32Values = {(int)VehicleUnit::US_GALLON}}}, {.config = { diff --git a/camera/device/3.2/default/convert.cpp b/camera/device/3.2/default/convert.cpp index 06ad7e963c..207560783f 100644 --- a/camera/device/3.2/default/convert.cpp +++ b/camera/device/3.2/default/convert.cpp @@ -16,6 +16,7 @@ #define LOG_TAG "android.hardware.camera.device@3.2-convert-impl" #include +#include #include "include/convert.h" @@ -43,6 +44,13 @@ bool convertFromHidl(const CameraMetadata &src, const camera_metadata_t** dst) { ALOGE("%s: input CameraMetadata is corrupt!", __FUNCTION__); return false; } + + if (validate_camera_metadata_structure((camera_metadata_t*)data, /*expected_size=*/NULL) != + OK) { + ALOGE("%s: Failed to validate the metadata structure", __FUNCTION__); + return false; + } + *dst = (camera_metadata_t*) data; return true; } diff --git a/gnss/common/utils/default/DeviceFileReader.cpp b/gnss/common/utils/default/DeviceFileReader.cpp index dfc086a8b8..91e75eb460 100644 --- a/gnss/common/utils/default/DeviceFileReader.cpp +++ b/gnss/common/utils/default/DeviceFileReader.cpp @@ -32,40 +32,52 @@ void DeviceFileReader::getDataFromDeviceFile(const std::string& command, int mMi return; } - int mGnssFd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK); - - if (mGnssFd == -1) { + int gnss_fd, epoll_fd; + if ((gnss_fd = open(deviceFilePath.c_str(), O_RDWR | O_NONBLOCK)) == -1) { + return; + } + if (write(gnss_fd, command.c_str(), command.size()) <= 0) { + close(gnss_fd); return; } - int bytes_write = write(mGnssFd, command.c_str(), command.size()); - if (bytes_write <= 0) { - close(mGnssFd); + // Create an epoll instance. + if ((epoll_fd = epoll_create1(EPOLL_CLOEXEC)) < 0) { + close(gnss_fd); return; } + // Add file descriptor to epoll instance. struct epoll_event ev, events[1]; - ev.data.fd = mGnssFd; + memset(&ev, 0, sizeof(ev)); + ev.data.fd = gnss_fd; ev.events = EPOLLIN; - int epoll_fd = epoll_create1(0); - epoll_ctl(epoll_fd, EPOLL_CTL_ADD, mGnssFd, &ev); + if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, gnss_fd, &ev) == -1) { + close(gnss_fd); + close(epoll_fd); + return; + } + + // Wait for device file event. + if (epoll_wait(epoll_fd, events, 1, mMinIntervalMs) == -1) { + close(gnss_fd); + close(epoll_fd); + return; + } + + // Handle event and write data to string buffer. int bytes_read = -1; std::string inputStr = ""; - int epoll_ret = epoll_wait(epoll_fd, events, 1, mMinIntervalMs); - - if (epoll_ret == -1) { - close(mGnssFd); - return; - } while (true) { memset(inputBuffer, 0, INPUT_BUFFER_SIZE); - bytes_read = read(mGnssFd, &inputBuffer, INPUT_BUFFER_SIZE); + bytes_read = read(gnss_fd, &inputBuffer, INPUT_BUFFER_SIZE); if (bytes_read <= 0) { break; } s_buffer_ += std::string(inputBuffer, bytes_read); } - close(mGnssFd); + close(gnss_fd); + close(epoll_fd); // Trim end of file mark(\n\n\n\n). auto pos = s_buffer_.find("\n\n\n\n"); diff --git a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h index ab67eb10bc..9ae6173a91 100644 --- a/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h +++ b/graphics/composer/2.1/utils/hal/include/composer-hal/2.1/ComposerCommandEngine.h @@ -207,7 +207,7 @@ class ComposerCommandEngine : protected CommandReaderBase { bool executeSetClientTarget(uint16_t length) { // 4 parameters followed by N rectangles - if ((length - 4) % 4 != 0) { + if (!length || (length - 4) % 4 != 0) { return false; } diff --git a/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc b/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc index deea16e4d3..e149058f0f 100644 --- a/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc +++ b/sensors/2.1/multihal/android.hardware.sensors@2.1-service-multihal.rc @@ -1,7 +1,7 @@ service vendor.sensors-hal-2-1-multihal /vendor/bin/hw/android.hardware.sensors@2.1-service.multihal class hal user system - group system wakelock context_hub input + group system wakelock context_hub input uhid task_profiles ServiceCapacityLow capabilities BLOCK_SUSPEND rlimit rtprio 10 10