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