普通文本  |  920行  |  31.52 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.boot.hardware.platform}.power.rc
import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.usb.rc
import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.diag.rc
import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.logging.rc
import /vendor/etc/init/hw/init.${ro.boot.hardware.platform}.mpssrfs.rc


on property:init.svc.vendor.charger=running
    # Lock to lowest freqency on charger mode
    write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor powersave
    write /sys/devices/system/cpu/cpu6/cpufreq/scaling_governor powersave
    # keep one LITTLE and one big
    write /sys/devices/system/cpu/cpu1/online 0
    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/cpu7/online 0
    wait /dev/block/bootdevice
    write /sys/class/typec/port0/port_type sink
    write /sys/module/lpm_levels/parameters/sleep_disabled 0
    # Disable sched_boost
    write /proc/sys/kernel/sched_boost 0
    # Enable thermal mitigation
    write /sys/devices/virtual/thermal/tz-by-name/backup-charge/mode enabled

service vendor.charger /charger
    class charger
    seclabel u:r:charger:s0
    user system
    group system wakelock input
    capabilities SYS_BOOT
    file /dev/kmsg w
    file /sys/fs/pstore/console-ramoops-0 r
    file /sys/fs/pstore/console-ramoops r
    file /proc/last_kmsg r

on early-init
    mount debugfs debugfs /sys/kernel/debug
    chmod 0755 /sys/kernel/debug
    # Enable sched_boost
    write /proc/sys/kernel/sched_boost 1

# Skip init trigger for charger mode
on early-init && property:ro.boot.mode=charger
    setprop vendor.skip.init 1

# We need vold early for metadata encryption
on early-fs
    start vold

on init && property:vendor.skip.init=0
    start logd

    # 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
    start keymaster-4-0

    # start Citadel keymaster (StrongBox) early
    start vendor.citadeld
    start vendor.keymaster-4-0-citadel

    # Disable powersaving
    write /sys/module/lpm_levels/parameters/sleep_disabled 1

    # Loading kernel modules in background
    start insmod_sh

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

    # 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/cpu0/cpufreq/schedutil/up_rate_limit_us 500
    write /sys/devices/system/cpu/cpu0/cpufreq/schedutil/down_rate_limit_us 20000

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

    # 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

    mkdir /dev/cpuset/camera-daemon
    write /dev/cpuset/camera-daemon/cpus 0-7
    write /dev/cpuset/camera-daemon/mems 0
    chown system system /dev/cpuset/camera-daemon
    chown system system /dev/cpuset/camera-daemon/tasks
    chmod 0664 /dev/cpuset/camera-daemon/tasks

    # 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

    # Some user code relies on ro.boot.hardware.revision
    setprop ro.boot.hardware.revision ${ro.revision}

    # Thermal config file per product
    setprop vendor.sys.qcom.thermalcfg /vendor/etc/thermal-engine-${ro.hardware}.conf

    # Allow PAI targeting per hardware SKU
    setprop ro.oem.key1 ${ro.boot.hardware.sku}

    # Property used by vintf for sku specific manifests
    setprop ro.boot.product.hardware.sku ${ro.boot.hardware.sku}

on late-init
    setprop vendor.thermal.config thermal_info_config.json
    chown system system /sys/devices/virtual/thermal/tz-by-name/mb-therm-monitor/trip_point_0_temp
    chown system system /sys/devices/virtual/thermal/tz-by-name/mb-therm-monitor/trip_point_0_hyst
    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_temp
    chown system system /sys/devices/virtual/thermal/tz-by-name/usbc-therm-monitor/trip_point_0_hyst

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

    mkdir /mnt/vendor/persist/audio 0770 media audio
    mkdir /mnt/vendor/persist/data 0700 system system
    mkdir /mnt/vendor/persist/display 0770 system graphics
    mkdir /mnt/vendor/persist/rfs 0770 root system
    mkdir /mnt/vendor/persist/hlos_rfs 0770 root system
    chmod 0770 /mnt/vendor/persist/rfs
    chmod 0770 /mnt/vendor/persist/rfs/shared
    chmod 0770 /mnt/vendor/persist/rfs/msm
    chmod 0770 /mnt/vendor/persist/rfs/msm/adsp
    chmod 0770 /mnt/vendor/persist/rfs/msm/mpss
    chmod 0770 /mnt/vendor/persist/rfs/msm/slpi
    chmod 0770 /mnt/vendor/persist/rfs/mdm
    chmod 0770 /mnt/vendor/persist/rfs/mdm/adsp
    chmod 0770 /mnt/vendor/persist/rfs/mdm/mpss
    chmod 0770 /mnt/vendor/persist/rfs/mdm/slpi
    chmod 0770 /mnt/vendor/persist/rfs/mdm/tn
    chmod 0770 /mnt/vendor/persist/rfs/apq
    chmod 0770 /mnt/vendor/persist/rfs/apq/gnss
    chmod 0770 /mnt/vendor/persist/hlos_rfs
    restorecon /mnt/vendor/persist/rfs
    restorecon /mnt/vendor/persist/hlos_rfs
    restorecon_recursive /mnt/vendor/persist/

    # for cycle count backup
    mkdir /mnt/vendor/persist/battery 0700 system system

