普通文本  |  898行  |  30.3 KB

#
# Copyright (C) 2016 The Android Open-Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

import /vendor/etc/init/hw/init.${ro.hardware}.usb.rc

on charger
    # Set runtime stune value
    write /dev/stune/schedtune.prefer_idle 0
    write /dev/stune/schedtune.boost 0
    # Offline CPUs
    write /sys/devices/system/cpu/cpu2/online 0
    write /sys/devices/system/cpu/cpu3/online 0
    write /sys/devices/system/cpu/cpu4/online 0
    write /sys/devices/system/cpu/cpu5/online 0
    write /sys/devices/system/cpu/cpu6/online 0
    write /sys/devices/system/cpu/cpu7/online 0
    wait /dev/block/platform/soc/${ro.boot.bootdevice}
    # Enable UFS powersaving
    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
    write /sys/class/typec/port0/port_type sink
    write /sys/module/lpm_levels/parameters/sleep_disabled N

service vendor.charger /charger
    class charger
    seclabel u:r:charger:s0

on early-init
    mount debugfs debugfs /sys/kernel/debug
    chmod 0755 /sys/kernel/debug
    # Loading kernel modules in background
    start vendor.insmod_sh

on init
    # Disable UFS powersaving
    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 0
    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 0
    write /sys/module/lpm_levels/parameters/sleep_disabled Y

    # QSEE rpmb listener need symlink for bootdevice
    wait /dev/block/platform/soc/${ro.boot.bootdevice}
    symlink /dev/block/platform/soc/${ro.boot.bootdevice} /dev/block/bootdevice

    # start qseecomd early as we mount system/ vendor/ early
    # vold needs keymaster that needs qseecomd
    start vendor.qseecomd

    # Support legacy paths
    symlink /sdcard /mnt/sdcard
    symlink /sdcard /storage/sdcard0

    # disable thermal hotplug for thermal
    write /sys/module/msm_thermal/core_control/enabled 0

    # bring back all cores
    write /sys/devices/system/cpu/cpu0/online 1
    write /sys/devices/system/cpu/cpu1/online 1
    write /sys/devices/system/cpu/cpu2/online 1
    write /sys/devices/system/cpu/cpu3/online 1
    write /sys/devices/system/cpu/cpu4/online 1
    write /sys/devices/system/cpu/cpu5/online 1
    write /sys/devices/system/cpu/cpu6/online 1
    write /sys/devices/system/cpu/cpu7/online 1
    # configure governor settings for little cluster
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor "schedutil"
    write /sys/devices/system/cpu/cpufreq/policy0/schedutil/up_rate_limit_us 500
    write /sys/devices/system/cpu/cpufreq/policy0/schedutil/down_rate_limit_us 20000

    # configure governor settings for big cluster
    write /sys/devices/system/cpu/cpu4/cpufreq/scaling_governor "schedutil"
    write /sys/devices/system/cpu/cpufreq/policy4/schedutil/up_rate_limit_us 500
    write /sys/devices/system/cpu/cpufreq/policy4/schedutil/down_rate_limit_us 20000

    # Set boottime stune value
    write /dev/stune/schedtune.prefer_idle 1
    write /dev/stune/schedtune.boost 100

    # set default schedTune value for foreground/top-app
    write /dev/stune/foreground/schedtune.prefer_idle 1
    write /dev/stune/top-app/schedtune.boost 10
    write /dev/stune/top-app/schedtune.prefer_idle 1

    # Setup cpusets used by the VR services.
    mkdir /dev/cpuset/kernel 0750 root system
    write /dev/cpuset/kernel/cpus 0
    write /dev/cpuset/kernel/mems 0
    chown system system /dev/cpuset/kernel/tasks
    chmod 0660 /dev/cpuset/kernel/tasks

    mkdir /dev/cpuset/system 0750 root system
    write /dev/cpuset/system/cpus 0
    write /dev/cpuset/system/mems 0
    chown system system /dev/cpuset/system/tasks
    chmod 0660 /dev/cpuset/system/tasks

    mkdir /dev/cpuset/system/performance 0750 root system
    write /dev/cpuset/system/performance/cpus 0
    write /dev/cpuset/system/performance/mems 0
    chown system system /dev/cpuset/system/performance/tasks
    chmod 0660 /dev/cpuset/system/performance/tasks

    mkdir /dev/cpuset/system/background 0750 root system
    write /dev/cpuset/system/background/cpus 0
    write /dev/cpuset/system/background/mems 0
    chown system system /dev/cpuset/system/background/tasks
    chmod 0660 /dev/cpuset/system/background/tasks

    mkdir /dev/cpuset/application 0750 root system
    write /dev/cpuset/application/cpus 0
    write /dev/cpuset/application/mems 0
    chown system system /dev/cpuset/application/tasks
    chmod 0660 /dev/cpuset/application/tasks

    mkdir /dev/cpuset/application/performance 0750 root system
    write /dev/cpuset/application/performance/cpus 0
    write /dev/cpuset/application/performance/mems 0
    chown system system /dev/cpuset/application/performance/tasks
    chmod 0660 /dev/cpuset/application/performance/tasks

    mkdir /dev/cpuset/application/background 0750 root system
    write /dev/cpuset/application/background/cpus 0
    write /dev/cpuset/application/background/mems 0
    chown system system /dev/cpuset/application/background/tasks
    chmod 0660 /dev/cpuset/application/background/tasks

    # Create UDS structure for base VR services.
    mkdir /dev/socket/pdx 0775 system system
    mkdir /dev/socket/pdx/system 0775 system system
    mkdir /dev/socket/pdx/system/buffer_hub 0775 system system
    mkdir /dev/socket/pdx/system/performance 0775 system system
    mkdir /dev/socket/pdx/system/vr 0775 system system
    mkdir /dev/socket/pdx/system/vr/display 0775 system system
    mkdir /dev/socket/pdx/system/vr/pose 0775 system system
    mkdir /dev/socket/pdx/system/vr/sensors 0775 system system

    # Disable retention
    write /sys/module/lpm_levels/system/pwr/cpu0/ret/idle_enabled N
    write /sys/module/lpm_levels/system/pwr/cpu1/ret/idle_enabled N
    write /sys/module/lpm_levels/system/pwr/cpu2/ret/idle_enabled N
    write /sys/module/lpm_levels/system/pwr/cpu3/ret/idle_enabled N
    write /sys/module/lpm_levels/system/perf/cpu4/ret/idle_enabled N
    write /sys/module/lpm_levels/system/perf/cpu5/ret/idle_enabled N
    write /sys/module/lpm_levels/system/perf/cpu6/ret/idle_enabled N
    write /sys/module/lpm_levels/system/perf/cpu7/ret/idle_enabled N
    write /sys/module/lpm_levels/system/pwr/pwr-l2-dynret/idle_enabled N
    write /sys/module/lpm_levels/system/pwr/pwr-l2-ret/idle_enabled N
    write /sys/module/lpm_levels/system/perf/perf-l2-dynret/idle_enabled N
    write /sys/module/lpm_levels/system/perf/perf-l2-ret/idle_enabled N

    # b/37682684 Enable suspend clock reporting
    write /sys/kernel/debug/clk/debug_suspend 1

    # ZRAM setup
    write /sys/block/zram0/comp_algorithm lz4
    write /proc/sys/vm/page-cluster 0

