Add EV parameters to VHAL

Add parameters:
  - INFO_FUEL_TYPE
  - INFO_EV_BATTERY_CAPACITY
  - INFO_EV_CONNECTOR_TYPE
  - ENGINE_ON
  - FUEL_LEVEL
  - FUEL_DOOR_OPEN
  - EV_BATTERY_LEVEL
  - EV_CHARGE_PORT_OPEN
  - EV_CHARGE_PORT_CONNECTED
  - EV_BATTERY_INSTANTANEOUS_CHARGE_RATE

Added enums:
  - EvConnectorType
  - FuelType

Bug: 63330964
Test: Embedded Kitchen Sink can access the params

Change-Id: Iaedbb02db91d354ebed98fbae4c1ba204098e152
diff --git a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 08d3d79..857efca 100644
--- a/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -78,6 +78,38 @@
 const ConfigDeclaration kVehicleProperties[]{
     {.config =
          {
+             .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::STATIC,
+         },
+     .initialValue = {.floatValues = {15000}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::INFO_FUEL_TYPE),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::STATIC,
+         },
+     .initialValue = {.int32Values = {1}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::INFO_EV_BATTERY_CAPACITY),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::STATIC,
+         },
+     .initialValue = {.floatValues = {150000}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::INFO_EV_CONNECTOR_TYPE),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::STATIC,
+         },
+     .initialValue = {.int32Values = {1}}},
+
+    {.config =
+         {
              .prop = toInt(VehicleProperty::INFO_MAKE),
              .access = VehiclePropertyAccess::READ,
              .changeMode = VehiclePropertyChangeMode::STATIC,
@@ -89,7 +121,7 @@
              .access = VehiclePropertyAccess::READ,
              .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
              .minSampleRate = 1.0f,
-             .maxSampleRate = 1000.0f,
+             .maxSampleRate = 10.0f,
          },
      .initialValue = {.floatValues = {0.0f}}},
 
@@ -101,6 +133,14 @@
          },
      .initialValue = {.floatValues = {0.0f}}},
 
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::ENGINE_ON),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.int32Values = {0}}},
+
     {
         .config =
             {
@@ -108,13 +148,61 @@
                 .access = VehiclePropertyAccess::READ,
                 .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
                 .minSampleRate = 1.0f,
-                .maxSampleRate = 1000.0f,
+                .maxSampleRate = 10.0f,
             },
         .initialValue = {.floatValues = {0.0f}},
     },
 
     {.config =
          {
+             .prop = toInt(VehicleProperty::FUEL_LEVEL),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.floatValues = {15000}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::FUEL_DOOR_OPEN),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.int32Values = {0}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::EV_BATTERY_LEVEL),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.floatValues = {150000}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::EV_CHARGE_PORT_OPEN),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.int32Values = {0}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::EV_CHARGE_PORT_CONNECTED),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.int32Values = {0}}},
+
+    {.config =
+         {
+             .prop = toInt(VehicleProperty::EV_BATTERY_INSTANTANEOUS_CHARGE_RATE),
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
+         },
+     .initialValue = {.floatValues = {0}}},
+
+    {.config =
+         {
              .prop = toInt(VehicleProperty::CURRENT_GEAR),
              .access = VehiclePropertyAccess::READ,
              .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
@@ -246,16 +334,6 @@
          },
      .initialValue = {.int32Values = {toInt(VehicleGear::GEAR_PARK)}}},
 
-    {
-        .config =
-            {
-                .prop = toInt(VehicleProperty::INFO_FUEL_CAPACITY),
-                .access = VehiclePropertyAccess::READ,
-                .changeMode = VehiclePropertyChangeMode::STATIC,
-            },
-        .initialValue = {.floatValues = {123000.0f}}  // In Milliliters
-    },
-
     {.config = {.prop = toInt(VehicleProperty::DISPLAY_BRIGHTNESS),
                 .access = VehiclePropertyAccess::READ_WRITE,
                 .changeMode = VehiclePropertyChangeMode::ON_CHANGE,
@@ -297,17 +375,16 @@
          },
      .initialValue = {.int32Values = {1}}},
 