on late-fs
    # Start devices by sysfs trigger, including sensor related script.
    start devstart_sh

    # Start services for bootanim
    start surfaceflinger
    start bootanim
    start vendor.hwcomposer-2-2
    start vendor.configstore-hal
    start vendor.qti.hardware.display.allocator

    # 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

    # Wait for keymaster HALs (TEE and StrongBox)
    exec_start wait_for_strongbox

    # Mount RW partitions which need run fsck
    mount_all /vendor/etc/fstab.${ro.boot.hardware.platform} --late

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

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

on post-fs
    # Disable sched autogroup
    write /proc/sys/kernel/sched_autogroup_enabled 0

    # 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

    # turn off vblank irq immediately after turning off
    write /sys/module/drm/parameters/vblankoffdelay -1

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

    # Setup folder for modem fdr
    mkdir /data/vendor/modem_fdr 0700 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 vendor.qcom.time.set true

    # Wait qseecomd started
    wait_for_prop vendor.sys.listeners.registered true

    # load IPA FWs
    # This must be started when vendor.sys.listeners.registered is true
    start ipastart_sh

# 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 initialize /data/
    mkdir /data/vendor/ipa 0770 radio radio
    chown radio radio /data/vendor/ipa

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

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

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

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

    # Create netmgr recovery folder
    mkdir /data/vendor/netmgr/recovery 0700 radio radio
    chmod 0770 /data/vendor/netmgr/recovery
    write /data/vendor/netmgr/recovery/recovery_info ""
    chown radio radio /data/vendor/netmgr/recovery/recovery_info

    # 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 for radio
    mkdir /data/vendor/radio 0773 system radio
    mkdir /data/vendor/modem_stat 0771 system radio
    write /data/vendor/modem_stat/debug.txt ""
    chown system radio /data/vendor/modem_stat/debug.txt
    chmod 0664 /data/vendor/modem_stat/debug.txt

    # Set up sensors-related directories and permissions
    chmod 775 /mnt/vendor/persist/sensors
    chmod 664 /mnt/vendor/persist/sensors/sensors_settings
    chown root system /mnt/vendor/persist/sensors/registry
    chmod 775 /mnt/vendor/persist/sensors/registry
    chown root system /mnt/vendor/persist/sensors/registry/registry
    chmod 775 /mnt/vendor/persist/sensors/registry/registry

    chown system root /mnt/vendor/persist/sensors/sensors_settings
    chown root root /mnt/vendor/persist/sensors/registry/registry/sensors_settings

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

    chmod 770 /mnt/vendor/persist/audio
    chmod 660 /mnt/vendor/persist/audio/audio.cal
    chown media audio /mnt/vendor/persist/audio
    chown audioserver audio /mnt/vendor/persist/audio/audio.cal

    chmod 770 /mnt/vendor/persist/haptics
    chmod 440 /mnt/vendor/persist/haptics/drv2624.cal
    chown system system /mnt/vendor/persist/haptics
    chown system system /mnt/vendor/persist/haptics/drv2624.cal

    # 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
    mkdir /dev/socket/location 0770 gps gps
    mkdir /dev/socket/location/mq 0770 gps gps
    mkdir /dev/socket/location/xtra 0770 gps gps

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

    # Secure Element directory for loader service functionality
    mkdir /data/vendor/secure_element 0770 secure_element secure_element

