Your HAL will generate a service that can be used in the upper layer. You can check it by running the command adb shell service list | grep 'SERVICE_NAME'.
You need to create an HAL Manager to facilitate communication between the service and your app. Here is an example I created for a Timer HAL:
https://github.com/alvenan/AOSPbenchmark/tree/main/timer_manager
In the Java file, you can see how to create a service instance and make function calls:
https://github.com/alvenan/AOSPbenchmark/blob/main/timer_manager/src/vendor/alvenan/timermanager/TimerManager.java
After compiling the manager, it will create a .jar library in the "out" folder. For example:
/your/path/aosp/out/target/common/obj/JAVA_LIBRARIES/your.package.yourservicemanager_intermediates/classes.jar
Then, you can add this path in Android Studio by going to Build > Edit Libraries and Dependencies > Dependencies. Under "Declared Dependencies," click on '+' and choose "JAR/AAR Dependency." Enter the path of the .jar file in step 1 and apply the changes.
After this, you will be able to instantiate the manager and access the service in your app:
https://github.com/alvenan/AOSPbenchmark/blob/main/bench_test_jni/JavaNativeTestApp/app/src/main/java/vendor/alvenan/javanativetestapp/MainActivity.java#L18
Finally, add your manager to your app's manifest:
https://github.com/alvenan/AOSPbenchmark/blob/main/bench_test_jni/JavaNativeTestApp/app/src/main/AndroidManifest.xml#L17
This is the approach I typically use for my HAL projects. For a more comprehensive overview, you can take a look at my repository:
https://github.com/alvenan/AOSPbenchmark/tree/main
I hope this helps.