Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7f23c0f4 authored by Yu Shan's avatar Yu Shan
Browse files

Update annotation gen script.

Refactor annotation gen script to use formatter instead of header
and footer so that we can add AllowedAccessMode in addition to
DefaultAccessMode. This will be used in VTS test.

This refactor also includes a minor change to sort the annotations
so that the order is stable.

Flag: EXEMPT internal refactor
Test: atest VehiclePropertyAnnotationCppTest
Bug: 393209222

Change-Id: I21359a648dc6507c10f9fc9b8579f9639fd8d259
parent 465d13f0
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -24,9 +24,10 @@
#include <unordered_set>

namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle;
using aidl_vehicle::AccessForVehicleProperty;
using aidl_vehicle::AllowedAccessForVehicleProperty;
using aidl_vehicle::AnnotationsForVehicleProperty;
using aidl_vehicle::ChangeModeForVehicleProperty;
using aidl_vehicle::DefaultAccessForVehicleProperty;
using aidl_vehicle::VehicleProperty;
using testing::IsEmpty;

@@ -53,8 +54,14 @@ TEST(VehiclePropertyAnnotationCppTest, testChangeMode) {
            << "generate_annotation_enums.py to update.";
}

TEST(VehiclePropertyAnnotationCppTest, testAccess) {
    ASSERT_TRUE(doesAnnotationMapContainsAllProps(AccessForVehicleProperty))
TEST(VehiclePropertyAnnotationCppTest, testDefaultAccess) {
    ASSERT_TRUE(doesAnnotationMapContainsAllProps(DefaultAccessForVehicleProperty))
            << "Outdated annotation-generated AIDL files. Please run "
            << "generate_annotation_enums.py to update.";
}

TEST(VehiclePropertyAnnotationCppTest, testAllowedAccess) {
    ASSERT_TRUE(doesAnnotationMapContainsAllProps(AllowedAccessForVehicleProperty))
            << "Outdated annotation-generated AIDL files. Please run "
            << "generate_annotation_enums.py to update.";
}
+288 −12

File changed.

Preview size limit exceeded, changes collapsed.

+282 −292

File changed.

Preview size limit exceeded, changes collapsed.

+2 −12
Original line number Diff line number Diff line
@@ -29,12 +29,7 @@

#include <unordered_map>

namespace aidl {
namespace android {
namespace hardware {
namespace automotive {
namespace vehicle {

namespace aidl::android::hardware::automotive::vehicle {
std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehicleProperty = {
        {VehicleProperty::INFO_VIN, VehiclePropertyChangeMode::STATIC},
        {VehicleProperty::INFO_MAKE, VehiclePropertyChangeMode::STATIC},
@@ -317,9 +312,4 @@ std::unordered_map<VehicleProperty, VehiclePropertyChangeMode> ChangeModeForVehi
        {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_ENABLED, VehiclePropertyChangeMode::ON_CHANGE},
        {VehicleProperty::LOW_SPEED_AUTOMATIC_EMERGENCY_BRAKING_STATE, VehiclePropertyChangeMode::ON_CHANGE},
};

}  // namespace vehicle
}  // namespace automotive
}  // namespace hardware
}  // namespace android
}  // aidl
}  // aidl::android::hardware::automotive::vehicle
+2 −12
Original line number Diff line number Diff line
@@ -28,12 +28,7 @@

#include <unordered_map>

namespace aidl {
namespace android {
namespace hardware {
namespace automotive {
namespace vehicle {

namespace aidl::android::hardware::automotive::vehicle {
std::unordered_map<VehicleProperty, int32_t> VersionForVehicleProperty = {
        {VehicleProperty::INFO_VIN, 2},
        {VehicleProperty::INFO_MAKE, 2},
@@ -316,9 +311,4 @@ std::unordered_map<VehicleProperty, int32_t> VersionForVehicleProperty = {
        {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
}  // aidl::android::hardware::automotive::vehicle
Loading