Merge Android 13 QPR3 tm-qpr-dev-plus-aosp-without-vendor@9936994

Bug: 275386652
Merged-In: Icd15f6e7bfdd7b3e3d0d4b407195258d4171c560
Change-Id: I115d5b25fc5b997a76ac4672262945f3393a9c78
This commit is contained in:
Xin Li 2023-04-18 16:34:16 -07:00
commit 71a948bc4c
5 changed files with 50 additions and 22 deletions

View file

@ -167,7 +167,15 @@ const std::vector<ConfigDeclaration> 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<ConfigDeclaration> 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<ConfigDeclaration> 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 =
{

View file

@ -16,6 +16,7 @@
#define LOG_TAG "android.hardware.camera.device@3.2-convert-impl"
#include <log/log.h>
#include <system/camera_metadata.h>
#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;
}

View file

@ -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");

View file

@ -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;
}

View file

@ -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