Loading automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -320,7 +320,11 @@ VhalResult<void> FakeVehicleHardware::setUserHalProp(const VehiclePropValue& val if (updatedValue != nullptr) { ALOGI("onSetProperty(): updating property returned by HAL: %s", updatedValue->toString().c_str()); if (auto writeResult = mServerSidePropStore->writeValue(std::move(result.value())); // Update timestamp otherwise writeValue might fail because the timestamp is outdated. updatedValue->timestamp = elapsedRealtimeNano(); if (auto writeResult = mServerSidePropStore->writeValue( std::move(result.value()), /*updateStatus=*/true, VehiclePropertyStore::EventMode::ALWAYS); !writeResult.ok()) { return StatusError(getErrorCode(writeResult)) << "failed to write value into property store, error: " Loading automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -1223,6 +1223,8 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { ASSERT_EQ(events.size(), static_cast<size_t>(1)); events[0].timestamp = 0; // The returned event will have area ID 0. valueToSet.areaId = 0; ASSERT_EQ(events[0], valueToSet); // Try to get switch_user again, should return default value. Loading Loading @@ -1277,6 +1279,8 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { auto events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast<size_t>(1)); events[0].timestamp = 0; // The returned event will have area ID 0. valueToSet.areaId = 0; EXPECT_EQ(events[0], valueToSet); // Try to get create_user again, should return default value. Loading Loading @@ -1330,7 +1334,7 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { ASSERT_EQ(events.size(), static_cast<size_t>(1)); events[0].timestamp = 0; EXPECT_EQ(events[0], (VehiclePropValue{ .areaId = 1, .areaId = 0, .prop = toInt(VehicleProperty::INITIAL_USER_INFO), .value.int32Values = {3, 1, 11}, })); Loading automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,9 @@ FakeUserHal::ValueResultType FakeUserHal::sendUserHalResponse( << "invalid action on lshal response: " << response->toString(); } // Update area ID to 0 since this is a global property (and the area ID was only set to emulate // the request id behavior). response->areaId = 0; ALOGD("updating property to: %s", response->toString().c_str()); return response; } Loading Loading
automotive/vehicle/aidl/impl/fake_impl/hardware/src/FakeVehicleHardware.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -320,7 +320,11 @@ VhalResult<void> FakeVehicleHardware::setUserHalProp(const VehiclePropValue& val if (updatedValue != nullptr) { ALOGI("onSetProperty(): updating property returned by HAL: %s", updatedValue->toString().c_str()); if (auto writeResult = mServerSidePropStore->writeValue(std::move(result.value())); // Update timestamp otherwise writeValue might fail because the timestamp is outdated. updatedValue->timestamp = elapsedRealtimeNano(); if (auto writeResult = mServerSidePropStore->writeValue( std::move(result.value()), /*updateStatus=*/true, VehiclePropertyStore::EventMode::ALWAYS); !writeResult.ok()) { return StatusError(getErrorCode(writeResult)) << "failed to write value into property store, error: " Loading
automotive/vehicle/aidl/impl/fake_impl/hardware/test/FakeVehicleHardwareTest.cpp +5 −1 Original line number Diff line number Diff line Loading @@ -1223,6 +1223,8 @@ TEST_F(FakeVehicleHardwareTest, testSwitchUser) { ASSERT_EQ(events.size(), static_cast<size_t>(1)); events[0].timestamp = 0; // The returned event will have area ID 0. valueToSet.areaId = 0; ASSERT_EQ(events[0], valueToSet); // Try to get switch_user again, should return default value. Loading Loading @@ -1277,6 +1279,8 @@ TEST_F(FakeVehicleHardwareTest, testCreateUser) { auto events = getChangedProperties(); ASSERT_EQ(events.size(), static_cast<size_t>(1)); events[0].timestamp = 0; // The returned event will have area ID 0. valueToSet.areaId = 0; EXPECT_EQ(events[0], valueToSet); // Try to get create_user again, should return default value. Loading Loading @@ -1330,7 +1334,7 @@ TEST_F(FakeVehicleHardwareTest, testInitialUserInfo) { ASSERT_EQ(events.size(), static_cast<size_t>(1)); events[0].timestamp = 0; EXPECT_EQ(events[0], (VehiclePropValue{ .areaId = 1, .areaId = 0, .prop = toInt(VehicleProperty::INITIAL_USER_INFO), .value.int32Values = {3, 1, 11}, })); Loading
automotive/vehicle/aidl/impl/fake_impl/userhal/src/FakeUserHal.cpp +3 −0 Original line number Diff line number Diff line Loading @@ -328,6 +328,9 @@ FakeUserHal::ValueResultType FakeUserHal::sendUserHalResponse( << "invalid action on lshal response: " << response->toString(); } // Update area ID to 0 since this is a global property (and the area ID was only set to emulate // the request id behavior). response->areaId = 0; ALOGD("updating property to: %s", response->toString().c_str()); return response; } Loading