Debugging the VHAL

This article explains how to get debug information while developing the VHAL:

  • Dump the current status of the VHAL.
  • Include the VHAL process dump in dumpstate.

When both are enabled, each item is included in adb bugreport.

In addition, by registering with Watchdog, runtime VHAL status can be retrieved if it is not in good condition.

Dump VHAL debug info

Implement debug for IVehicle.hal

IVehicle::debug is called when lshal debug <interface> <options> is invoked. You can dump the VHAL internal state or take the required actions to VHAL based on options.

Return<void> VehicleHal::debug(const hidl_handle& handle, const hidl_vec<hidl_string>& options) {
    if (handle.getNativeHandle() == nullptr || handle->numFds < 1) {
        ALOGE("Invalid parameters passed to debug()");
        return Void();

    int fd = handle->data[0];

    // Process options
    if (options.size() == 0) {
        return Void();
    std::string option = options[0];
    if (EqualsIgnoreCase(option, "--help")) {
    } else if (EqualsIgnoreCase(option, "--whateveroption")) {
        do_whatever_needed(fd, option);
    } else {
        dprintf(fd, "Invalid option: %s\n", option.c_str());

    return Void();

Dump the VHAL

Use lshal to dump the VHAL. The system privilege is needed.

shell$ adb shell lshal debug android.hardware.automotive.vehicle@2.0::IVehicle

Include HAL process dump in dumpstate

In the Android 10 QPR2 release, HALs can be included in the process dump when dumpstate (or bugreport) is initiated.

Setup configuration

Configure an SELinux policy

Add dump_extra_hal(hal_server_domain) in dumpstate.te. If dumpstate.te doesn't exist in the vendorsepolicy folder, create dumpstate.te.

shell$ cat dumpstate.te

List HAL interfaces

Add HAL interface names to the system property ro.dump.hals.extra. Numerous names are comma-separated. or product makefile are optimal locations for these items.

shell$ % cat

Dump HAL processes

To capture the system statusCall, call adb shell dumpstate or adb bugreport. The output will contain the process dump of the specified HAL interfaces.

Enable Watchdog to monitor VHAL health

Watchdog monitors the health status of registered clients and dumps or terminates registered clients when they become unhealthy. To register VHAL with Watchdog, see Watchdog.