on early-init
    mkdir /efs 0771 radio system
    mkdir /mnt/vendor/efs 0771 radio system
    mkdir /mnt/vendor/cpefs 0771 radio system
    mkdir /mnt/vendor/persist 0771 system system
    mount debugfs /sys/kernel/debug /sys/kernel/debug

on init
    start watchdogd

    # Fastcharge
    chown system radio /sys/class/sec/switch/afc_disable

    # ZRAM parameters
    write /proc/sys/vm/page-cluster 0
    write /proc/sys/vm/swappiness 130

    ## SCSC WLAN
    # SD-755: Increase default socket rx buffer limit
    write /proc/sys/net/core/rmem_default 327680
    write /proc/sys/net/core/rmem_max 327680


    ## SCSC BT
    chown bluetooth bluetooth /sys/module/scsc_bt/parameters/bluetooth_address

on late-fs
    # Start services for Boot Animation
    start servicemanager
    start surfaceflinger
    start bootanim
    # Make sure HW service manager started and start required HAL services
    start vendor.configstore-hal
    start vendor.gralloc-2-0

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

#    start mobicore

on post-fs
    # Allow writing to the kernel trace log.
    chmod 0222 /sys/kernel/debug/tracing/trace_marker

    # set RLIMIT_MEMLOCK to 64MB
    setrlimit 8 67108864 67108864

on post-fs-data
# NFC
    mkdir /data/vendor/nfc 0770 nfc nfc

# NFC: create /efs/sec_efs/nfc and /efs/nfc for nv storage
    mkdir /efs/sec_efs/nfc 0700 nfc nfc
    mkdir /efs/nfc 0700 nfc nfc

# TEEGRIS service
    mkdir /data/vendor/tee 0700 system system

# Log data folder
    mkdir /data/vendor 0771 root system
    mkdir /data/vendor/log 0771 root system
    mkdir /data/log/abox 0771 audioserver system

#dump Abox permission
    chmod 777 data/vendor/log/abox

    setprop vold.post_fs_data_done 1

# Gatekeeper data
    mkdir /data/vendor/gk 0771 system system

## SCSC WLAN
    # Setup Wi-Fi permissions
    mkdir /data/misc/wifi 0770 wifi system
    mkdir /data/misc/wifi/sockets 0770 wifi wifi
	mkdir /vendor/etc/wifi 0770 system system
	mkdir /data/hostapd 0770 system wifi

# Permissions for audio
    chown system radio /sys/class/audio/earjack/select_jack
    chown system radio /sys/class/audio/earjack/key_state
    chown system radio /sys/class/audio/earjack/state
    chown system radio /sys/class/audio/earjack/mic_adc

    chown system audio /sys/class/nxp/tfa_cal/status
    chown system audio /sys/class/nxp/tfa_cal/rdc
    chown system audio /sys/class/nxp/tfa_cal/temp

    mkdir /mnt/vendor/efs/nxp 0770 system audio
    chown system audio /mnt/vendor/efs/nxp/rdc_cal
    chown system audio /mnt/vendor/efs/nxp/temp_cal
    chmod 0660 /mnt/vendor/efs/nxp/rdc_cal
    chmod 0660 /mnt/vendor/efs/nxp/temp_cal

    mkdir /efs/nxp 0770 system audio
    chown system audio /efs/nxp/rdc_cal
    chown system audio /efs/nxp/temp_cal
    chmod 0660 /efs/nxp/rdc_cal
    chmod 0660 /efs/nxp/temp_cal

    chown system audio /sys/class/nxp/tfa_log/data_maxx
    chown system audio /sys/class/nxp/tfa_log/count_overxmax
    chown system audio /sys/class/nxp/tfa_log/data_maxt
    chown system audio /sys/class/nxp/tfa_log/count_overtmax
    chmod 0440 /sys/class/nxp/tfa_log/data_maxx
    chmod 0440 /sys/class/nxp/tfa_log/count_overxmax
    chmod 0440 /sys/class/nxp/tfa_log/data_maxt
    chmod 0440 /sys/class/nxp/tfa_log/count_overtmax

