1import /vendor/etc/init/hw/init.gs201.usb.rc
2import android.hardware.drm@1.2-service.widevine.rc
3import init.exynos.sensorhub.rc
4
5on early-init && property:ro.debuggable=1
6    # Convert /dev/block/by-name/persist to ext4 on userdebug builds only
7    exec -- /system_ext/bin/convert_to_ext4.sh /dev/block/by-name/persist false
8    mount_all /vendor/etc/fstab.persist --early
9
10on early-init && property:ro.debuggable=0
11    mount_all /vendor/etc/fstab.persist --early
12
13on init
14    # CPU0 cannot be offline
15    chmod 0444 /sys/devices/system/cpu/cpu0/online
16
17    # Set teo as cpu idle governor
18    write /sys/devices/system/cpu/cpuidle/current_governor teo
19    # Disable util-awareness
20    write /proc/vendor_sched/teo_util_threshold "1024 1024 1024"
21
22    # Boot time fs tuning
23    write /sys/block/sda/queue/scheduler bfq
24    write /sys/block/sda/queue/iosched/slice_idle 0
25
26    chown system system /proc/vendor_sched/groups/bg/set_task_group
27    chown system system /proc/vendor_sched/groups/cam/set_task_group
28    chown system system /proc/vendor_sched/groups/fg/set_task_group
29    chown system system /proc/vendor_sched/groups/nnapi/set_task_group
30    chown system system /proc/vendor_sched/groups/sys/set_task_group
31    chown system system /proc/vendor_sched/groups/sys_bg/set_task_group
32    chown system system /proc/vendor_sched/groups/ta/set_task_group
33    chown system system /proc/vendor_sched/groups/rt/set_task_group
34    chown system system /proc/vendor_sched/groups/sf/set_task_group
35    chown system system /proc/vendor_sched/groups/dex2oat/set_task_group
36    chown system system /proc/vendor_sched/groups/cam_power/set_task_group
37    chown system system /proc/vendor_sched/groups/ota/set_task_group
38    chown system system /proc/vendor_sched/groups/bg/set_proc_group
39    chown system system /proc/vendor_sched/groups/cam/set_proc_group
40    chown system system /proc/vendor_sched/groups/fg/set_proc_group
41    chown system system /proc/vendor_sched/groups/nnapi/set_proc_group
42    chown system system /proc/vendor_sched/groups/sys/set_proc_group
43    chown system system /proc/vendor_sched/groups/sys_bg/set_proc_group
44    chown system system /proc/vendor_sched/groups/ta/set_proc_group
45    chown system system /proc/vendor_sched/groups/rt/set_proc_group
46    chown system system /proc/vendor_sched/groups/sf/set_proc_group
47    chown system system /proc/vendor_sched/groups/dex2oat/set_proc_group
48    chown system system /proc/vendor_sched/groups/cam_power/set_proc_group
49    chown system system /proc/vendor_sched/groups/ota/set_proc_group
50    chown system system /proc/vendor_sched/prefer_idle_set
51    chown system system /proc/vendor_sched/prefer_idle_clear
52    chown system system /proc/vendor_sched/pmu_poll_enable
53    chown system system /proc/vendor_sched/pmu_poll_time
54    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold
55    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold
56    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency
57    chown system system /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable
58    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold
59    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold
60    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency
61    chown system system /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable
62    chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/lcpi_threshold
63    chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/spc_threshold
64    chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/limit_frequency
65    chown system system /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/pmu_limit_enable
66    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware
67    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware
68    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware
69    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware
70    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware
71    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware
72    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware
73    chown system system /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware
74
75    chmod 0220 /proc/vendor_sched/groups/bg/set_task_group
76    chmod 0220 /proc/vendor_sched/groups/cam/set_task_group
77    chmod 0220 /proc/vendor_sched/groups/fg/set_task_group
78    chmod 0220 /proc/vendor_sched/groups/nnapi/set_task_group
79    chmod 0220 /proc/vendor_sched/groups/sys/set_task_group
80    chmod 0220 /proc/vendor_sched/groups/sys_bg/set_task_group
81    chmod 0220 /proc/vendor_sched/groups/ta/set_task_group
82    chmod 0220 /proc/vendor_sched/groups/rt/set_task_group
83    chmod 0220 /proc/vendor_sched/groups/sf/set_task_group
84    chmod 0220 /proc/vendor_sched/groups/dex2oat/set_task_group
85    chmod 0220 /proc/vendor_sched/groups/cam_power/set_task_group
86    chmod 0220 /proc/vendor_sched/groups/ota/set_task_group
87    chmod 0220 /proc/vendor_sched/groups/bg/set_proc_group
88    chmod 0220 /proc/vendor_sched/groups/cam/set_proc_group
89    chmod 0220 /proc/vendor_sched/groups/fg/set_proc_group
90    chmod 0220 /proc/vendor_sched/groups/nnapi/set_proc_group
91    chmod 0220 /proc/vendor_sched/groups/sys/set_proc_group
92    chmod 0220 /proc/vendor_sched/groups/sys_bg/set_proc_group
93    chmod 0220 /proc/vendor_sched/groups/ta/set_proc_group
94    chmod 0220 /proc/vendor_sched/groups/rt/set_proc_group
95    chmod 0220 /proc/vendor_sched/groups/sf/set_proc_group
96    chmod 0220 /proc/vendor_sched/groups/dex2oat/set_proc_group
97    chmod 0220 /proc/vendor_sched/groups/cam_power/set_proc_group
98    chmod 0220 /proc/vendor_sched/groups/ota/set_proc_group
99    chmod 0220 /proc/vendor_sched/prefer_idle_set
100    chmod 0220 /proc/vendor_sched/prefer_idle_clear
101    chmod 0220 /proc/vendor_sched/pmu_poll_enable
102    chmod 0220 /proc/vendor_sched/pmu_poll_time
103
104    start vendor.keymaster-4-0
105
106    # ZRAM setup
107    write /sys/block/zram0/comp_algorithm lz77eh
108    write /proc/sys/vm/page-cluster 0
109
110    # Some user code relies on ro.boot.hardware.revision
111    setprop ro.boot.hardware.revision ${ro.revision}
112
113    # Allow PAI targeting per hardware SKU
114    setprop ro.oem.key1 ${ro.boot.hardware.sku}
115
116    # Property used by vintf for sku specific manifests
117    # Property used by NFC for sku specific configurations
118    setprop ro.boot.product.hardware.sku ${ro.boot.hardware.sku}
119
120    # Support legacy paths
121    symlink /data/app /factory
122
123    # Apply network parameters for high data performance.
124    write /proc/sys/net/core/rmem_default 1310720
125    write /proc/sys/net/core/rmem_max 8388608
126    write /proc/sys/net/core/wmem_default 327680
127    write /proc/sys/net/core/wmem_max 8388608
128    write /proc/sys/net/core/optmem_max 20480
129    write /proc/sys/net/core/netdev_max_backlog 10000
130    write /proc/sys/net/ipv4/tcp_rmem "2097152 4194304 8388608"
131    write /proc/sys/net/ipv4/tcp_wmem "262144 524288 8388608"
132    write /proc/sys/net/ipv4/tcp_mem "44259 59012 88518"
133    write /proc/sys/net/ipv4/udp_mem "88518 118025 177036"
134
135    write /sys/class/net/rmnet0/queues/rx-0/rps_cpus fe
136    write /sys/class/net/rmnet1/queues/rx-0/rps_cpus fe
137    write /sys/class/net/rmnet2/queues/rx-0/rps_cpus fe
138    write /sys/class/net/rmnet3/queues/rx-0/rps_cpus fe
139    write /sys/class/net/rmnet4/queues/rx-0/rps_cpus fe
140    write /sys/class/net/rmnet5/queues/rx-0/rps_cpus fe
141    write /sys/class/net/rmnet6/queues/rx-0/rps_cpus fe
142    write /sys/class/net/rmnet7/queues/rx-0/rps_cpus fe
143
144    # Create UDS structure for base VR services.
145    mkdir /dev/socket/pdx 0775 system system
146    mkdir /dev/socket/pdx/system 0775 system system
147    mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
148    mkdir /dev/socket/pdx/system/performance 0775 system system
149    mkdir /dev/socket/pdx/system/vr 0775 system system
150    mkdir /dev/socket/pdx/system/vr/display 0775 system system
151    mkdir /dev/socket/pdx/system/vr/pose 0775 system system
152    mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
153
154    # Boot time 183626384
155    write /proc/vendor_sched/groups/ta/uclamp_min 159
156    write /proc/vendor_sched/groups/ta/prefer_idle 1
157    write /proc/vendor_sched/groups/fg/uclamp_min 159
158    write /proc/vendor_sched/groups/fg/prefer_idle 1
159    write /proc/vendor_sched/groups/sys/uclamp_min 159
160    write /proc/vendor_sched/groups/sys/prefer_idle 1
161
162    # governor setting
163    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor sched_pixel
164    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/up_rate_limit_us 500
165    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_us 5000
166    write /sys/devices/system/cpu/cpu0/cpufreq/sched_pixel/down_rate_limit_scale_pow 2
167    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor sched_pixel
168    write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/up_rate_limit_us 500
169    write /sys/devices/system/cpu/cpu4/cpufreq/sched_pixel/down_rate_limit_us 20000
170    write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor sched_pixel
171    write /sys/devices/system/cpu/cpu6/cpufreq/sched_pixel/up_rate_limit_us 500
172    write /sys/devices/system/cpu/cpu6/cpufreq/sched_pixel/down_rate_limit_us 20000
173
174    # memlat cpuidle awareness setting
175    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/memlat_cpuidle_state_aware 2
176    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/memlat_cpuidle_state_aware 2
177    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/memlat_cpuidle_state_aware 2
178    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/memlat_cpuidle_state_aware 2
179    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/memlat_cpuidle_state_aware 2
180    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/memlat_cpuidle_state_aware 2
181    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/memlat_cpuidle_state_aware 2
182    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/memlat_cpuidle_state_aware 2
183
184    # RT uclamp setting
185    write /proc/sys/kernel/sched_util_clamp_min_rt_default 0
186
187    # change permissions and default values for camera-daemon cpu controller
188    chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.min
189    chown system system /dev/cpuctl/camera-daemon/cpu.uclamp.max
190    chown root root /dev/cpuctl/camera-daemon/cpu.uclamp.latency_sensitive
191    chown system system /dev/cpuctl/camera-daemon/cgroup.procs
192
193    mkdir /dev/cpuset/camera-daemon-high-group
194    write /dev/cpuset/camera-daemon-high-group/cpus 0-7
195    write /dev/cpuset/camera-daemon-high-group/mems 0
196    chown system system /dev/cpuset/camera-daemon-high-group/tasks
197    chmod 0664 /dev/cpuset/camera-daemon-high-group/tasks
198
199    mkdir /dev/cpuset/camera-daemon-mid-group
200    write /dev/cpuset/camera-daemon-mid-group/cpus 0-7
201    write /dev/cpuset/camera-daemon-mid-group/mems 0
202    chown system system /dev/cpuset/camera-daemon-mid-group/tasks
203    chmod 0664 /dev/cpuset/camera-daemon-mid-group/tasks
204
205    mkdir /dev/cpuset/camera-daemon-mid-high-group
206    write /dev/cpuset/camera-daemon-mid-high-group/cpus 0-7
207    write /dev/cpuset/camera-daemon-mid-high-group/mems 0
208    chown system system /dev/cpuset/camera-daemon-mid-high-group/tasks
209    chmod 0664 /dev/cpuset/camera-daemon-mid-high-group/tasks
210
211    write /proc/vendor_sched/groups/cam/prefer_idle 1
212    write /proc/vendor_sched/groups/cam/uclamp_min 1
213
214    chown system system /dev/cpuset/cgroup.procs
215
216    # nanohub sensor
217    chmod 0664 /dev/nanohub
218    chmod 0664 /dev/nanohub_comms
219    chown system system /dev/nanohub
220    chown system system /dev/nanohub_comms
221
222    # Dump maxfg
223    chown system system /sys/class/power_supply/maxfg/m5_model_state
224    chown system system /sys/class/power_supply/maxfg_base/m5_model_state
225    chown system system /dev/maxfg_history
226
227    # Dump eeprom
228    chown system system /sys/devices/platform/10da0000.hsi2c/i2c-15/15-0050/eeprom
229
230    # Loading common kernel modules in background
231    start init_display
232
233    # Charge stats (write 0)
234    chown system system /sys/class/power_supply/battery/charge_stats
235
236    # Pca Charge stats (write 0)
237    chown system system /sys/class/power_supply/pca94xx-mains/device/chg_stats
238
239    # Wireless Charge stats (write 0)
240    chown system system /sys/class/power_supply/wireless/device/charge_stats
241
242    # Thermal Charge stats (write 0)
243    chown system system /sys/devices/platform/google,charger/thermal_stats
244
245    # Google Charger stats (write 0)
246    chown system system /sys/devices/platform/google,charger/charge_stats
247
248    # Permission for wireless charging fan
249    chown system system /sys/devices/platform/google,charger/thermal_dc_fan_alarm
250    chown system system /sys/devices/platform/google,cpm/thermal_mdis_fan_alarm
251
252    # Permission for wireless charging
253    chown system system /sys/class/power_supply/wireless/capacity
254    chown system system /sys/class/power_supply/wireless/device/rtx
255    chown system system /sys/class/power_supply/wireless/device/rxdata
256    chown system system /sys/class/power_supply/wireless/device/txdata
257    chown system system /sys/class/power_supply/wireless/device/rxlen
258    chown system system /sys/class/power_supply/wireless/device/txlen
259    chown system system /sys/class/power_supply/wireless/device/ccreset
260    chown system system /sys/class/power_supply/wireless/device/status
261    chown system system /sys/class/power_supply/wireless/device/version
262    chown system system /sys/class/power_supply/wireless/device/features
263    chown system system /sys/class/power_supply/wireless/device/authtype
264
265    # Adaptive charge
266    chown system system /sys/class/power_supply/battery/charge_deadline
267
268    # Charging policy
269    chown system system /sys/class/power_supply/battery/charging_policy
270
271    # BatteryHealthData
272    chown system system /sys/class/power_supply/battery/first_usage_date
273    chown system system /sys/devices/platform/google,battery/power_supply/battery/swelling_data
274
275    # Battery Defender
276    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_cnt
277    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_dry_run
278    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_enable
279    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_recharge_soc
280    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_trickle_reset_sec
281    chown system system /sys/devices/platform/google,battery/power_supply/battery/bd_clear
282    chown system system /sys/devices/platform/google,battery/power_supply/battery/health_safety_margin
283    chown system system /sys/devices/platform/google,charger/bd_drainto_soc
284    chown system system /sys/devices/platform/google,charger/bd_recharge_soc
285    chown system system /sys/devices/platform/google,charger/bd_recharge_voltage
286    chown system system /sys/devices/platform/google,charger/bd_resume_abs_temp
287    chown system system /sys/devices/platform/google,charger/bd_resume_soc
288    chown system system /sys/devices/platform/google,charger/bd_resume_temp
289    chown system system /sys/devices/platform/google,charger/bd_resume_time
290    chown system system /sys/devices/platform/google,charger/bd_temp_dry_run
291    chown system system /sys/devices/platform/google,charger/bd_temp_enable
292    chown system system /sys/devices/platform/google,charger/bd_trigger_temp
293    chown system system /sys/devices/platform/google,charger/bd_trigger_time
294    chown system system /sys/devices/platform/google,charger/bd_trigger_voltage
295    chown system system /sys/devices/platform/google,charger/bd_clear
296    chown system system /sys/devices/platform/google,charger/bd_state
297    chown system system /sys/devices/platform/google,charger/charge_start_level
298    chown system system /sys/devices/platform/google,charger/charge_stop_level
299    chown system system /sys/devices/platform/google,cpm/dc_ctl
300    # Important to include dd_state as it's used in battery defender in charger mode
301    chown system system /sys/devices/platform/google,charger/dd_state
302    chown system system /sys/devices/platform/google,charger/dd_settings
303
304    # Battery temperature filter
305    chown system system /sys/class/power_supply/battery/temp_filter_enable
306
307    # Power Stats HAL
308    chown system system /dev/bbd_pwrstat
309
310    # Add a boost for NNAPI HAL
311    write /proc/vendor_sched/groups/nnapi/prefer_idle 0
312    write /proc/vendor_sched/groups/nnapi/uclamp_min 512
313
314    # Add memlat governor settings
315    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/polling_interval 10
316    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/polling_interval 10
317    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/polling_interval 10
318    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/polling_interval 10
319    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/polling_interval 10
320    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/polling_interval 10
321    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/polling_interval 10
322    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/polling_interval 10
323    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu0_memlat@17000010/mem_latency/ratio_ceil 400
324    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu1_memlat@17000010/mem_latency/ratio_ceil 400
325    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu2_memlat@17000010/mem_latency/ratio_ceil 400
326    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu3_memlat@17000010/mem_latency/ratio_ceil 400
327    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu4_memlat@17000010/mem_latency/ratio_ceil 2700
328    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu5_memlat@17000010/mem_latency/ratio_ceil 2700
329    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu6_memlat@17000010/mem_latency/ratio_ceil 3200
330    write /sys/class/devfreq/gs_memlat_devfreq:devfreq_mif_cpu7_memlat@17000010/mem_latency/ratio_ceil 3200
331
332    # Set boost_adpf_prio, -1 by default
333    write /proc/vendor_sched/boost_adpf_prio ${persist.device_config.vendor_system_native_boot.boost_adpf_prio:--1}
334
335on late-fs
336    # Start bootanimation class before mount
337    start bootanim
338    class_start animation
339
340    # Mount RW partitions which need run fsck
341    mount_all --late
342
343on post-fs-data
344    # Log data folder
345    mkdir /data/vendor 0771 radio system
346    mkdir /data/vendor/log 0771 radio system
347
348    mkdir /data/exynos/log 0771 radio system
349    mkdir /data/vendor/rild 0771 radio system
350    mkdir /data/vendor/dump 0771 radio system
351
352    # PixelLogger log paths.
353    mkdir /data/vendor/radio 773 system radio
354    mkdir /data/vendor/radio/logs 773 system radio
355    mkdir /data/vendor/radio/logs/always-on 777 system radio
356
357    # Write display frequency config from RadioExt HAL
358
359    # OSC frequency files
360    chown system system /sys/devices/platform/1c2c0000.drmdsim/1c2c0000.drmdsim.0/osc2_clk_khz
361    chmod 0664 /sys/devices/platform/1c2c0000.drmdsim/1c2c0000.drmdsim.0/osc2_clk_khz
362
363    # MIPI frequency files
364    chown system system /sys/devices/platform/1c2c0000.drmdsim/hs_clock
365    chown system system /sys/devices/platform/1c2d0000.drmdsim/hs_clock
366    chmod 0664 /sys/devices/platform/1c2c0000.drmdsim/hs_clock
367    chmod 0664 /sys/devices/platform/1c2d0000.drmdsim/hs_clock
368
369    # IPSEC PIDDIR for VoWiFi
370    mkdir /data/vendor/misc 0771 root system
371    mkdir /data/vendor/misc/vpn 0771 root system
372
373    # Permissions Camera
374    mkdir /data/vendor/camera 0770 system camera
375    mkdir /data/vendor/camera/catpipe 0770 system camera
376    mkdir /data/vendor/camera/video_bokeh_node 0770 system camera
377    chmod 0755 /sys/kernel/debug/tracing
378    restorecon /sys/kernel/debug/tracing/trace_marker
379
380    # ranging sensor
381    chown system system /dev/stmvl53l1_ranging
382    chmod 0660 /dev/stmvl53l1_ranging
383
384    # Factory calibration files
385    chmod 0771 /mnt/vendor/persist/camera
386    chmod 0771 /mnt/vendor/persist/camera/OTP_calibration
387    chmod 0771 /mnt/vendor/persist/camera/pdaf_calibration_data
388    mkdir /mnt/vendor/persist/camera/rear 0770 system system
389    chmod 0771 /mnt/vendor/persist/camera/rear
390
391    # Audio dump and debug
392    mkdir /data/vendor/audio 0770 audio audio
393
394    # Create the directories for Darwinn HAL.
395    mkdir /data/vendor/hal_neuralnetworks_darwinn 0770 system system
396    mkdir /data/vendor/hal_neuralnetworks_darwinn/checksum_cache 0770 system system
397    mkdir /data/vendor/edgetpu 0770 system system
398    mkdir /data/vendor/edgetpu/cache 0770 system system
399
400    # Compatibility path for TPU
401    symlink /dev/janeiro /dev/edgetpu
402
403
404on zygote-start
405    # For PixelLogger configuration file.
406    chmod 0771 /data/vendor/wifi
407    write /proc/vendor_sched/groups/sys/uclamp_min 0
408
409on post-fs-data
410    # Create the directories used by the Wireless subsystem
411    mkdir /data/vendor/wifi 0771 wifi wifi
412    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
413    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
414
415# Gatekeeper data
416    mkdir /data/vendor/gk 0771 system system
417
418# HWC data
419    mkdir /data/vendor/log/hwc 0771 system graphics
420
421# Video data
422    mkdir /data/vendor/media 0700 mediacodec mediacodec
423
424on post-fs-data
425    # GPS
426    mkdir /data/vendor/gps 0771 system system
427    chown system system /data/vendor/gps
428    rm /data/vendor/gps/gps_started
429    rm /data/vendor/gps/glonass_started
430    rm /data/vendor/gps/beidou_started
431    rm /data/vendor/gps/smd_started
432    rm /data/vendor/gps/sv_cno.info
433
434    chown gps system /sys/devices/platform/10940000.spi/spi_master/spi5/spi5.0/nstandby
435    chmod 0664 /dev/ttyBCM
436    chown gps system /dev/ttyBCM
437    chmod 0664 /dev/bbd_control
438    chown gps system /dev/bbd_control
439    chmod 0664 /dev/bbd_patch
440    chown gps system /dev/bbd_patch
441    chmod 0664 /dev/bbd_sensor
442    chown gps system /dev/bbd_sensor
443
444on early-boot
445    # Wait for insmod_sh to finish all common modules
446    wait_for_prop vendor.common.modules.ready 1
447
448    # PCIe link stats for pixelstats
449    chown system system /sys/devices/platform/11920000.pcie/link_stats/complete_timeout_irqs
450    chown system system /sys/devices/platform/11920000.pcie/link_stats/link_down_irqs
451    chown system system /sys/devices/platform/11920000.pcie/link_stats/link_recovery_failures
452    chown system system /sys/devices/platform/11920000.pcie/link_stats/link_up_average
453    chown system system /sys/devices/platform/11920000.pcie/link_stats/link_up_failures
454    chown system system /sys/devices/platform/11920000.pcie/link_stats/pll_lock_average
455    chown system system /sys/devices/platform/14520000.pcie/link_stats/complete_timeout_irqs
456    chown system system /sys/devices/platform/14520000.pcie/link_stats/link_down_irqs
457    chown system system /sys/devices/platform/14520000.pcie/link_stats/link_recovery_failures
458    chown system system /sys/devices/platform/14520000.pcie/link_stats/link_up_average
459    chown system system /sys/devices/platform/14520000.pcie/link_stats/link_up_failures
460    chown system system /sys/devices/platform/14520000.pcie/link_stats/pll_lock_average
461
462    # Dump Battery EEPROM history for pixelstats
463    chown system system /dev/battery_history
464    chmod 0644 /dev/battery_history
465
466    # Permission for logbuffer
467    chown system system /dev/logbuffer_maxfg
468    chown system system /dev/logbuffer_maxfg_base
469    chown system system /dev/logbuffer_maxfg_secondary
470    chown system system /dev/logbuffer_maxfg_monitor
471    chown system system /dev/logbuffer_maxfg_base_monitor
472    chown system system /dev/logbuffer_maxfg_secondary_monitor
473    chown system system /dev/logbuffer_maxq
474    chown system system /dev/logbuffer_rtx
475    chown system system /dev/logbuffer_ssoc
476    chown system system /dev/logbuffer_ttf
477    chown system system /dev/logbuffer_tcpm
478    chown system system /dev/logbuffer_usbpd
479    chown system system /dev/logbuffer_pogo_transport
480    chown system system /dev/logbuffer_wireless
481    chown system system /dev/logbuffer_pca9468
482    chown system system /dev/logbuffer_cpm
483    chown system system /dev/logbuffer_bd
484    chown system system /dev/logbuffer_dual_batt
485    chown system system /dev/logbuffer_cpif
486
487on boot
488
489    # Allow to access debugfs for system:system
490    chmod 0755 /sys/kernel/debug
491    chown system system /sys/kernel/debug
492
493    #setprop ro.radio.noril no
494
495    # default country code
496    setprop ro.boot.wificountrycode 00
497
498    # Set up kernel tracing, but disable it by default
499    chmod 0222 /sys/kernel/debug/tracing/trace_marker
500    write /sys/kernel/debug/tracing/tracing_on 0
501
502    # Change permission for A-Box firmware logs file & GPR dump
503    chown audioserver system /sys/devices/platform/17c50000.abox/reset
504    chown audioserver system /sys/devices/platform/17c50000.abox/service
505    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/gpr
506    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/calliope_sram
507    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/calliope_dram
508    chown audioserver system /sys/devices/platform/17c50000.abox/0.abox_debug/calliope_iva
509    chown audioserver system /sys/kernel/debug/abox/log-00
510
511# Permission for USB SELECT
512    chown system system /sys/class/android_usb/android0/enable
513    chmod 0660 /sys/class/android_usb/android0/enable
514    chown system system /sys/class/android_usb/android0/idVendor
515    chmod 0660 /sys/class/android_usb/android0/idVendor
516    chown system system /sys/class/android_usb/android0/idProduct
517    chmod 0660 /sys/class/android_usb/android0/idProduct
518    chown system system /sys/class/android_usb/android0/f_diag/clients
519    chmod 0660 /sys/class/android_usb/android0/f_diag/clients
520    chown system system /sys/class/android_usb/android0/functions
521    chmod 0660 /sys/class/android_usb/android0/functions
522    chown system system /sys/class/android_usb/android0/bDeviceClass
523    chmod 0660 /sys/class/android_usb/android0/bDeviceClass
524
525# Permission for UART SWITCH
526    chmod 0660 /sys/class/sec/switch/uart_sel
527    chown system system /sys/class/sec/switch/uart_sel
528
529# VTS sysfs file permission
530    chown audioserver system /sys/devices/platform/13810000.vts/vts_svoice_model
531    chown audioserver system /sys/devices/platform/13810000.vts/vts_google_model
532    chmod 0660 /sys/devices/platform/13810000.vts/vts_svoice_model
533    chmod 0660 /sys/devices/platform/13810000.vts/vts_google_model
534
535on property:persist.vendor.radio.no_modem_board=1
536    setprop ro.radio.noril yes
537
538on fs
539    mount_all --early
540
541    # for battery defender
542    mkdir /mnt/vendor/persist/battery 0700 system system
543
544    # for battery defender
545    mkdir /mnt/vendor/persist/battery 0700 system system
546
547    restorecon_recursive /mnt/vendor/persist
548    restorecon_recursive /mnt/vendor/persist/aoc
549    restorecon_recursive /mnt/vendor/persist/audio
550    restorecon_recursive /mnt/vendor/persist/sensors
551    restorecon_recursive /mnt/vendor/persist/battery
552    # Set up display-related directories and permissions
553    # Add restorecon_recursive command to make sure the restorecon label is persist_display_file.
554    restorecon_recursive /mnt/vendor/persist/display
555    mkdir /mnt/vendor/persist/data/sfs 0700 system system
556    mkdir /mnt/vendor/persist/data/tz 0700 system system
557    mkdir /mnt/vendor/persist/touch 0770 system system
558
559# Permissions for ION
560    chmod 0660 /sys/class/ion_cma/ion_video_ext/isolated
561    chown system system /sys/class/ion_cma/ion_video_ext/isolated
562
563# Permissions for hwcomposer
564    chown system system /sys/class/backlight/panel0-backlight/als_table
565    chown system system /sys/class/backlight/panel0-backlight/brightness
566    chown system system /sys/class/backlight/panel0-backlight/dimming_on
567    chown system system /sys/class/backlight/panel0-backlight/hbm_mode
568    chown system system /sys/class/backlight/panel0-backlight/local_hbm_mode
569    chown system system /sys/class/backlight/panel0-backlight/allow_wakeup_by_state_change
570    chown system system /sys/devices/platform/exynos-drm/primary-panel/gamma
571    chown system system /sys/devices/platform/exynos-drm/primary-panel/min_vrefresh
572    chown system system /sys/devices/platform/exynos-drm/primary-panel/idle_delay_ms
573    chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_idle
574    chown system system /sys/devices/platform/exynos-drm/primary-panel/panel_need_handle_idle_exit
575    chown system system /sys/module/drm/parameters/vblankoffdelay
576    chown system system /sys/module/drm/parameters/debug
577    chown system system /sys/class/dqe0/atc/ambient_light
578    chown system system /sys/class/dqe0/atc/st
579    chown system system /sys/class/dqe0/atc/en
580    chown system system /sys/class/dqe0/atc/lt
581    chown system system /sys/class/dqe0/atc/ns
582    chown system system /sys/class/dqe0/atc/dither
583    chown system system /sys/class/dqe0/atc/pl_w1
584    chown system system /sys/class/dqe0/atc/pl_w2
585    chown system system /sys/class/dqe0/atc/ctmode
586    chown system system /sys/class/dqe0/atc/pp_en
587    chown system system /sys/class/dqe0/atc/upgrade_on
588    chown system system /sys/class/dqe0/atc/tdr_max
589    chown system system /sys/class/dqe0/atc/tdr_min
590    chown system system /sys/class/dqe0/atc/back_light
591    chown system system /sys/class/dqe0/atc/dstep
592    chown system system /sys/class/dqe0/atc/scale_mode
593    chown system system /sys/class/dqe0/atc/threshold_1
594    chown system system /sys/class/dqe0/atc/threshold_2
595    chown system system /sys/class/dqe0/atc/threshold_3
596    chown system system /sys/class/dqe0/atc/gain_limit
597    chown system system /sys/class/dqe0/atc/lt_calc_ab_shift
598
599    chown system system /sys/devices/platform/1c240000.drmdecon/early_wakeup
600    chmod 0660 /sys/devices/platform/1c240000.drmdecon/early_wakeup
601    chown system system /sys/devices/platform/1c242000.drmdecon/early_wakeup
602    chmod 0660 /sys/devices/platform/1c242000.drmdecon/early_wakeup
603
604# Copy DRM Key
605#    copy /system/app/wv.keys /factory/wv.keys
606
607# Permission for DRM Key
608#    chmod 0644 /factory/wv.keys
609
610# Permission for flashlight control for HAL3.3
611# The Istor espresso board does not have the flash led h/w, So the below permission line are blocked.
612# If you want to test the flashlight in board which have the flash led h/w, Enable the below blocked lines.
613    chmod 0660 /sys/class/camera/flash/rear_torch_flash
614    chown system camera /sys/class/camera/flash/rear_torch_flash
615#load ecd firmware
616    write /proc/ecd/load_firmware 1
617
618service abox /vendor/bin/main_abox 17c50000.abox
619    class late_start
620    user audioserver
621    group audioserver
622    seclabel u:r:abox:s0
623
624# on userdebug and eng builds, enable kgdb on the serial console
625on property:ro.debuggable=1
626    write /sys/module/kgdboc/parameters/kgdboc ttyFIQ1
627    write /sys/module/fiq_debugger/parameters/kgdb_enable 1
628
629# Touch
630on property:vendor.device.modules.ready=1
631    chown system system /sys/class/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs/get_raw_data
632    chown system system /sys/class/spi_master/spi0/spi0.0/synaptics_tcm.0/sysfs/force_active
633    chown system system /sys/class/spi_master/spi11/spi11.0/stm_fts_cmd
634    chown system system /sys/class/spi_master/spi11/spi11.0/glove_mode
635    chown system system /sys/class/spi_master/spi6/spi6.0/stm_fts_cmd
636    chown system system /sys/class/spi_master/spi6/spi6.0/glove_mode
637    chown system system /sys/devices/virtual/sec/tsp/fw_version
638    chown system system /sys/devices/virtual/sec/tsp/cmd
639    chown system system /sys/devices/virtual/sec/tsp/cmd_result
640    chown system system /sys/devices/virtual/sec/tsp/status
641    # Allow access to touch
642    chown system input /dev/touch_offload
643    chmod 660 /dev/touch_offload
644
645# Route touch_sensitivity_mode to persist
646on property:debug.touch_sensitivity_mode=0
647    setprop persist.vendor.touch_sensitivity_mode 0
648
649on property:debug.touch_sensitivity_mode=1
650    setprop persist.vendor.touch_sensitivity_mode 1
651
652on property:init.svc.vendor.charger=running
653    stop keymaster-4-0
654
655    setprop sys.usb.configfs 1
656    setprop vendor.setup.power 1
657
658    # keep one little and one mid core
659    write /sys/devices/system/cpu/cpu1/online 0
660    write /sys/devices/system/cpu/cpu2/online 0
661    write /sys/devices/system/cpu/cpu3/online 0
662    write /sys/devices/system/cpu/cpu5/online 0
663    write /sys/devices/system/cpu/cpu6/online 0
664    write /sys/devices/system/cpu/cpu7/online 0
665
666on property:sys.boot_completed=1
667    # Enable ZRAM on boot_complete
668    swapon_all /vendor/etc/fstab.${ro.board.platform}
669    write /proc/sys/vm/swappiness 60
670
671    # Adjust watermark level
672    write /proc/sys/vm/watermark_scale_factor 200
673
674    # Back to default VM settings
675    write /proc/sys/vm/dirty_expire_centisecs 3000
676    write /proc/sys/vm/dirty_background_ratio 10
677
678    # Reset DDR frequency
679    write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
680    write /sys/devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/exynos_data/cancel_boot_freq 1
681
682    # Setup final cpuset
683    write /dev/cpuset/top-app/cpus ${persist.device_config.vendor_system_native.top-app_cpuset:-0-7}
684    write /dev/cpuset/foreground/cpus ${persist.device_config.vendor_system_native.foreground_cpuset:-0-3,4-5}
685    write /dev/cpuset/background/cpus ${persist.device_config.vendor_system_native.background_cpuset:-0-3}
686    write /dev/cpuset/system-background/cpus ${persist.device_config.vendor_system_native.system-background_cpuset:-0-3}
687    write /dev/cpuset/restricted/cpus ${persist.device_config.vendor_system_native.restricted_cpuset:-0-3}
688    write /dev/cpuset/camera-daemon/cpus ${persist.device_config.vendor_system_native.camera-daemon_cpuset:-0-7}
689    setprop vendor.powerhal.init 1
690
691    # Setup final cpu.uclamp
692    write /proc/vendor_sched/groups/ta/uclamp_min 1
693    write /proc/vendor_sched/groups/fg/uclamp_min 0
694    write /proc/vendor_sched/groups/sys/prefer_idle 0
695
696    # Set ug group
697    write /proc/vendor_sched/groups/bg/ug 0
698    write /proc/vendor_sched/groups/sys_bg/ug 0
699    write /proc/vendor_sched/groups/ota/ug 0
700    write /proc/vendor_sched/groups/dex2oat/ug 1
701    write /proc/vendor_sched/groups/ta/ug 1
702
703    # Set bg group throttle
704    write /proc/vendor_sched/ug_bg_group_throttle ${persist.device_config.vendor_system_native.ug_bg_group_throttle:-308}
705
706    # Set uclamp.max for some groups, which could indicate cpu importance used in scheduling
707    write /proc/vendor_sched/groups/bg/uclamp_max 512
708    write /proc/vendor_sched/groups/sys_bg/uclamp_max 512
709    write /proc/vendor_sched/groups/ota/uclamp_max 512
710    write /proc/vendor_sched/groups/dex2oat/uclamp_max 615
711
712    # Set PMU freq limit parameters
713    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/lcpi_threshold 2
714    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/spc_threshold 70
715    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/limit_frequency 1401000
716    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/lcpi_threshold 6
717    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/spc_threshold 65
718    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/limit_frequency 1836000
719    write /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/lcpi_threshold 5
720    write /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/spc_threshold 69
721    write /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/limit_frequency 2507000
722    write /proc/vendor_sched/pmu_poll_time 10
723
724    # Disable PMU freq limit
725    write /sys/devices/system/cpu/cpufreq/policy0/sched_pixel/pmu_limit_enable 1
726    write /sys/devices/system/cpu/cpufreq/policy4/sched_pixel/pmu_limit_enable 1
727    write /sys/devices/system/cpu/cpufreq/policy6/sched_pixel/pmu_limit_enable 1
728    write /proc/vendor_sched/pmu_poll_enable 0
729
730    # Make devices on the critical path for suspend/resume asynchronous
731    write /sys/devices/platform/acpm_mfd_bus@18110000/i2c-21/21-002f/power/async "enabled"
732    write /sys/devices/platform/acpm_mfd_bus@18110000/i2c-21/power/async "enabled"
733    write /sys/devices/platform/acpm_mfd_bus@18110000/power/async "enabled"
734    write /sys/devices/platform/acpm_mfd_bus@18100000/i2c-20/20-001f/power/async "enabled"
735    write /sys/devices/platform/acpm_mfd_bus@18100000/i2c-20/power/async "enabled"
736    write /sys/devices/platform/acpm_mfd_bus@18100000/power/async "enabled"
737    write /sys/devices/platform/dbgdev-pd-hsi0/power/async "enabled"
738    write /sys/devices/platform/fixedregulator@0/regulator/regulator.2/power/async "enabled"
739    write /sys/devices/platform/fixedregulator@0/power/async "enabled"
740    write /sys/devices/platform/1e080000.clock-controller/power/async "enabled"
741    write /sys/devices/platform/10840000.pinctrl/power/async "enabled"
742    write /sys/devices/platform/18062080.pd-hsi0/power/async "enabled"
743    write /sys/devices/platform/14460000.pinctrl/power/async "enabled"
744
745    # Setup cpu.shares to throttle background groups (bg ~ 5% sysbg ~ 5% dex2oat ~2.5%)
746    write /dev/cpuctl/background/cpu.shares 1024
747    write /dev/cpuctl/system-background/cpu.shares 1024
748    write /dev/cpuctl/dex2oat/cpu.shares 512
749    write /dev/cpuctl/system/cpu.shares 20480
750    # We only have system and background groups holding tasks and the groups below are empty
751    write /dev/cpuctl/camera-daemon/cpu.shares 20480
752    write /dev/cpuctl/foreground/cpu.shares 20480
753    write /dev/cpuctl/nnapi-hal/cpu.shares 20480
754    write /dev/cpuctl/rt/cpu.shares 20480
755    write /dev/cpuctl/top-app/cpu.shares 20480
756
757    # gvotables for dumpstate
758    chown system system /sys/kernel/debug/gvotables
759
760    # Permission for wireless charging
761    chown system system /sys/class/power_supply/wireless/capacity
762    chown system system /sys/class/power_supply/wireless/device/rtx
763    chown system system /sys/class/power_supply/wireless/device/rxdata
764    chown system system /sys/class/power_supply/wireless/device/txdata
765    chown system system /sys/class/power_supply/wireless/device/rxlen
766    chown system system /sys/class/power_supply/wireless/device/txlen
767    chown system system /sys/class/power_supply/wireless/device/ccreset
768    chown system system /sys/class/power_supply/wireless/device/status
769    chown system system /sys/class/power_supply/wireless/device/version
770
771    # AOC reset permission
772    chown root system /sys/devices/platform/19000000.aoc/reset
773    chmod 0220 /sys/devices/platform/19000000.aoc/reset
774
775    # AOC UDFPS clock compensation permission
776    chown system system /sys/devices/platform/19000000.aoc/control/udfps_set_clock_source
777    chmod 220 /sys/devices/platform/19000000.aoc/control/udfps_set_clock_source
778    chown system system /sys/devices/platform/19000000.aoc/control/udfps_get_osc_freq
779    chmod 440 /sys/devices/platform/19000000.aoc/control/udfps_get_osc_freq
780    chown system system /sys/devices/platform/19000000.aoc/control/udfps_get_disp_freq
781    chmod 440 /sys/devices/platform/19000000.aoc/control/udfps_get_disp_freq
782
783    # Disable GPU firmware logging
784    write /sys/devices/platform/28000000.mali/firmware_config/Log\ verbosity/cur 0
785
786    # write serialno to battery path for pairing
787    write /sys/class/power_supply/battery/dev_sn ${ro.boot.serialno}
788
789    # Reduce pm_freeze_timeout value
790    write /sys/power/pm_freeze_timeout 1000
791
792# IMS WiFi Calling
793    service charonservice /system/vendor/bin/charon
794    class main
795    user root
796    disabled
797    seclabel u:r:charonservice:s0
798
799on property:vendor.charon.exec=1
800    rm /data/vendor/misc/vpn/charon.pid
801    chmod 0666 /dev/tun
802    start charonservice
803
804on property:vendor.charon.exec=0
805    stop charonservice
806    rm /data/vendor/misc/vpn/charon.pid
807
808# charger driver exposes now finer grain control, map demo mode to those properties
809# NOTE: demo mode can only be exit wiping data (which reset the persist properties)
810on property:sys.retaildemo.enabled=1
811    setprop persist.vendor.charge.stop.level 35
812    setprop persist.vendor.charge.start.level 30
813
814# Test Harness Mode default battery profile.
815on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=0
816    setprop persist.vendor.charge.stop.level 70
817    setprop persist.vendor.charge.start.level 35
818    setprop vendor.battery.defender.disable 1
819
820# Extremely restricted battery profile.
821on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=1
822    setprop persist.vendor.charge.stop.level 50
823    setprop persist.vendor.charge.start.level 35
824    setprop vendor.battery.defender.disable 1
825
826# Normal behavior (as if the device was a regular device)
827on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=2
828    setprop persist.vendor.charge.stop.level 100
829    setprop persist.vendor.charge.start.level 0
830
831# Unrestricted, allows charging to 100%
832on  property:persist.sys.test_harness=1 && property:persist.vendor.testing_battery_profile=3
833    setprop persist.vendor.charge.stop.level 100
834    setprop persist.vendor.charge.start.level 0
835    setprop vendor.battery.defender.disable 1
836
837# on userdebug and eng builds, enable scsi error recovery log
838on property:ro.debuggable=1
839    write /sys/module/scsi_mod/parameters/scsi_logging_level 63
840
841service init_display /vendor/bin/init.display.sh
842    class main
843    user root
844    group root system
845    disabled
846    oneshot
847
848# bugreport is triggered by holding down volume down, volume up and power
849service bugreport /system/bin/dumpstate -d -p -z
850    class main
851    user root
852    disabled
853    oneshot
854    keycodes 114 115 116
855
856# Proxy for Secure Storage
857on post-fs-data
858    mkdir /data/vendor/rebootescrow 0770 hsm hsm
859    mkdir /data/vendor/ss 0770 root system
860    mkdir /mnt/vendor/persist/ss 0770 root system
861    restorecon_recursive /mnt/vendor/persist/ss
862    symlink /mnt/vendor/persist/ss /data/vendor/ss/persist
863    chown root system /data/vendor/ss/persist
864    chmod 0770 /data/vendor/ss/persist
865    chown system system /data/vendor/ss/persist/nsp
866
867    restart storageproxyd
868
869service storageproxyd /vendor/bin/storageproxyd -d /dev/trusty-ipc-dev0 \
870        -r /dev/sg1 -p /data/vendor/ss -t ufs
871    class early_hal
872    user system
873    group system
874
875# Write build info to kdebuginfo
876on property:ro.build.fingerprint=*
877    write /sys/module/debug_kinfo/parameters/build_info ${ro.build.fingerprint}
878
879# Bluetooth
880on early-boot
881    chown bluetooth system /sys/devices/platform/175b0000.serial/serial0/serial0-0/bluetooth/hci0/rfkill0/state
882    chown bluetooth system /sys/devices/platform/odm/odm:btbcm/rfkill/rfkill0/state
883    chown bluetooth system /sys/devices/platform/odm/odm:btbcm/rfkill/rfkill2/state
884
885on post-fs-data
886    chown bluetooth system /proc/bluetooth/sleep/btwake
887    chown bluetooth system /proc/bluetooth/sleep/lpm
888    chown bluetooth system /proc/bluetooth/sleep/btwrite
889    mkdir /data/vendor/bluetooth 0770 bluetooth system
890
891on post-fs-data
892    mkdir /data/vendor/powerstats 0771 system system
893    chown system system /data/vendor/powerstats
894    # Thermal Residency Stats (write 1 to reset)
895    chown system system /sys/kernel/metrics/thermal/tr_by_group/tmu/stats_reset
896    chown system system /sys/kernel/metrics/thermal/tr_by_group/spmic/stats_reset
897
898on property:vendor.brownout.mitigation.ready=1
899    # BCL
900    write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_light_clk_ratio 0x80041c3 #DFS
901    write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu1_heavy_clk_ratio 0xfff041c0 #DFS
902    write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_heavy_clk_ratio 0xfff041c0 #DFS
903    write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_light_clk_ratio 0xfff041c3 #DFS
904    write /sys/devices/virtual/pmic/mitigation/clock_ratio/cpu2_light_clk_ratio 0xfff041c3 #OCP
905    write /sys/devices/virtual/pmic/mitigation/clock_ratio/gpu_heavy_clk_ratio 0xfff04385 #OCP
906    write /sys/devices/virtual/pmic/mitigation/clock_ratio/tpu_heavy_clk_ratio 0xfff041c1 #OCP
907    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/uvlo1_lvl 3200
908    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/smpl_lvl 3100
909    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/uvlo2_lvl 3000
910    write /sys/devices/virtual/pmic/mitigation/triggered_lvl/soft_ocp_cpu2_lvl 12000
911    write /sys/devices/virtual/pmic/mitigation/clock_div/tpu_clk_div 0x1
912    write /sys/devices/virtual/pmic/mitigation/clock_div/gpu_clk_div 0x1
913    write /sys/devices/virtual/pmic/mitigation/clock_div/cpu1_clk_div 0x381
914    write /sys/devices/virtual/pmic/mitigation/clock_div/cpu2_clk_div 0x1
915
916on property:vendor.thermal.link_ready=1
917    # BCL
918    chown system system /dev/thermal/tz-by-name/soc/mode
919    chown system system /dev/thermal/tz-by-name/vdroop2/trip_point_0_temp
920    chown system system /dev/thermal/tz-by-name/vdroop2/trip_point_0_hyst
921    chown system system /dev/thermal/tz-by-name/vdroop1/trip_point_0_temp
922    chown system system /dev/thermal/tz-by-name/vdroop1/trip_point_0_hyst
923    chown system system /dev/thermal/tz-by-name/smpl_gm/trip_point_0_temp
924    chown system system /dev/thermal/tz-by-name/smpl_gm/trip_point_0_hyst
925    chown system system /dev/thermal/tz-by-name/ocp_cpu1/trip_point_0_temp
926    chown system system /dev/thermal/tz-by-name/ocp_cpu1/trip_point_0_hyst
927    chown system system /dev/thermal/tz-by-name/ocp_cpu2/trip_point_0_temp
928    chown system system /dev/thermal/tz-by-name/ocp_cpu2/trip_point_0_hyst
929    chown system system /dev/thermal/tz-by-name/ocp_tpu/trip_point_0_temp
930    chown system system /dev/thermal/tz-by-name/ocp_tpu/trip_point_0_hyst
931    chown system system /dev/thermal/tz-by-name/ocp_gpu/trip_point_0_temp
932    chown system system /dev/thermal/tz-by-name/ocp_gpu/trip_point_0_hyst
933    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu1/trip_point_0_temp
934    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu1/trip_point_0_hyst
935    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu2/trip_point_0_temp
936    chown system system /dev/thermal/tz-by-name/soft_ocp_cpu2/trip_point_0_hyst
937    chown system system /dev/thermal/tz-by-name/soft_ocp_tpu/trip_point_0_temp
938    chown system system /dev/thermal/tz-by-name/soft_ocp_tpu/trip_point_0_hyst
939    chown system system /dev/thermal/tz-by-name/soft_ocp_gpu/trip_point_0_temp
940    chown system system /dev/thermal/tz-by-name/soft_ocp_gpu/trip_point_0_hyst
941    chown system system /dev/thermal/tz-by-name/soc/trip_point_0_temp
942    chown system system /dev/thermal/tz-by-name/soc/trip_point_0_hyst
943    chown system system /dev/thermal/tz-by-name/batoilo/trip_point_0_temp
944    chown system system /dev/thermal/tz-by-name/batoilo/trip_point_0_hyst
945    # Thermal
946    chown system system /dev/thermal/tz-by-name/skin_therm/trip_point_0_temp
947    chown system system /dev/thermal/tz-by-name/skin_therm/trip_point_0_hyst
948    chown system system /dev/thermal/tz-by-name/skin_therm1/trip_point_0_temp
949    chown system system /dev/thermal/tz-by-name/skin_therm1/trip_point_0_hyst
950    chown system system /dev/thermal/tz-by-name/quiet_therm/trip_point_0_temp
951    chown system system /dev/thermal/tz-by-name/quiet_therm/trip_point_0_hyst
952    chown system system /dev/thermal/tz-by-name/usb_pwr_therm2/trip_point_0_temp
953    chown system system /dev/thermal/tz-by-name/usb_pwr_therm2/trip_point_0_hyst
954    chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_temp
955    chown system system /dev/thermal/tz-by-name/usb_pwr_therm/trip_point_0_hyst
956    chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote
957    chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-0/user_vote
958    chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote
959    chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-1/user_vote
960    chmod 664 /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote
961    chown system system /dev/thermal/cdev-by-name/thermal-cpufreq-2/user_vote
962    chmod 664 /dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote
963    chown system system /dev/thermal/cdev-by-name/thermal-gpufreq-0/user_vote
964    chmod 664 /dev/thermal/cdev-by-name/tpu_cooling/user_vote
965    chown system system /dev/thermal/cdev-by-name/gxp-cooling/user_vote
966    chown system system /dev/thermal/cdev-by-name/tpu_cooling/user_vote
967    chmod 664 /dev/thermal/cdev-by-name/fcc/cur_state
968    chown system system /dev/thermal/cdev-by-name/fcc/cur_state
969    chmod 664 /dev/thermal/cdev-by-name/dc_icl/cur_state
970    chown system system /dev/thermal/cdev-by-name/dc_icl/cur_state
971    chmod 664 /dev/thermal/cdev-by-name/wlc_fcc/cur_state
972    chown system system /dev/thermal/cdev-by-name/wlc_fcc/cur_state
973    chmod 664 /dev/thermal/cdev-by-name/chg_mdis/cur_state
974    chown system system /dev/thermal/cdev-by-name/chg_mdis/cur_state
975    chmod 664 /dev/thermal/cdev-by-name/usbc-port/cur_state
976    chown system system /dev/thermal/cdev-by-name/usbc-port/cur_state
977
978on charger
979    # Use charger thermal config
980    setprop vendor.thermal.config "thermal_info_config_charge.json"
981
982    # Wait for insmod_sh to finish all common modules
983    wait_for_prop vendor.common.modules.ready 1
984
985    # Create thermal symlink in off charging mode
986    mkdir /dev/thermal 0750 system system
987    mkdir /dev/thermal/tz-by-name 0750 system system
988    mkdir /dev/thermal/cdev-by-name 0750 system system
989    start vendor.thermal.symlinks
990
991    # Cancel boot devfreq and uclamp
992    write /sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/exynos_data/cancel_boot_freq 1
993    write /sys/devices/platform/17000020.devfreq_int/devfreq/17000020.devfreq_int/exynos_data/cancel_boot_freq 1
994    write /proc/vendor_sched/groups/ta/uclamp_min 0
995    write /proc/vendor_sched/groups/ta/prefer_idle 0
996    write /proc/vendor_sched/groups/fg/uclamp_min 0
997    write /proc/vendor_sched/groups/fg/prefer_idle 0
998    write /proc/vendor_sched/groups/sys/uclamp_min 0
999    write /proc/vendor_sched/groups/sys/prefer_idle 0
1000
1001    # Enable SICD
1002    write /sys/devices/system/cpu/cpupm/cpupm/sicd 1
1003
1004on property:vendor.disable.bcl.control=1
1005    write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 0
1006
1007on property:vendor.disable.bcl.control=0
1008    write /sys/devices/virtual/pmic/mitigation/instruction/enable_mitigation 1
1009
1010# UDFPS
1011on post-fs-data && property:ro.vendor.factory=1
1012    # HBM mode for UDFPS factory apk
1013    chmod 666 /d/dri/0/DSI-1/panel/reg/payload
1014    chmod 666 /d/dri/0/DSI-1/panel/reg/count
1015    chmod 666 /d/dri/0/DSI-1/panel/reg/address
1016    chmod 666 /d/dri/0/DSI-1/panel/hbm_mode
1017    chmod 666 /sys/class/backlight/panel0-backlight/local_hbm_max_timeout
1018    chmod 666 /sys/class/backlight/panel0-backlight/local_hbm_mode
1019    chmod 666 /sys/class/backlight/panel0-backlight/hbm_mode
1020
1021# Persistent Soft Max Freq overrides
1022on property:persist.vendor.softmaxfreq.cl0=*
1023    write /sys/devices/platform/exynos-acme/freq_qos_max "0 ${persist.vendor.softmaxfreq.cl0}"
1024
1025on property:persist.vendor.softmaxfreq.cl1=*
1026    write /sys/devices/platform/exynos-acme/freq_qos_max "4 ${persist.vendor.softmaxfreq.cl1}"
1027
1028on property:persist.vendor.softmaxfreq.cl2=*
1029    write /sys/devices/platform/exynos-acme/freq_qos_max "6 ${persist.vendor.softmaxfreq.cl2}"
1030
1031on property:ro.boot.mode=charger && property:init.svc.vendor.charger=running
1032    # Disable dock-defend in Off Mode Charger
1033    write /sys/devices/platform/google,charger/dd_state -1
1034
1035# Cpuset experiment
1036on property:persist.device_config.vendor_system_native.top-app_cpuset=*
1037    write /dev/cpuset/top-app/cpus ${persist.device_config.vendor_system_native.top-app_cpuset:-0-7}
1038on property:persist.device_config.vendor_system_native.foreground_cpuset=*
1039    write /dev/cpuset/foreground/cpus ${persist.device_config.vendor_system_native.foreground_cpuset:-0-3,4-5}
1040on property:persist.device_config.vendor_system_native.background_cpuset=*
1041    write /dev/cpuset/background/cpus ${persist.device_config.vendor_system_native.background_cpuset:-0-3}
1042on property:persist.device_config.vendor_system_native.system-background_cpuset=*
1043    write /dev/cpuset/system-background/cpus ${persist.device_config.vendor_system_native.system-background_cpuset:-0-3}
1044on property:persist.device_config.vendor_system_native.restricted_cpuset=*
1045    write /dev/cpuset/restricted/cpus ${persist.device_config.vendor_system_native.restricted_cpuset:-0-3}
1046on property:persist.device_config.vendor_system_native.camera-daemon_cpuset=*
1047    write /dev/cpuset/camera-daemon/cpus ${persist.device_config.vendor_system_native.camera-daemon_cpuset:-0-7}
1048