1# Tangorpro specific init.rc
2import /vendor/etc/init/hw/init.gs201.rc
3
4on init && property:ro.build.flavor=tangorpro-userdebug
5    import /vendor/etc/init/hw/init.tangorpro.userdebug.rc
6
7on init && property:ro.vendor.factory=1
8    import /vendor/etc/init/hw/init.factory.rc
9
10on init
11    # Load FPC's internal lib
12    setprop ro.hardware.fingerprint "fpc"
13
14# When ro.build.flavor=factory_tangorpro-userdebug, add vendor/bin/factory to default path
15on init && property:ro.build.flavor=factory_tangorpro-userdebug
16    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
17
18on early-boot
19    # Wait for insmod_sh to finish all common modules
20    wait_for_prop vendor.common.modules.ready 1
21    start insmod_sh_tangorpro
22
23service insmod_sh_tangorpro /vendor/bin/insmod.sh /vendor/etc/init.insmod.tangorpro.cfg
24    class main
25    user root
26    group root system
27    disabled
28    oneshot
29
30on boot && property:ro.build.flavor=factory_tangorpro-userdebug
31    # FTM log folder
32    mkdir /data/ftmlog 0775 system system
33
34    # Audio test folder
35    mkdir /data/AudioTest 0775 system system
36
37    # Led calibration folder
38    mkdir /mnt/vendor/persist/led 0770 system system
39
40on property:vendor.mfgapi.touchpanel.permission=1
41    chmod 0600 /sys/devices/virtual/sec/tsp/cmd
42    chown system system /sys/devices/virtual/sec/tsp/cmd
43
44# Touch
45on property:vendor.device.modules.ready=1
46    chown system system /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/force_touch_active
47    chown system system /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/nvt_dttw_mode
48    chown system system /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/nvt_fw_history
49    chown system system /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/nvt_high_sensi_mode
50    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/v4l2_enabled
51    chown system system /sys/devices/virtual/goog_touch_interface/gti.0/offload_enabled
52    chown system system /proc/nvt_baseline
53    chown system system /proc/nvt_diff
54    chown system system /proc/nvt_heatmap
55    chown system system /proc/nvt_raw
56
57on property:vendor.all.modules.ready=1 && property:persist.sys.tap_gesture=
58    write /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/nvt_dttw_mode 1
59    write /sys/devices/platform/exynos-drm/primary-panel/force_power_on 1
60
61on property:vendor.all.modules.ready=1 && property:persist.sys.tap_gesture=1
62    write /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/nvt_dttw_mode 1
63    write /sys/devices/platform/exynos-drm/primary-panel/force_power_on 1
64
65on property:vendor.all.modules.ready=1 && property:persist.sys.tap_gesture=0
66    write /sys/devices/platform/10d10000.spi/spi_master/spi0/spi0.0/input/nvt_touch/nvt_dttw_mode 0
67    write /sys/devices/platform/exynos-drm/primary-panel/force_power_on 0
68
69on property:vendor.all.modules.ready=1 && property:ro.build.flavor=factory_tangorpro-userdebug
70    write /sys/devices/virtual/goog_touch_interface/gti.0/v4l2_enabled 0
71    write /sys/devices/virtual/goog_touch_interface/gti.0/offload_enabled 0
72    setprop persist.sys.tap_gesture 0
73
74# Start the twoshay touch service
75on property:vendor.device.modules.ready=1
76    start twoshay
77
78# Fingerprint
79on post-fs-data
80    # Fingerprint
81    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/clk_enable
82    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/hw_reset
83    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/irq
84    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/wakeup_enable
85
86# Permissions for hwcomposer
87on fs
88    chown system system /sys/class/backlight/panel0-backlight/cabc_mode
89
90# Castauth
91on property:ro.vendor.trusty.storage.fs_ready=1
92    exec_background - system shell -- /vendor/bin/trusty_apploader /vendor/firmware/cast_auth.app
93
94# Wifi
95on post-fs-data
96    setprop wifi.direct.interface p2p-dev-wlan0
97    setprop wifi.aware.interface aware_nmi0
98
99# Audio
100on post-fs-data
101    chmod 644 /mnt/vendor/persist/audio/speaker.cal
102    chmod 644 /mnt/vendor/persist/audio/speaker.diag
103
104on init && property:ro.bootmode=charger
105    write /sys/devices/platform/19000000.aoc/dmic_power_enable 0
106
107# Thermal
108on property:vendor.thermal.link_ready=1
109    chown system system /dev/thermal/tz-by-name/charger_skin_therm/trip_point_0_temp
110    chown system system /dev/thermal/tz-by-name/charger_skin_therm/trip_point_0_hyst
111    chown system system /dev/thermal/tz-by-name/disp_therm/trip_point_0_temp
112    chown system system /dev/thermal/tz-by-name/disp_therm/trip_point_0_hyst
113    chown system system /dev/thermal/tz-by-name/neutral_therm/trip_point_0_temp
114    chown system system /dev/thermal/tz-by-name/neutral_therm/trip_point_0_hyst
115
116# Pogo
117on post-fs
118    chown root system /sys/devices/platform/google,pogo/move_data_to_usb
119    chown system system /sys/devices/platform/google,pogo/hall1_s
120    chown system system /sys/devices/platform/google,pogo/hall1_n
121    chown system system /sys/devices/platform/google,pogo/hall2_s
122    chmod 664 /sys/devices/platform/google,pogo/move_data_to_usb
123    chmod 600 /sys/devices/platform/google,pogo/hall1_s
124    chmod 600 /sys/devices/platform/google,pogo/hall1_n
125    chmod 600 /sys/devices/platform/google,pogo/hall2_s
126
127# Set/Clear force_pogo feature
128on property:persist.vendor.usb.force_pogo=1
129    write /sys/devices/platform/google,pogo/force_pogo 1
130
131on property:persist.vendor.usb.force_pogo=0
132    write /sys/devices/platform/google,pogo/force_pogo 0
133
134# Sensor
135on init && property:ro.bootmode=charger
136    write /sys/devices/platform/19000000.aoc/sensor_power_enable 0
137