on init
    setprop vendor.thermal.config thermal_info_config.json

on fs
    mount_all /vendor/etc/fstab.${ro.hardware} --early

    mkdir /persist/data 0700 system system
    mkdir /persist/display 0770 system graphics
    mkdir /persist/rfs 0770 root system
    mkdir /persist/hlos_rfs 0770 root system
    mkdir /persist/elabel 0700 system system
    chmod 0770 /persist/rfs
    chmod 0770 /persist/rfs/shared
    chmod 0770 /persist/rfs/msm
    chmod 0770 /persist/rfs/msm/adsp
    chown system system /persist/rfs/msm/adsp
    chmod 0770 /persist/rfs/msm/mpss
    chown system system /persist/rfs/msm/mpss
    mkdir /persist/rfs/msm/slpi 0770 system system
    chmod 0770 /persist/rfs/mdm
    chmod 0770 /persist/rfs/mdm/adsp
    chown system system /persist/rfs/mdm/adsp
    chmod 0770 /persist/rfs/mdm/mpss
    chown system system /persist/rfs/mdm/mpss
    mkdir /persist/rfs/mdm/slpi 0770 system system
    chmod 0770 /persist/rfs/mdm/sparrow
    chown system system /persist/rfs/mdm/sparrow
    mkdir /persist/rfs/mdm/tn 0770 system system
    chmod 0770 /persist/rfs/apq
    chmod 0770 /persist/rfs/apq/gnss
    chmod 0770 /persist/hlos_rfs

    # b/78019660 Remove unlabeled persist_rfs_file
    rm /persist/rfs/msm/mpss/server_check.txt

    # for android.hardware.health@2.0-service.marlin cycle count backup
    mkdir /persist/battery 0700 system system

    restorecon_recursive /persist