# Change permission for A-Box firmware logs file & GPR dump
    chown audioserver system /sys/kernel/debug/abox/log-00
    chown audioserver system /sys/devices/platform/14a50000.abox/14a50000.abox:abox_debug@0/gpr
    chown audioserver system /sys/devices/platform/14a50000.abox/14a50000.abox:abox_debug@0/calliope_sram
    chown audioserver system /sys/devices/platform/14a50000.abox/14a50000.abox:abox_debug@0/calliope_dram
    chown audioserver system /sys/devices/platform/14a50000.abox/14a50000.abox:abox_debug@0/calliope_iva

# FM Radio
    chown system audio /dev/radio0
    chmod 0660 /dev/radio0

# Permissions for backlight
    chown system system /sys/class/backlight/panel/brightness

# Permissions for LCD
    chown system radio /sys/class/lcd/panel/lcd_type
    chown system system /sys/class/lcd/panel/lux

# Permissions Camera
    mkdir /data/vendor/camera 0770 cameraserver system
    mkdir /data/misc/camera 0770 cameraserver cameraserver
    chown system radio /sys/class/camera/rear/rear_camfw
    chown system radio /sys/class/camera/rear/rear_camfw_full
    chown system radio /sys/class/camera/rear/rear_checkfw_user
    chown system radio /sys/class/camera/rear/rear_checkfw_factory
    chown system radio /sys/class/camera/rear/rear_sensor_standby
    chown system radio /sys/class/camera/rear/rear_camtype
    chown system radio /sys/class/camera/rear/rear_calcheck
    chown system radio /sys/class/camera/rear/rear_afcal
    chown system system /sys/class/camera/rear/rear_hwparam
    chown cameraserver cameraserver /sys/class/camera/rear/rear_awb_master
    chown cameraserver cameraserver /sys/class/camera/rear/rear_awb_module
    chown cameraserver cameraserver /sys/class/camera/rear/rear_sensorid_exif
    chown cameraserver cameraserver /sys/class/camera/rear/rear_sensorid
    chown cameraserver cameraserver /sys/class/camera/rear/ssrm_camera_info
    chown system radio /sys/class/camera/rear/isp_core
    chown system radio /sys/class/camera/rear/fw_update
    chown system radio /sys/class/camera/rear/rear_moduleid
    chown system radio /sys/class/camera/flash/rear_flash
    chown cameraserver system /sys/class/camera/flash/rear_torch_flash
    chown system radio /sys/class/camera/flash/front_flash
    chown cameraserver system /sys/class/camera/flash/front_torch_flash
    chown system radio /sys/class/camera/front/front_camfw
    chown system radio /sys/class/camera/front/front_camfw_full
    chown system radio /sys/class/camera/front/front_checkfw_factory
    chown system radio /sys/class/camera/front/front_camtype
    chown system radio /sys/class/camera/front/front_moduleid
    chown system system /sys/class/camera/front/front_hwparam
    chown cameraserver cameraserver /sys/class/camera/front/front_sensorid_exif
    chown cameraserver cameraserver /sys/class/camera/front/front_sensorid
    chown system radio /sys/class/camera/front/front2_camfw
    chown system radio /sys/class/camera/front/front2_camfw_full
    chown system radio /sys/class/camera/front/front2_checkfw_user
    chown system radio /sys/class/camera/front/front2_checkfw_factory
    chown system radio /sys/class/camera/front/front2_tilt
    chown system system /sys/class/camera/front/front2_hwparam
    chown system system /sys/class/camera/front/front2_camtype
    chown system radio /sys/class/camera/front/front_dualcal
    chown system radio /sys/class/camera/front/front_dualcal_size
    chown system radio /sys/class/camera/front/front2_shift_x
    chown system radio /sys/class/camera/front/front2_shift_y
    chown cameraserver cameraserver /sys/class/camera/front/front_xtalkcal
    chown system radio /sys/class/camera/rear/supported_cameraIds

    ## Rear2 camera permission
    chown system radio /sys/class/camera/rear/rear2_camfw
    chown system radio /sys/class/camera/rear/rear2_camfw_full
    chown system radio /sys/class/camera/rear/rear2_checkfw_user
    chown system radio /sys/class/camera/rear/rear2_checkfw_factory
    chown system system /sys/class/camera/rear/rear2_hwparam
    chown cameraserver cameraserver /sys/class/camera/rear/rear2_sensorid_exif
    chown cameraserver cameraserver /sys/class/camera/rear/rear2_sensorid
    chown system radio /sys/class/camera/rear/rear2_moduleid
    chown system radio /sys/class/camera/rear/rear2_tilt

    ## Rear3 camera permission
    chown system radio /sys/class/camera/rear/rear3_camfw
    chown system radio /sys/class/camera/rear/rear3_camfw_full
    chown system radio /sys/class/camera/rear/rear3_checkfw_user
    chown system radio /sys/class/camera/rear/rear3_checkfw_factory
    chown system system /sys/class/camera/rear/rear3_hwparam
    chown cameraserver cameraserver /sys/class/camera/rear/rear3_sensorid_exif
    chown cameraserver cameraserver /sys/class/camera/rear/rear3_sensorid
    chown system radio /sys/class/camera/rear/rear3_moduleid

