Generate VersionForVehicleProperty.h.
This will be used in VHAL implementation to filter out properties
that are not supported by the client version.
Test: presubmit
Bug: 115764870
Change-Id: I89d8421debde15677b0fbd6da69335f43b681eff
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
index a8effcb..15056e2 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/AccessForVehicleProperty.h
@@ -22,8 +22,7 @@
// clang-format off
-#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
-#define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+#pragma once
#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.h>
@@ -309,5 +308,3 @@
} // namespace hardware
} // namespace android
} // aidl
-
-#endif // android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
index 3321c20..d3f97e3 100644
--- a/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
+++ b/automotive/vehicle/aidl/generated_lib/cpp/ChangeModeForVehicleProperty.h
@@ -22,8 +22,7 @@
// clang-format off
-#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
-#define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+#pragma once
#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.h>
@@ -309,5 +308,3 @@
} // namespace hardware
} // namespace android
} // aidl
-
-#endif // android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
diff --git a/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h b/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h
new file mode 100644
index 0000000..70c914d
--- /dev/null
+++ b/automotive/vehicle/aidl/generated_lib/cpp/VersionForVehicleProperty.h
@@ -0,0 +1,309 @@
+/*
+ * Copyright (C) 2023 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * DO NOT EDIT MANUALLY!!!
+ *
+ * Generated by tools/generate_annotation_enums.py.
+ */
+
+// clang-format off
+
+#pragma once
+
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
+
+#include <unordered_map>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+std::unordered_map<VehicleProperty, int32_t> VersionForVehicleProperty = {
+ {VehicleProperty::INFO_VIN, 2},
+ {VehicleProperty::INFO_MAKE, 2},
+ {VehicleProperty::INFO_MODEL, 2},
+ {VehicleProperty::INFO_MODEL_YEAR, 2},
+ {VehicleProperty::INFO_FUEL_CAPACITY, 2},
+ {VehicleProperty::INFO_FUEL_TYPE, 2},
+ {VehicleProperty::INFO_EV_BATTERY_CAPACITY, 2},
+ {VehicleProperty::INFO_EV_CONNECTOR_TYPE, 2},
+ {VehicleProperty::INFO_FUEL_DOOR_LOCATION, 2},
+ {VehicleProperty::INFO_EV_PORT_LOCATION, 2},
+ {VehicleProperty::INFO_DRIVER_SEAT, 2},
+ {VehicleProperty::INFO_EXTERIOR_DIMENSIONS, 2},
+ {VehicleProperty::INFO_MULTI_EV_PORT_LOCATIONS, 2},
+ {VehicleProperty::PERF_ODOMETER, 2},
+ {VehicleProperty::PERF_VEHICLE_SPEED, 2},
+ {VehicleProperty::PERF_VEHICLE_SPEED_DISPLAY, 2},
+ {VehicleProperty::PERF_STEERING_ANGLE, 2},
+ {VehicleProperty::PERF_REAR_STEERING_ANGLE, 2},
+ {VehicleProperty::ENGINE_COOLANT_TEMP, 2},
+ {VehicleProperty::ENGINE_OIL_LEVEL, 2},
+ {VehicleProperty::ENGINE_OIL_TEMP, 2},
+ {VehicleProperty::ENGINE_RPM, 2},
+ {VehicleProperty::WHEEL_TICK, 2},
+ {VehicleProperty::FUEL_LEVEL, 2},
+ {VehicleProperty::FUEL_DOOR_OPEN, 2},
+ {VehicleProperty::EV_BATTERY_LEVEL, 2},
+ {VehicleProperty::EV_CURRENT_BATTERY_CAPACITY, 2},
+ {VehicleProperty::EV_CHARGE_PORT_OPEN, 2},
+ {VehicleProperty::EV_CHARGE_PORT_CONNECTED, 2},
+ {VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE, 2},
+ {VehicleProperty::RANGE_REMAINING, 2},
+ {VehicleProperty::EV_BATTERY_AVERAGE_TEMPERATURE, 3},
+ {VehicleProperty::TIRE_PRESSURE, 2},
+ {VehicleProperty::CRITICALLY_LOW_TIRE_PRESSURE, 2},
+ {VehicleProperty::ENGINE_IDLE_AUTO_STOP_ENABLED, 2},
+ {VehicleProperty::IMPACT_DETECTED, 3},
+ {VehicleProperty::GEAR_SELECTION, 2},
+ {VehicleProperty::CURRENT_GEAR, 2},
+ {VehicleProperty::PARKING_BRAKE_ON, 2},
+ {VehicleProperty::PARKING_BRAKE_AUTO_APPLY, 2},
+ {VehicleProperty::EV_BRAKE_REGENERATION_LEVEL, 2},
+ {VehicleProperty::FUEL_LEVEL_LOW, 2},
+ {VehicleProperty::NIGHT_MODE, 2},
+ {VehicleProperty::TURN_SIGNAL_STATE, 2},
+ {VehicleProperty::IGNITION_STATE, 2},
+ {VehicleProperty::ABS_ACTIVE, 2},
+ {VehicleProperty::TRACTION_CONTROL_ACTIVE, 2},
+ {VehicleProperty::EV_STOPPING_MODE, 2},
+ {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_ENABLED, 3},
+ {VehicleProperty::ELECTRONIC_STABILITY_CONTROL_STATE, 2},
+ {VehicleProperty::HVAC_FAN_SPEED, 2},
+ {VehicleProperty::HVAC_FAN_DIRECTION, 2},
+ {VehicleProperty::HVAC_TEMPERATURE_CURRENT, 2},
+ {VehicleProperty::HVAC_TEMPERATURE_SET, 2},
+ {VehicleProperty::HVAC_DEFROSTER, 2},
+ {VehicleProperty::HVAC_AC_ON, 2},
+ {VehicleProperty::HVAC_MAX_AC_ON, 2},
+ {VehicleProperty::HVAC_MAX_DEFROST_ON, 2},
+ {VehicleProperty::HVAC_RECIRC_ON, 2},
+ {VehicleProperty::HVAC_DUAL_ON, 2},
+ {VehicleProperty::HVAC_AUTO_ON, 2},
+ {VehicleProperty::HVAC_SEAT_TEMPERATURE, 2},
+ {VehicleProperty::HVAC_SIDE_MIRROR_HEAT, 2},
+ {VehicleProperty::HVAC_STEERING_WHEEL_HEAT, 2},
+ {VehicleProperty::HVAC_TEMPERATURE_DISPLAY_UNITS, 2},
+ {VehicleProperty::HVAC_ACTUAL_FAN_SPEED_RPM, 2},
+ {VehicleProperty::HVAC_POWER_ON, 2},
+ {VehicleProperty::HVAC_FAN_DIRECTION_AVAILABLE, 2},
+ {VehicleProperty::HVAC_AUTO_RECIRC_ON, 2},
+ {VehicleProperty::HVAC_SEAT_VENTILATION, 2},
+ {VehicleProperty::HVAC_ELECTRIC_DEFROSTER_ON, 2},
+ {VehicleProperty::HVAC_TEMPERATURE_VALUE_SUGGESTION, 2},
+ {VehicleProperty::DISTANCE_DISPLAY_UNITS, 2},
+ {VehicleProperty::FUEL_VOLUME_DISPLAY_UNITS, 2},
+ {VehicleProperty::TIRE_PRESSURE_DISPLAY_UNITS, 2},
+ {VehicleProperty::EV_BATTERY_DISPLAY_UNITS, 2},
+ {VehicleProperty::FUEL_CONSUMPTION_UNITS_DISTANCE_OVER_VOLUME, 2},
+ {VehicleProperty::VEHICLE_SPEED_DISPLAY_UNITS, 2},
+ {VehicleProperty::EXTERNAL_CAR_TIME, 2},
+ {VehicleProperty::ANDROID_EPOCH_TIME, 2},
+ {VehicleProperty::STORAGE_ENCRYPTION_BINDING_SEED, 2},
+ {VehicleProperty::ENV_OUTSIDE_TEMPERATURE, 2},
+ {VehicleProperty::AP_POWER_STATE_REQ, 2},
+ {VehicleProperty::AP_POWER_STATE_REPORT, 2},
+ {VehicleProperty::AP_POWER_BOOTUP_REASON, 2},
+ {VehicleProperty::DISPLAY_BRIGHTNESS, 2},
+ {VehicleProperty::PER_DISPLAY_BRIGHTNESS, 2},
+ {VehicleProperty::VALET_MODE_ENABLED, 3},
+ {VehicleProperty::HEAD_UP_DISPLAY_ENABLED, 3},
+ {VehicleProperty::HW_KEY_INPUT, 2},
+ {VehicleProperty::HW_KEY_INPUT_V2, 2},
+ {VehicleProperty::HW_MOTION_INPUT, 2},
+ {VehicleProperty::HW_ROTARY_INPUT, 2},
+ {VehicleProperty::HW_CUSTOM_INPUT, 2},
+ {VehicleProperty::DOOR_POS, 2},
+ {VehicleProperty::DOOR_MOVE, 2},
+ {VehicleProperty::DOOR_LOCK, 2},
+ {VehicleProperty::DOOR_CHILD_LOCK_ENABLED, 2},
+ {VehicleProperty::MIRROR_Z_POS, 2},
+ {VehicleProperty::MIRROR_Z_MOVE, 2},
+ {VehicleProperty::MIRROR_Y_POS, 2},
+ {VehicleProperty::MIRROR_Y_MOVE, 2},
+ {VehicleProperty::MIRROR_LOCK, 2},
+ {VehicleProperty::MIRROR_FOLD, 2},
+ {VehicleProperty::MIRROR_AUTO_FOLD_ENABLED, 2},
+ {VehicleProperty::MIRROR_AUTO_TILT_ENABLED, 2},
+ {VehicleProperty::SEAT_MEMORY_SELECT, 2},
+ {VehicleProperty::SEAT_MEMORY_SET, 2},
+ {VehicleProperty::SEAT_BELT_BUCKLED, 2},
+ {VehicleProperty::SEAT_BELT_HEIGHT_POS, 2},
+ {VehicleProperty::SEAT_BELT_HEIGHT_MOVE, 2},
+ {VehicleProperty::SEAT_FORE_AFT_POS, 2},
+ {VehicleProperty::SEAT_FORE_AFT_MOVE, 2},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_1_POS, 2},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_1_MOVE, 2},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_2_POS, 2},
+ {VehicleProperty::SEAT_BACKREST_ANGLE_2_MOVE, 2},
+ {VehicleProperty::SEAT_HEIGHT_POS, 2},
+ {VehicleProperty::SEAT_HEIGHT_MOVE, 2},
+ {VehicleProperty::SEAT_DEPTH_POS, 2},
+ {VehicleProperty::SEAT_DEPTH_MOVE, 2},
+ {VehicleProperty::SEAT_TILT_POS, 2},
+ {VehicleProperty::SEAT_TILT_MOVE, 2},
+ {VehicleProperty::SEAT_LUMBAR_FORE_AFT_POS, 2},
+ {VehicleProperty::SEAT_LUMBAR_FORE_AFT_MOVE, 2},
+ {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_POS, 2},
+ {VehicleProperty::SEAT_LUMBAR_SIDE_SUPPORT_MOVE, 2},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_POS, 2},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_POS_V2, 2},
+ {VehicleProperty::SEAT_HEADREST_HEIGHT_MOVE, 2},
+ {VehicleProperty::SEAT_HEADREST_ANGLE_POS, 2},
+ {VehicleProperty::SEAT_HEADREST_ANGLE_MOVE, 2},
+ {VehicleProperty::SEAT_HEADREST_FORE_AFT_POS, 2},
+ {VehicleProperty::SEAT_HEADREST_FORE_AFT_MOVE, 2},
+ {VehicleProperty::SEAT_FOOTWELL_LIGHTS_STATE, 2},
+ {VehicleProperty::SEAT_FOOTWELL_LIGHTS_SWITCH, 2},
+ {VehicleProperty::SEAT_EASY_ACCESS_ENABLED, 2},
+ {VehicleProperty::SEAT_AIRBAG_ENABLED, 3},
+ {VehicleProperty::SEAT_AIRBAGS_DEPLOYED, 2},
+ {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_POS, 2},
+ {VehicleProperty::SEAT_CUSHION_SIDE_SUPPORT_MOVE, 2},
+ {VehicleProperty::SEAT_LUMBAR_VERTICAL_POS, 2},
+ {VehicleProperty::SEAT_LUMBAR_VERTICAL_MOVE, 2},
+ {VehicleProperty::SEAT_WALK_IN_POS, 2},
+ {VehicleProperty::SEAT_BELT_PRETENSIONER_DEPLOYED, 3},
+ {VehicleProperty::SEAT_OCCUPANCY, 2},
+ {VehicleProperty::WINDOW_POS, 2},
+ {VehicleProperty::WINDOW_MOVE, 2},
+ {VehicleProperty::WINDOW_LOCK, 2},
+ {VehicleProperty::WINDSHIELD_WIPERS_PERIOD, 2},
+ {VehicleProperty::WINDSHIELD_WIPERS_STATE, 2},
+ {VehicleProperty::WINDSHIELD_WIPERS_SWITCH, 2},
+ {VehicleProperty::STEERING_WHEEL_DEPTH_POS, 2},
+ {VehicleProperty::STEERING_WHEEL_DEPTH_MOVE, 2},
+ {VehicleProperty::STEERING_WHEEL_HEIGHT_POS, 2},
+ {VehicleProperty::STEERING_WHEEL_HEIGHT_MOVE, 2},
+ {VehicleProperty::STEERING_WHEEL_THEFT_LOCK_ENABLED, 2},
+ {VehicleProperty::STEERING_WHEEL_LOCKED, 2},
+ {VehicleProperty::STEERING_WHEEL_EASY_ACCESS_ENABLED, 2},
+ {VehicleProperty::GLOVE_BOX_DOOR_POS, 2},
+ {VehicleProperty::GLOVE_BOX_LOCKED, 2},
+ {VehicleProperty::VEHICLE_MAP_SERVICE, 2},
+ {VehicleProperty::LOCATION_CHARACTERIZATION, 2},
+ {VehicleProperty::ULTRASONICS_SENSOR_POSITION, 3},
+ {VehicleProperty::ULTRASONICS_SENSOR_ORIENTATION, 3},
+ {VehicleProperty::ULTRASONICS_SENSOR_FIELD_OF_VIEW, 3},
+ {VehicleProperty::ULTRASONICS_SENSOR_DETECTION_RANGE, 3},
+ {VehicleProperty::ULTRASONICS_SENSOR_SUPPORTED_RANGES, 3},
+ {VehicleProperty::ULTRASONICS_SENSOR_MEASURED_DISTANCE, 3},
+ {VehicleProperty::OBD2_LIVE_FRAME, 2},
+ {VehicleProperty::OBD2_FREEZE_FRAME, 2},
+ {VehicleProperty::OBD2_FREEZE_FRAME_INFO, 2},
+ {VehicleProperty::OBD2_FREEZE_FRAME_CLEAR, 2},
+ {VehicleProperty::HEADLIGHTS_STATE, 2},
+ {VehicleProperty::HIGH_BEAM_LIGHTS_STATE, 2},
+ {VehicleProperty::FOG_LIGHTS_STATE, 2},
+ {VehicleProperty::HAZARD_LIGHTS_STATE, 2},
+ {VehicleProperty::HEADLIGHTS_SWITCH, 2},
+ {VehicleProperty::HIGH_BEAM_LIGHTS_SWITCH, 2},
+ {VehicleProperty::FOG_LIGHTS_SWITCH, 2},
+ {VehicleProperty::HAZARD_LIGHTS_SWITCH, 2},
+ {VehicleProperty::CABIN_LIGHTS_STATE, 2},
+ {VehicleProperty::CABIN_LIGHTS_SWITCH, 2},
+ {VehicleProperty::READING_LIGHTS_STATE, 2},
+ {VehicleProperty::READING_LIGHTS_SWITCH, 2},
+ {VehicleProperty::STEERING_WHEEL_LIGHTS_STATE, 2},
+ {VehicleProperty::STEERING_WHEEL_LIGHTS_SWITCH, 2},
+ {VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION, 2},
+ {VehicleProperty::DISABLED_OPTIONAL_FEATURES, 2},
+ {VehicleProperty::INITIAL_USER_INFO, 2},
+ {VehicleProperty::SWITCH_USER, 2},
+ {VehicleProperty::CREATE_USER, 2},
+ {VehicleProperty::REMOVE_USER, 2},
+ {VehicleProperty::USER_IDENTIFICATION_ASSOCIATION, 2},
+ {VehicleProperty::EVS_SERVICE_REQUEST, 2},
+ {VehicleProperty::POWER_POLICY_REQ, 2},
+ {VehicleProperty::POWER_POLICY_GROUP_REQ, 2},
+ {VehicleProperty::CURRENT_POWER_POLICY, 2},
+ {VehicleProperty::WATCHDOG_ALIVE, 2},
+ {VehicleProperty::WATCHDOG_TERMINATED_PROCESS, 2},
+ {VehicleProperty::VHAL_HEARTBEAT, 2},
+ {VehicleProperty::CLUSTER_SWITCH_UI, 2},
+ {VehicleProperty::CLUSTER_DISPLAY_STATE, 2},
+ {VehicleProperty::CLUSTER_REPORT_STATE, 2},
+ {VehicleProperty::CLUSTER_REQUEST_DISPLAY, 2},
+ {VehicleProperty::CLUSTER_NAVIGATION_STATE, 2},
+ {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_TYPE, 2},
+ {VehicleProperty::ELECTRONIC_TOLL_COLLECTION_CARD_STATUS, 2},
+ {VehicleProperty::FRONT_FOG_LIGHTS_STATE, 2},
+ {VehicleProperty::FRONT_FOG_LIGHTS_SWITCH, 2},
+ {VehicleProperty::REAR_FOG_LIGHTS_STATE, 2},
+ {VehicleProperty::REAR_FOG_LIGHTS_SWITCH, 2},
+ {VehicleProperty::EV_CHARGE_CURRENT_DRAW_LIMIT, 2},
+ {VehicleProperty::EV_CHARGE_PERCENT_LIMIT, 2},
+ {VehicleProperty::EV_CHARGE_STATE, 2},
+ {VehicleProperty::EV_CHARGE_SWITCH, 2},
+ {VehicleProperty::EV_CHARGE_TIME_REMAINING, 2},
+ {VehicleProperty::EV_REGENERATIVE_BRAKING_STATE, 2},
+ {VehicleProperty::TRAILER_PRESENT, 2},
+ {VehicleProperty::VEHICLE_CURB_WEIGHT, 2},
+ {VehicleProperty::GENERAL_SAFETY_REGULATION_COMPLIANCE_REQUIREMENT, 2},
+ {VehicleProperty::SUPPORTED_PROPERTY_IDS, 2},
+ {VehicleProperty::SHUTDOWN_REQUEST, 2},
+ {VehicleProperty::VEHICLE_IN_USE, 2},
+ {VehicleProperty::CLUSTER_HEARTBEAT, 3},
+ {VehicleProperty::VEHICLE_DRIVING_AUTOMATION_CURRENT_LEVEL, 3},
+ {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_ENABLED, 2},
+ {VehicleProperty::AUTOMATIC_EMERGENCY_BRAKING_STATE, 2},
+ {VehicleProperty::FORWARD_COLLISION_WARNING_ENABLED, 2},
+ {VehicleProperty::FORWARD_COLLISION_WARNING_STATE, 2},
+ {VehicleProperty::BLIND_SPOT_WARNING_ENABLED, 2},
+ {VehicleProperty::BLIND_SPOT_WARNING_STATE, 2},
+ {VehicleProperty::LANE_DEPARTURE_WARNING_ENABLED, 2},
+ {VehicleProperty::LANE_DEPARTURE_WARNING_STATE, 2},
+ {VehicleProperty::LANE_KEEP_ASSIST_ENABLED, 2},
+ {VehicleProperty::LANE_KEEP_ASSIST_STATE, 2},
+ {VehicleProperty::LANE_CENTERING_ASSIST_ENABLED, 2},
+ {VehicleProperty::LANE_CENTERING_ASSIST_COMMAND, 2},
+ {VehicleProperty::LANE_CENTERING_ASSIST_STATE, 2},
+ {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_ENABLED, 2},
+ {VehicleProperty::EMERGENCY_LANE_KEEP_ASSIST_STATE, 2},
+ {VehicleProperty::CRUISE_CONTROL_ENABLED, 2},
+ {VehicleProperty::CRUISE_CONTROL_TYPE, 2},
+ {VehicleProperty::CRUISE_CONTROL_STATE, 2},
+ {VehicleProperty::CRUISE_CONTROL_COMMAND, 2},
+ {VehicleProperty::CRUISE_CONTROL_TARGET_SPEED, 2},
+ {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_TARGET_TIME_GAP, 2},
+ {VehicleProperty::ADAPTIVE_CRUISE_CONTROL_LEAD_VEHICLE_MEASURED_DISTANCE, 2},
+ {VehicleProperty::HANDS_ON_DETECTION_ENABLED, 2},
+ {VehicleProperty::HANDS_ON_DETECTION_DRIVER_STATE, 2},
+ {VehicleProperty::HANDS_ON_DETECTION_WARNING, 2},
+ {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_SYSTEM_ENABLED, 3},
+ {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_STATE, 3},
+ {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING_ENABLED, 3},
+ {VehicleProperty::DRIVER_DROWSINESS_ATTENTION_WARNING, 3},
+ {VehicleProperty::DRIVER_DISTRACTION_SYSTEM_ENABLED, 3},
+ {VehicleProperty::DRIVER_DISTRACTION_STATE, 3},
+ {VehicleProperty::DRIVER_DISTRACTION_WARNING_ENABLED, 2},
+ {VehicleProperty::DRIVER_DISTRACTION_WARNING, 3},
+ {VehicleProperty::LOW_SPEED_COLLISION_WARNING_ENABLED, 3},
+ {VehicleProperty::LOW_SPEED_COLLISION_WARNING_STATE, 3},
+ {VehicleProperty::CROSS_TRAFFIC_MONITORING_ENABLED, 3},
+ {VehicleProperty::CROSS_TRAFFIC_MONITORING_WARNING_STATE, 3},
+ {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, 3},
+ {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, 3},
+};
+
+} // namespace vehicle
+} // namespace automotive
+} // namespace hardware
+} // namespace android
+} // aidl
diff --git a/automotive/vehicle/tools/generate_annotation_enums.py b/automotive/vehicle/tools/generate_annotation_enums.py
index 05fc99a..87e9bdc 100755
--- a/automotive/vehicle/tools/generate_annotation_enums.py
+++ b/automotive/vehicle/tools/generate_annotation_enums.py
@@ -42,6 +42,8 @@
'AccessForVehicleProperty.java')
ENUM_JAVA_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/java/' +
'EnumForVehicleProperty.java')
+VERSION_CPP_FILE_PATH = ('hardware/interfaces/automotive/vehicle/aidl/generated_lib/cpp/' +
+ 'VersionForVehicleProperty.h')
SCRIPT_PATH = 'hardware/interfaces/automotive/vehicle/tools/generate_annotation_enums.py'
TAB = ' '
@@ -50,6 +52,7 @@
RE_COMMENT_BEGIN = re.compile('\s*\/\*\*?')
RE_COMMENT_END = re.compile('\s*\*\/')
RE_CHANGE_MODE = re.compile('\s*\* @change_mode (\S+)\s*')
+RE_VERSION = re.compile('\s*\* @version (\S+)\s*')
RE_ACCESS = re.compile('\s*\* @access (\S+)\s*')
RE_DATA_ENUM = re.compile('\s*\* @data_enum (\S+)\s*')
RE_UNIT = re.compile('\s*\* @unit (\S+)\s+')
@@ -81,8 +84,7 @@
"""
-CHANGE_MODE_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
-#define android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
+CHANGE_MODE_CPP_HEADER = """#pragma once
#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyChangeMode.h>
@@ -98,7 +100,7 @@
std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehicleProperty = {
"""
-CHANGE_MODE_CPP_FOOTER = """
+CPP_FOOTER = """
};
} // namespace vehicle
@@ -106,12 +108,9 @@
} // namespace hardware
} // namespace android
} // aidl
-
-#endif // android_hardware_automotive_vehicle_aidl_generated_lib_ChangeModeForVehicleProperty_H_
"""
-ACCESS_CPP_HEADER = """#ifndef android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
-#define android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+ACCESS_CPP_HEADER = """#pragma once
#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
#include <aidl/android/hardware/automotive/vehicle/VehiclePropertyAccess.h>
@@ -127,16 +126,19 @@
std::unordered_map<VehicleProperty, VehiclePropertyAccess> AccessForVehicleProperty = {
"""
-ACCESS_CPP_FOOTER = """
-};
+VERSION_CPP_HEADER = """#pragma once
-} // namespace vehicle
-} // namespace automotive
-} // namespace hardware
-} // namespace android
-} // aidl
+#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
-#endif // android_hardware_automotive_vehicle_aidl_generated_lib_AccessForVehicleProperty_H_
+#include <unordered_map>
+
+namespace aidl {
+namespace android {
+namespace hardware {
+namespace automotive {
+namespace vehicle {
+
+std::unordered_map<VehicleProperty, int32_t> VersionForVehicleProperty = {
"""
CHANGE_MODE_JAVA_HEADER = """package android.hardware.automotive.vehicle;
@@ -148,7 +150,7 @@
public static final Map<Integer, Integer> values = Map.ofEntries(
"""
-CHANGE_MODE_JAVA_FOOTER = """
+JAVA_FOOTER = """
);
}
@@ -163,12 +165,6 @@
public static final Map<Integer, Integer> values = Map.ofEntries(
"""
-ACCESS_JAVA_FOOTER = """
- );
-
-}
-"""
-
ENUM_JAVA_HEADER = """package android.hardware.automotive.vehicle;
import java.util.List;
@@ -179,12 +175,6 @@
public static final Map<Integer, List<Class<?>>> values = Map.ofEntries(
"""
-ENUM_JAVA_FOOTER = """
- );
-
-}
-"""
-
class PropertyConfig:
"""Represents one VHAL property definition in VehicleProperty.aidl."""
@@ -196,6 +186,7 @@
self.access_modes = []
self.enum_types = []
self.unit_type = None
+ self.version = None
def __repr__(self):
return self.__str__()
@@ -258,6 +249,11 @@
match = RE_DATA_ENUM.match(line)
if match:
config.enum_types.append(match.group(1))
+ match = RE_VERSION.match(line)
+ if match:
+ if config.version != None:
+ raise Exception('Duplicate version annotation for property: ' + prop_name)
+ config.version = match.group(1)
else:
match = RE_VALUE.match(line)
if match:
@@ -270,6 +266,9 @@
if not config.access_modes:
raise Exception(
'No access_mode annotation for property: ' + prop_name)
+ if not config.version:
+ raise Exception(
+ 'no version annotation for property: ' + prop_name)
config.name = prop_name
configs.append(config)
@@ -295,6 +294,9 @@
continue;
if not cpp:
annotation = "List.of(" + ', '.join([class_name + ".class" for class_name in config.enum_types]) + ")"
+ elif field == 'version':
+ if cpp:
+ annotation = config.version
else:
raise Exception('Unknown field: ' + field)
if counter != 0:
@@ -347,6 +349,69 @@
return f.name
+class GeneratedFile:
+
+ def __init__(self, type):
+ self.type = type
+ self.cpp_file_path = None
+ self.java_file_path = None
+ self.cpp_header = None
+ self.java_header = None
+ self.cpp_footer = None
+ self.java_footer = None
+ self.cpp_output_file = None
+ self.java_output_file = None
+
+ def setCppFilePath(self, cpp_file_path):
+ self.cpp_file_path = cpp_file_path
+
+ def setJavaFilePath(self, java_file_path):
+ self.java_file_path = java_file_path
+
+ def setCppHeader(self, cpp_header):
+ self.cpp_header = cpp_header
+
+ def setCppFooter(self, cpp_footer):
+ self.cpp_footer = cpp_footer
+
+ def setJavaHeader(self, java_header):
+ self.java_header = java_header
+
+ def setJavaFooter(self, java_footer):
+ self.java_footer = java_footer
+
+ def convert(self, file_parser, check_only, temp_files):
+ if self.cpp_file_path:
+ output_file = GeneratedFile._getOutputFile(self.cpp_file_path, check_only, temp_files)
+ file_parser.convert(output_file, self.cpp_header, self.cpp_footer, True, self.type)
+ self.cpp_output_file = output_file
+
+ if self.java_file_path:
+ output_file = GeneratedFile._getOutputFile(self.java_file_path, check_only, temp_files)
+ file_parser.convert(output_file, self.java_header, self.java_footer, False, self.type)
+ self.java_output_file = output_file
+
+ def cmp(self):
+ if self.cpp_file_path:
+ if not filecmp.cmp(self.cpp_output_file, self.cpp_file_path):
+ return False
+
+ if self.java_file_path:
+ if not filecmp.cmp(self.java_output_file, self.java_file_path):
+ return False
+
+ return True
+
+ @staticmethod
+ def _getOutputFile(file_path, check_only, temp_files):
+ if not check_only:
+ return file_path
+
+ temp_file = createTempFile()
+ temp_files.append(temp_file)
+ return temp_file
+
+
def main():
parser = argparse.ArgumentParser(
description='Generate Java and C++ enums based on annotations in VehicleProperty.aidl')
@@ -382,51 +447,52 @@
f.outputAsCsv(args.output_csv)
return
- change_mode_cpp_file = os.path.join(android_top, CHANGE_MODE_CPP_FILE_PATH);
- access_cpp_file = os.path.join(android_top, ACCESS_CPP_FILE_PATH);
- change_mode_java_file = os.path.join(android_top, CHANGE_MODE_JAVA_FILE_PATH);
- access_java_file = os.path.join(android_top, ACCESS_JAVA_FILE_PATH);
- enum_java_file = os.path.join(android_top, ENUM_JAVA_FILE_PATH);
+ generated_files = []
+
+ change_mode = GeneratedFile('change_mode')
+ change_mode.setCppFilePath(os.path.join(android_top, CHANGE_MODE_CPP_FILE_PATH))
+ change_mode.setJavaFilePath(os.path.join(android_top, CHANGE_MODE_JAVA_FILE_PATH))
+ change_mode.setCppHeader(CHANGE_MODE_CPP_HEADER)
+ change_mode.setCppFooter(CPP_FOOTER)
+ change_mode.setJavaHeader(CHANGE_MODE_JAVA_HEADER)
+ change_mode.setJavaFooter(JAVA_FOOTER)
+ generated_files.append(change_mode)
+
+ access_mode = GeneratedFile('access_mode')
+ access_mode.setCppFilePath(os.path.join(android_top, ACCESS_CPP_FILE_PATH))
+ access_mode.setJavaFilePath(os.path.join(android_top, ACCESS_JAVA_FILE_PATH))
+ access_mode.setCppHeader(ACCESS_CPP_HEADER)
+ access_mode.setCppFooter(CPP_FOOTER)
+ access_mode.setJavaHeader(ACCESS_JAVA_HEADER)
+ access_mode.setJavaFooter(JAVA_FOOTER)
+ generated_files.append(access_mode)
+
+ enum_types = GeneratedFile('enum_types')
+ enum_types.setJavaFilePath(os.path.join(android_top, ENUM_JAVA_FILE_PATH))
+ enum_types.setJavaHeader(ENUM_JAVA_HEADER)
+ enum_types.setJavaFooter(JAVA_FOOTER)
+ generated_files.append(enum_types)
+
+ version = GeneratedFile('version')
+ version.setCppFilePath(os.path.join(android_top, VERSION_CPP_FILE_PATH))
+ version.setCppHeader(VERSION_CPP_HEADER)
+ version.setCppFooter(CPP_FOOTER)
+ generated_files.append(version)
+
temp_files = []
- if not args.check_only:
- change_mode_cpp_output = change_mode_cpp_file
- access_cpp_output = access_cpp_file
- change_mode_java_output = change_mode_java_file
- access_java_output = access_java_file
- enum_java_output = enum_java_file
- else:
- change_mode_cpp_output = createTempFile()
- temp_files.append(change_mode_cpp_output)
- access_cpp_output = createTempFile()
- temp_files.append(access_cpp_output)
- change_mode_java_output = createTempFile()
- temp_files.append(change_mode_java_output)
- access_java_output = createTempFile()
- temp_files.append(access_java_output)
- enum_java_output = createTempFile()
- temp_files.append(enum_java_output)
-
try:
- f.convert(change_mode_cpp_output, CHANGE_MODE_CPP_HEADER, CHANGE_MODE_CPP_FOOTER,
- True, 'change_mode')
- f.convert(change_mode_java_output, CHANGE_MODE_JAVA_HEADER,
- CHANGE_MODE_JAVA_FOOTER, False, 'change_mode')
- f.convert(access_cpp_output, ACCESS_CPP_HEADER, ACCESS_CPP_FOOTER, True, 'access_mode')
- f.convert(access_java_output, ACCESS_JAVA_HEADER, ACCESS_JAVA_FOOTER, False, 'access_mode')
- f.convert(enum_java_output, ENUM_JAVA_HEADER, ENUM_JAVA_FOOTER, False, 'enum_types')
+ for generated_file in generated_files:
+ generated_file.convert(f, args.check_only, temp_files)
if not args.check_only:
return
- if ((not filecmp.cmp(change_mode_cpp_output, change_mode_cpp_file)) or
- (not filecmp.cmp(change_mode_java_output, change_mode_java_file)) or
- (not filecmp.cmp(access_cpp_output, access_cpp_file)) or
- (not filecmp.cmp(access_java_output, access_java_file)) or
- (not filecmp.cmp(enum_java_output, enum_java_file))):
- print('The generated enum files for VehicleProperty.aidl requires update, ')
- print('Run \npython ' + android_top + '/' + SCRIPT_PATH)
- sys.exit(1)
+ for generated_file in generated_files:
+ if not generated_file.cmp():
+ print('The generated enum files for VehicleProperty.aidl requires update, ')
+ print('Run \npython ' + android_top + '/' + SCRIPT_PATH)
+ sys.exit(1)
except Exception as e:
print('Error parsing VehicleProperty.aidl')
print(e)