migrate car service to use vehicle network service

- all jni stuffs gone as HAL is no longer loaded by car service
- disabled dispatch limiting in CarSensorService as vehicle
  network service is already doing it.
- needs product config change to start VNS for CarService to work.

bug: 24095928

Change-Id: I5d7b2ae7efb24daf23f304db4def0c4f9a519b25
(cherry picked from commit 3f3190ce58955eda2730331c825ebd6433dab42d)
diff --git a/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java b/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java
index 54ff7d3..28184b5 100644
--- a/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java
+++ b/libvehiclenetwork/java/src/com/android/car/vehiclenetwork/VehicleNetwork.java
@@ -89,6 +89,33 @@
         }
     }
 
+    public void setIntProperty(int property, int value) {
+        VehiclePropValue v = VehiclePropValue.newBuilder().
+                setProp(property).
+                setValueType(VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_INT32).
+                setInt32Value(value).
+                build();
+        setProperty(v);
+    }
+
+    public void setLongProperty(int property, long value) {
+        VehiclePropValue v = VehiclePropValue.newBuilder().
+                setProp(property).
+                setValueType(VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_INT64).
+                setInt64Value(value).
+                build();
+        setProperty(v);
+    }
+
+    public void setIntProperty(int property, float value) {
+        VehiclePropValue v = VehiclePropValue.newBuilder().
+                setProp(property).
+                setValueType(VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_FLOAT).
+                setFloatValue(value).
+                build();
+        setProperty(v);
+    }
+
     public VehiclePropValue getProperty(int property) {
         try {
             VehiclePropValueParcelable parcelable = mService.getProperty(property);
@@ -101,6 +128,51 @@
         return null;
     }
 
+    public int getIntProperty(int property) {
+        VehiclePropValue v = getProperty(property);
+        if (v == null) {
+            throw new IllegalStateException();
+        }
+        if (v.getValueType() != VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_INT32) {
+            throw new IllegalArgumentException();
+        }
+        return v.getInt32Value();
+    }
+
+    public float getFloatProperty(int property) {
+        VehiclePropValue v = getProperty(property);
+        if (v == null) {
+            throw new IllegalStateException();
+        }
+        if (v.getValueType() != VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_FLOAT) {
+            throw new IllegalArgumentException();
+        }
+        return v.getFloatValue();
+    }
+
+    public long getLongProperty(int property) {
+        VehiclePropValue v = getProperty(property);
+        if (v == null) {
+            throw new IllegalStateException();
+        }
+        if (v.getValueType() != VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_INT64) {
+            throw new IllegalArgumentException();
+        }
+        return v.getInt64Value();
+    }
+
+    //TODO check UTF8 to java string conversion
+    public String getStringProperty(int property) {
+        VehiclePropValue v = getProperty(property);
+        if (v == null) {
+            throw new IllegalStateException();
+        }
+        if (v.getValueType() != VehicleNetworkConsts.VehicleValueType.VEHICLE_VALUE_TYPE_STRING) {
+            throw new IllegalArgumentException();
+        }
+        return v.getStringValue();
+    }
+
     public void subscribe(int property, float sampleRate) {
         try {
             mService.subscribe(mVehicleNetworkListener, property, sampleRate);