on late-fs
    # Start devices by sysfs trigger
    start vendor.devstart_sh
    # Start services for bootanim
    start surfaceflinger
    start bootanim
    start vendor.hwcomposer-2-1
    start vendor.configstore-hal
    start vendor.gralloc-2-0

    # Wait for hwservicemanager ready since fsck might be triggered in mount_all --late
    # In such case, init won't responce the property_set from hwservicemanager and then
    # cause services for bootanim not running.
    wait_for_prop hwservicemanager.ready true
    # Mount RW partitions which need run fsck
    mount_all /vendor/etc/fstab.${ro.hardware} --late

    # Required for time_daemon
    mkdir /persist/time 0770 system system

    # Start time daemon early so that the system time can be set early
    start vendor.time_daemon

on post-fs
    # set RLIMIT_MEMLOCK to 64MB
    setrlimit 8 67108864 67108864

    chmod 0664 /sys/devices/virtual/graphics/fb0/idle_time
    chown system graphics /sys/devices/virtual/graphics/fb0/idle_time
    write /sys/devices/virtual/graphics/fb0/idle_time 100

    # Wait qseecomd started
    wait_for_prop sys.listeners.registered true

on property:sys.listeners.registered=true
    # load IPA FWs
    start vendor.ipastart_sh

on post-fs-data
    # We can start netd here before in is launched in common init.rc on zygote-start
    start netd

    # b/38048356 Setup debug folders for camera
    mkdir /data/vendor/camera 0770 camera camera

    # b/38496103 Setup debug folders for display
    mkdir /data/vendor/display 0770 system graphics

    # b/65834073 Create rfs folder for tftp_server
    mkdir /data/vendor/tombstones/rfs 0770 root system

    # keep that at the end of on post-fs-data
    # Set indication (checked by vold) that we have finished this action
    setprop vold.post_fs_data_done 1

    # Wait until the system time is set
    wait_for_prop sys.time.set true