# Permissions for SVC
    chown system system /sys/devices/svc/Camera/SVC_rear_module
    chown system system /sys/devices/svc/Camera/SVC_front_module

    chmod 0755 /sys/kernel/debug/tracing
    restorecon /sys/kernel/debug/tracing/trace_marker

# Permission for flashlight control for HAL3.3
# The Istor espresso board does not have the flash led h/w, So the below permission line are blocked.
# If you want to test the flashlight in board which have the flash led h/w, Enable the below blocked lines.
    chmod 0660 /sys/class/camera/flash/rear_flash
    chown system camera /sys/class/camera/flash/rear_flash

# permissions for bluetooth.
    setprop ro.bt.bdaddr_path "/mnt/vendor/efs/bluetooth/bt_addr"
    chown bluetooth bluetooth ro.bt.bdaddr_path

# for BT MAC address
    mkdir /mnt/vendor/efs/bluetooth 0770 system bluetooth
# if already exist
    chown system bluetooth /mnt/vendor/efs/bluetooth
    chown system bluetooth /mnt/vendor/efs/bluetooth/bt_addr
    chmod 0770 /mnt/vendor/efs/bluetooth
    chmod 0660 /mnt/vendor/efs/bluetooth/bt_addr

# Magnetic sensor YAS537 lib
    mkdir /data/vendor/yas_lib 0770 system system

# for WIFI MAC address
    mkdir /mnt/vendor/efs/wifi 0775 wifi root
    chown wifi root /mnt/vendor/efs/wifi/.mac.info
    chmod 0664 /mnt/vendor/efs/wifi/.mac.info
    chown wifi root /mnt/vendor/efs/wifi/.mac.cob
    chmod 0664 /mnt/vendor/efs/wifi/.mac.cob

    write /sys/module/scsc_mx/parameters/disable_recovery_handling 0

# MST/NFC Switch
    chown system /dev/mst_ctrl
    chmod 0660 /dev/mst_ctrl

# setup cgroup freezer for freecess
    mkdir /dev/freezer
    mount cgroup none /dev/freezer freezer
    mkdir /dev/freezer/frozen
    mkdir /dev/freezer/thaw
    write /dev/freezer/frozen/freezer.state FROZEN
    write /dev/freezer/thaw/freezer.state THAWED

# MARs for freecess
    chown system system /dev/freezer
    chown system system /dev/freezer/frozen
    chown system system /dev/freezer/frozen/tasks
    chown system system /dev/freezer/frozen/cgroup.procs
    chown system system /dev/freezer/thaw
    chown system system /dev/freezer/thaw/tasks
    chown system system /dev/freezer/thaw/cgroup.procs

# MARs for freecess
    chmod 0644 /dev/freezer/frozen/tasks
    chmod 0644 /dev/freezer/frozen/cgroup.procs
    chmod 0644 /dev/freezer/thaw/tasks
    chmod 0644 /dev/freezer/thaw/cgroup.procs

