1

I'm trying to learn to write Hardware Abstraction Layer (HAL). Here's the path I've taken so far, please correct me if I'm off in any step.

  1. Downloaded AOSP and built it successfully (86%)
  2. Located Vehicle Hal Support Library
  3. Located android.hardware.automotive.vehicle C++ code.

Things I've attempted after that the steps below without succeeding to get those above classes recognized.

  1. Import android.hardware.automotive.vehicle classes in Android Studio for a typical Android App that targets 29 Api Level.
  2. Adding meta tag of android.car app
  3. Copy/Pasting all source code under AOSP /packages/services/Car/
  4. Partially contemplated adding android.hardware.automotive.vehicle@2.0.so Library and trying to access it through JNI (Not so sure about this one).

Please orient me, I see some repositories on github not doing anything special and somehow they're able to import the package in a java class like this.

import android.hardware.automotive.vehicle.V2_0.VehicleHwKeyInputAction;
import android.hardware.automotive.vehicle.V2_0.VehiclePropValue;
import android.hardware.automotive.vehicle.V2_0.VehicleProperty;
import android.hardware.automotive.vehicle.V2_0.VehiclePropertyAccess;

Here

how on earth do they get access to those classes?

Thanks

gerfmarquez
  • 177
  • 2
  • 12
  • I think I partially deduced the answer from this other post, https://stackoverflow.com/questions/58119775/android-studio-car-api Although I'm still doubtful I have to include the whole jar or even if a regular AOSP full build will generate all required jars for the specific package android.hardware.automotive.vehicle – gerfmarquez Nov 30 '20 at 10:40

1 Answers1

0

Vehicle HAL is not meant to be accessed directly from apps. Car Service does that for you.

You have couple options depending on what you're actually trying to accomplish:

  1. Learn to write HAL services - it's like writing a driver for a given hardware (in this case, something that provides car data to Car Service).

  2. Learn to write HAL clients - try modifying EmbeddedKitchenSink app first. Please note you need to build it with AOSP and not in AmdroidStudio since this is a system app (and regular apps doesn't have access to the HAL)

  3. Learn Vehicle APIs - that's what you need car lib for. Details on how to use it: https://stackoverflow.com/a/63321234/14759774

twasilczyk
  • 186
  • 4