# zygote need to be started after otapreopt which will be done on post-fs-data
on zygote-start
    # zygote is started in common init.rc
    # and now we can continue to initialize /data/
    mkdir /data/tombstones 0771 system system
    mkdir /tombstones/modem 0771 system system
    mkdir /tombstones/lpass 0771 system system
    mkdir /tombstones/wcnss 0771 system system
    mkdir /tombstones/dsps 0771 system system
    mkdir /data/misc/qvop 0660 system system
    mkdir /data/misc/hbtp 0750 system system
    mkdir /data/misc/seemp 0700 system system

    # Create directory for TZ Apps
    mkdir /data/misc/qsee 0770 system system

    mkdir /data/media 0770 media_rw media_rw
    chown media_rw media_rw /data/media

    mkdir /data/vendor/ipa 0770 radio radio
    chown radio radio /data/vendor/ipa

    # Create the directories used by the Wireless subsystem
    mkdir /data/misc/wifi 0770 wifi wifi
    mkdir /data/misc/wifi/wpa_supplicant 0770 wifi wifi
    mkdir /data/vendor/wifi 0771 wifi wifi
    mkdir /data/vendor/wifi/wpa 0770 wifi wifi
    mkdir /data/vendor/wifi/wpa/sockets 0770 wifi wifi
    mkdir /data/misc/dhcp 0770 dhcp dhcp
    chown dhcp dhcp /data/misc/dhcp

    # Mounting of persist is moved to 'on emmc-fs' and 'on fs' sections
    # We chown/chmod /persist again so because mount is run as root + defaults
    chown root system /persist
    chmod 0771 /persist
    chown system system /persist/WCNSS_qcom_wlan_nv.bin

    # Create directory for hostapd
    mkdir /data/hostapd 0770 system wifi

    # Trigger WLAN driver load
    write /sys/kernel/boot_wlan/boot_wlan 1

    #create port-bridge log dir
    mkdir /data/misc/port_bridge 0770 radio radio
    chmod 0770 /data/misc/port_bridge

    #create netmgr log dir
    mkdir /data/vendor/netmgr 0771 radio radio
    chmod 0771 /data/vendor/netmgr

    # Create the directories used by CnE subsystem
    mkdir /data/connectivity 0771 system system
    chown system system /data/connectivity

    # Create the directories used by DPM subsystem
    mkdir /data/dpm 0771 system system
    chown system system /data/dpm

    mkdir /data/dpm/nsrm 0771 system system
    chown system system /data/dpm/nsrm

    # Create directory used by audio subsystem
    mkdir /data/vendor/audio 0770 audio audio

    # Create directory for audio delta files
    mkdir /data/vendor/audio/acdbdata 0770 media audio
    mkdir /data/vendor/audio/acdbdata/delta 0770 media audio

    # Create directory used by the DASH client
    mkdir /data/misc/dash 0770 media audio

    # Create directory for radio
    mkdir /data/vendor/radio 0773 system radio

    # Create directory used by display clients
    mkdir /data/misc/display 0770 system graphics

    # Setup sensors-related directories and permissions
    mkdir /persist/sensors 0775
    chown root system /persist/sensors
    write /persist/sensors/sensors_settings 1
    chown root system /persist/sensors/sensors_settings
    chmod 664 /persist/sensors/sensors_settings
    chown root system /persist/sensors/sns.reg
    chmod 664 /persist/sensors/sns.reg

    mkdir /data/vendor/sensors 0770
    chown system system /data/vendor/sensors

    # These files might have been created by root from a prior build - make sure
    # they are accessible to the sensors daemon
    chown system system /data/vendor/sensors/cal.bin
    chown system system /data/vendor/sensors/cal.txt

    # /dev/sensors only supports an ioctl to get the current SLPI timestamp;
    # allow the sensors daemon to perform this as non-root
    chown root system /dev/sensors
    chmod 660 /dev/sensors

    # Mark the copy complete flag to not completed
    write /data/vendor/radio/copy_complete 0
    chown radio radio /data/vendor/radio/copy_complete
    chmod 0660 /data/vendor/radio/copy_complete

    # File flags for prebuilt ril db file
    write /data/vendor/radio/prebuilt_db_support 1
    chown radio radio /data/vendor/radio/prebuilt_db_support
    chmod 0400 /data/vendor/radio/prebuilt_db_support
    write /data/vendor/radio/db_check_done 0
    chown radio radio /data/vendor/radio/db_check_done
    chmod 0660 /data/vendor/radio/db_check_done

    # Create directories for Location services
    mkdir /data/vendor/location 0770 gps gps
    mkdir /data/vendor/location/mq 0770 gps gps
    mkdir /data/vendor/location/xtwifi 0770 gps gps

    # NFC local data and nfcee xml storage
    mkdir /data/vendor/nfc 0770 nfc nfc

    # b/62837579 elabel directory
    mkdir /data/misc/elabel 0700 system system