# OLAF setup
    mkdir /dev/freezer/olaf
    write /dev/freezer/olaf/freezer.state THAWED
    chown system system /dev/freezer/olaf
    chown system system /dev/freezer/olaf/tasks
    chown system system /dev/freezer/olaf/cgroup.procs
    chown system system /dev/freezer/olaf/freezer.state
    chmod 0644 /dev/freezer/olaf/tasks
    chmod 0644 /dev/freezer/olaf/cgroup.procs
    chmod 0644 /dev/freezer/olaf/freezer.state

on boot

	setprop wifi.interface wlan0

    # Allow to access debugfs for system:system
    chmod 0755 /sys/kernel/debug
    chown system system /sys/kernel/debug

	# Set permissions for ttysac2
	chown system system /dev/ttySAC2
	chmod 0660 /dev/ttySAC2

    # Set up kernel tracing, but disable it by default
    chmod 0222 /sys/kernel/debug/tracing/trace_marker
    write /sys/kernel/debug/tracing/tracing_on 0

    # DVFS & Hotplug
    chown system system /sys/power/cpuhotplug/enabled
    chown system system /sys/power/cpuhotplug/min_online_cpu
    chown system system /sys/power/cpuhotplug/max_online_cpu
    chmod 0664 /sys/power/cpuhotplug/enabled
    chmod 0664 /sys/power/cpuhotplug/min_online_cpu
    chmod 0664 /sys/power/cpuhotplug/max_online_cpu

    # CPU C-state node
    chown radio system /sys/module/cpuidle/parameters/off
    chmod 0664 /sys/module/cpuidle/parameters/off

    # Permissions for input_booster
    chown system radio /sys/class/input_booster/level
    chown system radio /sys/class/input_booster/head
    chown system radio /sys/class/input_booster/tail
    chmod 0664 /sys/class/input_booster/level
    chmod 0664 /sys/class/input_booster/head
    chmod 0664 /sys/class/input_booster/tail

    # Permissions for family_boost
    chown system radio /sys/kernel/hmp/family_boost
    chmod 0664 /sys/kernel/hmp/family_boost

    chown system radio /sys/kernel/hmp/down_threshold
    chmod 0664 /sys/kernel/hmp/down_threshold

    chown system radio /sys/devices/system/sec_os_ctrl/migrate_os
    chmod 0664 /sys/devices/system/sec_os_ctrl/migrate_os

    # mif dvfs node
    chown system system sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/available_frequencies
    chmod 0444 sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/available_frequencies
    chown system system sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/min_freq
    chmod 0664 sys/devices/platform/17000010.devfreq_mif/devfreq/17000010.devfreq_mif/min_freq

    # GPU dvfs node
    chown radio system /sys/devices/platform/11500000.mali/dvfs_table
    chmod 0664 /sys/devices/platform/11500000.mali/dvfs_table
    chown radio system /sys/devices/platform/11500000.mali/dvfs_min_lock
    chmod 0664 /sys/devices/platform/11500000.mali/dvfs_min_lock
    chown radio system /sys/devices/platform/11500000.mali/dvfs_max_lock
    chmod 0664 /sys/devices/platform/11500000.mali/dvfs_max_lock

    # Change permission for interactive governor
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_rate
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/timer_slack
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/min_sample_time
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/hispeed_freq
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/target_loads
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/go_hispeed_load
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/above_hispeed_delay
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/boost
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/boost
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/input_boost
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/input_boost
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse_duration
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/boostpulse_duration
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
    chmod 0660 /sys/devices/system/cpu/cpu0/cpufreq/interactive/io_is_busy
    
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_rate
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_rate
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_slack
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/timer_slack
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/min_sample_time
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/min_sample_time
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/hispeed_freq
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/hispeed_freq
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/target_loads
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/target_loads
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/go_hispeed_load
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/go_hispeed_load
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/above_hispeed_delay
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/above_hispeed_delay
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/boost
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/boost
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/input_boost
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/input_boost
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse_duration
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/boostpulse_duration
    chown system system /sys/devices/system/cpu/cpu6/cpufreq/interactive/io_is_busy
    chmod 0660 /sys/devices/system/cpu/cpu6/cpufreq/interactive/io_is_busy