on early-boot
    # wait for devices
    wait_for_prop vendor.qcom.devup 1

    # wait for insmod_sh to finish all modules
    wait_for_prop vendor.all.modules.ready 1

    write /sys/kernel/boot_adsp/boot 1
    write /sys/kernel/boot_cdsp/boot 1

    # Update dm-verity state and set partition.*.verified properties
    verity_update_state

    # Permission for rainbow sensor
    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_enable
    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_enable
    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_read_byte
    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_read_byte
    chown cameraserver camera /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_write_byte
    chmod 0660 /sys/devices/platform/soc/ac4a000.qcom,cci/ac4a000.qcom,cci:qcom,rainbow@20/rainbow_write_byte
    chown cameraserver camera /dev/vd6281
    chmod 0660 /dev/vd6281

    # 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
    chown system system /sys/class/leds/vibrator/device/lra_wave_shape

    # 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/backlight/panel0-backlight/brightness
    chown system system /sys/class/backlight/panel0-backlight/vr_mode

    # Permission for Wireless charger
    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/rxdata
    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/txdata
    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/txlen
    chown system system /sys/devices/platform/soc/a88000.i2c/i2c-0/0-0061/ccreset

    # Permission for Pixelstats
    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_read_cnt
    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_write_cnt
    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_discard_cnt
    chown system system /sys/devices/platform/soc/7c4000.sdhci/mmc_host/mmc0/slowio_flush_cnt

    # Permission for Health Storage HAL
    chown system system /sys/devices/platform/soc/7c4000.sdhci/manual_gc

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

    # 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

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

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

service vendor.thermal-engine /vendor/bin/thermal-engine -c ${vendor.sys.qcom.thermalcfg}
   class main
   user root
   group root system
   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

on property:persist.vendor.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

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

on property:sys.boot_completed=1
    # Set the default IRQ affinity to the silver cluster.
    write /proc/irq/default_smp_affinity 3f

    # Enable ZRAM on boot_complete
    swapon_all /vendor/etc/fstab.${ro.boot.hardware.platform}
    write /proc/sys/vm/swappiness 100

    # Setup final cpuset
    write /dev/cpuset/top-app/cpus 0-7
    write /dev/cpuset/foreground/cpus 0-5,7
    write /dev/cpuset/background/cpus 4-5
    write /dev/cpuset/system-background/cpus 2-5
    write /dev/cpuset/restricted/cpus 2-5

    # Setup final blkio
    # value for group_idle is us
    write /dev/blkio/blkio.weight 1000
    write /dev/blkio/background/blkio.weight 10
    write /dev/blkio/blkio.group_idle 2000
    write /dev/blkio/background/blkio.group_idle 0

    # 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

    # Dump QCOM FG cycle counts for dumpstate
    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

    # HardwareInfo needs to be able to read CC bins
    chmod 644 /sys/devices/platform/soc/c440000.qcom,spmi/spmi-0/spmi0-00/c440000.qcom,spmi:qcom,pm660@0:qpnp,fg/cycle_counts_bins

    # dumpstate needs to read, vendor.health-hal needs to be able to RW
    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

    # HardwareInfo needs to be able to read charge_full
    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

    # eMMC health
    chmod 755 /sys/kernel/debug/mmc0
    chmod 755 /sys/kernel/debug/mmc0/mmc0:0001
    chmod 644 /sys/kernel/debug/mmc0/mmc0:0001/ext_csd
    chmod 644 /sys/kernel/debug/mmc0/ring_buffer
    chmod 644 /sys/kernel/debug/mmc0/err_stats
    chmod 644 /sys/kernel/debug/mmc0/show_host
    chmod 644 /sys/kernel/debug/mmc0/io_stats
    chmod 644 /sys/kernel/debug/mmc0/req_stats

    # Disable sched_boost
    write /proc/sys/kernel/sched_boost 0

    # Enable PowerHAL hint processing
    setprop vendor.powerhal.init 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 600
    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

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

on property:sys.shutdown.requested=*
    stop vendor.per_proxy

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

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

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

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

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

service sensors.qti /vendor/bin/sensors.qti
    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 adsprpcd /vendor/bin/adsprpcd rootpd
   class main
   user system
   group system

service cdsprpcd /vendor/bin/cdsprpcd
   class main
   user system
   group system

service adsprpcd_audiopd /vendor/bin/adsprpcd audiopd
   class main
   user media
   group media

service adsprpcd_sensorspd /vendor/bin/adsprpcd sensorspd
   class main
   user system
   group system

service 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 modem_svc /vendor/bin/modem_svc -q
   class core
   user root
   group system
   capabilities NET_BIND_SERVICE

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 cnss-daemon /vendor/bin/cnss-daemon -n -l
   class late_start
   user system
   group system inet wifi

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

service 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 imsdatadaemon

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

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

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

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

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

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

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

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

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

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

# 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 devstart_sh /vendor/bin/init.qcom.devstart.sh
    class main
    user root
    group root system
    disabled
    oneshot

service vendor.wlan_sh /vendor/bin/init.qcom.wlan.sh
    class main
    user root
    group root
    disabled
    oneshot

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

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

