Create default VehicleService.
Create default VehicleService to use the default VHAL implementation.
The original default VehicleService is now renamed to emulator-service.
Test: Presubmit.
Bug: 192276902
Change-Id: I4ef4c3d68a0d3f7c7e0742fe7d4477cdb0a89c76
diff --git a/automotive/vehicle/2.0/default/Android.bp b/automotive/vehicle/2.0/default/Android.bp
index 2c3422e..bd9e9b6 100644
--- a/automotive/vehicle/2.0/default/Android.bp
+++ b/automotive/vehicle/2.0/default/Android.bp
@@ -223,12 +223,12 @@
}
cc_binary {
- name: "android.hardware.automotive.vehicle@2.0-service",
+ name: "android.hardware.automotive.vehicle@2.0-default-service",
defaults: ["vhal_v2_0_target_defaults"],
vintf_fragments: [
- "android.hardware.automotive.vehicle@2.0-service.xml",
+ "android.hardware.automotive.vehicle@2.0-default-service.xml",
],
- init_rc: ["android.hardware.automotive.vehicle@2.0-service.rc"],
+ init_rc: ["android.hardware.automotive.vehicle@2.0-default-service.rc"],
vendor: true,
relative_install_path: "hw",
srcs: ["VehicleService.cpp"],
@@ -240,7 +240,7 @@
static_libs: [
"android.hardware.automotive.vehicle@2.0-manager-lib",
"android.hardware.automotive.vehicle@2.0-libproto-native",
- "android.hardware.automotive.vehicle@2.0-emulator-impl-lib",
+ "android.hardware.automotive.vehicle@2.0-default-impl-lib",
],
}
diff --git a/automotive/vehicle/2.0/default/VehicleService.cpp b/automotive/vehicle/2.0/default/VehicleService.cpp
index fae6e43..12e15f9 100644
--- a/automotive/vehicle/2.0/default/VehicleService.cpp
+++ b/automotive/vehicle/2.0/default/VehicleService.cpp
@@ -14,40 +14,40 @@
* limitations under the License.
*/
-#define LOG_TAG "automotive.vehicle@2.0-service"
+#define LOG_TAG "automotive.vehicle@2.0-default-service"
#include <android/log.h>
#include <hidl/HidlTransportSupport.h>
#include <iostream>
-#include <EmulatedVehicleConnector.h>
-#include <EmulatedVehicleHal.h>
+#include <vhal_v2_0/DefaultVehicleConnector.h>
+#include <vhal_v2_0/DefaultVehicleHal.h>
#include <vhal_v2_0/VehicleHalManager.h>
-using namespace android;
-using namespace android::hardware;
-using namespace android::hardware::automotive::vehicle::V2_0;
+using ::android::hardware::automotive::vehicle::V2_0::VehicleHalManager;
+using ::android::hardware::automotive::vehicle::V2_0::VehiclePropertyStore;
+using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVehicleConnector;
+using ::android::hardware::automotive::vehicle::V2_0::impl::DefaultVehicleHal;
int main(int /* argc */, char* /* argv */ []) {
auto store = std::make_unique<VehiclePropertyStore>();
- auto connector = std::make_unique<impl::EmulatedVehicleConnector>();
- auto hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get());
- auto emulator = connector->getEmulator();
+ auto connector = std::make_unique<DefaultVehicleConnector>();
+ auto hal = std::make_unique<DefaultVehicleHal>(store.get(), connector.get());
auto service = std::make_unique<VehicleHalManager>(hal.get());
connector->setValuePool(hal->getValuePool());
- configureRpcThreadpool(4, true /* callerWillJoin */);
+ android::hardware::configureRpcThreadpool(4, true /* callerWillJoin */);
ALOGI("Registering as service...");
- status_t status = service->registerAsService();
+ android::status_t status = service->registerAsService();
- if (status != OK) {
+ if (status != android::OK) {
ALOGE("Unable to register vehicle service (%d)", status);
return 1;
}
ALOGI("Ready");
- joinRpcThreadpool();
+ android::hardware::joinRpcThreadpool();
- return 1;
+ return 0;
}
diff --git a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.rc
similarity index 77%
rename from automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc
rename to automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.rc
index 44f9134..8279af7 100644
--- a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc
+++ b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.rc
@@ -1,4 +1,4 @@
-service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service
+service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-default-service
class early_hal
user vehicle_network
group system inet
diff --git a/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.xml b/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.xml
similarity index 100%
rename from automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.xml
rename to automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-default-service.xml