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