on early-boot
    # wait for devices
    wait_for_prop sys.qcom.devup 1
    # wait for insmod_sh to finish all modules
    wait_for_prop sys.all.modules.ready 1
    # Update dm-verity state and set partition.*.verified properties
    verity_update_state

    # Permission for laser sensor driver
    chown camera camera /sys/class/wahoo_laser/laser/enable_ps_sensor

    # Permission for Vibrator
    chown system system /sys/class/leds/vibrator/device/mode
    chown system system /sys/class/leds/vibrator/device/od_clamp
    chown system system /sys/class/leds/vibrator/device/rtp_input
    chown system system /sys/class/leds/vibrator/device/scale
    chown system system /sys/class/leds/vibrator/device/set_sequencer
    chown system system /sys/class/leds/vibrator/device/autocal_result
    chown system system /sys/class/leds/vibrator/device/ctrl_loop
    chown system system /sys/class/leds/vibrator/device/ol_lra_period
    chown system system /sys/class/leds/vibrator/device/autocal
    chown system system /sys/class/leds/vibrator/device/lp_trigger_effect

    # Permission for LED driver
    chown system system /sys/class/leds/red/on_off_ms
    chown system system /sys/class/leds/green/on_off_ms
    chown system system /sys/class/leds/blue/on_off_ms
    chown system system /sys/class/leds/red/rgb_start
    chown system system /sys/class/leds/green/rgb_start
    chown system system /sys/class/leds/blue/rgb_start
    chown system system /sys/class/graphics/fb0/msm_fb_persist_mode

    # dumpstate needs to read, vendor.health-hal needs to be able to RW
    chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins
    # HardwareInfo needs to be able to read CC bins
    chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/cycle_counts_bins

    # dumpstate needs to read, vendor.health-hal needs to be able to RW
    chown system system /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full
    # HardwareInfo needs to be able to read charge_full
    chmod 644 /sys/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-02/800f000.qcom,spmi:qcom,pmi8998@2:qpnp,fg/power_supply/bms/charge_full

on boot
    mkdir /dev/socket/qmux_radio 0770 radio radio
    chmod 2770 /dev/socket/qmux_radio
    mkdir /dev/socket/qmux_audio 0770 media audio
    chmod 2770 /dev/socket/qmux_audio
    mkdir /dev/socket/qmux_bluetooth 0770 bluetooth bluetooth
    chmod 2770 /dev/socket/qmux_bluetooth
    mkdir /dev/socket/qmux_gps 0770 gps gps
    chmod 2770 /dev/socket/qmux_gps

    # Create NETMGR daemon socket area
    mkdir /dev/socket/netmgr 0750 radio radio

    setprop wifi.interface wlan0

    # Assign TCP buffer thresholds to be ceiling value of technology maximums
    # Increased technology maximums should be reflected here.
    write /proc/sys/net/core/rmem_max  8388608
    write /proc/sys/net/core/wmem_max  8388608

    # Update DVR cpusets to boot-time values.
    write /dev/cpuset/kernel/cpus 0-7
    write /dev/cpuset/system/cpus 0-7
    write /dev/cpuset/system/performance/cpus 0-7
    write /dev/cpuset/system/background/cpus 0-7
    write /dev/cpuset/system/cpus 0-7
    write /dev/cpuset/application/cpus 0-7
    write /dev/cpuset/application/performance/cpus 0-7
    write /dev/cpuset/application/background/cpus 0-7
    write /dev/cpuset/application/cpus 0-7

    # Bluetooth
    chown bluetooth net_bt /sys/class/rfkill/rfkill0/type
    chown bluetooth net_bt /sys/class/rfkill/rfkill0/state
    chmod 0660 /sys/class/rfkill/rfkill0/state
    chown bluetooth net_bt /sys/class/rfkill/rfkill0/device/extldo
    chmod 0660 /sys/class/rfkill/rfkill0/device/extldo

    # Wifi firmware reload path
    chown wifi wifi /sys/module/wlan/parameters/fwpath

    # default country code
    setprop ro.boot.wificountrycode 00

    # Make the ftm4 command node writeable from dumpstate
    chown system system /sys/devices/virtual/input/ftm4_touch/cmd

    # ftm4 VR mode
    chown system system /sys/devices/virtual/input/ftm4_touch/vrmode

    # WLAN debug access
    chown system system /d/icnss/stats

service vendor.init-elabel-sh /system/bin/init.elabel.sh
    class late_start
    user system
    group system
    oneshot

service vendor.init-radio-sh /vendor/bin/init.radio.sh
    class late_start
    user radio
    group root radio
    oneshot

service vendor.folio_daemon /system/bin/folio_daemon
    class late_start
    user system
    group system uhid
    disabled