# Mount cpuset group for cameraserver
    mkdir /dev/cpuset/cameraserver
    copy /dev/cpuset/cpus /dev/cpuset/cameraserver/cpus
    copy /dev/cpuset/mems /dev/cpuset/cameraserver/mems
    chown system system /dev/cpuset/cameraserver
    chown system system /dev/cpuset/cameraserver/tasks
    chown system system /dev/cpuset/cameraserver/cpus
    chmod 0664 /dev/cpuset/cameraserver/tasks
    chmod 0664 /dev/cpuset/cameraserver/cpus

# For CPUSET(7885)   0-3, 4-5, 6-7
    chown system system /dev/cpuset/top-app/cpus
    chown system system /dev/cpuset/foreground/cpus
    chown system system /dev/cpuset/background/cpus
    chown system system /dev/cpuset/system-background/cpus
    chmod 664 /dev/cpuset/top-app/cpus
    chmod 664 /dev/cpuset/foreground/cpus
    chmod 664 /dev/cpuset/background/cpus
    chmod 664 /dev/cpuset/system-background/cpus
    write /dev/cpuset/top-app/cpus 0-7
    write /dev/cpuset/foreground/cpus 0-7
    write /dev/cpuset/background/cpus 0-7
    write /dev/cpuset/system-background/cpus 0-7

# For Selective boost
    write /dev/cpuset/top-app/selective_boost 1
    write /dev/cpuset/foreground/selective_boost 1
    write /dev/cpuset/cameraserver/selective_boost 1

# Permission for UART SWITCH
    chmod 0660 /sys/class/sec/switch/uart_sel
    chown system system /sys/class/sec/switch/uart_sel

# Prevents permission denied error for telephony
    chmod 0644 /proc/cmdline

on fs
    mount_all /vendor/etc/fstab.${ro.hardware} --early
    # We need to seperate mounting SEC_EFS partition from fstab file due to GSI image loading case
    wait /dev/block/platform/13500000.dwmmc0/by-name/sec_efs
    mount ext4 /dev/block/platform/13500000.dwmmc0/by-name/sec_efs /efs nosuid nodev noatime noauto_da_alloc,discard,journal_checksum,data=ordered,errors=panic

    mount none /mnt/vendor/cpefs /cpefs bind
    restorecon_recursive /mnt/vendor/efs
    restorecon_recursive /mnt/vendor/cpefs
    restorecon_recursive /mnt/vendor/persist

    mkdir /mnt/vendor/persist/data/sfs 0700 system system
    mkdir /mnt/vendor/persist/data/tz 0700 system system

    # Start HW service manager early
    start hwservicemanager

    chown radio system /mnt/vendor/efs
    chmod 0771 /mnt/vendor/efs
    chown radio system /mnt/vendor/cpefs
    chmod 0771 /mnt/vendor/cpefs
    chown system system /mnt/vendor/persist

    # Enable rmnet data and aggregation
    setprop persist.rmnet.mux enabled
    setprop persist.rmnet.data.enable true
    setprop persist.data.wda.enable true
    setprop persist.data.df.agg.dl_pkt 10
    setprop persist.data.df.agg.dl_size 4096

# Permissions for ION
    chmod 0660 /sys/class/ion_cma/ion_video_ext/isolated
    chown system system /sys/class/ion_cma/ion_video_ext/isolated

# Sensors permissions
# Flush
    chown system radio /sys/class/sensors/sensor_dev/flush
# Accelerometer_sensor
    chown system radio /sys/class/sensors/accelerometer_sensor/raw_data
    chown system radio /sys/class/sensors/accelerometer_sensor/calibration
    chown system radio /sys/class/sensors/accelerometer_sensor/reactive_alert
    chown system radio /sys/class/sensors/accelerometer_sensor/vendor
    chown system radio /sys/class/sensors/accelerometer_sensor/name
    chown system radio /sys/class/sensors/accelerometer_sensor/selftest
    chown system radio /sys/class/sensors/accelerometer_sensor/lowpassfilter
