1#
2# Copyright (C) 2016 The Android Open-Source Project
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17import /vendor/etc/init/hw/init.${ro.hardware}.usb.rc
18
19on charger
20    # Set runtime stune value
21    write /dev/stune/schedtune.prefer_idle 0
22    write /dev/stune/schedtune.boost 0
23    # Offline CPUs
24    write /sys/devices/system/cpu/cpu2/online 0
25    write /sys/devices/system/cpu/cpu3/online 0
26    write /sys/devices/system/cpu/cpu4/online 0
27    write /sys/devices/system/cpu/cpu5/online 0
28    write /sys/devices/system/cpu/cpu6/online 0
29    write /sys/devices/system/cpu/cpu7/online 0
30    wait /dev/block/platform/soc/${ro.boot.bootdevice}
31    # Enable UFS powersaving
32    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
33    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
34    write /sys/class/typec/port0/port_type sink
35    write /sys/module/lpm_levels/parameters/sleep_disabled N
36
37service vendor.charger /system/bin/charger
38    class charger
39    seclabel u:r:charger:s0
40
41on early-init
42    mount debugfs debugfs /sys/kernel/debug
43    chmod 0755 /sys/kernel/debug
44    # Loading kernel modules in background
45    start vendor.insmod_sh
46
47on init
48    # Disable UFS powersaving
49    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 0
50    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 0
51    write /sys/module/lpm_levels/parameters/sleep_disabled Y
52
53    # QSEE rpmb listener need symlink for bootdevice
54    wait /dev/block/platform/soc/${ro.boot.bootdevice}
55    symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
56
57    # start qseecomd early as we mount system/ vendor/ early
58    # vold needs keymaster that needs qseecomd
59    start vendor.qseecomd
60
61    # Support legacy paths
62    symlink /sdcard /mnt/sdcard
63    symlink /sdcard /storage/sdcard0
64
65    # disable thermal hotplug for thermal
66    write /sys/module/msm_thermal/core_control/enabled 0
67
68    # bring back all cores
69    write /sys/devices/system/cpu/cpu0/online 1
70    write /sys/devices/system/cpu/cpu1/online 1
71    write /sys/devices/system/cpu/cpu2/online 1
72    write /sys/devices/system/cpu/cpu3/online 1
73    write /sys/devices/system/cpu/cpu4/online 1
74    write /sys/devices/system/cpu/cpu5/online 1
75    write /sys/devices/system/cpu/cpu6/online 1
76    write /sys/devices/system/cpu/cpu7/online 1
77    # configure governor settings for little cluster
78    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "schedutil"
79    write /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us 500
80    write /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us 20000
81
82    # configure governor settings for big cluster
83    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor "schedutil"
84    write /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us 500
85    write /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us 20000
86
87    # Set boottime stune value
88    write /dev/stune/schedtune.prefer_idle 1
89    write /dev/stune/schedtune.boost 100
90
91    # set default schedTune value for foreground/top-app
92    write /dev/stune/foreground/schedtune.prefer_idle 1
93    write /dev/stune/top-app/schedtune.boost 10
94    write /dev/stune/top-app/schedtune.prefer_idle 1
95
96    # Setup cpusets used by the VR services.
97    mkdir /dev/cpuset/kernel 0750 root system
98    write /dev/cpuset/kernel/cpus 0
99    write /dev/cpuset/kernel/mems 0
100    chown system system /dev/cpuset/kernel/tasks
101    chmod 0660 /dev/cpuset/kernel/tasks
102
103    mkdir /dev/cpuset/system 0750 root system
104    write /dev/cpuset/system/cpus 0
105    write /dev/cpuset/system/mems 0
106    chown system system /dev/cpuset/system/tasks
107    chmod 0660 /dev/cpuset/system/tasks
108
109    mkdir /dev/cpuset/system/performance 0750 root system
110    write /dev/cpuset/system/performance/cpus 0
111    write /dev/cpuset/system/performance/mems 0
112    chown system system /dev/cpuset/system/performance/tasks
113    chmod 0660 /dev/cpuset/system/performance/tasks
114
115    mkdir /dev/cpuset/system/background 0750 root system
116    write /dev/cpuset/system/background/cpus 0
117    write /dev/cpuset/system/background/mems 0
118    chown system system /dev/cpuset/system/background/tasks
119    chmod 0660 /dev/cpuset/system/background/tasks
120
121    mkdir /dev/cpuset/application 0750 root system
122    write /dev/cpuset/application/cpus 0
123    write /dev/cpuset/application/mems 0
124    chown system system /dev/cpuset/application/tasks
125    chmod 0660 /dev/cpuset/application/tasks
126
127    mkdir /dev/cpuset/application/performance 0750 root system
128    write /dev/cpuset/application/performance/cpus 0
129    write /dev/cpuset/application/performance/mems 0
130    chown system system /dev/cpuset/application/performance/tasks
131    chmod 0660 /dev/cpuset/application/performance/tasks
132
133    mkdir /dev/cpuset/application/background 0750 root system
134    write /dev/cpuset/application/background/cpus 0
135    write /dev/cpuset/application/background/mems 0
136    chown system system /dev/cpuset/application/background/tasks
137    chmod 0660 /dev/cpuset/application/background/tasks
138
139    # Create UDS structure for base VR services.
140    mkdir /dev/socket/pdx 0775 system system
141    mkdir /dev/socket/pdx/system 0775 system system
142    mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
143    mkdir /dev/socket/pdx/system/performance 0775 system system
144    mkdir /dev/socket/pdx/system/vr 0775 system system
145    mkdir /dev/socket/pdx/system/vr/display 0775 system system
146    mkdir /dev/socket/pdx/system/vr/pose 0775 system system
147    mkdir /dev/socket/pdx/system/vr/sensors 0775 system system
148
149    # Disable retention
150    write /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled N
151    write /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled N
152    write /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled N
153    write /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled N
154    write /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled N
155    write /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled N
156    write /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled N
157    write /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled N
158    write /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled N
159    write /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled N
160    write /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled N
161    write /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled N
162
163    # b/37682684 Enable suspend clock reporting
164    write /sys/kernel/debug/clk/debug_suspend 1
165
166    # ZRAM setup
167    write /sys/block/zram0/comp_algorithm lz4
168    write /proc/sys/vm/page-cluster 0
169
170on init
171    setprop vendor.thermal.config thermal_info_config.json
172
173on fs
174    mount_all /vendor/etc/fstab.${ro.hardware} --early
175
176    mkdir /persist/data 0700 system system
177    mkdir /persist/display 0770 system graphics
178    mkdir /persist/rfs 0770 root system
179    mkdir /persist/hlos_rfs 0770 root system
180    mkdir /persist/elabel 0700 system system
181    chmod 0770 /persist/rfs
182    chmod 0770 /persist/rfs/shared
183    chmod 0770 /persist/rfs/msm
184    chmod 0770 /persist/rfs/msm/adsp
185    chown system system /persist/rfs/msm/adsp
186    chmod 0770 /persist/rfs/msm/mpss
187    chown system system /persist/rfs/msm/mpss
188    mkdir /persist/rfs/msm/slpi 0770 system system
189    chmod 0770 /persist/rfs/mdm
190    chmod 0770 /persist/rfs/mdm/adsp
191    chown system system /persist/rfs/mdm/adsp
192    chmod 0770 /persist/rfs/mdm/mpss
193    chown system system /persist/rfs/mdm/mpss
194    mkdir /persist/rfs/mdm/slpi 0770 system system
195    chmod 0770 /persist/rfs/mdm/sparrow
196    chown system system /persist/rfs/mdm/sparrow
197    mkdir /persist/rfs/mdm/tn 0770 system system
198    chmod 0770 /persist/rfs/apq
199    chmod 0770 /persist/rfs/apq/gnss
200    chmod 0770 /persist/hlos_rfs
201
202    # b/78019660 Remove unlabeled persist_rfs_file
203    rm /persist/rfs/msm/mpss/server_check.txt
204
205    # for android.hardware.health@2.0-service.marlin cycle count backup
206    mkdir /persist/battery 0700 system system
207
208    restorecon_recursive /persist
209
210on late-fs
211    # Start devices by sysfs trigger
212    start vendor.devstart_sh
213    # Start services for bootanim
214    start surfaceflinger
215    start bootanim
216    start vendor.hwcomposer-2-1
217    start vendor.configstore-hal
218    start vendor.gralloc-2-0
219
220    # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late
221    # In such case, init won't responce the property_set from hwservicemanager and then
222    # cause services for bootanim not running.
223    wait_for_prop hwservicemanager.ready true
224    # Mount RW partitions which need run fsck
225    mount_all /vendor/etc/fstab.${ro.hardware} --late
226
227    # Required for time_daemon
228    mkdir /persist/time 0770 system system
229
230    # Start time daemon early so that the system time can be set early
231    start vendor.time_daemon
232
233on post-fs
234    # set RLIMIT_MEMLOCK to 64MB
235    setrlimit 8 67108864 67108864
236
237    chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time
238    chown system graphics /sys/devices/virtual/graphics/fb0/idle_time
239    write /sys/devices/virtual/graphics/fb0/idle_time 100
240
241    # Wait qseecomd started
242    wait_for_prop sys.listeners.registered true
243
244on property:sys.listeners.registered=true
245    # load IPA FWs
246    start vendor.ipastart_sh
247
248on post-fs-data
249    # We can start netd here before in is launched in common init.rc on zygote-start
250    start netd
251
252    # b/38048356 Setup debug folders for camera
253    mkdir /data/vendor/camera 0770 camera camera
254
255    # b/38496103 Setup debug folders for display
256    mkdir /data/vendor/display 0770 system graphics
257
258    # b/65834073 Create rfs folder for tftp_server
259    mkdir /data/vendor/tombstones/rfs 0770 root system
260
261    # keep that at the end of on post-fs-data
262    # Set indication (checked by vold) that we have finished this action
263    setprop vold.post_fs_data_done 1
264
265    # Wait until the system time is set
266    wait_for_prop sys.time.set true
267
268# zygote need to be started after otapreopt which will be done on post-fs-data
269on zygote-start
270    # zygote is started in common init.rc
271    # and now we can continue to initialize /data/
272    mkdir /data/tombstones 0771 system system
273    mkdir /tombstones/modem 0771 system system
274    mkdir /tombstones/lpass 0771 system system
275    mkdir /tombstones/wcnss 0771 system system
276    mkdir /tombstones/dsps 0771 system system
277    mkdir /data/misc/qvop 0660 system system
278    mkdir /data/misc/hbtp 0750 system system
279    mkdir /data/misc/seemp 0700 system system
280
281    # Create directory for TZ Apps
282    mkdir /data/misc/qsee 0770 system system
283
284    mkdir /data/media 0770 media_rw media_rw
285    chown media_rw media_rw /data/media
286
287    mkdir /data/vendor/ipa 0770 radio radio
288    chown radio radio /data/vendor/ipa
289
290    # Create the directories used by the Wireless subsystem
291    mkdir /data/misc/wifi 0770 wifi wifi
292    mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
293    mkdir /data/vendor/wifi 0771 wifi wifi
294    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
295    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
296    mkdir /data/misc/dhcp 0770 dhcp dhcp
297    chown dhcp dhcp /data/misc/dhcp
298
299    # Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections
300    # We chown/chmod /persist again so because mount is run as root + defaults
301    chown root system /persist
302    chmod 0771 /persist
303    chown system system /persist/WCNSS_qcom_wlan_nv.bin
304
305    # Trigger WLAN driver load
306    write /sys/kernel/boot_wlan/boot_wlan 1
307
308    #create port-bridge log dir
309    mkdir /data/misc/port_bridge 0770 radio radio
310    chmod 0770 /data/misc/port_bridge
311
312    #create netmgr log dir
313    mkdir /data/vendor/netmgr 0771 radio radio
314    chmod 0771 /data/vendor/netmgr
315
316    # Create the directories used by CnE subsystem
317    mkdir /data/connectivity 0771 system system
318    chown system system /data/connectivity
319
320    # Create the directories used by DPM subsystem
321    mkdir /data/dpm 0771 system system
322    chown system system /data/dpm
323
324    mkdir /data/dpm/nsrm 0771 system system
325    chown system system /data/dpm/nsrm
326
327    # Create directory used by audio subsystem
328    mkdir /data/vendor/audio 0770 audio audio
329
330    # Create directory for audio delta files
331    mkdir /data/vendor/audio/acdbdata 0770 media audio
332    mkdir /data/vendor/audio/acdbdata/delta 0770 media audio
333
334    # Create directory used by the DASH client
335    mkdir /data/misc/dash 0770 media audio
336
337    # Create directory for radio
338    mkdir /data/vendor/radio 0773 system radio
339
340    # Create directory used by display clients
341    mkdir /data/misc/display 0770 system graphics
342
343    # Setup sensors-related directories and permissions
344    mkdir /persist/sensors 0775
345    chown root system /persist/sensors
346    write /persist/sensors/sensors_settings 1
347    chown root system /persist/sensors/sensors_settings
348    chmod 664 /persist/sensors/sensors_settings
349    chown root system /persist/sensors/sns.reg
350    chmod 664 /persist/sensors/sns.reg
351
352    mkdir /data/vendor/sensors 0770
353    chown system system /data/vendor/sensors
354
355    # These files might have been created by root from a prior build - make sure
356    # they are accessible to the sensors daemon
357    chown system system /data/vendor/sensors/cal.bin
358    chown system system /data/vendor/sensors/cal.txt
359
360    # /dev/sensors only supports an ioctl to get the current SLPI timestamp;
361    # allow the sensors daemon to perform this as non-root
362    chown root system /dev/sensors
363    chmod 660 /dev/sensors
364
365    # Mark the copy complete flag to not completed
366    write /data/vendor/radio/copy_complete 0
367    chown radio radio /data/vendor/radio/copy_complete
368    chmod 0660 /data/vendor/radio/copy_complete
369
370    # File flags for prebuilt ril db file
371    write /data/vendor/radio/prebuilt_db_support 1
372    chown radio radio /data/vendor/radio/prebuilt_db_support
373    chmod 0400 /data/vendor/radio/prebuilt_db_support
374    write /data/vendor/radio/db_check_done 0
375    chown radio radio /data/vendor/radio/db_check_done
376    chmod 0660 /data/vendor/radio/db_check_done
377
378    # Create directories for Location services
379    mkdir /data/vendor/location 0770 gps gps
380    mkdir /data/vendor/location/mq 0770 gps gps
381    mkdir /data/vendor/location/xtwifi 0770 gps gps
382
383    # NFC local data and nfcee xml storage
384    mkdir /data/vendor/nfc 0770 nfc nfc
385
386    # b/62837579 elabel directory
387    mkdir /data/misc/elabel 0700 system system
388
389on early-boot
390    # wait for devices
391    wait_for_prop sys.qcom.devup 1
392    # wait for insmod_sh to finish all modules
393    wait_for_prop sys.all.modules.ready 1
394    # Update dm-verity state and set partition.*.verified properties
395    verity_update_state
396
397    # Permission for laser sensor driver
398    chown camera camera /sys/class/wahoo_laser/laser/enable_ps_sensor
399
400    # Permission for Vibrator
401    chown system system /sys/class/leds/vibrator/device/mode
402    chown system system /sys/class/leds/vibrator/device/od_clamp
403    chown system system /sys/class/leds/vibrator/device/rtp_input
404    chown system system /sys/class/leds/vibrator/device/scale
405    chown system system /sys/class/leds/vibrator/device/set_sequencer
406    chown system system /sys/class/leds/vibrator/device/autocal_result
407    chown system system /sys/class/leds/vibrator/device/ctrl_loop
408    chown system system /sys/class/leds/vibrator/device/ol_lra_period
409    chown system system /sys/class/leds/vibrator/device/autocal
410    chown system system /sys/class/leds/vibrator/device/lp_trigger_effect
411
412    # Permission for LED driver
413    chown system system /sys/class/leds/red/on_off_ms
414    chown system system /sys/class/leds/green/on_off_ms
415    chown system system /sys/class/leds/blue/on_off_ms
416    chown system system /sys/class/leds/red/rgb_start
417    chown system system /sys/class/leds/green/rgb_start
418    chown system system /sys/class/leds/blue/rgb_start
419    chown system system /sys/class/graphics/fb0/msm_fb_persist_mode
420
421    # dumpstate needs to read, vendor.health-hal needs to be able to RW
422    chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
423    # HardwareInfo needs to be able to read CC bins
424    chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
425
426    # dumpstate needs to read, vendor.health-hal needs to be able to RW
427    chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full
428    # HardwareInfo needs to be able to read charge_full
429    chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full
430
431on boot
432    mkdir /dev/socket/qmux_radio 0770 radio radio
433    chmod 2770 /dev/socket/qmux_radio
434    mkdir /dev/socket/qmux_audio 0770 media audio
435    chmod 2770 /dev/socket/qmux_audio
436    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
437    chmod 2770 /dev/socket/qmux_bluetooth
438    mkdir /dev/socket/qmux_gps 0770 gps gps
439    chmod 2770 /dev/socket/qmux_gps
440
441    # Create NETMGR daemon socket area
442    mkdir /dev/socket/netmgr 0750 radio radio
443
444    setprop wifi.interface wlan0
445
446    # Assign TCP buffer thresholds to be ceiling value of technology maximums
447    # Increased technology maximums should be reflected here.
448    write /proc/sys/net/core/rmem_max  8388608
449    write /proc/sys/net/core/wmem_max  8388608
450
451    # Update DVR cpusets to boot-time values.
452    write /dev/cpuset/kernel/cpus 0-7
453    write /dev/cpuset/system/cpus 0-7
454    write /dev/cpuset/system/performance/cpus 0-7
455    write /dev/cpuset/system/background/cpus 0-7
456    write /dev/cpuset/system/cpus 0-7
457    write /dev/cpuset/application/cpus 0-7
458    write /dev/cpuset/application/performance/cpus 0-7
459    write /dev/cpuset/application/background/cpus 0-7
460    write /dev/cpuset/application/cpus 0-7
461
462    # Bluetooth
463    chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
464    chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
465    chmod 0660 /sys/class/rfkill/rfkill0/state
466    chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
467    chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
468
469    # Wifi firmware reload path
470    chown wifi wifi /sys/module/wlan/parameters/fwpath
471
472    # default country code
473    setprop ro.boot.wificountrycode 00
474
475    # Make the ftm4 command node writeable from dumpstate
476    chown system system /sys/devices/virtual/input/ftm4_touch/cmd
477
478    # ftm4 VR mode
479    chown system system /sys/devices/virtual/input/ftm4_touch/vrmode
480
481    # WLAN debug access
482    chown system system /d/icnss/stats
483
484service vendor.init-elabel-sh /system/bin/init.elabel.sh
485    class late_start
486    user system
487    group system
488    oneshot
489
490service vendor.init-radio-sh /vendor/bin/init.radio.sh
491    class late_start
492    user radio
493    group root radio
494    oneshot
495
496service vendor.folio_daemon /system/bin/folio_daemon
497    class late_start
498    user system
499    group system uhid
500    disabled
501
502on property:init.svc.zygote=running
503    start vendor.folio_daemon
504
505on property:init.svc.zygote=stopped
506    stop vendor.folio_daemon
507
508on property:vendor.qcom.thermalcfg=*
509    restart vendor.thermal-engine
510
511service vendor.thermal-engine /vendor/bin/thermal-engine -c ${vendor.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
512   class hal
513   user root
514   group root system diag
515   socket thermal-send-client stream 0666 system system
516   socket thermal-recv-client stream 0660 system system
517   socket thermal-recv-passive-client stream 0666 system system
518
519service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
520    socket msm_irqbalance seqpacket 660 root system
521    class core
522    user root
523    group root
524    writepid /dev/cpuset/system-background/tasks
525
526on property:persist.sys.ssr.restart_level=*
527    start vendor.ssr_setup
528
529service vendor.ssr_setup /vendor/bin/ssr_setup
530    oneshot
531    disabled
532
533service vendor.ssr_diag /vendor/bin/ssr_diag
534    class late_start
535    user system
536    group system
537    disabled
538
539service vendor.per_mgr /vendor/bin/pm-service
540    class core
541    user system
542    group system
543    ioprio rt 4
544    shutdown critical
545
546service vendor.per_proxy /vendor/bin/pm-proxy
547    class core
548    user system
549    group system
550    disabled
551
552on property:sys.post_boot.parsed=1
553    # Enable PowerHAL hint processing
554    setprop vendor.powerhal.init 1
555
556on property:sys.boot_completed=1
557    # Set runtime stune value
558    write /dev/stune/schedtune.prefer_idle 0
559    write /dev/stune/schedtune.boost 0
560
561    # Enable power setting and set sys.post_boot.parsed to 1
562    start vendor.power_sh
563
564    # Enable UFS powersaving
565    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
566    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
567    write /sys/module/lpm_levels/parameters/sleep_disabled N
568
569    # Setup final cpuset
570    write /dev/cpuset/top-app/cpus 0-7
571    write /dev/cpuset/foreground/cpus 0-3,6-7
572    write /dev/cpuset/background/cpus 0-1
573    write /dev/cpuset/system-background/cpus 0-3
574    write /dev/cpuset/restricted/cpus 0-3
575
576    # Update DVR cpusets to runtime values.
577    write /dev/cpuset/kernel/cpus 2,3
578    write /dev/cpuset/system/performance/cpus 6-7
579    write /dev/cpuset/system/background/cpus 0-1
580    write /dev/cpuset/system/cpus 0-1,6-7
581    write /dev/cpuset/application/performance/cpus 4-5
582    write /dev/cpuset/application/background/cpus 0-1
583    write /dev/cpuset/application/cpus 0-1,4-5
584
585    # UFS health
586    chmod 755 /sys/kernel/debug/ufshcd0
587    chmod 644 /sys/kernel/debug/ufshcd0/err_state
588    chmod 644 /sys/kernel/debug/ufshcd0/power_mode
589    chmod 644 /sys/kernel/debug/ufshcd0/host_regs
590    chmod 644 /sys/kernel/debug/ufshcd0/show_hba
591    chmod 644 /sys/kernel/debug/ufshcd0/dump_device_desc
592    chmod 644 /sys/kernel/debug/ufshcd0/dump_health_desc
593    chmod 755 /sys/kernel/debug/ufshcd0/stats
594    chmod 644 /sys/kernel/debug/ufshcd0/stats/req_stats
595    chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats
596    chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats
597
598    # QCOM FG SRAM dump for dumpstate
599    chown system system /d/fg/sram/data
600    chown system system /d/fg/sram/count
601    chown system system /d/fg/sram/address
602
603    # com.google.android.hardwareinfo needs to be able to read cycle counts
604    chmod 0666 /sys/class/power_supply/bms/cycle_count_id
605
606    trigger sys-boot-completed-set
607
608# We want one opportunity per boot to enable zram, so we
609# use a trigger we fire from the above stanza. If
610# persist.sys.zram_enabled becomes true after boot,
611# we don't want to run swapon_all at that time.
612on sys-boot-completed-set && property:persist.sys.zram_enabled=1
613    swapon_all /vendor/etc/fstab.${ro.hardware}
614    write /proc/sys/vm/swappiness 100
615
616on property:init.svc.vendor.per_mgr=running
617    start vendor.per_proxy
618
619on shutdown
620    stop vendor.per_proxy
621    # Disable subsystem restart
622    write /sys/module/subsystem_restart/parameters/disable_restart_work 0x9889deed
623
624service vendor.qseecomd /vendor/bin/qseecomd
625   class core
626   user root
627   group root
628   shutdown critical
629
630service vendor.time_daemon /vendor/bin/time_daemon
631   class core
632   user root
633   group root
634
635service vendor.ss_ramdump /vendor/bin/subsystem_ramdump
636    class main
637    user root
638    group root system
639    disabled
640
641on property:persist.sys.ssr.enable_ramdumps=1
642    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
643    mkdir /data/vendor/ssrdump 771 root system
644    mkdir /data/vendor/ramdump 771 root system
645    start vendor.ss_ramdump
646
647on property:persist.sys.ssr.enable_ramdumps=0
648    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
649
650service vendor.sensors /vendor/bin/sensors.qcom
651    class core
652    user system
653    group system
654    # Grants the ability for this daemon to bind IPC router ports so it can
655    # register QMI services
656    capabilities NET_BIND_SERVICE
657
658service vendor.adsprpcd /vendor/bin/adsprpcd
659   class main
660   user media
661   group media
662
663service vendor.irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
664    class core
665    user root
666    oneshot
667
668service vendor.rmt_storage /vendor/bin/rmt_storage
669    class core
670    user root
671    ioprio rt 0
672    shutdown critical
673
674service vendor.tftp_server /vendor/bin/tftp_server
675   class core
676   user root
677   group root system
678
679service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
680    -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 -dd \
681    -g@android:wpa_wlan0
682    #   we will start as root and wpa_supplicant will switch to user wifi
683    #   after setting up the capabilities required for WEXT
684    #   user wifi
685    #   group wifi inet keystore
686    interface android.hardware.wifi.supplicant@1.0::ISupplicant default
687    interface android.hardware.wifi.supplicant@1.1::ISupplicant default
688    interface android.hardware.wifi.supplicant@1.2::ISupplicant default
689    class main
690    socket wpa_wlan0 dgram 660 wifi wifi
691    disabled
692    oneshot
693
694service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l
695   class late_start
696   user system
697   group system inet wifi
698
699service vendor.imsqmidaemon /vendor/bin/imsqmidaemon
700   class main
701   user system
702   socket ims_qmid stream 0660 system radio
703   group radio log diag
704
705service vendor.imsdatadaemon /vendor/bin/imsdatadaemon
706   class main
707   user system
708   socket ims_datad stream 0660 system radio
709   group system wifi radio inet log
710   disabled
711
712on property:vendor.ims.QMI_DAEMON_STATUS=1
713   start vendor.imsdatadaemon
714
715service vendor.ims_rtp_daemon /vendor/bin/ims_rtp_daemon
716   class main
717   user system
718   group radio diag inet log
719   disabled
720
721service vendor.imsrcsservice /vendor/bin/imsrcsd
722   class hal
723   user system
724   group radio diag inet log
725   disabled
726
727on property:vendor.ims.DATA_DAEMON_STATUS=1
728   start vendor.ims_rtp_daemon
729   start vendor.imsrcsservice
730
731service vendor.cnd /vendor/bin/cnd
732   class main
733   user radio
734   group inet system wifi radio wakelock
735
736service vendor.netmgrd /vendor/bin/netmgrd
737    class main
738    user root
739    group root wifi wakelock radio inet
740
741service vendor.port-bridge /vendor/bin/port-bridge
742    class main
743    user radio
744    group radio system inet
745    oneshot
746
747service vendor.ipacm /vendor/bin/ipacm
748    class main
749    user radio
750    group radio inet
751
752service vendor.qti /vendor/bin/qti
753    class main
754    user radio
755    group radio net_raw diag usb net_admin
756
757on property:wc_transport.start_hci=true
758    start vendor.hci_filter
759
760on property:wc_transport.start_hci=false
761    stop vendor.hci_filter
762
763service vendor.loc_launcher /vendor/bin/loc_launcher
764    class late_start
765    group gps inet diag wifi
766
767service vendor.pd_mapper /vendor/bin/pd-mapper
768     class core
769
770service vendor.atfwd /vendor/bin/ATFWD-daemon
771    class late_start
772    user system
773    group system radio
774    disabled
775
776on property:persist.radio.atfwd.start=true
777    start vendor.atfwd
778
779on property:persist.radio.atfwd.start=false
780    stop vendor.atfwd
781
782# b/68982314
783on property:sys.uidcpupower=*
784   write /proc/uid_cpupower/enable 1
785
786on property:sys.uidcpupower=0
787   write /proc/uid_cpupower/enable 0
788
789# bugreport is triggered by holding down volume down, volume up and power
790service bugreport /system/bin/dumpstate -d -p -B -z \
791        -o /data/user_de/0/com.android.shell/files/bugreports/bugreport
792    class main
793    disabled
794    oneshot
795    keycodes 114 115 116
796
797service vendor.chre /vendor/bin/chre
798    class late_start
799    user system
800    group system
801    socket chre seqpacket 0660 root system
802    shutdown critical
803
804service vendor.power_sh /vendor/bin/init.power.sh
805    class main
806    user root
807    group root system
808    disabled
809    oneshot
810
811service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh
812    class main
813    user root
814    group root system
815    disabled
816    oneshot
817
818service vendor.ipastart_sh /vendor/bin/init.qcom.ipastart.sh
819    class main
820    user system
821    group net_admin
822    disabled
823    oneshot
824
825service vendor.insmod_sh /vendor/bin/init.insmod.sh
826    class main
827    user root
828    group root system
829    disabled
830    oneshot
831
832# charger driver exposes now finer grain control, map demo mode to those properties
833# demo mode can only be exit wipping data which will also reset the persist properties
834on property:sys.retaildemo.enabled=1
835    setprop persist.vendor.charge.stop.level 35
836    setprop persist.vendor.charge.start.level 30
837
838on property:sys.boot_completed=1
839    # Create pixel-trace.
840    # At this moment, only mm_event is available. If others want to put more,
841    # it should get hard review from pixel-perf-team.
842
843    mkdir /sys/kernel/debug/tracing/instances/pixel-trace 755 system system
844    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/trace
845    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/trace
846    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
847    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
848    write /sys/kernel/debug/tracing/instances/pixel-trace/buffer_size_kb 64
849    write /sys/kernel/debug/tracing/instances/pixel-trace/events/mm_event/enable 1
850
851# turns off tracing right before bugreporting to keep more traces
852on property:init.svc.dumpstatez=running
853    write /d/tracing/instances/pixel-trace/tracing_on 0
854
855on property:init.svc.dumpstatez=stopped
856    write /d/tracing/instances/pixel-trace/tracing_on 1
857
858on property:init.svc.bugreport=running
859    write /d/tracing/instances/pixel-trace/tracing_on 0
860
861on property:init.svc.bugreport=stopped
862    write /d/tracing/instances/pixel-trace/tracing_on 1
863
864# init-fingerprint-sh is for stopping fps_hal after init retry fail serval times
865# It keeps running until max init retry or fps_hal running successfully
866# vendor.fps_hal restarts until max init retry times
867#
868# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
869service init-fingerprint-sh /vendor/bin/init.fingerprint.sh 10
870    group root
871    user root
872    disabled
873    oneshot
874
875on property:sys.boot_completed=1
876    start init-fingerprint-sh
877
878on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
879    start init-fingerprint-sh
880