service 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

service ppd /vendor/bin/mm-pp-dpps
    class late_start
    user graphics
    group graphics
    socket pps stream 0660 system system
    disabled

service wait_for_strongbox /vendor/bin/hw/wait_for_strongbox
    user root
    group root system
    priority -20
    ioprio rt 0

on property:init.svc.vendor.hwcomposer-2-2=stopped
    stop ppd

on property:init.svc.vendor.hwcomposer-2-2=running
    start ppd

# 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

on property:wlan.driver.status=ok
    # Get the wlan driver/fw version
    start vendor.wlan_sh

on property:ro.boot.mode=sota
    setprop ro.boot.sota enabled

on property:ro.boot.hardware.sku=G020A
    setprop persist.vendor.nfc.uicc_enabled true
    setprop persist.vendor.radio.uicc_se_enabled true
on property:ro.boot.hardware.sku=G020B
    setprop persist.vendor.nfc.uicc_enabled true
    setprop persist.vendor.radio.uicc_se_enabled true
on property:ro.boot.hardware.sku=G020C
    setprop persist.vendor.nfc.uicc_enabled true
    setprop persist.vendor.radio.uicc_se_enabled true
on property:ro.boot.hardware.sku=G020D
    setprop persist.vendor.nfc.uicc_enabled false
    setprop persist.vendor.radio.uicc_se_enabled false
    interface_start android.hardware.secure_element@1.1::ISecureElement/eSE1
on property:ro.boot.hardware.sku=G020E
    setprop persist.vendor.nfc.uicc_enabled true
    setprop persist.vendor.radio.uicc_se_enabled true
on property:ro.boot.hardware.sku=G020F
    setprop persist.vendor.nfc.uicc_enabled true
    setprop persist.vendor.radio.uicc_se_enabled true
on property:ro.boot.hardware.sku=G020G
    setprop persist.vendor.nfc.uicc_enabled true
    setprop persist.vendor.radio.uicc_se_enabled true
on property:ro.boot.hardware.sku=G020H
    setprop persist.vendor.nfc.uicc_enabled false
    setprop persist.vendor.radio.uicc_se_enabled false
    interface_start android.hardware.secure_element@1.1::ISecureElement/eSE1

# charger driver exposes now finer grain control, map demo mode to those properties
# demo mode can only be exited by wiping 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:persist.vendor.charge.stop.level=*
    write /sys/devices/platform/soc/soc:google,charger/charge_stop_level ${persist.vendor.charge.stop.level}

on property:persist.vendor.charge.start.level=*
    write /sys/devices/platform/soc/soc:google,charger/charge_start_level ${persist.vendor.charge.start.level}

# For Japan radio builds, always enforce camera shutter sound
# Since this property is read by the audio server in system service,
# it should be written by the system init.
on property:ro.boot.hardware.radio.subtype=0
    setprop audio.camerasound.force true

# Touch
on property:vendor.all.modules.ready=1
    wait /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
    chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/read_report
    chown system system /sys/devices/platform/soc/a84000.i2c/i2c-2/2-0020/input/input2/suspend

# DSDS feature
# Enable 2nd qcrild when the property set to dsds
on property:persist.radio.multisim.config=dsds
    start vendor.qcrild2

on property:sys.boot_completed=1 && property:ro.boot.mode=firstboot
    start init-firstboot-sh

service init-firstboot-sh /vendor/bin/init.firstboot.sh
    user nobody
    disabled
    oneshot

# 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

# Write the dark theme magic (`theme-dark`, or 0x7468656d652d6461726b in hex string) to /misc
# partition. Offset 0 in vendor space is effectively offset 2048 in /misc partition.
service vendor.theme_set /vendor/bin/misc_writer --vendor-space-offset 0 --hex-string 0x7468656d652d6461726b
    disabled
    oneshot

# Clear the 10-byte dark theme magic in /misc partition. Offset 0 in vendor space is effectively
# offset 2048 in /misc partition.
service vendor.theme_clear /vendor/bin/misc_writer --vendor-space-offset 0 --hex-string 0x00000000000000000000
    disabled
    oneshot

# Set dark boot flag on dark mode (UiModeManager.MODE_NIGHT_YES == 2).
on property:persist.sys.theme=2
    start vendor.theme_set

# Clear the dark boot flag on light mode (UiModeManager.MODE_NIGHT_NO == 1) or auto mode
# (UiModeManager.MODE_NIGHT_AUTO == 0).
on property:persist.sys.theme=1
    start vendor.theme_clear

on property:persist.sys.theme=0
    start vendor.theme_clear