on property:init.svc.zygote=running
    start vendor.folio_daemon

on property:init.svc.zygote=stopped
    stop vendor.folio_daemon

on property:vendor.qcom.thermalcfg=*
    restart vendor.thermal-engine

service vendor.thermal-engine /vendor/bin/thermal-engine -c ${vendor.qcom.thermalcfg:-/vendor/etc/thermal-engine.conf}
   class hal
   user root
   group root system diag
   socket thermal-send-client stream 0666 system system
   socket thermal-recv-client stream 0660 system system
   socket thermal-recv-passive-client stream 0666 system system

service vendor.msm_irqbalance /vendor/bin/msm_irqbalance -f /vendor/etc/msm_irqbalance.conf
    socket msm_irqbalance seqpacket 660 root system
    class core
    user root
    group root
    writepid /dev/cpuset/system-background/tasks

on property:persist.sys.ssr.restart_level=*
    start vendor.ssr_setup

service vendor.ssr_setup /vendor/bin/ssr_setup
    oneshot
    disabled

service vendor.ssr_diag /vendor/bin/ssr_diag
    class late_start
    user system
    group system
    disabled

service vendor.per_mgr /vendor/bin/pm-service
    class core
    user system
    group system
    ioprio rt 4
    shutdown critical

service vendor.per_proxy /vendor/bin/pm-proxy
    class core
    user system
    group system
    disabled

on property:sys.post_boot.parsed=1
    # Enable PowerHAL hint processing
    setprop vendor.powerhal.init 1

on property:sys.boot_completed=1
    # Set runtime stune value
    write /dev/stune/schedtune.prefer_idle 0
    write /dev/stune/schedtune.boost 0

    # Enable power setting and set sys.post_boot.parsed to 1
    start vendor.power_sh

    # Enable UFS powersaving
    write /sys/devices/soc/${ro.boot.bootdevice}/clkscale_enable 1
    write /sys/devices/soc/${ro.boot.bootdevice}/clkgate_enable 1
    write /sys/module/lpm_levels/parameters/sleep_disabled N

    # Setup final cpuset
    write /dev/cpuset/top-app/cpus 0-7
    write /dev/cpuset/foreground/cpus 0-3,6-7
    write /dev/cpuset/background/cpus 0-1
    write /dev/cpuset/system-background/cpus 0-3
    write /dev/cpuset/restricted/cpus 0-3

    # Update DVR cpusets to runtime values.
    write /dev/cpuset/kernel/cpus 2,3
    write /dev/cpuset/system/performance/cpus 6-7
    write /dev/cpuset/system/background/cpus 0-1
    write /dev/cpuset/system/cpus 0-1,6-7
    write /dev/cpuset/application/performance/cpus 4-5
    write /dev/cpuset/application/background/cpus 0-1
    write /dev/cpuset/application/cpus 0-1,4-5

    # UFS health
    chmod 755 /sys/kernel/debug/ufshcd0
    chmod 644 /sys/kernel/debug/ufshcd0/err_state
    chmod 644 /sys/kernel/debug/ufshcd0/power_mode
    chmod 644 /sys/kernel/debug/ufshcd0/host_regs
    chmod 644 /sys/kernel/debug/ufshcd0/show_hba
    chmod 644 /sys/kernel/debug/ufshcd0/dump_device_desc
    chmod 644 /sys/kernel/debug/ufshcd0/dump_health_desc
    chmod 755 /sys/kernel/debug/ufshcd0/stats
    chmod 644 /sys/kernel/debug/ufshcd0/stats/req_stats
    chmod 644 /sys/kernel/debug/ufshcd0/stats/query_stats
    chmod 644 /sys/kernel/debug/ufshcd0/stats/err_stats

    # QCOM FG SRAM dump for dumpstate
    chown system system /d/fg/sram/data
    chown system system /d/fg/sram/count
    chown system system /d/fg/sram/address

    # com.google.android.hardwareinfo needs to be able to read cycle counts
    chmod 0666 /sys/class/power_supply/bms/cycle_count_id

    trigger sys-boot-completed-set