-    {
-        .config =
-            {
-                .prop = WHEEL_TICK,
-                .access = VehiclePropertyAccess::READ,
-                .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
-                .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000},
-                .minSampleRate = 1.0f,
-                .maxSampleRate = 100.0f,
-            },
-    },
+    {.config =
+         {
+             .prop = WHEEL_TICK,
+             .access = VehiclePropertyAccess::READ,
+             .changeMode = VehiclePropertyChangeMode::CONTINUOUS,
+             .configArray = {ALL_WHEELS, 50000, 50000, 50000, 50000},
+             .minSampleRate = 1.0f,
+             .maxSampleRate = 10.0f,
+         },
+     .initialValue = {.int64Values = {0, 100000, 200000, 300000, 400000}}},
 
     {
         .config =
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 7c08b4a..e07917e 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -148,7 +148,7 @@
         | VehicleArea:GLOBAL),
 
     /**
-     * Fuel capacity of the vehicle
+     * Fuel capacity of the vehicle in milliliters
      *
      * @change_mode VehiclePropertyChangeMode:STATIC
      * @access VehiclePropertyAccess:READ
@@ -161,6 +161,45 @@
         | VehicleArea:GLOBAL),
 
     /**
+     * List of fuels the vehicle may use.  Uses enum FuelType
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     * @unit VehicleUnit:MILLILITERS
+     */
+    INFO_FUEL_TYPE = (
+        0x0105
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:INT32_VEC
+        | VehicleArea:GLOBAL),
+
+    /**
+     * Battery capacity of the vehicle, if EV or hybrid.  This is the nominal
+     * battery capacity when the vehicle is new.
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     * @unit VehicleUnit:WH
+     */
+    INFO_EV_BATTERY_CAPACITY = (
+        0x0106
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:FLOAT
+        | VehicleArea:GLOBAL),
+
+    /**
+     * List of connectors this EV may use.  Uses enum EvConnectorType
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     */
+    INFO_EV_CONNECTOR_TYPE = (
+        0x0107
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:INT32_VEC
+        | VehicleArea:GLOBAL),
+
+    /**
      * Current odometer value of the vehicle
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE | VehiclePropertyChangeMode:CONTINUOUS
@@ -187,6 +226,19 @@
         | VehicleArea:GLOBAL),
 
     /**
+     * Engine on
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     */
+    ENGINE_ON = (
+        0x0300
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:BOOLEAN
+        | VehicleArea:GLOBAL),
+
+
+    /**
      * Temperature of engine coolant
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
@@ -259,8 +311,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:CONTINUOUS
      * @access VehiclePropertyAccess:READ
-     *
-     * @since o.mr1
      */
     WHEEL_TICK = (
       0x0306
@@ -270,6 +320,88 @@
 
 
     /**
+     * Fuel remaining in the the vehicle, in milliliters
+     *
+     * Value may not exceed INFO_FUEL_CAPACITY
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     * @unit VehicleUnit:MILLILITER
+     */
+    FUEL_LEVEL = (
+        0x0307
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:FLOAT
+        | VehicleArea:GLOBAL),
+
+    /**
+     * Fuel door open
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     */
+    FUEL_DOOR_OPEN = (
+        0x0308
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:BOOLEAN
+        | VehicleArea:GLOBAL),
+
+    /**
+     * EV battery level in WH, if EV or hybrid
+     *
+     * Value may not exceed INFO_EV_BATTERY_CAPACITY
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     * @unit VehicleUnit:WH
+     */
+    EV_BATTERY_LEVEL = (
+        0x0309
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:FLOAT
+        | VehicleArea:GLOBAL),
+
+    /**
+     * EV charge port open
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     */
+    EV_CHARGE_PORT_OPEN = (
+        0x030A
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:BOOLEAN
+        | VehicleArea:GLOBAL),
+
+    /**
+     * EV charge port connected
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     */
+    EV_CHARGE_PORT_CONNECTED = (
+        0x030B
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:BOOLEAN
+        | VehicleArea:GLOBAL),
+
+    /**
+     * EV instantaneous charge rate in milliwatts
+     *
+     * Positive value indicates battery is being charged.
+     * Negative value indicates battery being discharged.
+     *
+     * @change_mode VehiclePropertyChangeMode:STATIC
+     * @access VehiclePropertyAccess:READ
+     * @unit VehicleUnit:MW
+     */
+    EV_BATTERY_INSTANTANEOUS_CHARGE_RATE = (
+        0x030C
+        | VehiclePropertyGroup:SYSTEM
+        | VehiclePropertyType:FLOAT
+        | VehicleArea:GLOBAL),
+
+    /**
      * Currently selected gear
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
@@ -376,8 +508,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ
-     *
-     * @since o.mr1
      */
     ABS_ACTIVE = (
         0x040A
@@ -390,8 +520,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ
-     *
-     * @since o.mr1
      */
     TRACTION_CONTROL_ACTIVE = (
         0x040B
@@ -720,8 +848,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ_WRITE
-     *
-     * @since o.mr1
      */
     HVAC_AUTO_RECIRC_ON = (
         0x0512
@@ -1899,8 +2025,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ_WRITE
-     *
-     * @since o.mr1
      */
     VEHICLE_MAP_SERVICE = (
         0x0C00
@@ -1948,8 +2072,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ
-     *
-     * @since o.mr1
      */
     OBD2_LIVE_FRAME = (
       0x0D00
@@ -1980,8 +2102,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ
-     *
-     * @since o.mr1
      */
     OBD2_FREEZE_FRAME = (
       0x0D01
@@ -2003,8 +2123,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:READ
-     *
-     * @since o.mr1
      */
     OBD2_FREEZE_FRAME_INFO = (
       0x0D02
@@ -2031,8 +2149,6 @@
      *
      * @change_mode VehiclePropertyChangeMode:ON_CHANGE
      * @access VehiclePropertyAccess:WRITE
-     *
-     * @since o.mr1
      */
     OBD2_FREEZE_FRAME_CLEAR = (
       0x0D03
@@ -2042,6 +2158,73 @@
 };
 
 /**
+ * Used by INFO_EV_CONNECTOR_TYPE to enumerate the type of connectors
+ * available to charge the vehicle.  Consistent with projection protocol.
+ */
+enum EvConnectorType : int32_t {
+    /**
+     * Default type if the vehicle does not know or report the EV connector
+     * type.
+     */
+    EV_CONNECTOR_TYPE_UNKNOWN = 0,
+    EV_CONNECTOR_TYPE_J1772 = 1,
+    EV_CONNECTOR_TYPE_MENNEKES = 2,
+    EV_CONNECTOR_TYPE_CHADEMO = 3,
+    EV_CONNECTOR_TYPE_COMBO_1 = 4,
+    EV_CONNECTOR_TYPE_COMBO_2 = 5,
+    EV_CONNECTOR_TYPE_TESLA_ROADSTER = 6,
+    EV_CONNECTOR_TYPE_TESLA_HPWC = 7,
+    EV_CONNECTOR_TYPE_TESLA_SUPERCHARGER = 8,
+    EV_CONNECTOR_TYPE_GBT = 9,
+
+    /**
+     * Connector type to use when no other types apply. Before using this
+     * value, work with Google to see if the EvConnectorType enum can be
+     * extended with an appropriate value.
+     */
+    EV_CONNECTOR_TYPE_OTHER = 101,
+};
+
+/**
+ * Used by INFO_FUEL_TYPE to enumerate the type of fuels this vehicle uses.
+ * Consistent with projection protocol.
+ */
+enum FuelType : int32_t {
+    /**
+     * Fuel type to use if the HU does not know on which types of fuel the vehicle
+     * runs. The use of this value is generally discouraged outside of aftermarket units.
+     */
+    FUEL_TYPE_UNKNOWN = 0,
+    /** Unleaded gasoline */
+    FUEL_TYPE_UNLEADED = 1,
+    /** Leaded gasoline */
+    FUEL_TYPE_LEADED = 2,
+    /** Diesel #1 */
+    FUEL_TYPE_DIESEL_1 = 3,
+    /** Diesel #2 */
+    FUEL_TYPE_DIESEL_2 = 4,
+    /** Biodiesel */
+    FUEL_TYPE_BIODIESEL = 5,
+    /** 85% ethanol/gasoline blend */
+    FUEL_TYPE_E85 = 6,
+    /** Liquified petroleum gas */
+    FUEL_TYPE_LPG = 7,
+    /** Compressed natural gas */
+    FUEL_TYPE_CNG = 8,
+    /** Liquified natural gas */
+    FUEL_TYPE_LNG = 9,
+    /** Electric */
+    FUEL_TYPE_ELECTRIC = 10,
+    /** Hydrogen fuel cell */
+    FUEL_TYPE_HYDROGEN = 11,
+    /**
+     * Fuel type to use when no other types apply. Before using this value, work with
+     * Google to see if the FuelType enum can be extended with an appropriate value.
+     */
+    FUEL_TYPE_OTHER = 12,
+};
+
+/**
  * Bit flags for fan direction
  */
 enum VehicleHvacFanDirection : int32_t {
@@ -2511,6 +2694,12 @@
     NANO_SECS      = 0x50,
     SECS           = 0x53,
     YEAR           = 0x59,
+
+    // Electrical Units
+    WATT_HOUR      = 0x60,
+    MILLIAMPERE    = 0x61,
+    MILLIVOLT      = 0x62,
+    MILLIWATTS     = 0x63,
 };
 
   /**
diff --git a/current.txt b/current.txt
index 63a2260..c1aa97a 100644
--- a/current.txt
+++ b/current.txt
@@ -259,3 +259,4 @@
 
 # ABI preserving changes to HALs during Android P
 fb92e2b40f8e9d494e8fd3b4ac18499a3216342e7cff160714c3bbf3660b6e79 android.hardware.gnss@1.0::IGnssConfiguration
+d4c10cb28318dba8efb22231a8c23e86ad8853f85775187c40b42a878a5ef4d5 android.hardware.automotive.vehicle@2.0::types