Android Automotive

I’d love to hear about your experiments with sending values via the socket.
Being able to do that would be really valuable when running in an emulator.

1 Like

Thank you so much for your Adding HAL to device helper.
It seems to work, now the service is running correctly.

Problem is on the running tests, the FakeValueGenerator. Got this error :
android.util.AndroidException: INSTRUMENTATION_FAILED:

In fact, it is not on the list of the possible instrumentation.
The output of this command : adb shell pm list instrumentation is instrumentation:org.chromium.webview_shell/.WebViewLayoutTestRunner (target=org.chromium.webview_shell) only.

Maybe this line PRODUCT_PACKAGES += VehicleHALTest did not do anything ?

Maybe. Have you tried running adb install on the apk to manually install the tests?

No I did not. I found the APK and installed it.

The tests are not updating the values on the KitchenSinkApp.

com.android.car.vehiclehal.test.E2ePerformanceTest:…
com.android.car.vehiclehal.test.Obd2FreezeFrameTest:.
com.android.car.vehiclehal.test.Obd2LiveFrameTest:.

Time: 2.407

OK (7 tests)

In fact they finish after 2 seconds.

Are these tests calling the code FakeValueGenerator.cpp that I see in hardware/interfaces/automotive/vehicle ?

EDIT:
Indeed, I noticed that the EmbeddKitchenSinkApp has some problems to connect to the Car.
here is my logcat :
https://gist.github.com/AhmedX6/17213a06b30ef6971107a7ffa9d0b120

Hmm… that’s interesting.
Looks like the Vehicle service crashed.
We were also seeing intermittent dead object exceptions yesterday on master.
I’m wondering if something changed recently.
Not sure, but I’ll let you know if we find the cause.

Thank you. I noticed that there was an exception in line 220 of SensorHalService.java (ArrayIndexOutOfBounds)…

Can you try running adb logcat CAR.SENSOR:* *:S to see what’s going on in there?
Might want to do it on a fresh boot to get early logs too.
adb reboot && adb logcat CAR.SENSOR:* :*S

You might also want to try adding additional logging to that file to get extra visibility into what’s happening.

It’s a misery… CPU is overheating. And I have so much exceptions like that.

CAR.SENSOR.KS: Unrecognized event type: 22
04-11 15:18:51.233  3177  3177 W System.err: java.lang.ArrayIndexOutOfBoundsException: length=0; index=0

I think I will develop my own application that will connect to the car and the Sensor.
You think it’s possible on user application ? Or application must be system ?

What is the best solution ?
I don’t know really if the testRunner is working well. I see some values changing but the app bugs too much.

The best solution is to dig in and figure out what event type 22 is, where it’s coming from, and why the index is out of bounds.

I consistently find it disappointing that the Hikey960 is only supported on the master branch when there’s no guarantee the master branch works at any given moment in time…

Event type 22 should be public static final int SENSOR_TYPE_IGNITION_STATE = 22;

#EDIT
I did develop my own application that connect to Car Service and I think I found where is the problem on KitchenApp, because I don’t have any problem on my own application
Problems come from :
for (Integer sensor : supportedSensors) { ...} at line 128 of SensorTestFragment.java. When adding multiple listeners it makes crash the CarSensorManager, the result is a DeadObjectException.

So in my application I just added one listener on the SPEED and I have no problems.

1 Like

@doitright

Is it possible to get the position using : Location location = lm.getLastKnownLocation(LocationManager.GPS_PROVIDER); with Android Automotive ?

I have plugged a USB GPS but indeed, no ttyUSB0 is mounted. I tested on a Raspberry my USB GPS and I see the ttyUSBO.

Maybe a configuration on Kernel is missing ?

Thanks for help.

So first off, a GPS is not a filesystem, so they are not mounted.
If your GPS isn’t working, the first thing you need to check is the kernel output. Plug it in, and see what the kernel says.

Regarding the device file for the GPS, that would depend on what kind of hardware is in your “USB GPS”. I’ve been working with U-BLOX GPS’s, since they are both inexpensive, and very good. They enumerate as /dev/ttyACMx (and so you will notice that all of my configurations have it set to reflect that path). If yours enumerates as ttyUSB0, then you would have to adjust the configurations (this means GPS HAL, SELINUX policy, and UEVENT configuration) to match yours.

While I can’t possibly enable every possible hardware configuration in the kernel, I can tell you that the kernel (upstream AOSP one, and thus copied into my fork) does have most generic USB-serial drivers enabled. You can’t just guess that something is missing in the kernel until you actually check what the kernel says when you plug the hardware in.

1 Like

Thank for all these explanations.
Here you have the output when I plug my USB GPS.
:confused: $ [ 1249.892694] usb 1-1.2.4: new full-speed USB device number 7 using xhci-hcd
[ 1250.059676] usb 1-1.2.4: New USB device found, idVendor=10c4, idProduct=ea60
[ 1250.067150] usb 1-1.2.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1250.074861] usb 1-1.2.4: Product: CP2102 USB to UART Bridge Controller
[ 1250.081544] usb 1-1.2.4: Manufacturer: Silicon Labs
[ 1250.086627] usb 1-1.2.4: SerialNumber: 0001

Indeed I see in file_contexts line /dev/ttyACM(.*) u:object_r:console_device:s0.
What should I change exactly, I don’t really understand how all that works.

When I say “mounted” I mean that there is no ttyUSB created when I plug the GPS USB.
In file_contexts I see also /dev/ttyUSB(.*) u:object_r:console_device:s0. This one does not work then ?

Everything that says ttyUSB0 is for the AMFM RADIO.

Your hardware is supported by the cp210x driver: https://github.com/torvalds/linux/blob/master/drivers/usb/serial/cp210x.c#L144

To enable that, you will have to set CONFIG_USB_SERIAL_CP210X=y in your kernel config.

Probably isn’t enabled, because its a very unusual part.

1 Like

Everything is correct. I’ll do that, and i’ll let you know. Thanks :smiley:

#EDIT
ttyUSB is now detected :slight_smile: and I get NMEA from GPS :smiley: many thanks !

@doitright Hello,

I have this error that always appears multiple times when I click or when I scroll on the system ?
Do you know where does it happens and why ?

04-16 08:33:49.123 2310 3554 W StreamHAL: Error from HAL stream in function get_presentation_position: Operation not permitted
04-16 08:33:49.123 2310 3554 E modules.usbaudio_hal.hikey: out_write: start_output_stream returned error -22

Thanks.

As per the instructions on my GitHub project, it requires that you use a vantec nba-200u usb sound card.

1 Like

Like this one ?

Sure. That will be fine.

1 Like

@doitright @rubberduck203

Do you know if it’s possible to set a custom size for the whole System UI Android from source even if I compile for 1920x1080 (for example), I would like that Android SystemUI takes 1280x1080 and let other part (640x1080) for another display.
This question has no relation with Automotive especially but I don’t find any solution.
Maybe the SurfaceFlinger or the WindowManager? Do you have an idea ?