# We want one opportunity per boot to enable zram, so we
# use a trigger we fire from the above stanza. If
# persist.sys.zram_enabled becomes true after boot,
# we don't want to run swapon_all at that time.
on sys-boot-completed-set && property:persist.sys.zram_enabled=1
    swapon_all /vendor/etc/fstab.${ro.hardware}
    write /proc/sys/vm/swappiness 100

on property:init.svc.vendor.per_mgr=running
    start vendor.per_proxy

on shutdown
    stop vendor.per_proxy
    # Disable subsystem restart
    write /sys/module/subsystem_restart/parameters/disable_restart_work 0x9889deed

service vendor.qseecomd /vendor/bin/qseecomd
   class core
   user root
   group root
   shutdown critical

service vendor.time_daemon /vendor/bin/time_daemon
   class core
   user root
   group root

service vendor.ss_ramdump /vendor/bin/subsystem_ramdump
    class main
    user root
    group root system
    disabled

on property:persist.sys.ssr.enable_ramdumps=1
    write /sys/module/subsystem_restart/parameters/enable_ramdumps 1
    mkdir /data/vendor/ssrdump 771 root system
    mkdir /data/vendor/ramdump 771 root system
    start vendor.ss_ramdump

on property:persist.sys.ssr.enable_ramdumps=0
    write /sys/module/subsystem_restart/parameters/enable_ramdumps 0

service vendor.sensors /vendor/bin/sensors.qcom
    class core
    user system
    group system
    # Grants the ability for this daemon to bind IPC router ports so it can
    # register QMI services
    capabilities NET_BIND_SERVICE

service vendor.adsprpcd /vendor/bin/adsprpcd
   class main
   user media
   group media

service vendor.irsc_util /vendor/bin/irsc_util "/vendor/etc/sec_config"
    class core
    user root
    oneshot

service vendor.rmt_storage /vendor/bin/rmt_storage
    class core
    user root
    ioprio rt 0
    shutdown critical

service vendor.tftp_server /vendor/bin/tftp_server
   class core
   user root
   group root system

service wpa_supplicant /vendor/bin/hw/wpa_supplicant \
    -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 -dd \
    -g@android:wpa_wlan0
    #   we will start as root and wpa_supplicant will switch to user wifi
    #   after setting up the capabilities required for WEXT
    #   user wifi
    #   group wifi inet keystore
    interface android.hardware.wifi.supplicant@1.0::ISupplicant default
    interface android.hardware.wifi.supplicant@1.1::ISupplicant default
    interface android.hardware.wifi.supplicant@1.2::ISupplicant default
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service vendor.cnss-daemon /vendor/bin/cnss-daemon -n -l
   class late_start
   user system
   group system inet wifi

service vendor.imsqmidaemon /vendor/bin/imsqmidaemon
   class main
   user system
   socket ims_qmid stream 0660 system radio
   group radio log diag

service vendor.imsdatadaemon /vendor/bin/imsdatadaemon
   class main
   user system
   socket ims_datad stream 0660 system radio
   group system wifi radio inet log
   disabled

on property:vendor.ims.QMI_DAEMON_STATUS=1
   start vendor.imsdatadaemon

service vendor.ims_rtp_daemon /vendor/bin/ims_rtp_daemon
   class main
   user system
   group radio diag inet log
   disabled

service vendor.imsrcsservice /vendor/bin/imsrcsd
   class hal
   user system
   group radio diag inet log
   disabled

on property:vendor.ims.DATA_DAEMON_STATUS=1
   start vendor.ims_rtp_daemon
   start vendor.imsrcsservice

service vendor.cnd /vendor/bin/cnd
   class main
   user radio
   group inet system wifi radio wakelock

service vendor.netmgrd /vendor/bin/netmgrd
    class main
    user root
    group root wifi wakelock radio inet

service vendor.port-bridge /vendor/bin/port-bridge
    class main
    user radio
    group radio system inet
    oneshot

service vendor.ipacm /vendor/bin/ipacm
    class main
    user radio
    group radio inet

service vendor.qti /vendor/bin/qti
    class main
    user radio
    group radio net_raw diag usb net_admin

on property:wc_transport.start_hci=true
    start vendor.hci_filter

