1# Fake VHAL mode in Car Service
2
3### How to enable fake VHAL mode.
4
5**Note**: Fake VHAL can only be enabled in eng or userdebug build.
6
7For default usage to enable fake VHAL mode, run `enable-fake-vhal.sh` and verify the result shows
8
9```
10Car Service connects to FakeVehicleStub: true
11```
12
13To disable, run `disable-fake-vhal.sh` and verify the result shows
14
15```
16Car Service connects to FakeVehicleStub: false
17```
18
19#### Push ENABLE file and optional custom config files to device
20
211.  Push ENABLE file and optional custom config files.
22
23    Option A. Use the default config file only. Push an empty ENABLE file to device.
24
25    ```
26    $ touch /tmp/ENABLE
27    $ adb push /tmp/ENABLE /data/system/car/fake_vhal_config/ENABLE
28    ```
29
30    Option B. Add custom config file names to ENABLE file. Push both ENABLE file and custom config files to device.
31
32    ```
33    $ echo <custom-config-file-name> > /tmp/ENABLE
34    $ adb push /tmp/ENABLE /data/system/car/fake_vhal_config/ENABLE
35    $ adb push <path-to-file>/<custom-config-file-name> \
36      /data/system/car/fake_vhal_config/<custom-config-file-name>
37    ```
38
39#### Activate fake VHAL mode.
40
411.  Reboot device
42
43    ```
44    $ adb shell stop && adb shell start
45    $ adb wait-for-device # wait until the device is connected.
46    ```
47
481.  Check if Car Service is connecting to fake VHAL.
49
50    ```
51    $ adb shell cmd car_service check-fake-vhal
52    Car Service connects to FakeVehicleStub: true
53    ```
54
551.  Delete ENABLE file from device and restart service to disable fake VHAL.
56
57    ```
58    $ adb shell
59    $ cd data/system/car/fake_vhal_config
60    $ rm ENABLE
61    $ exit
62    $ adb shell stop && adb shell start
63    ```
64