1# ICarTelemetry Sample Client
2
3This is a sample vendor service that sends `CarData` to car telemetry service.
4
5## Running
6
7**1. Quick mode - under root**
8
9```
10m -j android.automotive.telemetryd-sampleclient
11
12adb root
13adb remount  # make sure run "adb disable-verity" before remounting
14adb push $ANDROID_PRODUCT_OUT/vendor/bin/android.automotive.telemetryd-sampleclient /system/bin/
15
16adb shell /system/bin/android.automotive.telemetryd-sampleclient --batch-size 1000 --cardata-size 1000 --interval-micros 10
17
18# Then check logcat and dumpsys to verify the results. The following command enables VERBOSE logs.
19adb shell setprop log.tag.android.automotive.telemetryd@1.0 V
20adb logcat -v color -b all -T 1000
21```
22
23**2. Under vendor**
24
25To include it in the final image, add
26`PRODUCT_PACKAGES += android.automotive.telemetryd-sampleclient` to
27`//packages/services/Car/cpp/telemetry/cartelemetryd/products/telemetry.mk` (or other suitable mk file).
28
29```
30# this goes to products/telemetry.mk
31
32PRODUCT_PACKAGES += android.automotive.telemetryd-sampleclient
33```
34
35The sampleclient doesn't automatically start during boot, to start manually, run:
36`adb shell /vendor/bin/android.automotive.telemetryd-sampleclient`.
37
38If you want to test it by running `init`, add these SELinux rules:
39
40```
41# this goes to sepolicy/private/cartelemetryd.te
42
43type cartelemetryd_sample, domain;
44type cartelemetryd_sample_exec, vendor_file_type, exec_type, file_type;
45init_daemon_domain(cartelemetryd_sample)
46```
47
48```
49# this goes to sepolicy/private/file_contexts
50
51/vendor/bin/android\.automotive\.telemetryd-sampleclient  u:object_r:cartelemetryd_sample_exec:s0
52```
53
54And create an `.rc` file:
55
56```
57# File: cartelemetryd-sampleclient.rc
58# Don't forget to add `init_rc: ["cartelemetryd-sampleclient.rc"],` to the Android.bp
59
60service cartelemetryd_sample /vendor/bin/android.automotive.telemetryd-sampleclient
61    class hal
62    user system
63    group system
64    oneshot  # run once, otherwise init keeps restarting it
65    disabled  # do not start automatically
66```
67