aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteve Paik <spaik@google.com>2018-05-01 20:13:08 -0700
committerSteve Paik <spaik@google.com>2018-05-02 15:53:18 -0700
commit360b7a9816f5d692c5ccdc9ac3a9ffec27e75402 (patch)
tree619d8b8886233089f5e68030ae6a3306e5b6945d
parent5bb392c6fae473dbc16d960d773483283dbc0f6d (diff)
downloadCar-360b7a9816f5d692c5ccdc9ac3a9ffec27e75402.tar.gz
Fix CarSensorManager
CarSensorManager isn't loading properly because wheel_ticks was changed from type MIXED to INT64_VEC. Bug: 78656259 Test: ./vehicle_simulator.py --property VEHICLEPROPERTY_EV_CHARGE_PORT_CONNECTED --value 1 Change-Id: Ibf100e6ba1df0c824181b3dde269fe16d37e1fe7
-rw-r--r--service/src/com/android/car/CarSensorEventFactory.java19
-rw-r--r--service/src/com/android/car/hal/SensorHalService.java4
2 files changed, 23 insertions, 0 deletions
diff --git a/service/src/com/android/car/CarSensorEventFactory.java b/service/src/com/android/car/CarSensorEventFactory.java
index ac4d54dab0..dc45f8c095 100644
--- a/service/src/com/android/car/CarSensorEventFactory.java
+++ b/service/src/com/android/car/CarSensorEventFactory.java
@@ -19,6 +19,8 @@ package com.android.car;
import android.car.hardware.CarSensorEvent;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
+import java.util.List;
+
//TODO add memory pool and recycling
public class CarSensorEventFactory {
@@ -35,6 +37,23 @@ public class CarSensorEventFactory {
return event;
}
+ /**
+ * Create int64 vector event
+ * @param sensorType
+ * @param timestamp
+ * @param value
+ *
+ * @return CarSensorEvent
+ */
+ public static CarSensorEvent createInt64VecEvent(int sensorType, long timestamp,
+ List<Long> value) {
+ CarSensorEvent event = new CarSensorEvent(sensorType, timestamp, 0, 0, value.size());
+ for (int i = 0; i < value.size(); i++) {
+ event.longValues[i] = value.get(i);
+ }
+ return event;
+ }
+
public static CarSensorEvent createFloatEvent(int sensorType, long timestamp, float value) {
CarSensorEvent event = new CarSensorEvent(sensorType, timestamp, 1, 0, 0);
event.floatValues[0] = value;
diff --git a/service/src/com/android/car/hal/SensorHalService.java b/service/src/com/android/car/hal/SensorHalService.java
index 36f281913b..f36895566f 100644
--- a/service/src/com/android/car/hal/SensorHalService.java
+++ b/service/src/com/android/car/hal/SensorHalService.java
@@ -215,6 +215,10 @@ public class SensorHalService extends SensorHalServiceBase {
event = CarSensorEventFactory.createFloatEvent(sensorType, v.timestamp,
v.value.floatValues.get(0));
break;
+ case VehiclePropertyType.INT64_VEC:
+ event = CarSensorEventFactory.createInt64VecEvent(sensorType, v.timestamp,
+ v.value.int64Values);
+ break;
default:
Log.w(TAG, "createCarSensorEvent: unsupported type: 0x" + toHexString(dataType));
break;