[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-03-26 UTC。"],[],[],null,["# HIDL VHAL migration guide\n\nTo migrate an existing **HIDL** VHAL implementation to an **AIDL** VHAL,\nuse the\n[AIDL reference implementation](/docs/automotive/vhal/reference-implementation)\nstructure to implement the `IVehicleHardware` interface.\n\nIf the existing HIDL implementation also follows\n[HIDL reference implementation](https://android.googlesource.com/platform/hardware/interfaces/+/refs/heads/android16-release/automotive/vehicle/2.0/default/impl/vhal_v2_0),\nthe vendor has implemented the `VehicleHal` class. `IVehicleHardware` is\nvery similar to `VehicleHal`.\n| **Note:** AIDL uses different types than HIDL. Some types used in the HIDL implementation must be migrated. For detail, see [Type differences in AIDL](#aidl-diffs) below.\n\n| HIDL VHAL | AIDL VHAL |\n|------------------------------------|----------------------------------------------------------------------|\n| `getAllPropertyConfigs()` | Same as `VehicleHal.listProperties()` |\n| `getValues(callback, requests)` | Can call `VehicleHal.get()` for each request and can call callbacks. |\n| `dump()` | Same as `VehicleHal.dump()` |\n| `checkHealth()` | Can return `VehicleHal.get()` |\n| `registerPropertyChangeCallback()` | Similar to setting `VehicleHal.mOnHalEvent` |\n\nType differences in AIDL\n------------------------\n\nWhen migrating from the HIDL VHAL to the AIDL VHAL, consider these differences.\n\n1. HIDL generates one header file (`types.h`) for all types generated from `types.hal`. AIDL generates one header file for each type. For example, `VehiclePropValue.h` from `VehiclePropValue.aidl`.\n\n As a result, you must include all header files for the types you need. A helper file,\n `VehicleHalTypes.h` in the `VehicleHalUtils` library contains most of\n the common types.\n\n| Instead of ... | Use |\n|----------------|-------------------|\n| `hidl_vec` | `std::vector` |\n| `hidl_string` | `std::string` |\n| `android::sp` | `std::shared_ptr` |\n| `android::wp` | `std::weak_ptr` |\n\n2. All types defined in `types.hal` are the same in AIDL **except** for:\n - `SubscribeFlags` is removed as it's not used because `onPropertySet` is removed\n - `UserFlags` is now defined in `UserInfo.aidl` and should be defined as a flag instead of an enum. A user flag field is an integer that has multiple `UserInfo.USER_FLAG_XXX` bit-or together.\n - `RawValue` in `VehiclePropValue` is renamed as `RawPropValue`\n - `bytes` in `RawValue` is renamed as `byteValues`"]]