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

Commit d567a2a1 authored by Pavel Maltsev's avatar Pavel Maltsev
Browse files

Introduce ignition state property in VHAL

Bug: b/32312972

Test: added tests in Car Service (another CL), also this property
      should be veirified in VTS
Change-Id: I3531227f2f12806a67926cfd930547df54475991
parent 8d1d2714
Loading
Loading
Loading
Loading
+38 −0
Original line number Diff line number Diff line
@@ -662,6 +662,25 @@ $(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (VehicleIgnitionState)
#
GEN := $(intermediates)/android/hardware/vehicle/V2_0/VehicleIgnitionState.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vehicle@2.0::types.VehicleIgnitionState

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (VehicleInstrumentClusterType)
#
@@ -1615,6 +1634,25 @@ $(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (VehicleIgnitionState)
#
GEN := $(intermediates)/android/hardware/vehicle/V2_0/VehicleIgnitionState.java
$(GEN): $(HIDL)
$(GEN): PRIVATE_HIDL := $(HIDL)
$(GEN): PRIVATE_DEPS := $(LOCAL_PATH)/types.hal
$(GEN): PRIVATE_OUTPUT_DIR := $(intermediates)
$(GEN): PRIVATE_CUSTOM_TOOL = \
        $(PRIVATE_HIDL) -o $(PRIVATE_OUTPUT_DIR) \
        -Ljava \
        -randroid.hardware:hardware/interfaces \
        -randroid.hidl:system/libhidl/transport \
        android.hardware.vehicle@2.0::types.VehicleIgnitionState

$(GEN): $(LOCAL_PATH)/types.hal
	$(transform-generated-source)
LOCAL_GENERATED_SOURCES += $(GEN)

#
# Build types.hal (VehicleInstrumentClusterType)
#
+6 −0
Original line number Diff line number Diff line
@@ -167,6 +167,12 @@ const VehiclePropConfig kVehicleProperties[] = {
                .maxInt32Value = 10
            }
        }
    },

    {
        .prop = VehicleProperty::IGNITION_STATE,
        .access = VehiclePropertyAccess::READ,
        .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
    }
};

+3 −0
Original line number Diff line number Diff line
@@ -87,6 +87,9 @@ VehicleHal::VehiclePropValuePtr DefaultVehicleHal::get(
        case VehicleProperty::DRIVING_STATUS:
            v = pool.obtainInt32(toInt(VehicleDrivingStatus::UNRESTRICTED));
            break;
        case VehicleProperty::IGNITION_STATE:
            v = pool.obtainInt32(toInt(VehicleIgnitionState::ACC));
            break;
        default:
            *outStatus = StatusCode::INVALID_ARG;
    }
+41 −0
Original line number Diff line number Diff line
@@ -309,6 +309,18 @@ enum VehicleProperty: int32_t {
        | VehiclePropertyType:INT32
        | VehicleArea:GLOBAL),

    /*
     * Represents ignition state
     *
     * @change_mode VehiclePropertyChangeMode:ON_CHANGE
     * @access VehiclePropertyAccess:READ
     */
    IGNITION_STATE = (
        0x0409
            | VehiclePropertyGroup:SYSTEM
            | VehiclePropertyType:INT32
            | VehicleArea:GLOBAL),

    /*
     * Fan speed setting
     *
@@ -2405,6 +2417,35 @@ struct VehiclePropValue {
    RawValue value;
};

enum VehicleIgnitionState : int32_t {
    UNDEFINED = 0,

    /* Steering wheel is locked */
    LOCK = 1,

     /*
      * Steering wheel is not locked, engine and all accessories are OFF. If
      * car can be in LOCK and OFF state at the same time than HAL must report
      * LOCK state.
      */
    OFF,

    /*
     * Typically in this state accessories become available (e.g. radio).
     * Instrument cluster and engine are turned off
     */
    ACC,

    /*
     * Ignition is in state ON. Accessories and instrument cluster available,
     * engine might be running or ready to be started.
     */
    ON,

    /* Typically in this state engine is starting (cranking). */
    START
};


/*
 * Represent the operation where the current error has happened.