1# Lynx specific init.rc
2import /vendor/etc/init/hw/init.gs201.rc
3
4on init
5    # NFC streset tool name
6    setprop persist.vendor.nfc.streset libstreset21
7    setprop persist.vendor.se.streset libstreset21
8    setprop dalvik.vm.dexopt.thermal-cutoff 1
9
10# When ro.build.flavor=factory_lynx-userdebug, add vendor/bin/factory to default path
11on init && property:ro.build.flavor=factory_lynx-userdebug
12    export PATH /product/bin:/apex/com.android.runtime/bin:/apex/com.android.art/bin:/system_ext/bin:/system/bin:/system/xbin:/odm/bin:/vendor/bin:/vendor/xbin:/vendor/bin/factory
13
14on early-boot
15    # Wait for insmod_sh to finish all common modules
16    wait_for_prop vendor.common.modules.ready 1
17    start insmod_sh_lynx
18
19service insmod_sh_lynx /vendor/bin/insmod.sh /vendor/etc/init.insmod.lynx.cfg
20    class main
21    user root
22    group root system
23    disabled
24    oneshot
25
26on boot && property:ro.build.flavor=factory_lynx-userdebug
27    # FTM log folder
28    mkdir /data/ftmlog 0775 system system
29
30    # Audio test folder
31    mkdir /data/AudioTest 0775 system system
32
33# Start the twoshay touch service
34on property:vendor.device.modules.ready=1
35    start twoshay
36
37on property:vendor.mfgapi.touchpanel.permission=1
38    chmod 0600 /sys/devices/virtual/sec/tsp/cmd
39    chown system system /sys/devices/virtual/sec/tsp/cmd
40
41# SecureElement eSE2 cts mode
42on property:persist.vendor.se.ese2.mode=ctsmode
43    write /sys/class/st33spi/st33spi/st33spi_state 33
44
45# Allow secure_element group to read / write ST33 SPI state
46on post-fs-data
47    chown secure_element secure_element  /sys/class/st33spi/st33spi/st33spi_state
48    chmod 0660  /sys/class/st33spi/st33spi/st33spi_state
49
50# Wifi
51on property:sys.boot_completed=1
52    write /sys/bus/platform/drivers/cnss2/qcom,cnss-qca6490/fs_ready 1
53
54on property:vendor.all.modules.ready=1 && property:vendor.all.devices.ready=1
55    write /sys/bus/platform/drivers/cnss2/qcom,cnss-qca6490/fs_ready 1
56    # Create directories for wifihal services
57    mkdir /dev/socket/wifihal 0770 wifi wifi
58    chmod 2777 /dev/socket/wifihal
59    # Create directories for Location services
60    mkdir /dev/socket/location 0770 wifi wifi
61    chmod 2777 /dev/socket/location
62    mkdir /dev/socket/location/mq 0770 wifi wifi
63    chmod 2777 /dev/socket/location/mq
64    start vendor.loc_launcher
65
66# Start loc_launcher to launch lowi-server
67service vendor.loc_launcher /system/vendor/bin/loc_launcher
68    class late_start
69    user wifi
70    group wifi
71    disabled
72
73# Start cnss-daemon for CHRE
74service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l
75   class late_start
76   user system
77   group system inet wifi
78
79# Toggle high_sensitivity according to touch_sensitivity_mode
80on property:persist.vendor.touch_sensitivity_mode=0 && property:sys.boot_completed=1
81    write /sys/devices/virtual/goog_touch_interface/gti.0/screen_protector_mode_enabled 0
82
83on property:persist.vendor.touch_sensitivity_mode=1 && property:sys.boot_completed=1
84    write /sys/devices/virtual/goog_touch_interface/gti.0/screen_protector_mode_enabled 1
85
86# For Japan sku, always enforce camera shutter sound
87# Since this property is read by the audio server in system service,
88# it should be written by the system init.
89on property:ro.boot.hardware.sku=G82U8
90    setprop audio.camerasound.force true
91
92# Haptics
93on property:vendor.all.modules.ready=1
94    mkdir /mnt/vendor/persist/haptics 0770 system system
95    chmod 770 /mnt/vendor/persist/haptics
96    chmod 440 /mnt/vendor/persist/haptics/cs40l26.cal
97    chown system system /mnt/vendor/persist/haptics
98    chown system system /mnt/vendor/persist/haptics/cs40l26.cal
99
100    chown system system /sys/bus/i2c/devices/8-0043/calibration/f0_stored
101    chown system system /sys/bus/i2c/devices/8-0043/calibration/q_stored
102    chown system system /sys/bus/i2c/devices/8-0043/calibration/redc_stored
103    chown system system /sys/bus/i2c/devices/8-0043/default/vibe_state
104    chown system system /sys/bus/i2c/devices/8-0043/default/num_waves
105    chown system system /sys/bus/i2c/devices/8-0043/default/f0_offset
106    chown system system /sys/bus/i2c/devices/8-0043/default/owt_free_space
107    chown system system /sys/bus/i2c/devices/8-0043/default/f0_comp_enable
108    chown system system /sys/bus/i2c/devices/8-0043/default/redc_comp_enable
109    chown system system /sys/bus/i2c/devices/8-0043/default/delay_before_stop_playback_us
110
111    enable vendor.vibrator.cs40l26
112