1# Felix specific init.rc
2import /vendor/etc/init/hw/init.gs201.rc
3
4on init && property:ro.vendor.factory=1
5    import /vendor/etc/init/hw/init.factory.rc
6
7# SFPS Fingerprint
8on post-fs-data
9    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/clk_enable
10    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/hw_reset
11    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/irq
12    chown system system /sys/devices/platform/odm/odm:fp_fpc1020/wakeup_enable
13
14# Permissions for hwcomposer
15on fs
16    chown system system /sys/class/backlight/panel1-backlight/als_table
17    chown system system /sys/class/backlight/panel1-backlight/brightness
18    chown system system /sys/class/backlight/panel1-backlight/dimming_on
19    chown system system /sys/class/backlight/panel1-backlight/hbm_mode
20    chown system system /sys/class/backlight/panel1-backlight/local_hbm_mode
21    chown system system /sys/class/backlight/panel1-backlight/allow_wakeup_by_state_change
22    chown system system /sys/devices/platform/exynos-drm/secondary-panel/gamma
23    chown system system /sys/devices/platform/exynos-drm/secondary-panel/min_vrefresh
24    chown system system /sys/devices/platform/exynos-drm/secondary-panel/idle_delay_ms
25    chown system system /sys/devices/platform/exynos-drm/secondary-panel/panel_idle
26    chown system system /sys/devices/platform/exynos-drm/secondary-panel/panel_need_handle_idle_exit
27    chown system system /sys/class/dqe1/atc/ambient_light
28    chown system system /sys/class/dqe1/atc/st
29    chown system system /sys/class/dqe1/atc/en
30    chown system system /sys/class/dqe1/atc/lt
31    chown system system /sys/class/dqe1/atc/ns
32    chown system system /sys/class/dqe1/atc/dither
33    chown system system /sys/class/dqe1/atc/pl_w1
34    chown system system /sys/class/dqe1/atc/pl_w2
35    chown system system /sys/class/dqe1/atc/ctmode
36    chown system system /sys/class/dqe1/atc/pp_en
37    chown system system /sys/class/dqe1/atc/upgrade_on
38    chown system system /sys/class/dqe1/atc/tdr_max
39    chown system system /sys/class/dqe1/atc/tdr_min
40    chown system system /sys/class/dqe1/atc/back_light
41    chown system system /sys/class/dqe1/atc/dstep
42    chown system system /sys/class/dqe1/atc/scale_mode
43    chown system system /sys/class/dqe1/atc/threshold_1
44    chown system system /sys/class/dqe1/atc/threshold_2
45    chown system system /sys/class/dqe1/atc/threshold_3
46    chown system system /sys/class/dqe1/atc/gain_limit
47    chown system system /sys/class/dqe1/atc/lt_calc_ab_shift
48    chown system system /sys/devices/platform/1c241000.drmdecon/early_wakeup
49    chmod 0660 /sys/devices/platform/1c241000.drmdecon/early_wakeup
50
51# Touch
52on property:vendor.device.modules.ready=1
53    chown system input /dev/touch_offload_fts
54    chown system input /dev/touch_offload_fts_ext
55    chmod 660 /dev/touch_offload_fts
56    chmod 660 /dev/touch_offload_fts_ext
57    # Start the twoshay touch service
58    start twoshay
59
60# Toggle glove_mode according to touch_sensitivity_mode, only apply to outer panel
61on property:persist.vendor.touch_sensitivity_mode=0 && property:sys.boot_completed=1
62    write /sys/devices/virtual/goog_touch_interface/gti.1/force_active 1
63    write /sys/devices/virtual/goog_touch_interface/gti.1/screen_protector_mode_enabled 0
64    write /sys/devices/virtual/goog_touch_interface/gti.1/force_active 0
65
66on property:persist.vendor.touch_sensitivity_mode=1 && property:sys.boot_completed=1
67    write /sys/devices/virtual/goog_touch_interface/gti.1/force_active 1
68    write /sys/devices/virtual/goog_touch_interface/gti.1/screen_protector_mode_enabled 1
69    write /sys/devices/virtual/goog_touch_interface/gti.1/force_active 0
70
71# Load FPC's internal lib
72on init
73    setprop ro.hardware.fingerprint "fpc"
74    # NFC streset tool name
75    setprop persist.vendor.nfc.streset libstreset21
76    setprop persist.vendor.se.streset libstreset21
77    setprop dalvik.vm.dexopt.thermal-cutoff 1
78
79# When ro.build.flavor=factory_felix-userdebug, add vendor/bin/factory to default path
80on init && property:ro.build.flavor=factory_felix-userdebug
81    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
82
83on early-boot
84    # Wait for insmod_sh to finish all common modules
85    wait_for_prop vendor.common.modules.ready 1
86    start insmod_sh_felix
87    chown system system /sys/class/power_supply/dualbatt/dbatt_stats
88
89service insmod_sh_felix /vendor/bin/insmod.sh /vendor/etc/init.insmod.felix.cfg
90    class main
91    user root
92    group root system
93    disabled
94    oneshot
95
96on boot && property:ro.build.flavor=factory_felix-userdebug
97    # FTM log folder
98    mkdir /data/ftmlog 0775 system system
99
100    # Audio test folder
101    mkdir /data/AudioTest 0775 system system
102
103on property:vendor.mfgapi.touchpanel.permission=1
104    chmod 0600 /sys/devices/virtual/sec/tsp/cmd
105    chown system system /sys/devices/virtual/sec/tsp/cmd
106
107# Thermal
108on property:persist.device_config.vendor_system_native_boot.thermal_proactive_skin=1
109    setprop vendor.thermal.config "thermal_info_config_proactive_skin.json"
110
111on property:vendor.thermal.link_ready=1
112    write /dev/thermal/tz-by-name/skin_therm/trip_point_1_temp 61000
113    write /dev/thermal/tz-by-name/skin_therm/trip_point_2_temp 63000
114
115# Bluetooth
116on post-fs-data
117    chown bluetooth system /proc/bluetooth/timesync
118
119    # Speaker amp permission
120    chmod 644 /mnt/vendor/persist/audio/speaker.cal
121
122# Hall sensor
123on init && property:ro.bootmode=normal
124    write /sys/devices/platform/hall_sensor/enable 0
125
126on init && property:ro.bootmode=unknown
127    write /sys/devices/platform/hall_sensor/enable 0
128
129on init && property:ro.bootmode=factory
130    write /sys/devices/platform/hall_sensor/enable 0
131
132# SecureElement eSE2 cts mode
133on property:persist.vendor.se.ese2.mode=ctsmode
134    write /sys/class/st33spi/st33spi/st33spi_state 33
135
136# Allow secure_element group to read / write ST33 SPI state
137on post-fs-data
138    chown secure_element secure_element  /sys/class/st33spi/st33spi/st33spi_state
139    chmod 0660  /sys/class/st33spi/st33spi/st33spi_state
140
141# charger driver exposes now finer grain control, map demo mode to those properties
142# NOTE: demo mode can only be exit wiping data (which reset the persist properties)
143on property:sys.retaildemo.enabled=1
144    setprop persist.vendor.charge.stop.level 35
145    setprop persist.vendor.charge.start.level 30
146
147# WiFi
148on post-fs-data
149    setprop wifi.direct.interface p2p-dev-wlan0
150    setprop wifi.aware.interface aware_nmi0
151
152# For Japan sku, always enforce camera shutter sound
153# Since this property is read by the audio server in system service,
154# it should be written by the system init.
155on property:ro.boot.hardware.sku=G0B96
156    setprop audio.camerasound.force true
157