on property:wc_transport.start_hci=false
    stop vendor.hci_filter

service vendor.loc_launcher /vendor/bin/loc_launcher
    class late_start
    group gps inet diag wifi

service vendor.pd_mapper /vendor/bin/pd-mapper
     class core

service vendor.atfwd /vendor/bin/ATFWD-daemon
    class late_start
    user system
    group system radio
    disabled

on property:persist.radio.atfwd.start=true
    start vendor.atfwd

on property:persist.radio.atfwd.start=false
    stop vendor.atfwd

# b/68982314
on property:sys.uidcpupower=*
   write /proc/uid_cpupower/enable 1

on property:sys.uidcpupower=0
   write /proc/uid_cpupower/enable 0

# bugreport is triggered by holding down volume down, volume up and power
service bugreport /system/bin/dumpstate -d -p -B -z \
        -o /data/user_de/0/com.android.shell/files/bugreports/bugreport
    class main
    disabled
    oneshot
    keycodes 114 115 116

service vendor.chre /vendor/bin/chre
    class late_start
    user system
    group system
    socket chre seqpacket 0660 root system
    shutdown critical

service vendor.power_sh /vendor/bin/init.power.sh
    class main
    user root
    group root system
    disabled
    oneshot

service vendor.devstart_sh /vendor/bin/init.qcom.devstart.sh
    class main
    user root
    group root system
    disabled
    oneshot

service vendor.ipastart_sh /vendor/bin/init.qcom.ipastart.sh
    class main
    user system
    group net_admin
    disabled
    oneshot

service vendor.insmod_sh /vendor/bin/init.insmod.sh
    class main
    user root
    group root system
    disabled
    oneshot

# b/70518189 vDSO experiments
on property:sys.vdso=*
   write /sys/module/vdso/parameters/enable_32 1
   write /sys/module/vdso/parameters/enable_64 1

on property:sys.vdso=false
   write /sys/module/vdso/parameters/enable_32 0
   write /sys/module/vdso/parameters/enable_64 0

on property:sys.vdso=64
   write /sys/module/vdso/parameters/enable_32 0

on property:sys.vdso=32
   write /sys/module/vdso/parameters/enable_64 0

# charger driver exposes now finer grain control, map demo mode to those properties
# demo mode can only be exit wipping data which will also reset the persist properties
on property:sys.retaildemo.enabled=1
    setprop persist.vendor.charge.stop.level 35
    setprop persist.vendor.charge.start.level 30

on property:sys.boot_completed=1
    # Create pixel-trace.
    # At this moment, only mm_event is available. If others want to put more,
    # it should get hard review from pixel-perf-team.

    mkdir /sys/kernel/debug/tracing/instances/pixel-trace 755 system system
    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/trace
    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/trace
    chown system system /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
    chmod 0660 /sys/kernel/debug/tracing/instances/pixel-trace/tracing_on
    write /sys/kernel/debug/tracing/instances/pixel-trace/buffer_size_kb 64
    write /sys/kernel/debug/tracing/instances/pixel-trace/events/mm_event/enable 1

# turns off tracing right before bugreporting to keep more traces
on property:init.svc.dumpstatez=running
    write /d/tracing/instances/pixel-trace/tracing_on 0

on property:init.svc.dumpstatez=stopped
    write /d/tracing/instances/pixel-trace/tracing_on 1

on property:init.svc.bugreport=running
    write /d/tracing/instances/pixel-trace/tracing_on 0

on property:init.svc.bugreport=stopped
    write /d/tracing/instances/pixel-trace/tracing_on 1

# init-fingerprint-sh is for stopping fps_hal after init retry fail serval times
# It keeps running until max init retry or fps_hal running successfully
# vendor.fps_hal restarts until max init retry times
#
# /vendor/bin/init.fingerprint.sh [max_init_retry_times]
service init-fingerprint-sh /vendor/bin/init.fingerprint.sh 10
    group root
    user root
    disabled
    oneshot

on property:sys.boot_completed=1
    start init-fingerprint-sh

on property:vendor.fps.init.succeed=true && property:init.svc.vendor.fps_hal=stopped
    start init-fingerprint-sh