IVIVehicleService启动

Posted xhBruce

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了IVIVehicleService启动相关的知识,希望对你有一定的参考价值。

【IVI】VehicleService启动

android12-release
Android Automotive OS知识体系

1、rc文件android.hardware.automotive.vehicle@2.0-service.rc

VehicleService进程名:vendor.vehicle-hal-2.0
bin文件:/vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service
对应启动入口:hardware/interfaces/automotive/vehicle/2.0/default/VehicleService.cpp

hardware/interfaces/automotive/vehicle/2.0/default/android.hardware.automotive.vehicle@2.0-service.rc

service vendor.vehicle-hal-2.0 /vendor/bin/hw/android.hardware.automotive.vehicle@2.0-service
    class hal
    user vehicle_network
    group system inet

2、VehicleService.cpp#main()启动

  • EmulatedVehicleConnector继承VehicleHalClient、VehicleHalServer(即是IVehicleServer、IVehicleClient
  • hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get(), userHal)与VehicleHal通行,EmulatedVehicleHal最终继承VehicleHal
  • configureRpcThreadpool、joinRpcThreadpool 组队出现的东西,libhidl 库,用于自动生成HIDL语言,并辅助服务添加到 hwbinder域
  • VehicleHalManager 继承IVehicle ,再查看service->registerAsService()注册到 /dev/hwbinder 并添加到 defaultServiceManager()
int main(int /* argc */, char* /* argv */ []) 
    auto store = std::make_unique<VehiclePropertyStore>();
    auto connector = std::make_unique<impl::EmulatedVehicleConnector>();
    auto userHal = connector->getEmulatedUserHal();
    auto hal = std::make_unique<impl::EmulatedVehicleHal>(store.get(), connector.get(), userHal);
    auto emulator = std::make_unique<impl::VehicleEmulator>(hal.get());
    auto service = std::make_unique<VehicleHalManager>(hal.get());
    connector->setValuePool(hal->getValuePool());

    configureRpcThreadpool(4, true /* callerWillJoin */);

    ALOGI("Registering as service...");
    status_t status = service->registerAsService();

    if (status != OK) 
        ALOGE("Unable to register vehicle service (%d)", status);
        return 1;
    

    ALOGI("Ready");
    joinRpcThreadpool();

    return 1;

2.1 libhidl、libhwbinder路径

Binder 域
system/libhidl/transport/HidlTransportSupport.cpp
system/libhidl/transport/include/hidl/HidlTransportSupport.h
system/libhidl/transport/ServiceManagement.cpp
system/libhidl/transport/include/hidl/ServiceManagement.h

system/libhwbinder/ProcessState.cpp
system/libhwbinder/IPCThreadState.cpp

2.2 hidl-gen自动生成代码文件Bp、Bn端:types.hal、IVehicle.hal、IVehicleCallback.hal

// This file is autogenerated by hidl-gen -Landroidbp.

package 
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "hardware_interfaces_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["hardware_interfaces_license"],


hidl_interface 
    name: "android.hardware.automotive.vehicle@2.0",
    root: "android.hardware",
    srcs: [
        "types.hal",
        "IVehicle.hal",
        "IVehicleCallback.hal",
    ],
    interfaces: [
        "android.hidl.base@1.0",
    ],
    gen_java: true,

3、时序图

以上是关于IVIVehicleService启动的主要内容,如果未能解决你的问题,请参考以下文章

IVIVehicleService启动

VirtualBox启动模式分析(正常启动/无界面启动/分离式启动)

android 性能优化 -- 启动过程 冷启动 热启动

windows的服务启动类型的延迟启动要系统开机后多少秒才自动启动?

uefi启动中删除多余的启动项

windowsxp软件添加启动项怎么延迟启动?