Vehicle HAL reference impl Part I

Implemented:
  - defined VehicleHal
  - object pool for VehiclePropValue objects
  - batching of vehicle HAL events
  - subscription management

Test: unit tests provided

Bug: b/31971746
Change-Id: Idd2d0aee7b32a975c3db54812be235e13f52905a
diff --git a/vehicle/2.0/default/Android.mk b/vehicle/2.0/default/Android.mk
index a30d753..e14cb19 100644
--- a/vehicle/2.0/default/Android.mk
+++ b/vehicle/2.0/default/Android.mk
@@ -14,29 +14,92 @@
 
 LOCAL_PATH := $(call my-dir)
 
+module_prefix = android.hardware.vehicle@2.0
+
+###############################################################################
+# Vehicle reference implementation lib
+###############################################################################
 include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vehicle@2.0-impl
-# TODO(pavelm): add LOCAL_INIT_RC
-LOCAL_MODULE_RELATIVE_PATH := hw
+LOCAL_MODULE := $(module_prefix)-manager-lib
 LOCAL_SRC_FILES := \
-    Vehicle.cpp \
-    VehicleCallback.cpp \
+    vehicle_hal_manager/SubscriptionManager.cpp \
+    vehicle_hal_manager/VehicleHalManager.cpp \
+    vehicle_hal_manager/VehicleCallback.cpp \
 
 LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libbinder \
     libhidl \
     libhwbinder \
     libutils \
-    android.hardware.vehicle@2.0 \
+    $(module_prefix) \
 
-include $(BUILD_SHARED_LIBRARY)
+include $(BUILD_STATIC_LIBRARY)
 
-
+###############################################################################
+# Vehicle default VehicleHAL implementation
+###############################################################################
 include $(CLEAR_VARS)
-LOCAL_MODULE := android.hardware.vehicle@2.0-service
+
+LOCAL_MODULE:= $(module_prefix)-default-impl-lib
+LOCAL_SRC_FILES:= \
+    impl/DefaultVehicleHal.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libbinder \
+    libhidl \
+    libhwbinder \
+    libutils \
+    $(module_prefix) \
+
+include $(BUILD_STATIC_LIBRARY)
+
+
+###############################################################################
+# Vehicle reference implementation unit tests
+###############################################################################
+include $(CLEAR_VARS)
+
+LOCAL_MODULE:= $(module_prefix)-manager-unit-tests
+
+LOCAL_WHOLE_STATIC_LIBRARIES := $(module_prefix)-manager-lib
+
+LOCAL_SRC_FILES:= \
+    tests/VehicleObjectPool_test.cpp \
+    tests/VehiclePropConfigIndex_test.cpp \
+    tests/SubscriptionManager_test.cpp \
+    tests/VehicleHalManager_test.cpp \
+
+LOCAL_SHARED_LIBRARIES := \
+    liblog \
+    libbinder \
+    libhidl \
+    libhwbinder \
+    libutils \
+    $(module_prefix) \
+
+LOCAL_CFLAGS += -Wall -Wextra
+LOCAL_MODULE_TAGS := tests
+
+include $(BUILD_NATIVE_TEST)
+
+
+###############################################################################
+# Vehicle HAL service
+###############################################################################
+include $(CLEAR_VARS)
+LOCAL_MODULE := $(module_prefix)-service
 LOCAL_MODULE_RELATIVE_PATH := hw
+# TODO(pavelm): add LOCAL_INIT_RC
+
 LOCAL_SRC_FILES := \
     VehicleService.cpp
 
+LOCAL_WHOLE_STATIC_LIBRARIES := \
+    $(module_prefix)-manager-lib \
+    $(module_prefix)-default-impl-lib \
+
 LOCAL_SHARED_LIBRARIES := \
     liblog \
     libbinder \