Separate VHAL emulator logic out.

Create EmulatedVehicleServer logic and moves emulator dependency
under it. This is part of the default VHAL refactoring. By letting
EmulatedVehicleServer depends on emulator, if we provides a
different VehicleServer implementation, it would not have emulator
dependency.

Create DefaultVehicleHal and let EmulatedVehicleHal inherits from
DefaultVehicleHal.

Test: Locally run in an emulator, test setting/getting properties
through emulator. Would add more tests in following CL.
Bug: 188204722

Change-Id: I20c4f69144277c717fed880a3bb9824f23ae0490
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index ea42c3e..4c51c62 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -47,6 +47,7 @@
 
 cc_library_headers {
     name: "vhal_v2_0_common_headers",
+    visibility: ["//visibility:public"],
     vendor: true,
     export_include_dirs: ["common/include/vhal_v2_0"],
 }
@@ -58,6 +59,7 @@
     defaults: ["vhal_v2_0_target_defaults"],
     srcs: [
         "common/src/Obd2SensorStore.cpp",
+        "common/src/ProtoMessageConverter.cpp",
         "common/src/SubscriptionManager.cpp",
         "common/src/VehicleHalManager.cpp",
         "common/src/VehicleObjectPool.cpp",
@@ -68,9 +70,13 @@
     ],
     shared_libs: [
         "libbase",
+        "libprotobuf-cpp-lite",
     ],
     local_include_dirs: ["common/include/vhal_v2_0"],
     export_include_dirs: ["common/include"],
+    static_libs: [
+        "android.hardware.automotive.vehicle@2.0-libproto-native",
+    ],
 }
 
 // Vehicle default VehicleHAL implementation
@@ -80,24 +86,16 @@
     defaults: ["vhal_v2_0_target_defaults"],
     cflags: ["-DENABLE_VENDOR_CLUSTER_PROPERTY_FOR_TESTING"],
     srcs: [
-        "impl/vhal_v2_0/CommConn.cpp",
-        "impl/vhal_v2_0/EmulatedVehicleConnector.cpp",
-        "impl/vhal_v2_0/EmulatedVehicleHal.cpp",
+        "impl/vhal_v2_0/DefaultVehicleHal.cpp",
         "impl/vhal_v2_0/VehicleHalClient.cpp",
-        "impl/vhal_v2_0/VehicleHalServer.cpp",
-        "impl/vhal_v2_0/VehicleEmulator.cpp",
-        "impl/vhal_v2_0/PipeComm.cpp",
-        "impl/vhal_v2_0/ProtoMessageConverter.cpp",
-        "impl/vhal_v2_0/SocketComm.cpp",
+        "impl/vhal_v2_0/DefaultVehicleHalServer.cpp",
         "impl/vhal_v2_0/LinearFakeValueGenerator.cpp",
         "impl/vhal_v2_0/JsonFakeValueGenerator.cpp",
         "impl/vhal_v2_0/GeneratorHub.cpp",
-        "impl/vhal_v2_0/qemu_pipe.cpp",
     ],
     local_include_dirs: ["common/include/vhal_v2_0"],
     export_include_dirs: ["impl"],
     whole_static_libs: [
-        "android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib",
         "android.hardware.automotive.vehicle@2.0-manager-lib",
     ],
     shared_libs: [
@@ -110,19 +108,6 @@
     ],
 }
 
-// Library used  to emulate User HAL behavior through lshal debug requests.
-cc_library_static {
-    name: "android.hardware.automotive.vehicle@2.0-emulated-user-hal-lib",
-    vendor: true,
-    defaults: ["vhal_v2_0_target_defaults"],
-    srcs: [
-        "impl/vhal_v2_0/EmulatedUserHal.cpp",
-    ],
-    whole_static_libs: [
-        "android.hardware.automotive.vehicle@2.0-user-hal-helper-lib",
-    ],
-}
-
 // Vehicle HAL Server reference impl lib
 cc_library_static {
     name: "android.hardware.automotive.vehicle@2.0-server-common-lib",
@@ -133,10 +118,14 @@
     export_include_dirs: ["common/include"],
     srcs: [
         "common/src/Obd2SensorStore.cpp",
+        "common/src/ProtoMessageConverter.cpp",
         "common/src/VehicleObjectPool.cpp",
         "common/src/VehiclePropertyStore.cpp",
         "common/src/VehicleUtils.cpp",
     ],
+    static_libs: [
+        "android.hardware.automotive.vehicle@2.0-libproto-native",
+    ],
 }
 
 // Vehicle HAL Server default implementation
@@ -151,8 +140,7 @@
         "impl/vhal_v2_0/GeneratorHub.cpp",
         "impl/vhal_v2_0/JsonFakeValueGenerator.cpp",
         "impl/vhal_v2_0/LinearFakeValueGenerator.cpp",
-        "impl/vhal_v2_0/ProtoMessageConverter.cpp",
-        "impl/vhal_v2_0/VehicleHalServer.cpp",
+        "impl/vhal_v2_0/DefaultVehicleHalServer.cpp",
     ],
     whole_static_libs: [
         "android.hardware.automotive.vehicle@2.0-server-common-lib",
@@ -234,8 +222,8 @@
     ],
     static_libs: [
         "android.hardware.automotive.vehicle@2.0-manager-lib",
-        "android.hardware.automotive.vehicle@2.0-default-impl-lib",
         "android.hardware.automotive.vehicle@2.0-libproto-native",
+        "//device/generic/car/emulator/vhal_v2_0:android.hardware.automotive.vehicle@2.0-emulator-impl-lib",
     ],
 }