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

Commit 4b7c5bad authored by Terry Guan's avatar Terry Guan Committed by Automerger Merge Worker
Browse files

Merge "Added Vendor Error Properties" into udc-dev am: f8c7c18d

parents 3622929c f8c7c18d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -136,6 +136,7 @@ const std::unordered_map<std::string, int> CONSTANTS_BY_NAME = {
#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
        // Following are test properties:
        {"ECHO_REVERSE_BYTES", ECHO_REVERSE_BYTES},
        {"VENDOR_PROPERTY_ID", VENDOR_PROPERTY_ID},
        {"kMixedTypePropertyForTest", kMixedTypePropertyForTest},
        {"VENDOR_CLUSTER_NAVIGATION_STATE", VENDOR_CLUSTER_NAVIGATION_STATE},
        {"VENDOR_CLUSTER_REQUEST_DISPLAY", VENDOR_CLUSTER_REQUEST_DISPLAY},
+5 −0
Original line number Diff line number Diff line
@@ -181,6 +181,11 @@
            "access": "VehiclePropertyAccess::READ_WRITE",
            "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
        },
        {
            "property": "Constants::VENDOR_PROPERTY_ID",
            "access": "VehiclePropertyAccess::READ_WRITE",
            "changeMode": "VehiclePropertyChangeMode::ON_CHANGE"
        },
        {
            "property": "VehicleProperty::SUPPORT_CUSTOMIZE_VENDOR_PERMISSION",
            "defaultValue": {
+8 −1
Original line number Diff line number Diff line
@@ -85,7 +85,8 @@ constexpr char OVERRIDE_CONFIG_DIR[] = "/vendor/etc/automotive/vhaloverride/";
// overwrite the default configs.
constexpr char OVERRIDE_PROPERTY[] = "persist.vendor.vhal_init_value_override";
constexpr char POWER_STATE_REQ_CONFIG_PROPERTY[] = "ro.vendor.fake_vhal.ap_power_state_req.config";

// The value to be returned if VENDOR_PROPERTY_ID is set as the property
constexpr int VENDOR_ERROR_CODE = 0x00ab0005;
// A list of supported options for "--set" command.
const std::unordered_set<std::string> SET_PROP_OPTIONS = {
        // integer.
@@ -389,6 +390,9 @@ FakeVehicleHardware::ValueResultType FakeVehicleHardware::maybeGetSpecialValue(
        case ECHO_REVERSE_BYTES:
            *isSpecialValue = true;
            return getEchoReverseBytes(value);
        case VENDOR_PROPERTY_ID:
            *isSpecialValue = true;
            return StatusError((StatusCode)VENDOR_ERROR_CODE);
        default:
            // Do nothing.
            break;
@@ -469,6 +473,9 @@ VhalResult<void> FakeVehicleHardware::maybeSetSpecialValue(const VehiclePropValu
        case OBD2_FREEZE_FRAME_CLEAR:
            *isSpecialValue = true;
            return mFakeObd2Frame->clearObd2FreezeFrames(value);
        case VENDOR_PROPERTY_ID:
            *isSpecialValue = true;
            return StatusError((StatusCode)VENDOR_ERROR_CODE);

#ifdef ENABLE_VEHICLE_HAL_TEST_PROPERTIES
        case toInt(VehicleProperty::CLUSTER_REPORT_STATE):
+5 −0
Original line number Diff line number Diff line
@@ -409,6 +409,11 @@ TEST_F(FakeVehicleHardwareTest, testGetDefaultValues) {
            continue;
        }

        if (propId == VENDOR_PROPERTY_ID) {
            // Ignore VENDOR_PROPERTY_ID, it has special logic.
            continue;
        }

        if (isGlobalProp(propId)) {
            if (config.initialValue == RawPropValues{}) {
                addGetValueRequest(getValueRequests, expectedGetValueResults, requestId++,
+7 −0
Original line number Diff line number Diff line
@@ -84,6 +84,13 @@ constexpr int32_t ECHO_REVERSE_BYTES = 0x2a12 |
                                       toInt(testpropertyutils_impl::VehicleArea::GLOBAL) |
                                       toInt(testpropertyutils_impl::VehiclePropertyType::BYTES);

// This property is used for testing vendor error codes end to end.
// 0x21402a13
constexpr int32_t VENDOR_PROPERTY_ID = 0x2a13 |
                                       toInt(testpropertyutils_impl::VehiclePropertyGroup::VENDOR) |
                                       toInt(testpropertyutils_impl::VehicleArea::GLOBAL) |
                                       toInt(testpropertyutils_impl::VehiclePropertyType::INT32);

// This property is used for test purpose. End to end tests use this property to test set and get
// method for MIXED type properties.
constexpr int32_t kMixedTypePropertyForTest =