Initial submit of Vehicle HAL 2.1
Major changes / decisions:
- created empty IVehicle@2.1 interface to distinguish HAL impls
from client's (Car Service) perspective;
- created default 2.1 implementation that currently delegates all
calls to existing 2.0 implementation
- had to refactor a little bit 2.0 thus components could be esily
imported in 2.1
TOOD:
- move OBD and VMS code to 2.1
- decouple "DefaultVehicleHal.cpp"
- rename "DefaultVehicleHal" to Emulator (let's call things by their names)
b/34716856
Test: todo
Change-Id: Ib23650ca1277f0dfb24e5c789d65a19dce8b1abc
diff --git a/automotive/vehicle/2.0/default/Android.mk b/automotive/vehicle/2.0/default/Android.mk
index c394f2e..324be51 100644
--- a/automotive/vehicle/2.0/default/Android.mk
+++ b/automotive/vehicle/2.0/default/Android.mk
@@ -14,20 +14,26 @@
LOCAL_PATH := $(call my-dir)
-module_prefix = android.hardware.automotive.vehicle@2.0
+vhal_v2_0 = android.hardware.automotive.vehicle@2.0
###############################################################################
# Vehicle reference implementation lib
###############################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := $(module_prefix)-manager-lib
+LOCAL_MODULE := $(vhal_v2_0)-manager-lib
LOCAL_SRC_FILES := \
- vehicle_hal_manager/AccessControlConfigParser.cpp \
- vehicle_hal_manager/Obd2SensorStore.cpp \
- vehicle_hal_manager/SubscriptionManager.cpp \
- vehicle_hal_manager/VehicleHalManager.cpp \
- vehicle_hal_manager/VehicleObjectPool.cpp \
- vehicle_hal_manager/VehicleUtils.cpp \
+ common/src/AccessControlConfigParser.cpp \
+ common/src/Obd2SensorStore.cpp \
+ common/src/SubscriptionManager.cpp \
+ common/src/VehicleHalManager.cpp \
+ common/src/VehicleObjectPool.cpp \
+ common/src/VehicleUtils.cpp \
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/common/include/vhal_v2_0
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH)/common/include
LOCAL_SHARED_LIBRARIES := \
libbinder \
@@ -36,7 +42,7 @@
libhwbinder \
liblog \
libutils \
- $(module_prefix) \
+ $(vhal_v2_0) \
include $(BUILD_STATIC_LIBRARY)
@@ -44,11 +50,11 @@
# Vehicle HAL Protobuf library
###############################################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := $(call all-proto-files-under, impl/proto)
+LOCAL_SRC_FILES := $(call all-proto-files-under, impl/vhal_v2_0/proto)
LOCAL_PROTOC_OPTIMIZE_TYPE := nano
-LOCAL_MODULE := $(module_prefix)-libproto-native
+LOCAL_MODULE := $(vhal_v2_0)-libproto-native
LOCAL_MODULE_CLASS := STATIC_LIBRARIES
LOCAL_MODULE_TAGS := optional
@@ -57,7 +63,7 @@
generated_sources_dir := $(call local-generated-sources-dir)
LOCAL_EXPORT_C_INCLUDE_DIRS := \
- $(generated_sources_dir)/proto/$(LOCAL_PATH)/impl/proto
+ $(generated_sources_dir)/proto/$(LOCAL_PATH)/impl/vhal_v2_0/proto
include $(BUILD_STATIC_LIBRARY)
@@ -67,9 +73,18 @@
###############################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE:= $(module_prefix)-default-impl-lib
+LOCAL_MODULE:= $(vhal_v2_0)-default-impl-lib
LOCAL_SRC_FILES:= \
- impl/DefaultVehicleHal.cpp \
+ impl/vhal_v2_0/DefaultVehicleHal.cpp \
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/impl/vhal_v2_0
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := \
+ $(LOCAL_PATH)/impl
+
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+ $(vhal_v2_0)-manager-lib \
LOCAL_SHARED_LIBRARIES := \
libbinder \
@@ -79,10 +94,10 @@
liblog \
libprotobuf-cpp-lite \
libutils \
- $(module_prefix) \
+ $(vhal_v2_0) \
LOCAL_STATIC_LIBRARIES := \
- $(module_prefix)-libproto-native
+ $(vhal_v2_0)-libproto-native \
include $(BUILD_STATIC_LIBRARY)
@@ -92,9 +107,10 @@
###############################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE:= $(module_prefix)-manager-unit-tests
+LOCAL_MODULE:= $(vhal_v2_0)-manager-unit-tests
-LOCAL_WHOLE_STATIC_LIBRARIES := $(module_prefix)-manager-lib
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+ $(vhal_v2_0)-manager-lib \
LOCAL_SRC_FILES:= \
tests/AccessControlConfigParser_test.cpp \
@@ -111,7 +127,7 @@
libhwbinder \
liblog \
libutils \
- $(module_prefix) \
+ $(vhal_v2_0) \
LOCAL_CFLAGS += -Wall -Wextra
LOCAL_MODULE_TAGS := tests
@@ -123,18 +139,14 @@
# Vehicle HAL service
###############################################################################
include $(CLEAR_VARS)
-LOCAL_MODULE := $(module_prefix)-service
-LOCAL_INIT_RC := $(module_prefix)-service.rc
+LOCAL_MODULE := $(vhal_v2_0)-service
+LOCAL_INIT_RC := $(vhal_v2_0)-service.rc
LOCAL_PROPRIETARY_MODULE := true
LOCAL_MODULE_RELATIVE_PATH := hw
LOCAL_SRC_FILES := \
VehicleService.cpp
-LOCAL_WHOLE_STATIC_LIBRARIES := \
- $(module_prefix)-manager-lib \
- $(module_prefix)-default-impl-lib \
-
LOCAL_SHARED_LIBRARIES := \
libbinder \
libhidlbase \
@@ -143,9 +155,11 @@
liblog \
libprotobuf-cpp-lite \
libutils \
- $(module_prefix) \
+ $(vhal_v2_0) \
LOCAL_STATIC_LIBRARIES := \
- $(module_prefix)-libproto-native
+ $(vhal_v2_0)-manager-lib \
+ $(vhal_v2_0)-default-impl-lib \
+ $(vhal_v2_0)-libproto-native \
include $(BUILD_EXECUTABLE)
diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp
index 345dbcc..f88ce7b 100644
--- a/automotive/vehicle/2.0/default/VehicleService.cpp
+++ b/automotive/vehicle/2.0/default/VehicleService.cpp
@@ -20,9 +20,8 @@
#include <iostream>
-
-#include <vehicle_hal_manager/VehicleHalManager.h>
-#include <impl/DefaultVehicleHal.h>
+#include <vhal_v2_0/VehicleHalManager.h>
+#include <vhal_v2_0/DefaultVehicleHal.h>
using namespace android;
using namespace android::hardware;
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/AccessControlConfigParser.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/AccessControlConfigParser.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/AccessControlConfigParser.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/AccessControlConfigParser.h
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/ConcurrentQueue.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/ConcurrentQueue.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/ConcurrentQueue.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/ConcurrentQueue.h
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/Obd2SensorStore.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/Obd2SensorStore.h
similarity index 98%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/Obd2SensorStore.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/Obd2SensorStore.h
index 3e2a08e..fe231be 100644
--- a/automotive/vehicle/2.0/default/vehicle_hal_manager/Obd2SensorStore.h
+++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/Obd2SensorStore.h
@@ -19,7 +19,7 @@
#include <vector>
-#include <VehicleHal.h>
+#include "VehicleHal.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/SubscriptionManager.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/SubscriptionManager.h
diff --git a/automotive/vehicle/2.0/default/VehicleHal.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHal.h
similarity index 98%
rename from automotive/vehicle/2.0/default/VehicleHal.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHal.h
index 76df5b8..8203a1e 100644
--- a/automotive/vehicle/2.0/default/VehicleHal.h
+++ b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHal.h
@@ -18,8 +18,7 @@
#define android_hardware_automotive_vehicle_V2_0_VehicleHal_H
#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
-#include "vehicle_hal_manager/VehicleObjectPool.h"
-
+#include "VehicleObjectPool.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleHalManager.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHalManager.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleHalManager.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleHalManager.h
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleObjectPool.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleObjectPool.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleObjectPool.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleObjectPool.h
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehiclePropConfigIndex.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehiclePropConfigIndex.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehiclePropConfigIndex.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehiclePropConfigIndex.h
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleUtils.h b/automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleUtils.h
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleUtils.h
rename to automotive/vehicle/2.0/default/common/include/vhal_v2_0/VehicleUtils.h
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/AccessControlConfigParser.cpp b/automotive/vehicle/2.0/default/common/src/AccessControlConfigParser.cpp
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/AccessControlConfigParser.cpp
rename to automotive/vehicle/2.0/default/common/src/AccessControlConfigParser.cpp
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/Obd2SensorStore.cpp b/automotive/vehicle/2.0/default/common/src/Obd2SensorStore.cpp
similarity index 98%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/Obd2SensorStore.cpp
rename to automotive/vehicle/2.0/default/common/src/Obd2SensorStore.cpp
index 761e550..4ee0a71 100644
--- a/automotive/vehicle/2.0/default/vehicle_hal_manager/Obd2SensorStore.cpp
+++ b/automotive/vehicle/2.0/default/common/src/Obd2SensorStore.cpp
@@ -17,7 +17,7 @@
#include "Obd2SensorStore.h"
#include <utils/SystemClock.h>
-#include <vehicle_hal_manager/VehicleUtils.h>
+#include "VehicleUtils.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.cpp b/automotive/vehicle/2.0/default/common/src/SubscriptionManager.cpp
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/SubscriptionManager.cpp
rename to automotive/vehicle/2.0/default/common/src/SubscriptionManager.cpp
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleHalManager.cpp b/automotive/vehicle/2.0/default/common/src/VehicleHalManager.cpp
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleHalManager.cpp
rename to automotive/vehicle/2.0/default/common/src/VehicleHalManager.cpp
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleObjectPool.cpp b/automotive/vehicle/2.0/default/common/src/VehicleObjectPool.cpp
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleObjectPool.cpp
rename to automotive/vehicle/2.0/default/common/src/VehicleObjectPool.cpp
diff --git a/automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleUtils.cpp b/automotive/vehicle/2.0/default/common/src/VehicleUtils.cpp
similarity index 100%
rename from automotive/vehicle/2.0/default/vehicle_hal_manager/VehicleUtils.cpp
rename to automotive/vehicle/2.0/default/common/src/VehicleUtils.cpp
diff --git a/automotive/vehicle/2.0/default/impl/DefaultConfig.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
similarity index 98%
rename from automotive/vehicle/2.0/default/impl/DefaultConfig.h
rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
index 0c549b9..ec08a43 100644
--- a/automotive/vehicle/2.0/default/impl/DefaultConfig.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultConfig.h
@@ -18,7 +18,7 @@
#define android_hardware_automotive_vehicle_V2_0_impl_DefaultConfig_H_
#include <android/hardware/automotive/vehicle/2.0/IVehicle.h>
-#include <vehicle_hal_manager/VehicleUtils.h>
+#include <vhal_v2_0/VehicleUtils.h>
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.cpp b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
similarity index 100%
rename from automotive/vehicle/2.0/default/impl/DefaultVehicleHal.cpp
rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.cpp
diff --git a/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
similarity index 97%
rename from automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h
rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
index 4b89f55..51f7ba3 100644
--- a/automotive/vehicle/2.0/default/impl/DefaultVehicleHal.h
+++ b/automotive/vehicle/2.0/default/impl/vhal_v2_0/DefaultVehicleHal.h
@@ -18,15 +18,16 @@
#define android_hardware_automotive_vehicle_V2_0_impl_DefaultVehicleHal_H_
#include <memory>
-
-#include <VehicleHal.h>
-#include <impl/DefaultConfig.h>
#include <sys/socket.h>
#include <thread>
-#include <utils/SystemClock.h>
-#include <vehicle_hal_manager/Obd2SensorStore.h>
-#include "VehicleHalProto.pb.h"
+#include <utils/SystemClock.h>
+
+#include <vhal_v2_0/VehicleHal.h>
+#include <vhal_v2_0/Obd2SensorStore.h>
+
+#include "DefaultConfig.h"
+#include "VehicleHalProto.pb.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/impl/proto/VehicleHalProto.proto b/automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleHalProto.proto
similarity index 100%
rename from automotive/vehicle/2.0/default/impl/proto/VehicleHalProto.proto
rename to automotive/vehicle/2.0/default/impl/vhal_v2_0/proto/VehicleHalProto.proto
diff --git a/automotive/vehicle/2.0/default/tests/AccessControlConfigParser_test.cpp b/automotive/vehicle/2.0/default/tests/AccessControlConfigParser_test.cpp
index 6922b86..d9611c0 100644
--- a/automotive/vehicle/2.0/default/tests/AccessControlConfigParser_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/AccessControlConfigParser_test.cpp
@@ -19,8 +19,8 @@
#include <fstream>
#include <unordered_set>
-#include "vehicle_hal_manager/AccessControlConfigParser.h"
-#include <vehicle_hal_manager/VehicleUtils.h>
+#include "vhal_v2_0/AccessControlConfigParser.h"
+#include "vhal_v2_0/VehicleUtils.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/tests/Obd2SensorStore_test.cpp b/automotive/vehicle/2.0/default/tests/Obd2SensorStore_test.cpp
index 3ebebbd..a01c0f4 100644
--- a/automotive/vehicle/2.0/default/tests/Obd2SensorStore_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/Obd2SensorStore_test.cpp
@@ -16,8 +16,8 @@
#include <gtest/gtest.h>
-#include "vehicle_hal_manager/Obd2SensorStore.h"
-#include "vehicle_hal_manager/VehicleUtils.h"
+#include "vhal_v2_0/Obd2SensorStore.h"
+#include "vhal_v2_0/VehicleUtils.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp b/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp
index c6c6add..e13d003 100644
--- a/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/SubscriptionManager_test.cpp
@@ -19,7 +19,7 @@
#include <gtest/gtest.h>
-#include "vehicle_hal_manager/SubscriptionManager.h"
+#include "vhal_v2_0/SubscriptionManager.h"
#include "VehicleHalTestUtils.h"
diff --git a/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp b/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
index 274a843..f637344 100644
--- a/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/VehicleHalManager_test.cpp
@@ -21,7 +21,7 @@
#include <gtest/gtest.h>
-#include "vehicle_hal_manager/VehicleHalManager.h"
+#include "vhal_v2_0/VehicleHalManager.h"
#include "VehicleHalTestUtils.h"
diff --git a/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h b/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h
index 8ba36d8..ce1ed7d 100644
--- a/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h
+++ b/automotive/vehicle/2.0/default/tests/VehicleHalTestUtils.h
@@ -18,10 +18,11 @@
#define android_hardware_automotive_vehicle_V2_0_VehicleDebugUtils_H_
#include <android/hardware/automotive/vehicle/2.0/types.h>
-#include <vehicle_hal_manager/VehicleUtils.h>
#include <ios>
#include <sstream>
+#include "vhal_v2_0/VehicleUtils.h"
+
namespace android {
namespace hardware {
namespace automotive {
diff --git a/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp b/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp
index 7d37355..a291351 100644
--- a/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/VehicleObjectPool_test.cpp
@@ -20,7 +20,7 @@
#include <utils/SystemClock.h>
-#include "vehicle_hal_manager/VehicleObjectPool.h"
+#include "vhal_v2_0/VehicleObjectPool.h"
namespace android {
namespace hardware {
diff --git a/automotive/vehicle/2.0/default/tests/VehiclePropConfigIndex_test.cpp b/automotive/vehicle/2.0/default/tests/VehiclePropConfigIndex_test.cpp
index fad4ab3..0f65820 100644
--- a/automotive/vehicle/2.0/default/tests/VehiclePropConfigIndex_test.cpp
+++ b/automotive/vehicle/2.0/default/tests/VehiclePropConfigIndex_test.cpp
@@ -16,7 +16,7 @@
#include <gtest/gtest.h>
-#include "vehicle_hal_manager/VehiclePropConfigIndex.h"
+#include "vhal_v2_0/VehiclePropConfigIndex.h"
#include "VehicleHalTestUtils.h"
diff --git a/automotive/vehicle/2.0/types.hal b/automotive/vehicle/2.0/types.hal
index 68a8a17..5e22364 100644
--- a/automotive/vehicle/2.0/types.hal
+++ b/automotive/vehicle/2.0/types.hal
@@ -226,28 +226,6 @@
| VehicleArea:GLOBAL),
/*
- * Reports wheel rotational distance in meters since last wheel tick
- * event
- *
- * The value is a vector each element represents distance for individual
- * wheel in the following order: left front, right front, left rear,
- * right rear. VehiclePropValue.timestamp must be correctly filled in.
- *
- * Vendors must specify wheels that support this sensor in
- * VehiclePropConfig.configFlags. The format of this field is a bitset of
- * values from Wheel enum.
- *
- * @change_mode VehiclePropertyChangeMode:ON_CHANGE|VehiclePropertyChangeMode:CONTINUOUS
- * @access VehiclePropertyAccess:READ
- * @unit VehicleUnit:METER
- */
- WHEEL_TICK = (
- 0x0306
- | VehiclePropertyGroup:SYSTEM
- | VehiclePropertyType:FLOAT_VEC
- | VehicleArea:GLOBAL),
-
- /*
* Currently selected gear
*
* @change_mode VehiclePropertyChangeMode:ON_CHANGE