Merge "Update VHAL types.hal" into pi-dev
This commit is contained in:
commit
1058b982e9
12 changed files with 691 additions and 594 deletions
|
@ -26,14 +26,15 @@ hidl_interface {
|
|||
"Obd2IgnitionMonitorKind",
|
||||
"Obd2SecondaryAirStatus",
|
||||
"Obd2SparkIgnitionMonitors",
|
||||
"PortLocationType",
|
||||
"StatusCode",
|
||||
"SubscribeFlags",
|
||||
"SubscribeOptions",
|
||||
"VehicleApPowerBootupReason",
|
||||
"VehicleApPowerSetState",
|
||||
"VehicleApPowerState",
|
||||
"VehicleApPowerStateConfigFlag",
|
||||
"VehicleApPowerStateIndex",
|
||||
"VehicleApPowerStateReq",
|
||||
"VehicleApPowerStateReqIndex",
|
||||
"VehicleApPowerStateReport",
|
||||
"VehicleApPowerStateShutdownParam",
|
||||
"VehicleArea",
|
||||
"VehicleAreaConfig",
|
||||
|
@ -41,12 +42,13 @@ hidl_interface {
|
|||
"VehicleAreaMirror",
|
||||
"VehicleAreaSeat",
|
||||
"VehicleAreaWindow",
|
||||
"VehicleAreaZone",
|
||||
"VehicleDisplay",
|
||||
"VehicleGear",
|
||||
"VehicleHvacFanDirection",
|
||||
"VehicleHwKeyInputAction",
|
||||
"VehicleIgnitionState",
|
||||
"VehicleLightState",
|
||||
"VehicleLightSwitch",
|
||||
"VehicleOilLevel",
|
||||
"VehiclePropConfig",
|
||||
"VehiclePropValue",
|
||||
|
@ -54,10 +56,8 @@ hidl_interface {
|
|||
"VehiclePropertyAccess",
|
||||
"VehiclePropertyChangeMode",
|
||||
"VehiclePropertyGroup",
|
||||
"VehiclePropertyOperation",
|
||||
"VehiclePropertyStatus",
|
||||
"VehiclePropertyType",
|
||||
"VehicleRadioConstants",
|
||||
"VehicleTurnSignal",
|
||||
"VehicleUnit",
|
||||
"VmsAvailabilityStateIntegerValuesIndex",
|
||||
|
|
|
@ -33,7 +33,7 @@ interface IVehicleCallback {
|
|||
|
||||
/**
|
||||
* This method gets called if the client was subscribed to a property using
|
||||
* SubscribeFlags::SET_CALL flag and IVehicle#set(...) method was called.
|
||||
* SubscribeFlags::EVENTS_FROM_ANDROID flag and IVehicle#set(...) method was called.
|
||||
*
|
||||
* These events must be delivered to subscriber immediately without any
|
||||
* batching.
|
||||
|
|
|
@ -152,7 +152,7 @@ private:
|
|||
* VehiclePropValuePool pool;
|
||||
* auto v = pool.obtain(VehiclePropertyType::INT32);
|
||||
* v->propId = VehicleProperty::HVAC_FAN_SPEED;
|
||||
* v->areaId = VehicleAreaZone::ROW_1_LEFT;
|
||||
* v->areaId = VehicleAreaSeat::ROW_1_LEFT;
|
||||
* v->timestamp = elapsedRealtimeNano();
|
||||
* v->value->int32Values[0] = 42;
|
||||
*
|
||||
|
|
|
@ -106,7 +106,7 @@ StatusCode SubscriptionManager::addOrUpdateSubscription(
|
|||
|
||||
addClientToPropMapLocked(opts.propId, client);
|
||||
|
||||
if (SubscribeFlags::HAL_EVENT & opts.flags) {
|
||||
if (SubscribeFlags::EVENTS_FROM_CAR & opts.flags) {
|
||||
SubscribeOptions updated;
|
||||
if (updateHalEventSubscriptionLocked(opts, &updated)) {
|
||||
outUpdatedSubscriptions->push_back(updated);
|
||||
|
|
|
@ -216,7 +216,7 @@ void VehicleHalManager::onHalPropertySetError(StatusCode errorCode,
|
|||
int32_t property,
|
||||
int32_t areaId) {
|
||||
const auto& clients =
|
||||
mSubscriptionManager.getSubscribedClients(property, SubscribeFlags::HAL_EVENT);
|
||||
mSubscriptionManager.getSubscribedClients(property, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
|
||||
for (auto client : clients) {
|
||||
client->getCallback()->onPropertySetError(errorCode, property, areaId);
|
||||
|
@ -224,8 +224,8 @@ void VehicleHalManager::onHalPropertySetError(StatusCode errorCode,
|
|||
}
|
||||
|
||||
void VehicleHalManager::onBatchHalEvent(const std::vector<VehiclePropValuePtr>& values) {
|
||||
const auto& clientValues = mSubscriptionManager.distributeValuesToClients(
|
||||
values, SubscribeFlags::HAL_EVENT);
|
||||
const auto& clientValues =
|
||||
mSubscriptionManager.distributeValuesToClients(values, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
|
||||
for (const HalClientValues& cv : clientValues) {
|
||||
auto vecSize = cv.values.size();
|
||||
|
@ -250,8 +250,7 @@ void VehicleHalManager::onBatchHalEvent(const std::vector<VehiclePropValuePtr>&
|
|||
}
|
||||
|
||||
bool VehicleHalManager::isSampleRateFixed(VehiclePropertyChangeMode mode) {
|
||||
return (mode & VehiclePropertyChangeMode::ON_SET)
|
||||
|| (mode & VehiclePropertyChangeMode::ON_CHANGE);
|
||||
return (mode & VehiclePropertyChangeMode::ON_CHANGE);
|
||||
}
|
||||
|
||||
float VehicleHalManager::checkSampleRate(const VehiclePropConfig &config,
|
||||
|
@ -281,7 +280,7 @@ bool VehicleHalManager::isSubscribable(const VehiclePropConfig& config,
|
|||
SubscribeFlags flags) {
|
||||
bool isReadable = config.access & VehiclePropertyAccess::READ;
|
||||
|
||||
if (!isReadable && (SubscribeFlags::HAL_EVENT & flags)) {
|
||||
if (!isReadable && (SubscribeFlags::EVENTS_FROM_CAR & flags)) {
|
||||
ALOGW("Cannot subscribe, property 0x%x is not readable", config.prop);
|
||||
return false;
|
||||
}
|
||||
|
@ -289,12 +288,6 @@ bool VehicleHalManager::isSubscribable(const VehiclePropConfig& config,
|
|||
ALOGW("Cannot subscribe, property 0x%x is static", config.prop);
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: extend to support event notification for set from android
|
||||
if (config.changeMode == VehiclePropertyChangeMode::POLL) {
|
||||
ALOGW("Cannot subscribe, property 0x%x is poll only", config.prop);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -317,7 +310,8 @@ bool VehicleHalManager::checkReadPermission(const VehiclePropConfig &config) con
|
|||
}
|
||||
|
||||
void VehicleHalManager::handlePropertySetEvent(const VehiclePropValue& value) {
|
||||
auto clients = mSubscriptionManager.getSubscribedClients(value.prop, SubscribeFlags::SET_CALL);
|
||||
auto clients =
|
||||
mSubscriptionManager.getSubscribedClients(value.prop, SubscribeFlags::EVENTS_FROM_ANDROID);
|
||||
for (auto client : clients) {
|
||||
client->getCallback()->onPropertySet(value);
|
||||
}
|
||||
|
|
|
@ -30,7 +30,8 @@ namespace impl {
|
|||
//
|
||||
// Some handy constants to avoid conversions from enum to int.
|
||||
constexpr int ABS_ACTIVE = (int)VehicleProperty::ABS_ACTIVE;
|
||||
constexpr int AP_POWER_STATE = (int)VehicleProperty::AP_POWER_STATE;
|
||||
constexpr int AP_POWER_STATE_REQ = (int)VehicleProperty::AP_POWER_STATE_REQ;
|
||||
constexpr int AP_POWER_STATE_REPORT = (int)VehicleProperty::AP_POWER_STATE_REPORT;
|
||||
constexpr int OBD2_LIVE_FRAME = (int)VehicleProperty::OBD2_LIVE_FRAME;
|
||||
constexpr int OBD2_FREEZE_FRAME = (int)VehicleProperty::OBD2_FREEZE_FRAME;
|
||||
constexpr int OBD2_FREEZE_FRAME_INFO = (int)VehicleProperty::OBD2_FREEZE_FRAME_INFO;
|
||||
|
@ -149,14 +150,6 @@ const ConfigDeclaration kVehicleProperties[]{
|
|||
},
|
||||
.initialValue = {.floatValues = {0.0f}}},
|
||||
|
||||
{.config =
|
||||
{
|
||||
.prop = toInt(VehicleProperty::ENGINE_ON),
|
||||
.access = VehiclePropertyAccess::READ,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
},
|
||||
.initialValue = {.int32Values = {0}}},
|
||||
|
||||
{
|
||||
.config =
|
||||
{
|
||||
|
@ -255,7 +248,7 @@ const ConfigDeclaration kVehicleProperties[]{
|
|||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT)}},
|
||||
.areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}},
|
||||
// TODO(bryaneyler): Ideally, this is generated dynamically from
|
||||
// kHvacPowerProperties.
|
||||
.configString = "0x12400500,0x12400501" // HVAC_FAN_SPEED,HVAC_FAN_DIRECTION
|
||||
|
@ -276,28 +269,28 @@ const ConfigDeclaration kVehicleProperties[]{
|
|||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT)}}},
|
||||
.areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}}},
|
||||
.initialValue = {.int32Values = {1}}},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::HVAC_AC_ON),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT)}}},
|
||||
.areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}}},
|
||||
.initialValue = {.int32Values = {1}}},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::HVAC_AUTO_ON),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT)}}},
|
||||
.areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}}},
|
||||
.initialValue = {.int32Values = {1}}},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT),
|
||||
.areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT),
|
||||
.minInt32Value = 1,
|
||||
.maxInt32Value = 7}}},
|
||||
.initialValue = {.int32Values = {3}}},
|
||||
|
@ -306,24 +299,24 @@ const ConfigDeclaration kVehicleProperties[]{
|
|||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = (VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT)}}},
|
||||
.areaId = (VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT)}}},
|
||||
.initialValue = {.int32Values = {toInt(VehicleHvacFanDirection::FACE)}}},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::HVAC_TEMPERATURE_SET),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{
|
||||
.areaId = toInt(VehicleAreaZone::ROW_1_LEFT),
|
||||
.areaId = toInt(VehicleAreaSeat::ROW_1_LEFT),
|
||||
.minFloatValue = 16,
|
||||
.maxFloatValue = 32,
|
||||
},
|
||||
VehicleAreaConfig{
|
||||
.areaId = toInt(VehicleAreaZone::ROW_1_RIGHT),
|
||||
.areaId = toInt(VehicleAreaSeat::ROW_1_RIGHT),
|
||||
.minFloatValue = 16,
|
||||
.maxFloatValue = 32,
|
||||
}}},
|
||||
.initialAreaValues = {{toInt(VehicleAreaZone::ROW_1_LEFT), {.floatValues = {16}}},
|
||||
{toInt(VehicleAreaZone::ROW_1_RIGHT), {.floatValues = {20}}}}},
|
||||
.initialAreaValues = {{toInt(VehicleAreaSeat::ROW_1_LEFT), {.floatValues = {16}}},
|
||||
{toInt(VehicleAreaSeat::ROW_1_RIGHT), {.floatValues = {20}}}}},
|
||||
|
||||
{.config =
|
||||
{
|
||||
|
@ -424,11 +417,17 @@ const ConfigDeclaration kVehicleProperties[]{
|
|||
},
|
||||
},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
{.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REQ),
|
||||
.access = VehiclePropertyAccess::READ,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.configArray = {3}},
|
||||
.initialValue = {.int32Values = {toInt(VehicleApPowerState::ON_FULL), 0}}},
|
||||
.initialValue = {.int32Values = {toInt(VehicleApPowerStateReq::ON_FULL), 0}}},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::AP_POWER_STATE_REPORT),
|
||||
.access = VehiclePropertyAccess::WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.configArray = {3}},
|
||||
.initialValue = {.int32Values = {toInt(VehicleApPowerStateReport::BOOT_COMPLETE), 0}}},
|
||||
|
||||
{.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
|
|
|
@ -138,7 +138,7 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
|
|||
// TODO(75328113): this should be handled by property status
|
||||
auto hvacPowerOn = mPropStore->readValueOrNull(
|
||||
toInt(VehicleProperty::HVAC_POWER_ON),
|
||||
(VehicleAreaZone::ROW_1_LEFT | VehicleAreaZone::ROW_1_RIGHT));
|
||||
(VehicleAreaSeat::ROW_1_LEFT | VehicleAreaSeat::ROW_1_RIGHT));
|
||||
|
||||
if (hvacPowerOn && hvacPowerOn->value.int32Values.size() == 1
|
||||
&& hvacPowerOn->value.int32Values[0] == 0) {
|
||||
|
@ -153,7 +153,7 @@ StatusCode EmulatedVehicleHal::set(const VehiclePropValue& propValue) {
|
|||
// Placeholder for future implementation of VMS property in the default hal. For
|
||||
// now, just returns OK; otherwise, hal clients crash with property not supported.
|
||||
return StatusCode::OK;
|
||||
case AP_POWER_STATE:
|
||||
case AP_POWER_STATE_REPORT:
|
||||
// This property has different behavior between get/set. When it is set, the value
|
||||
// goes to the vehicle but is NOT updated in the property store back to Android.
|
||||
// Commented out for now, because it may mess up automated testing that use the
|
||||
|
|
|
@ -51,19 +51,16 @@ public:
|
|||
}
|
||||
|
||||
hidl_vec<SubscribeOptions> subscrToProp1 = {
|
||||
SubscribeOptions{.propId = PROP1, .flags = SubscribeFlags::HAL_EVENT},
|
||||
SubscribeOptions{.propId = PROP1, .flags = SubscribeFlags::EVENTS_FROM_CAR},
|
||||
};
|
||||
|
||||
hidl_vec<SubscribeOptions> subscrToProp2 = {
|
||||
SubscribeOptions {
|
||||
.propId = PROP2,
|
||||
.flags = SubscribeFlags::HAL_EVENT
|
||||
},
|
||||
SubscribeOptions{.propId = PROP2, .flags = SubscribeFlags::EVENTS_FROM_CAR},
|
||||
};
|
||||
|
||||
hidl_vec<SubscribeOptions> subscrToProp1and2 = {
|
||||
SubscribeOptions{.propId = PROP1, .flags = SubscribeFlags::HAL_EVENT},
|
||||
SubscribeOptions{.propId = PROP2, .flags = SubscribeFlags::HAL_EVENT},
|
||||
SubscribeOptions{.propId = PROP1, .flags = SubscribeFlags::EVENTS_FROM_CAR},
|
||||
SubscribeOptions{.propId = PROP2, .flags = SubscribeFlags::EVENTS_FROM_CAR},
|
||||
};
|
||||
|
||||
static std::list<sp<IVehicleCallback>> extractCallbacks(
|
||||
|
@ -76,11 +73,11 @@ public:
|
|||
}
|
||||
|
||||
std::list<sp<HalClient>> clientsToProp1() {
|
||||
return manager.getSubscribedClients(PROP1, SubscribeFlags::DEFAULT);
|
||||
return manager.getSubscribedClients(PROP1, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
}
|
||||
|
||||
std::list<sp<HalClient>> clientsToProp2() {
|
||||
return manager.getSubscribedClients(PROP2, SubscribeFlags::DEFAULT);
|
||||
return manager.getSubscribedClients(PROP2, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
}
|
||||
|
||||
void onPropertyUnsubscribed(int propertyId) {
|
||||
|
@ -110,9 +107,7 @@ TEST_F(SubscriptionManagerTest, multipleClients) {
|
|||
ASSERT_EQ(StatusCode::OK,
|
||||
manager.addOrUpdateSubscription(2, cb2, subscrToProp1, &updatedOptions));
|
||||
|
||||
auto clients = manager.getSubscribedClients(
|
||||
PROP1,
|
||||
SubscribeFlags::HAL_EVENT);
|
||||
auto clients = manager.getSubscribedClients(PROP1, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
|
||||
ASSERT_ALL_EXISTS({cb1, cb2}, extractCallbacks(clients));
|
||||
}
|
||||
|
@ -124,13 +119,11 @@ TEST_F(SubscriptionManagerTest, negativeCases) {
|
|||
|
||||
// Wrong prop
|
||||
auto clients = manager.getSubscribedClients(toInt(VehicleProperty::AP_POWER_BOOTUP_REASON),
|
||||
SubscribeFlags::HAL_EVENT);
|
||||
SubscribeFlags::EVENTS_FROM_CAR);
|
||||
ASSERT_TRUE(clients.empty());
|
||||
|
||||
// Wrong flag
|
||||
clients = manager.getSubscribedClients(
|
||||
PROP1,
|
||||
SubscribeFlags::SET_CALL);
|
||||
clients = manager.getSubscribedClients(PROP1, SubscribeFlags::EVENTS_FROM_ANDROID);
|
||||
ASSERT_TRUE(clients.empty());
|
||||
}
|
||||
|
||||
|
@ -139,27 +132,22 @@ TEST_F(SubscriptionManagerTest, mulipleSubscriptions) {
|
|||
ASSERT_EQ(StatusCode::OK, manager.addOrUpdateSubscription(1, cb1, subscrToProp1,
|
||||
&updatedOptions));
|
||||
|
||||
auto clients = manager.getSubscribedClients(
|
||||
PROP1,
|
||||
SubscribeFlags::DEFAULT);
|
||||
auto clients = manager.getSubscribedClients(PROP1, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
ASSERT_EQ((size_t) 1, clients.size());
|
||||
ASSERT_EQ(cb1, clients.front()->getCallback());
|
||||
|
||||
// Same property, but different zone, to make sure we didn't unsubscribe
|
||||
// from previous zone.
|
||||
ASSERT_EQ(StatusCode::OK, manager.addOrUpdateSubscription(1, cb1, {
|
||||
SubscribeOptions {
|
||||
.propId = PROP1,
|
||||
.flags = SubscribeFlags::DEFAULT
|
||||
}
|
||||
}, &updatedOptions));
|
||||
ASSERT_EQ(
|
||||
StatusCode::OK,
|
||||
manager.addOrUpdateSubscription(
|
||||
1, cb1, {SubscribeOptions{.propId = PROP1, .flags = SubscribeFlags::EVENTS_FROM_CAR}},
|
||||
&updatedOptions));
|
||||
|
||||
clients = manager.getSubscribedClients(PROP1,
|
||||
SubscribeFlags::DEFAULT);
|
||||
clients = manager.getSubscribedClients(PROP1, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
ASSERT_ALL_EXISTS({cb1}, extractCallbacks(clients));
|
||||
|
||||
clients = manager.getSubscribedClients(PROP1,
|
||||
SubscribeFlags::DEFAULT);
|
||||
clients = manager.getSubscribedClients(PROP1, SubscribeFlags::EVENTS_FROM_CAR);
|
||||
ASSERT_ALL_EXISTS({cb1}, extractCallbacks(clients));
|
||||
}
|
||||
|
||||
|
|
|
@ -241,10 +241,7 @@ TEST_F(VehicleHalManagerTest, halErrorEvent) {
|
|||
sp<MockedVehicleCallback> cb = new MockedVehicleCallback();
|
||||
|
||||
hidl_vec<SubscribeOptions> options = {
|
||||
SubscribeOptions {
|
||||
.propId = PROP,
|
||||
.flags = SubscribeFlags::DEFAULT
|
||||
},
|
||||
SubscribeOptions{.propId = PROP, .flags = SubscribeFlags::EVENTS_FROM_CAR},
|
||||
};
|
||||
|
||||
StatusCode res = manager->subscribe(cb, options);
|
||||
|
@ -259,11 +256,7 @@ TEST_F(VehicleHalManagerTest, subscribe) {
|
|||
sp<MockedVehicleCallback> cb = new MockedVehicleCallback();
|
||||
|
||||
hidl_vec<SubscribeOptions> options = {
|
||||
SubscribeOptions {
|
||||
.propId = PROP,
|
||||
.flags = SubscribeFlags::DEFAULT
|
||||
}
|
||||
};
|
||||
SubscribeOptions{.propId = PROP, .flags = SubscribeFlags::EVENTS_FROM_CAR}};
|
||||
|
||||
StatusCode res = manager->subscribe(cb, options);
|
||||
ASSERT_EQ(StatusCode::OK, res);
|
||||
|
@ -301,18 +294,14 @@ TEST_F(VehicleHalManagerTest, subscribe_WriteOnly) {
|
|||
sp<MockedVehicleCallback> cb = new MockedVehicleCallback();
|
||||
|
||||
hidl_vec<SubscribeOptions> options = {
|
||||
SubscribeOptions {
|
||||
.propId = PROP,
|
||||
.flags = SubscribeFlags::HAL_EVENT
|
||||
},
|
||||
SubscribeOptions{.propId = PROP, .flags = SubscribeFlags::EVENTS_FROM_CAR},
|
||||
};
|
||||
|
||||
StatusCode res = manager->subscribe(cb, options);
|
||||
// Unable to subscribe on Hal Events for write-only properties.
|
||||
ASSERT_EQ(StatusCode::INVALID_ARG, res);
|
||||
|
||||
|
||||
options[0].flags = SubscribeFlags::SET_CALL;
|
||||
options[0].flags = SubscribeFlags::EVENTS_FROM_ANDROID;
|
||||
|
||||
res = manager->subscribe(cb, options);
|
||||
// OK to subscribe on SET method call for write-only properties.
|
||||
|
@ -396,8 +385,8 @@ TEST_F(VehicleHalManagerTest, set_DifferentAreas) {
|
|||
const auto PROP = toInt(VehicleProperty::HVAC_FAN_SPEED);
|
||||
const auto VAL1 = 1;
|
||||
const auto VAL2 = 2;
|
||||
const auto AREA1 = toInt(VehicleAreaZone::ROW_1_LEFT);
|
||||
const auto AREA2 = toInt(VehicleAreaZone::ROW_1_RIGHT);
|
||||
const auto AREA1 = toInt(VehicleAreaSeat::ROW_1_LEFT);
|
||||
const auto AREA2 = toInt(VehicleAreaSeat::ROW_1_RIGHT);
|
||||
|
||||
{
|
||||
auto expectedValue1 = hal->getValuePool()->obtainInt32(VAL1);
|
||||
|
|
|
@ -40,64 +40,38 @@ const VehiclePropConfig kVehicleProperties[] = {
|
|||
.configString = "Some=config,options=if,you=have_any",
|
||||
},
|
||||
|
||||
{
|
||||
.prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {
|
||||
VehicleAreaConfig {
|
||||
.areaId = toInt(VehicleAreaZone::ROW_1_LEFT),
|
||||
.minInt32Value = 1,
|
||||
.maxInt32Value = 7},
|
||||
VehicleAreaConfig {
|
||||
.areaId = toInt(VehicleAreaZone::ROW_1_RIGHT),
|
||||
.minInt32Value = 1,
|
||||
.maxInt32Value = 5,
|
||||
}
|
||||
}
|
||||
},
|
||||
{.prop = toInt(VehicleProperty::HVAC_FAN_SPEED),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs =
|
||||
{VehicleAreaConfig{
|
||||
.areaId = toInt(VehicleAreaSeat::ROW_1_LEFT), .minInt32Value = 1, .maxInt32Value = 7},
|
||||
VehicleAreaConfig{
|
||||
.areaId = toInt(VehicleAreaSeat::ROW_1_RIGHT), .minInt32Value = 1, .maxInt32Value = 5,
|
||||
}}},
|
||||
|
||||
// Write-only property
|
||||
{
|
||||
.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE),
|
||||
.access = VehiclePropertyAccess::WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_SET,
|
||||
.areaConfigs = {
|
||||
VehicleAreaConfig {
|
||||
.areaId = toInt(VehicleAreaZone::ROW_1_LEFT),
|
||||
.minInt32Value = 64,
|
||||
.maxInt32Value = 80},
|
||||
VehicleAreaConfig {
|
||||
.areaId = toInt(VehicleAreaZone::ROW_1_RIGHT),
|
||||
.minInt32Value = 64,
|
||||
.maxInt32Value = 80,
|
||||
}
|
||||
}
|
||||
},
|
||||
{.prop = toInt(VehicleProperty::HVAC_SEAT_TEMPERATURE),
|
||||
.access = VehiclePropertyAccess::WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{.areaId = toInt(VehicleAreaSeat::ROW_1_LEFT),
|
||||
.minInt32Value = 64,
|
||||
.maxInt32Value = 80},
|
||||
VehicleAreaConfig{
|
||||
.areaId = toInt(VehicleAreaSeat::ROW_1_RIGHT),
|
||||
.minInt32Value = 64,
|
||||
.maxInt32Value = 80,
|
||||
}}},
|
||||
|
||||
{
|
||||
.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
|
||||
.access = VehiclePropertyAccess::READ,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {
|
||||
VehicleAreaConfig {
|
||||
.minFloatValue = 0,
|
||||
.maxFloatValue = 1.0
|
||||
}
|
||||
}
|
||||
},
|
||||
{.prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
|
||||
.access = VehiclePropertyAccess::READ,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{.minFloatValue = 0, .maxFloatValue = 1.0}}},
|
||||
|
||||
{
|
||||
.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {
|
||||
VehicleAreaConfig {
|
||||
.minInt32Value = 0,
|
||||
.maxInt32Value = 10
|
||||
}
|
||||
}
|
||||
},
|
||||
{.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE,
|
||||
.areaConfigs = {VehicleAreaConfig{.minInt32Value = 0, .maxInt32Value = 10}}},
|
||||
|
||||
{
|
||||
.prop = toInt(VehicleProperty::MIRROR_FOLD),
|
||||
|
@ -107,12 +81,9 @@ const VehiclePropConfig kVehicleProperties[] = {
|
|||
},
|
||||
|
||||
// Complex data type.
|
||||
{
|
||||
.prop = kCustomComplexProperty,
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE
|
||||
}
|
||||
};
|
||||
{.prop = kCustomComplexProperty,
|
||||
.access = VehiclePropertyAccess::READ_WRITE,
|
||||
.changeMode = VehiclePropertyChangeMode::ON_CHANGE}};
|
||||
|
||||
constexpr auto kTimeout = std::chrono::milliseconds(500);
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -296,8 +296,8 @@ f2904a4c108ad1b93eb2fa4e43b82bd01ce1ff26156316e49d1d9fc80dfecaad android.hardwar
|
|||
14ef8e993a4a7c899b19bb5e39b5b0cafd28312ea2b127e35b3be8f08e23fe8e android.hardware.automotive.evs@1.0::IEvsEnumerator
|
||||
3b17c1fdfc389e0abe626c37054954b07201127d890c2bc05d47613ec1f4de4f android.hardware.automotive.evs@1.0::types
|
||||
b3caf524c46a47d67e6453a34419e1881942d059e146cda740502670e9a752c3 android.hardware.automotive.vehicle@2.0::IVehicle
|
||||
80fb4156fa91ce86e49bd2cabe215078f6b69591d416a09e914532eae6712052 android.hardware.automotive.vehicle@2.0::IVehicleCallback
|
||||
a7ac51f419107020b9544efb25e030485e5dc4914c5138c2b8d83a1f52a76825 android.hardware.automotive.vehicle@2.0::types
|
||||
7ce8728b27600e840cacf0a832f6942819fe535f9d3797ae052d5eef5065921c android.hardware.automotive.vehicle@2.0::IVehicleCallback
|
||||
848fb32d5ca79dd527d966e67c0af5874b6d7b361246b491e315cf7dea7888ab android.hardware.automotive.vehicle@2.0::types
|
||||
32cc50cc2a7658ec613c0c2dd2accbf6a05113b749852879e818b8b7b438db19 android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioHost
|
||||
ff4be64d7992f8bec97dff37f35450e79b3430c61f85f54322ce45bef229dc3b android.hardware.bluetooth.a2dp@1.0::IBluetoothAudioOffload
|
||||
27f22d2e873e6201f9620cf4d8e2facb25bd0dd30a2b911e441b4600d560fa62 android.hardware.bluetooth.a2dp@1.0::types
|
||||
|
|
Loading…
Reference in a new issue