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.boot.hardware.platform}.power.rc
18import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.usb.rc
19import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.diag.rc
20import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.logging.rc
21import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.mpssrfs.rc
22
23
24on property:init.svc.vendor.charger=running
25    # Lock to lowest freqency on charger mode
26    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
27    write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor powersave
28    # keep one LITTLE and one big
29    write /sys/devices/system/cpu/cpu1/online 0
30    write /sys/devices/system/cpu/cpu2/online 0
31    write /sys/devices/system/cpu/cpu3/online 0
32    write /sys/devices/system/cpu/cpu4/online 0
33    write /sys/devices/system/cpu/cpu5/online 0
34    write /sys/devices/system/cpu/cpu7/online 0
35    wait /dev/block/bootdevice
36    write /sys/class/typec/port0/port_type sink
37    write /sys/module/lpm_levels/parameters/sleep_disabled 0
38    # Disable sched_boost
39    write /proc/sys/kernel/sched_boost 0
40    # Enable thermal mitigation
41    write /sys/devices/virtual/thermal/tz-by-name/backup-charge/mode enabled
42
43service vendor.charger /system/bin/charger
44    class charger
45    seclabel u:r:charger:s0
46    user system
47    group system wakelock input
48    capabilities SYS_BOOT
49    file /dev/kmsg w
50    file /sys/fs/pstore/console-ramoops-0 r
51    file /sys/fs/pstore/console-ramoops r
52    file /proc/last_kmsg r
53
54on early-init
55    mount debugfs debugfs /sys/kernel/debug
56    chmod 0755 /sys/kernel/debug
57    # Enable sched_boost
58    write /proc/sys/kernel/sched_boost 1
59
60# Skip init trigger for charger mode
61on early-init && property:ro.boot.mode=charger
62    setprop vendor.skip.init 1
63
64# We need vold early for metadata encryption
65on early-fs
66    start vold
67
68on init && property:vendor.skip.init=0
69    start logd
70
71    # QSEE rpmb listener need symlink for bootdevice
72    wait /dev/block/platform/soc/${ro.boot.bootdevice}
73    symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice
74
75    # start qseecomd early as we mount system/ vendor/ early
76    # vold needs keymaster that needs qseecomd
77    start vendor.qseecomd
78    start keymaster-4-0
79
80    # start Citadel keymaster (StrongBox) early
81    start vendor.citadeld
82    start vendor.keymaster-4-1-citadel
83
84    # Disable powersaving
85    write /sys/module/lpm_levels/parameters/sleep_disabled 1
86
87    # Loading kernel modules in background
88    start insmod_sh
89
90    # Support legacy paths
91    symlink /sdcard /mnt/sdcard
92    symlink /sdcard /storage/sdcard0
93
94    # bring back all cores
95    write /sys/devices/system/cpu/cpu0/online 1
96    write /sys/devices/system/cpu/cpu1/online 1
97    write /sys/devices/system/cpu/cpu2/online 1
98    write /sys/devices/system/cpu/cpu3/online 1
99    write /sys/devices/system/cpu/cpu4/online 1
100    write /sys/devices/system/cpu/cpu5/online 1
101    write /sys/devices/system/cpu/cpu6/online 1
102    write /sys/devices/system/cpu/cpu7/online 1
103
104    # configure governor settings for little cluster
105    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor schedutil
106    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/up_rate_limit_us 500
107    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000
108
109    # configure governor settings for big cluster
110    write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor schedutil
111    write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/up_rate_limit_us 500
112    write /sys/devices/system/cpu/cpu6/cpufreq/schedutil/down_rate_limit_us 20000
113
114    # set default schedTune value for foreground/top-app
115    write /dev/stune/foreground/schedtune.prefer_idle 1
116    write /dev/stune/top-app/schedtune.boost 10
117    write /dev/stune/top-app/schedtune.prefer_idle 1
118
119    mkdir /dev/cpuset/camera-daemon
120    write /dev/cpuset/camera-daemon/cpus 0-7
121    write /dev/cpuset/camera-daemon/mems 0
122    chown system system /dev/cpuset/camera-daemon
123    chown system system /dev/cpuset/camera-daemon/tasks
124    chmod 0664 /dev/cpuset/camera-daemon/tasks
125
126    # b/37682684 Enable suspend clock reporting
127    write /sys/kernel/debug/clk/debug_suspend 1
128
129    # ZRAM setup
130    write /sys/block/zram0/comp_algorithm lz4
131    write /proc/sys/vm/page-cluster 0
132
133    # Some user code relies on ro.boot.hardware.revision
134    setprop ro.boot.hardware.revision ${ro.revision}
135
136    # Thermal config file per product
137    setprop vendor.sys.qcom.thermalcfg /vendor/etc/thermal-engine-${ro.hardware}.conf
138
139    # Allow PAI targeting per hardware SKU
140    setprop ro.oem.key1 ${ro.boot.hardware.sku}
141
142    # Property used by vintf for sku specific manifests
143    setprop ro.boot.product.hardware.sku ${ro.boot.hardware.sku}
144
145    # Battery Defender
146    chown system system /sys/devices/platform/soc/soc:google,charger/charge_stop_level
147    chown system system /sys/devices/platform/soc/soc:google,charger/charge_start_level
148
149on late-init
150    chown system system /sys/devices/virtual/thermal/tz-by-name/mb-therm-monitor/trip_point_0_temp
151    chown system system /sys/devices/virtual/thermal/tz-by-name/mb-therm-monitor/trip_point_0_hyst
152    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_temp
153    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_hyst
154    chown system system /sys/devices/virtual/thermal/tz-by-name/soc/mode
155
156on fs
157    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --early
158
159    mkdir /mnt/vendor/persist/audio 0770 media audio
160    mkdir /mnt/vendor/persist/data 0700 system system
161    mkdir /mnt/vendor/persist/display 0770 system graphics
162    mkdir /mnt/vendor/persist/rfs 0770 root system
163    mkdir /mnt/vendor/persist/hlos_rfs 0770 root system
164    chmod 0770 /mnt/vendor/persist/rfs
165    chmod 0770 /mnt/vendor/persist/rfs/shared
166    chmod 0770 /mnt/vendor/persist/rfs/msm
167    chmod 0770 /mnt/vendor/persist/rfs/msm/adsp
168    chmod 0770 /mnt/vendor/persist/rfs/msm/mpss
169    chmod 0770 /mnt/vendor/persist/rfs/msm/slpi
170    chmod 0770 /mnt/vendor/persist/rfs/mdm
171    chmod 0770 /mnt/vendor/persist/rfs/mdm/adsp
172    chmod 0770 /mnt/vendor/persist/rfs/mdm/mpss
173    chmod 0770 /mnt/vendor/persist/rfs/mdm/slpi
174    chmod 0770 /mnt/vendor/persist/rfs/mdm/tn
175    chmod 0770 /mnt/vendor/persist/rfs/apq
176    chmod 0770 /mnt/vendor/persist/rfs/apq/gnss
177    chmod 0770 /mnt/vendor/persist/hlos_rfs
178    restorecon /mnt/vendor/persist/rfs
179    restorecon /mnt/vendor/persist/hlos_rfs
180    restorecon_recursive /mnt/vendor/persist/
181
182    # for cycle count backup
183    mkdir /mnt/vendor/persist/battery 0700 system system
184
185on late-fs
186    # Start devices by sysfs trigger, including sensor related script.
187    start devstart_sh
188
189    # Start services for bootanim
190    start vendor.power-hal-1-3
191    start surfaceflinger
192    start bootanim
193    start vendor.hwcomposer-2-2
194    start vendor.configstore-hal
195    start vendor.qti.hardware.display.allocator
196
197    # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late
198    # In such case, init won't responce the property_set from hwservicemanager and then
199    # cause services for bootanim not running.
200    wait_for_prop hwservicemanager.ready true
201
202    # Wait for keymaster HALs (TEE and StrongBox)
203    exec_start wait_for_strongbox
204
205    # Mount RW partitions which need run fsck
206    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --late
207
208    # Required for time_daemon
209    mkdir /mnt/vendor/persist/time 0770 system system
210
211    # Start time daemon early so that the system time can be set early
212    start time_daemon
213
214on post-fs
215    # Disable sched autogroup
216    write /proc/sys/kernel/sched_autogroup_enabled 0
217
218    # set RLIMIT_MEMLOCK to 64MB
219    setrlimit 8 67108864 67108864
220
221    chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time
222    chown system graphics /sys/devices/virtual/graphics/fb0/idle_time
223    write /sys/devices/virtual/graphics/fb0/idle_time 100
224
225    # turn off vblank irq immediately after turning off
226    write /sys/module/drm/parameters/vblankoffdelay -1
227
228on post-fs-data
229    # We can start netd here before in is launched in common init.rc on zygote-start
230    start netd
231
232    # b/38048356 Setup debug folders for camera
233    mkdir /data/vendor/camera 0770 camera camera
234
235    # b/38496103 Setup debug folders for display
236    mkdir /data/vendor/display 0770 system graphics
237
238    # Setup folder for modem fdr
239    mkdir /data/vendor/modem_fdr 0700 root system
240
241    # Resume-on-Reboot after we have the data dir and keymaster
242    mkdir /data/vendor/rebootescrow 0770 hsm hsm
243    start vendor.rebootescrow-citadel
244
245    # keep that at the end of on post-fs-data
246    # Set indication (checked by vold) that we have finished this action
247    setprop vold.post_fs_data_done 1
248
249    # Wait until the system time is set
250    wait_for_prop vendor.qcom.time.set true
251
252    # Wait qseecomd started
253    wait_for_prop vendor.sys.listeners.registered true
254
255    # load IPA FWs
256    # This must be started when vendor.sys.listeners.registered is true
257    start ipastart_sh
258
259# zygote need to be started after otapreopt which will be done on post-fs-data
260on zygote-start
261    # zygote is started in common init.rc
262    # and now we can continue initialize /data/
263    mkdir /data/vendor/ipa 0770 radio radio
264    chown radio radio /data/vendor/ipa
265
266    # Create the directories used by the Wireless subsystem
267    mkdir /data/vendor/wifi 0771 wifi wifi
268    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
269    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
270
271    # Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections
272    # We chown/chmod /mnt/vendor/persist/ again so because mount is run as root + defaults
273    chown root system /mnt/vendor/persist/
274    chmod 0771 /mnt/vendor/persist/
275
276    # Trigger WLAN driver load
277    write /sys/kernel/boot_wlan/boot_wlan 1
278
279    #create netmgr log dir
280    mkdir /data/vendor/netmgr 0771 radio radio
281    chmod 0771 /data/vendor/netmgr
282
283    # Create netmgr recovery folder
284    mkdir /data/vendor/netmgr/recovery 0700 radio radio
285    chmod 0770 /data/vendor/netmgr/recovery
286    write /data/vendor/netmgr/recovery/recovery_info ""
287    chown radio radio /data/vendor/netmgr/recovery/recovery_info
288
289    # Create directory used by audio subsystem
290    mkdir /data/vendor/audio 0770 audio audio
291
292    # Create directory for audio delta files
293    mkdir /data/vendor/audio/acdbdata 0770 media audio
294    mkdir /data/vendor/audio/acdbdata/delta 0770 media audio
295
296    # Create directory for radio
297    mkdir /data/vendor/radio 0773 system radio
298    mkdir /data/vendor/modem_stat 0771 system radio
299    write /data/vendor/modem_stat/debug.txt ""
300    chown system radio /data/vendor/modem_stat/debug.txt
301    chmod 0664 /data/vendor/modem_stat/debug.txt
302
303    # Set up sensors-related directories and permissions
304    chmod 775 /mnt/vendor/persist/sensors
305    chmod 664 /mnt/vendor/persist/sensors/sensors_settings
306    chown root system /mnt/vendor/persist/sensors/registry
307    chmod 775 /mnt/vendor/persist/sensors/registry
308    chown root system /mnt/vendor/persist/sensors/registry/registry
309    chmod 775 /mnt/vendor/persist/sensors/registry/registry
310
311    chown system root /mnt/vendor/persist/sensors/sensors_settings
312    chown root root /mnt/vendor/persist/sensors/registry/registry/sensors_settings
313
314    mkdir /data/vendor/sensors 0770
315    chown system system /data/vendor/sensors
316    mkdir /data/vendor/sensors/log 0770
317    chown system system /data/vendor/sensors/log
318
319    chmod 770 /mnt/vendor/persist/audio
320    chmod 660 /mnt/vendor/persist/audio/audio.cal
321    chown media audio /mnt/vendor/persist/audio
322    chown audioserver audio /mnt/vendor/persist/audio/audio.cal
323
324    chmod 770 /mnt/vendor/persist/haptics
325    chmod 440 /mnt/vendor/persist/haptics/drv2624.cal
326    chown system system /mnt/vendor/persist/haptics
327    chown system system /mnt/vendor/persist/haptics/drv2624.cal
328
329    # Mark the copy complete flag to not completed
330    write /data/vendor/radio/copy_complete 0
331    chown radio radio /data/vendor/radio/copy_complete
332    chmod 0660 /data/vendor/radio/copy_complete
333
334    # File flags for prebuilt ril db file
335    write /data/vendor/radio/prebuilt_db_support 1
336    chown radio radio /data/vendor/radio/prebuilt_db_support
337    chmod 0400 /data/vendor/radio/prebuilt_db_support
338    write /data/vendor/radio/db_check_done 0
339    chown radio radio /data/vendor/radio/db_check_done
340    chmod 0660 /data/vendor/radio/db_check_done
341
342    # Create directories for Location services
343    mkdir /data/vendor/location 0770 gps gps
344    mkdir /data/vendor/location/mq 0770 gps gps
345    mkdir /data/vendor/location/xtwifi 0770 gps gps
346    mkdir /dev/socket/location 0770 gps gps
347    mkdir /dev/socket/location/mq 0770 gps gps
348    mkdir /dev/socket/location/xtra 0770 gps gps
349
350    # NFC local data and nfcee xml storage
351    mkdir /data/vendor/nfc 0770 nfc nfc
352
353    # Secure Element directory for loader service functionality
354    mkdir /data/vendor/secure_element 0770 secure_element secure_element
355
356on early-boot
357    # wait for devices
358    wait_for_prop vendor.qcom.devup 1
359
360    # wait for insmod_sh to finish all modules
361    wait_for_prop vendor.all.modules.ready 1
362
363    write /sys/kernel/boot_adsp/boot 1
364    write /sys/kernel/boot_cdsp/boot 1
365
366    # Update dm-verity state and set partition.*.verified properties
367    verity_update_state
368
369    # Permission for rainbow sensor
370    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_enable
371    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_enable
372    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_read_byte
373    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_read_byte
374    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_write_byte
375    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_write_byte
376    chown cameraserver camera /dev/vd6281
377    chmod 0660 /dev/vd6281
378
379    # Permission for Vibrator
380    chown system system /sys/class/leds/vibrator/device/mode
381    chown system system /sys/class/leds/vibrator/device/od_clamp
382    chown system system /sys/class/leds/vibrator/device/rtp_input
383    chown system system /sys/class/leds/vibrator/device/scale
384    chown system system /sys/class/leds/vibrator/device/set_sequencer
385    chown system system /sys/class/leds/vibrator/device/autocal_result
386    chown system system /sys/class/leds/vibrator/device/ctrl_loop
387    chown system system /sys/class/leds/vibrator/device/ol_lra_period
388    chown system system /sys/class/leds/vibrator/device/autocal
389    chown system system /sys/class/leds/vibrator/device/lp_trigger_effect
390    chown system system /sys/class/leds/vibrator/device/lra_wave_shape
391
392    # Permission for LED driver
393    chown system system /sys/class/leds/red/on_off_ms
394    chown system system /sys/class/leds/green/on_off_ms
395    chown system system /sys/class/leds/blue/on_off_ms
396    chown system system /sys/class/leds/red/rgb_start
397    chown system system /sys/class/leds/green/rgb_start
398    chown system system /sys/class/leds/blue/rgb_start
399    chown system system /sys/class/backlight/panel0-backlight/brightness
400
401    # Permission for Wireless charger
402    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/rxdata
403    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/txdata
404    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/txlen
405    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/ccreset
406
407    # Permission for Pixelstats
408    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_read_cnt
409    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_write_cnt
410    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_discard_cnt
411    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_flush_cnt
412
413    # Permission for Health Storage HAL
414    chown system system /sys/devices/platform/soc/7c4000.sdhci/manual_gc
415
416on boot
417    mkdir /dev/socket/qmux_radio 0770 radio radio
418    chmod 2770 /dev/socket/qmux_radio
419    mkdir /dev/socket/qmux_audio 0770 media audio
420    chmod 2770 /dev/socket/qmux_audio
421    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
422    chmod 2770 /dev/socket/qmux_bluetooth
423    mkdir /dev/socket/qmux_gps 0770 gps gps
424    chmod 2770 /dev/socket/qmux_gps
425
426    # Create NETMGR daemon socket area
427    mkdir /dev/socket/netmgr 0750 radio radio
428
429    setprop wifi.interface wlan0
430
431    # Assign TCP buffer thresholds to be ceiling value of technology maximums
432    # Increased technology maximums should be reflected here.
433    write /proc/sys/net/core/rmem_max  8388608
434    write /proc/sys/net/core/wmem_max  8388608
435
436    # Bluetooth
437    chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
438    chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
439    chmod 0660 /sys/class/rfkill/rfkill0/state
440    chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
441    chmod 0660 /sys/class/rfkill/rfkill0/device/extldo
442
443    # Wifi firmware reload path
444    chown wifi wifi /sys/module/wlan/parameters/fwpath
445
446    # default country code
447    setprop ro.boot.wificountrycode 00
448
449    # WLAN debug access
450    chown system system /d/icnss/stats
451
452    # Default enable uicc_se
453    setprop persist.vendor.radio.uicc_se_enabled true
454
455service init-radio-sh /vendor/bin/init.radio.sh
456    class late_start
457    user radio
458    group root radio
459    oneshot
460
461service vendor.thermal-engine /vendor/bin/thermal-engine -c ${vendor.sys.qcom.thermalcfg}
462   class main
463   user root
464   group root system
465   socket thermal-send-client stream 0666 system system
466   socket thermal-recv-client stream 0660 system system
467   socket thermal-recv-passive-client stream 0666 system system
468
469on property:persist.vendor.sys.ssr.restart_level=*
470    start vendor.ssr_setup
471
472service vendor.ssr_setup /vendor/bin/ssr_setup
473    oneshot
474    disabled
475
476service vendor.ssr_diag /vendor/bin/ssr_diag
477    class late_start
478    user system
479    group system
480    disabled
481
482service vendor.per_mgr /vendor/bin/pm-service
483    class core
484    user system
485    group system
486    ioprio rt 4
487
488service vendor.per_proxy /vendor/bin/pm-proxy
489    class core
490    user system
491    group system
492    disabled
493
494on property:sys.boot_completed=1
495    # Set the default IRQ affinity to the silver cluster.
496    write /proc/irq/default_smp_affinity 3f
497
498    # Enable ZRAM on boot_complete
499    rm /data/unencrypted/zram_swap
500    swapon_all /vendor/etc/fstab.${ro.boot.hardware.platform}
501    write /proc/sys/vm/swappiness 100
502
503    # Setup final cpuset
504    write /dev/cpuset/top-app/cpus 0-7
505    write /dev/cpuset/foreground/cpus 0-5,7
506    write /dev/cpuset/background/cpus 4-5
507    write /dev/cpuset/system-background/cpus 2-5
508    write /dev/cpuset/restricted/cpus 2-5
509
510    # Setup final blkio
511    # value for group_idle is us
512    write /dev/blkio/blkio.weight 1000
513    write /dev/blkio/background/blkio.weight 200
514    write /dev/blkio/blkio.group_idle 2000
515    write /dev/blkio/background/blkio.group_idle 0
516
517    # QCOM FG SRAM dump for dumpstate
518    chown system system /d/fg/sram/data
519    chown system system /d/fg/sram/count
520    chown system system /d/fg/sram/address
521
522    # Dump QCOM FG cycle counts for dumpstate
523    chown system system /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm660@0:qpnp,fg/cycle_counts_bins
524
525    # HardwareInfo needs to be able to read CC bins
526    chmod 644 /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm660@0:qpnp,fg/cycle_counts_bins
527
528    # dumpstate needs to read, vendor.health-hal needs to be able to RW
529    chown system system /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm660@0:qpnp,fg/power_supply/bms/charge_full
530
531    # HardwareInfo needs to be able to read charge_full
532    chmod 644 /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm660@0:qpnp,fg/power_supply/bms/charge_full
533
534    # eMMC health
535    chmod 755 /sys/kernel/debug/mmc0
536    chmod 755 /sys/kernel/debug/mmc0/mmc0:0001
537    chmod 644 /sys/kernel/debug/mmc0/mmc0:0001/ext_csd
538    chmod 644 /sys/kernel/debug/mmc0/ring_buffer
539    chmod 644 /sys/kernel/debug/mmc0/err_stats
540    chmod 644 /sys/kernel/debug/mmc0/show_host
541    chmod 644 /sys/kernel/debug/mmc0/io_stats
542    chmod 644 /sys/kernel/debug/mmc0/req_stats
543
544    # Disable sched_boost
545    write /proc/sys/kernel/sched_boost 0
546
547    # Enable PowerHAL hint processing
548    setprop vendor.powerhal.init 1
549
550on property:init.svc.vendor.per_mgr=running
551    start vendor.per_proxy
552
553on property:sys.shutdown.requested=*
554    stop vendor.per_proxy
555
556service vendor.qseecomd /vendor/bin/qseecomd
557   class core
558   user root
559   group root
560
561service ss_ramdump /vendor/bin/subsystem_ramdump
562    class main
563    user root
564    group system
565    disabled
566
567on property:persist.vendor.sys.ssr.enable_ramdumps=1
568    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
569    mkdir /data/vendor/wifidump 771 root system
570    mkdir /data/vendor/ramdump 771 root system
571    mkdir /data/vendor/ssrdump 771 root system
572    mkdir /data/vendor/ssrlog  771 root system
573    start ss_ramdump
574
575on property:persist.vendor.sys.ssr.enable_ramdumps=0
576    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0
577
578service adsprpcd /vendor/bin/adsprpcd rootpd
579   class main
580   user system
581   group system
582
583service cdsprpcd /vendor/bin/cdsprpcd
584   class main
585   user system
586   group system
587
588service adsprpcd_audiopd /vendor/bin/adsprpcd audiopd
589   class main
590   user media
591   group media
592
593service adsprpcd_sensorspd /vendor/bin/adsprpcd sensorspd
594   class main
595   user system
596   group system
597
598service irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
599    class core
600    user root
601    oneshot
602
603service vendor.rmt_storage /vendor/bin/rmt_storage
604    class core
605    user root
606    ioprio rt 0
607    shutdown critical
608
609service vendor.tftp_server /vendor/bin/tftp_server
610   class core
611   user root
612   group root system
613
614service modem_svc /vendor/bin/modem_svc -q
615   class core
616   user root
617   group system
618   capabilities NET_BIND_SERVICE
619
620service cnss-daemon /vendor/bin/cnss-daemon -n -l
621   class late_start
622   user system
623   group system inet wifi
624
625service imsqmidaemon /vendor/bin/imsqmidaemon
626   class main
627   user system
628   socket ims_qmid stream 0660 system radio
629   group radio log diag
630
631service imsdatadaemon /vendor/bin/imsdatadaemon
632   class main
633   user system
634   socket ims_datad stream 0660 system radio
635   group system wifi radio inet log
636   disabled
637
638on property:vendor.ims.QMI_DAEMON_STATUS=1
639   start imsdatadaemon
640
641service ims_rtp_daemon /vendor/bin/ims_rtp_daemon
642   class main
643   user system
644   group radio diag inet log
645   disabled
646
647service imsrcsservice /vendor/bin/imsrcsd
648   class main
649   user system
650   group radio diag inet log
651   disabled
652
653on property:vendor.ims.DATA_DAEMON_STATUS=1
654   start ims_rtp_daemon
655   start imsrcsservice
656
657service cnd /vendor/bin/cnd
658   class main
659   user radio
660   group system wifi inet radio wakelock
661
662service netmgrd /vendor/bin/netmgrd
663    class main
664    user root
665    group root wifi wakelock radio inet
666
667service port-bridge /vendor/bin/port-bridge
668    class main
669    user radio
670    group radio system inet
671    oneshot
672
673service ipacm /vendor/bin/ipacm
674    class main
675    user radio
676    group radio inet
677
678service qti /vendor/bin/qti
679    class main
680    user radio
681    group radio net_raw diag usb net_admin
682
683service loc_launcher /vendor/bin/loc_launcher
684    class late_start
685    group gps inet diag wifi
686
687service pd_mapper /vendor/bin/pd-mapper
688     class core
689
690# bugreport is triggered by holding down volume down, volume up and power
691service bugreport /system/bin/dumpstate -d -p -z
692    class main
693    disabled
694    oneshot
695    keycodes 114 115 116
696
697service devstart_sh /vendor/bin/init.qcom.devstart.sh
698    class main
699    user root
700    group root system
701    disabled
702    oneshot
703
704service vendor.wlan_sh /vendor/bin/init.qcom.wlan.sh
705    class main
706    user root
707    group root
708    disabled
709    oneshot
710
711service ipastart_sh /vendor/bin/init.qcom.ipastart.sh
712    class main
713    user system
714    group net_admin
715    disabled
716    oneshot
717
718service insmod_sh /vendor/bin/init.insmod.sh
719    class main
720    user root
721    group root system
722    disabled
723    oneshot
724
725service msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
726    socket msm_irqbalance seqpacket 660 root system
727    class core
728    user root
729    group root
730    writepid /dev/cpuset/system-background/tasks
731
732service ppd /vendor/bin/mm-pp-dpps
733    class late_start
734    user graphics
735    group graphics
736    socket pps stream 0660 system system
737    disabled
738
739service wait_for_strongbox /vendor/bin/hw/wait_for_strongbox
740    user root
741    group root system
742    priority -20
743    ioprio rt 0
744
745on property:init.svc.vendor.hwcomposer-2-2=stopped
746    stop ppd
747
748on property:init.svc.vendor.hwcomposer-2-2=running
749    start ppd
750
751# b/70518189 vDSO experiments
752on property:sys.vdso=*
753    write /sys/module/vdso/parameters/enable_32 1
754    write /sys/module/vdso/parameters/enable_64 1
755
756on property:sys.vdso=false
757    write /sys/module/vdso/parameters/enable_32 0
758    write /sys/module/vdso/parameters/enable_64 0
759
760on property:sys.vdso=64
761    write /sys/module/vdso/parameters/enable_32 0
762
763on property:sys.vdso=32
764    write /sys/module/vdso/parameters/enable_64 0
765
766on property:wlan.driver.status=ok
767    # Get the wlan driver/fw version
768    start vendor.wlan_sh
769
770on property:ro.boot.mode=sota
771    setprop ro.boot.sota enabled
772
773on property:ro.boot.hardware.sku=G020D
774    start vendor.secure_element_hal_service_1_1
775on property:ro.boot.hardware.sku=G020H
776    start vendor.secure_element_hal_service_1_1
777
778# charger driver exposes now finer grain control, map demo mode to those properties
779# demo mode can only be exited by wiping data which will also reset the persist properties
780on property:sys.retaildemo.enabled=1
781    setprop persist.vendor.charge.stop.level 35
782    setprop persist.vendor.charge.start.level 30
783
784# For Japan radio builds, always enforce camera shutter sound
785# Since this property is read by the audio server in system service,
786# it should be written by the system init.
787on property:ro.boot.hardware.radio.subtype=0
788    setprop audio.camerasound.force true
789
790# Touch
791on property:vendor.all.modules.ready=1
792    wait /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
793    chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
794    chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/suspend
795
796# DSDS feature
797# Restart 1st qcrild after SIM config changed
798on property:vendor.radio.sim_num.switch=1to2 && property:persist.radio.multisim.config=dsds
799    restart vendor.qcrild
800
801on property:vendor.radio.sim_num.switch=2to1 && property:persist.radio.multisim.config=
802    restart vendor.qcrild
803
804# Enable 2nd qcrild when the property set to dsds
805on property:persist.radio.multisim.config=dsds
806    start vendor.qcrild2
807
808# Stop 2nd qcrild when the property set to empty string
809on property:persist.radio.multisim.config=
810    stop vendor.qcrild2
811
812on property:sys.boot_completed=1 && property:ro.boot.mode=firstboot
813    start init-firstboot-sh
814
815service init-firstboot-sh /vendor/bin/init.firstboot.sh
816    user nobody
817    disabled
818    oneshot
819
820# init-fingerprint-sh is for stopping fps_hal after init retry fail serval times
821# It keeps running until max init retry or fps_hal running successfully
822# vendor.fps_hal restarts until max init retry times
823#
824# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
825service init-fingerprint-sh /vendor/bin/init.fingerprint.sh 10
826    group root
827    user root
828    disabled
829    oneshot
830
831on property:sys.boot_completed=1
832    start init-fingerprint-sh
833
834on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
835    start init-fingerprint-sh
836
837# Write the dark theme magic to /misc partition.
838service vendor.theme_set /vendor/bin/misc_writer --set-dark-theme
839    disabled
840    oneshot
841
842# Clear the dark theme magic in /misc partition.
843service vendor.theme_clear /vendor/bin/misc_writer --clear-dark-theme
844    disabled
845    oneshot
846
847# Set dark boot flag on dark mode (UiModeManager.MODE_NIGHT_YES == 2).
848on property:persist.sys.theme=2
849    start vendor.theme_set
850
851# Clear the dark boot flag on light mode (UiModeManager.MODE_NIGHT_NO == 1) or auto mode
852# (UiModeManager.MODE_NIGHT_AUTO == 0).
853on property:persist.sys.theme=1
854    start vendor.theme_clear
855
856on property:persist.sys.theme=0
857    start vendor.theme_clear
858
859on init && property:ro.boot.slot_successful=no
860    write /sys/module/msm_poweroff/parameters/warm_reset 1
861
862# Set or clear the warm reset flag upon the change of system property. The flag itself is set
863# by writing a sysfs file; and the file will be read by kernel.
864on property:ota.warm_reset=1
865    write /sys/module/msm_poweroff/parameters/warm_reset 1
866
867on property:ota.warm_reset=0
868    write /sys/module/msm_poweroff/parameters/warm_reset 0
869