# Proximity_sensor
    chown system radio /sys/class/sensors/proximity_sensor/state
    chown system radio /sys/class/sensors/proximity_sensor/raw_data
    chown system radio /sys/class/sensors/proximity_sensor/prox_avg
    chown system radio /sys/class/sensors/proximity_sensor/prox_cal
    chown system radio /sys/class/sensors/proximity_sensor/vendor
    chown system radio /sys/class/sensors/proximity_sensor/name
    chown system radio /sys/class/sensors/proximity_sensor/thresh_high
    chown system radio /sys/class/sensors/proximity_sensor/thresh_low
    chown system radio /sys/class/sensors/proximity_sensor/thresh_detect_high
    chown system radio /sys/class/sensors/proximity_sensor/thresh_detect_low
    chown system radio /sys/class/sensors/proximity_sensor/barcode_emul_en
    chown system radio /sys/class/sensors/proximity_sensor/prox_offset_pass
    chown system radio /sys/class/sensors/proximity_sensor/prox_trim
    chown system radio /sys/class/sensors/proximity_sensor/prox_probe
    chown system radio /sys/class/sensors/proximity_sensor/check_far_state
    chown system radio /sys/class/sensors/proximity_sensor/pocket_prox
# Light_sensor
    chown system radio /sys/class/sensors/light_sensor/lux
    chown system radio /sys/class/sensors/light_sensor/raw_data
    chown system radio /sys/class/sensors/light_sensor/vendor
    chown system radio /sys/class/sensors/light_sensor/name
    chown system radio /sys/class/sensors/light_sensor/adata0
    chown system radio /sys/class/sensors/light_sensor/adata1
    chown system radio /sys/class/sensors/light_sensor/adata2
    chown system radio /sys/class/sensors/light_sensor/adata3
    chown system radio /sys/class/sensors/light_sensor/adata4
    chown system radio /sys/class/sensors/light_sensor/adata5
    chown system radio /sys/class/sensors/light_sensor/astep
    chown system radio /sys/class/sensors/light_sensor/again
    chown system radio /sys/class/sensors/light_sensor/wtime
    chown system radio /sys/class/sensors/light_sensor/als_ch_cfg
    chown system radio /sys/class/sensors/light_sensor/fifo_level
    chown system radio /sys/class/sensors/light_sensor/fifo_overflowx
    chown system radio /sys/class/sensors/light_sensor/fifo_reset
# Gyro_sensor
    chown system radio /sys/class/sensors/gyro_sensor/power_on
    chown system radio /sys/class/sensors/gyro_sensor/power_off
    chown system radio /sys/class/sensors/gyro_sensor/temperature
    chown system radio /sys/class/sensors/gyro_sensor/selftest
    chown system radio /sys/class/sensors/gyro_sensor/selftest_dps
    chown system radio /sys/class/sensors/gyro_sensor/vendor
    chown system radio /sys/class/sensors/gyro_sensor/name
# Magnetic_sensor
    chown system radio /sys/class/sensors/magnetic_sensor/raw_data
    chown system radio /sys/class/sensors/magnetic_sensor/vendor
    chown system radio /sys/class/sensors/magnetic_sensor/name
    chown system radio /sys/class/sensors/magnetic_sensor/selftest

# Grip_sensor
    chown system radio /sys/class/sensors/grip_sensor/name
    chown system radio /sys/class/sensors/grip_sensor/vendor
    chown system radio /sys/class/sensors/grip_sensor/raw_data
    chown system radio /sys/class/sensors/grip_sensor/threshold
    chown system radio /sys/class/sensors/grip_sensor/calibration
    chown system radio /sys/class/sensors/grip_sensor/onoff
    chown system radio /sys/class/sensors/grip_sensor/reset
    chown system radio /sys/class/sensors/grip_sensor/mode
    chown system radio /sys/class/sensors/grip_sensor/gain
    chown system radio /sys/class/sensors/grip_sensor/start
    chown system radio /sys/class/sensors/grip_sensor/normal_threshold
    chown system radio /sys/class/sensors/grip_sensor/gain_ch2
    chown system radio /sys/class/sensors/grip_sensor/raw_data_ch2
    chown system radio /sys/class/sensors/grip_sensor/diff_avg_ch2
    chown system radio /sys/class/sensors/grip_sensor/normal_threshold_ch2
    chown system radio /sys/class/sensors/grip_sensor/ch_state
    chown system radio /sys/class/sensors/grip_sensor/body_threshold

# Grip_sensor
    chown system radio /sys/class/sensors/grip_sensor/name
    chown system radio /sys/class/sensors/grip_sensor/grip_firm_update_status
    chown system radio /sys/class/sensors/grip_sensor/grip_firm_update
    chown system radio /sys/class/sensors/grip_sensor/grip_firm_version_phone
    chown system radio /sys/class/sensors/grip_sensor/grip_firm_version_panel
    chown system radio /sys/class/sensors/grip_sensor/grip_sar_enable
    chown system radio /sys/class/sensors/grip_sensor/grip_sar_only_mode
    chown system radio /sys/class/sensors/grip_sensor/grip_sar_press_threshold
    chown system radio /sys/class/sensors/grip_sensor/grip_sar_release_threshold
    chown system radio /sys/class/sensors/grip_sensor/grip_earjack
    chown system radio /sys/class/sensors/grip_sensor/grip_gain
    chown system radio /sys/class/sensors/grip_sensor/grip_raw
    chown system radio /sys/class/sensors/grip_sensor/grip_raw_d
    chown system radio /sys/class/sensors/grip_sensor/grip_sw_reset
    chown system radio /sys/class/sensors/grip_sensor/grip_threshold
    chown system radio /sys/class/sensors/grip_sensor/grip_total_cap
    chown system radio /sys/class/sensors/grip_sensor/grip_check
    chown system radio /sys/class/sensors/grip_sensor/grip
    chown system radio /sys/class/sensors/grip_sensor/grip_diff_d
    chown system radio /sys/class/sensors/grip_sensor/grip_baseline
    chown system radio /sys/class/sensors/grip_sensor/grip_irq_count

# Permissions for Fingerprint sensor
    chmod 0660 /dev/goodix_fp
    chmod 0660 /dev/esfp0
    chown system system /dev/goodix_fp
    chown system system /dev/esfp0
    chown system radio /sys/class/fingerprint/fingerprint/type_check
    chown system radio /sys/class/fingerprint/fingerprint/name
    chown system radio /sys/class/fingerprint/fingerprint/vendor
    chown system radio /sys/class/fingerprint/fingerprint/adm
    chown system radio /sys/class/fingerprint/fingerprint/bfs_values

# Permissions for System LSI NFC
# NFC : Permissions for NFC
        chmod 0660 /dev/sec-nfc
        chown nfc nfc /dev/sec-nfc
# Permissions for S.LSI ESE
        chmod 0660 /dev/p3
        chown system system /dev/p3

on property:sys.boot_completed=1
    swapon_all /vendor/etc/fstab.enableswap

# Permission for flashlight control for HAL3.3
# The Istor espresso board does not have the flash led h/w, So the below permission line are blocked.
# If you want to test the flashlight in board which have the flash led h/w, Enable the below blocked lines.
    chmod 0660 /sys/class/camera/flash/rear_flash
    chown system camera /sys/class/camera/flash/rear_flash
    chmod 0660 /sys/class/camera/flash/front_flash
    chown system camera /sys/class/camera/flash/front_flash

#load ecd firmware
    write /proc/ecd/load_firmware 1

# Abox FailSafe
service abox /vendor/bin/main_abox 14a50000.abox /data/log/abox
   class late_start
   user audioserver
   group system

# Set watchdog timer to 30 seconds and pet it every 10 seconds to get a 20 second margin
service watchdogd /system/bin/watchdogd 10 20
    class core
    seclabel u:r:watchdogd:s0

# TEEGRIS daemon
service tz_service /vendor/bin/tzdaemon
    class core
    user system
    group system readproc
    disabled

# Handle core_dump/profiling requests from SWd.
# used only for DEBUG builds.
service tz_msg_recv /vendor/bin/tz_message_receiver
    class core
    user system
    group system
    disabled

service tzts_service /vendor/bin/tzts_daemon
    class core
    user system
    group system
    disabled

service charger /system/bin/charger
    class charger
    user system
    group system graphics input
    capabilities SYS_BOOT
    seclabel u:r:charger:s0

# Start NFC on supported variants
service nfc_hal_service /vendor/bin/hw/android.hardware.nfc@1.2-service.samsung
    override
    class hal
    user nfc
    group nfc
    disabled

on property:ro.boot.product.hardware.sku=NFC
    start nfc_hal_service
