#################################################################################
### VENDOR_EDIT, OEM All rights reserved.
###
### File: - init.oem.rc
### Author: jiangyonggao
### all oem triger & init are here
### ------------------------------- Revision History: ----------------------------
### <author>                        <data>       <version>   <desc>
### ------------------------------------------------------------------------------
### jiangyg@PM                     2013-10-21                Create this file
##################################################################################
#Load WLAN driver

import /vendor/etc/init/hw/init.cust.rc
#ethan.peng@Connectivity,2020/12/29,close uicc since orange
import /vendor/etc/init/hw/init.uicc.rc

on property:wlan.driver.status=ok
    start load_wlan_driver

service load_wlan_driver /vendor/bin/sh /vendor/bin/load_wlan_driver
    class main
    disabled
    oneshot

on charger
    setprop persist.vendor.oem.dump 0
    setprop persist.vendor.oem.ssrdump 0
    start oemlogkit

#@bsp, 2019/08/22 Add dash charging
service dashd /vendor/bin/dashd
    class core
    seclabel u:r:dashd:s0
    group root system

#bsp, 2020/01/04 Add wireless charge
service wlchgd /vendor/bin/wlchgd
    class main
    disabled
    seclabel u:r:wlchgd:s0
    group root system

on fs
    #yankelong add
    chown system system /sys/class/leds/vibrator/haptic_audio_ai_input
    chown system system /sys/class/leds/vibrator/haptic_audio_tp_input
    chown system system /sys/class/leds/vibrator/haptic_audio_tp_size
    chown audioserver audioserver /sys/class/leds/vibrator/register
    chown system system /sys/class/leds/vibrator/vmax_mv
    chmod 660 /sys/class/leds/vibrator/vmax_mv
    chmod 660 /sys/class/leds/vibrator/rtp
    chmod 660 /sys/class/leds/vibrator/haptic_audio_tp_time
    chmod 644 /sys/class/leds/vibrator/haptic_osc_data
    chmod 660 /sys/class/leds/vibrator/ram_test
    chmod 644 /sys/class/leds/vibrator/ram_update
    chmod 644 /sys/class/leds/vibrator/f0_cali_data
    chown system system /sys/class/leds/vibrator/activate
    chown system system /sys/class/leds/vibrator/brightness
    chown system system /sys/class/leds/vibrator/duration
    chown system system /sys/class/leds/vibrator/state
    chown system system /sys/class/leds/vibrator/rf_hz
    chown system system /sys/class/leds/vibrator/lra_resistance
    chown system system /sys/class/leds/vibrator/gain
    chown system system /sys/class/leds/vibrator/vmax
    chown system system /sys/class/leds/vibrator/index
    chown system system /sys/class/leds/vibrator/activate_mode
    chown system system /sys/class/leds/vibrator/seq
    chown system audio /sys/class/leds/vibrator/rtp
    chown system audio /sys/class/leds/vibrator/haptic_audio_tp_time
    chown system system /sys/class/leds/vibrator/loop
    chown system system /sys/class/leds/vibrator/ignore_store
    chown system system /sys/class/leds/vibrator/osc_cali
    chown system system /sys/class/leds/vibrator/haptic_osc_data
    chown system system /sys/class/leds/vibrator/ram_test
    chown system system /sys/class/leds/vibrator/ram_update
    chown system system /sys/class/leds/vibrator/f0_cali_data
#ifdef VENDOR_EDIT
#    /* 20200330 david shih */
    chown system system /sys/module/proc/parameters/dbg_buf
#endif
    chown system system /sys/class/leds/vibrator/cali
    chown system system /sys/module/lpm_levels/parameters/sleep_disabled
    restorecon /sys/class/leds/vibrator/activate
    restorecon /sys/class/leds/vibrator/brightness
    restorecon /sys/class/leds/vibrator/duration
    restorecon /sys/class/leds/vibrator/state
#change ownership and premission for awinic haptic shock with music
    chown audioserver audioserver /dev/awinic_haptic
    chown audioserver audioserver /sys/class/leds/vibrator/haptic_audio
    chown audioserver audioserver /sys/class/leds/vibrator/gun_type
    chown audioserver audioserver /sys/class/leds/vibrator/bullet_nr
    chmod 777 /sys/class/leds/vibrator/gun_type
    chmod 777 /sys/class/leds/vibrator/bullet_nr
    chmod 777 /sys/class/leds/vibrator/register
#    /* add for aging apk to set node */
    chown system system /sys/class/power_supply/battery/is_aging_test
    chown system system /sys/class/power_supply/battery/dump_reg

#add for tri_state_key
    chown system system /sys/bus/platform/devices/soc/soc\:tri_state_key/hall_data_calib
    chown system system /sys/bus/platform/devices/soc/soc\:tri_state_key/hall_set_value

#add for tp firmware update
    write /sys/devices/platform/soc/a94000.i2c/i2c-4/4-004b/tp_fw_update 0
    write /sys/devices/platform/soc/a94000.i2c/i2c-4/4-0048/tp_fw_update 0
    write /sys/devices/platform/soc/984000.i2c/i2c-4/4-005d/tp_fw_update 0
    write /sys/devices/platform/soc/984000.i2c/i2c-4/4-0048/tp_fw_update 0
    write /sys/devices/platform/soc/a94000.i2c/i2c-4/4-005d/tp_fw_update 0
    write /sys/devices/platform/soc/880000.i2c/i2c-0/0-0038/tp_fw_update 0
    write /sys/devices/platform/soc/880000.spi/spi_master/spi0/spi0.0/tp_fw_update 0
#add for n200 
    write /sys/devices/platform/soc/4a80000.spi/spi_master/spi0/spi0.0/tp_fw_update 0

#add for tp debug log & to set node gesture_enable
    chown system system /proc/touchpanel/tp_debug_log
    chown system system /proc/touchpanel/gesture_enable
    chown system system /proc/touchpanel/gesture_switch
    chown system system /proc/touchpanel/tpedge_limit_enable
    chown system system /proc/touchpanel/tp_switch_dead_zone
    chown system system /proc/touchpanel/tp_switch_corner_dead_l_zone
    chown system system /proc/touchpanel/tp_switch_corner_dead_p_zone
    chown system system /proc/touchpanel/touch_apk
    chown system system /proc/touchpanel/get_device_temperature
    chown system system /proc/touchpanel/get_ic_firmware_version
#   /* add for wireless charge */
    chown system system /proc/wireless/enable_tx
    chown system system /proc/wireless/enable_rx
    chown system system /proc/wireless/epp_or_bpp
    chown system system /proc/wireless/current_out
    chown system system /proc/wireless/rx_voltage
    chown system system /proc/wireless/charge_pump_en
    chown system system /proc/wireless/deviated
    chown system system /proc/wireless/quiet_mode
    chown system system /proc/wireless/fast_skin_threld

    chown system system /proc/enhance_dash

# rayboo.lin@bsp, 2020/09/09 add for simCard holder detect
    chmod 0666 /proc/simholder/sim_holder_detect
    chown system system /proc/simholder/sim_holder_detect


#uma.mahesh@Imaging 2020/4/8 add for factory item
    chown system system /sys/class/leds/led:torch_0/brightness
    chmod 666 /sys/class/leds/led:torch_0/brightness
    chown system system /sys/class/leds/led:torch_1/brightness
    chmod 666 /sys/class/leds/led:torch_1/brightness
    chown system system /sys/class/leds/led:switch_0/brightness
    chmod 666 /sys/class/leds/led:switch_0/brightness
    chown system system /sys/class/leds/led:switch_1/brightness
    chmod 666 /sys/class/leds/led:switch_1/brightness
    chown system system /sys/class/leds/led:switch_2/brightness
    chmod 666 /sys/class/leds/led:switch_2/brightness
    chown system system /sys/class/leds/led:torch_2/brightness
    chmod 666 /sys/class/leds/led:torch_2/brightness
    chown system system /sys/class/leds/led:switch_3/brightness
    chmod 666 /sys/class/leds/led:switch_3/brightness
    mkdir /mnt/vendor/persist/camera 0777 system system
#add for laser
    chown system system /dev/stmvl53l1_ranging
    chmod 0666 /dev/stmvl53l1_ranging
    start vl53l1_daemon_main
#add for ams-tof
    chown system system /sys/kernel/tof_control/app0/capture
    chmod 666 /sys/kernel/tof_control/app0/capture
    chown system system /sys/kernel/tof_control/app0/app0_get_fac_calib
    chmod 666 /sys/kernel/tof_control/app0/app0_get_fac_calib
    chown system system /sys/kernel/tof_control/app0/app0_get_distance
    chmod 666 /sys/kernel/tof_control/app0/app0_get_distance
    chown system system /sys/kernel/tof_control/app0/app0_read_peak_crosstalk
    chmod 666 /sys/kernel/tof_control/app0/app0_read_peak_crosstalk
    chown system system /sys/kernel/tof_control/app0/period
    chmod 666 /sys/kernel/tof_control/app0/period
    chown system system /sys/kernel/tof_control/app0/iterations
    chmod 666 /sys/kernel/tof_control/app0/iterations
    chown system system /sys/kernel/tof_control/app0/alg_setting
    chmod 666 /sys/kernel/tof_control/app0/alg_setting
    chown system system /sys/kernel/tof_control/app0/app0_clk_iterations
    chmod 666 /sys/kernel/tof_control/app0/app0_clk_iterations
    chown system system /sys/kernel/tof_control/chip_enable
    chmod 666 /sys/kernel/tof_control/chip_enable
    chown system system /sys/kernel/tof_control/app0/app0_clk_trim_set
    chmod 666 /sys/kernel/tof_control/app0/app0_clk_trim_set
    chown system system /sys/kernel/tof_control/app0/app0_apply_fac_calib
    chmod 666 /sys/kernel/tof_control/app0/app0_apply_fac_calib
    chown system system /sys/kernel/tof_control/driver_debug
    chmod 666 /sys/kernel/tof_control/driver_debug
#add for ois debug
    chown system system /sys/kernel/ois_control/dump_registers
    chmod 666 /sys/kernel/ois_control/dump_registers


#   Power@bsp, 2020/2/27, add for thermal
    chown system system /dev/msm_thermal
    chown system system /dev/skin_thermal
    chown system system /dev/modem_skin_therm
    chown system system /dev/mmw0_therm
    chown system system /dev/mmw1_therm
    chown system system /dev/mmw2_therm
    chmod 0664 /dev/msm_thermal
    chmod 0664 /dev/skin_thermal
    chmod 0664 /dev/modem_skin_therm
    chmod 0664 /dev/mmw0_therm
    chmod 0664 /dev/mmw1_therm
    chmod 0664 /dev/mmw2_therm

#ifdef VENDOR_EDIT
#if OP_FEATURE_MM_ADSP_MINIDUMP == 1
#   zhangrun@MM, 2020/09/12, implement to collect adsp minidump
    chmod 664 /dev/ramdump_adsp
#endif

#ifdef VENDOR_EDIT
#   BSP add for display  2020/04/17 @Leo_BSP
    chmod 0666 /sys/class/drm/card0-DSI-1/hbm
    chmod 0666 /sys/class/drm/card0-DSI-1/hbm_brightness
    chmod 0666 /sys/class/backlight/panel0-backlight/brightness
#endif
#	display add 2018/10/19  @lichao_display
	chmod 0666 /sys/class/drm/card0-DSI-1/SRGB
	chmod 0666 /sys/class/drm/card0-DSI-1/DCI_P3
	chmod 0666 /sys/class/drm/card0-DSI-1/aod
	chmod 0666 /sys/class/drm/card0-DSI-1/night_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/panel_serial_number
	chmod 0666 /sys/class/drm/card0-DSI-1/cabc
	chmod 0666 /sys/class/drm/card0-DSI-1/oplus_shutdownflag
	chmod 0666 /sys/class/drm/card0-DSI-1/oneplus_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/adaption_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/notify_fppress
	chmod 0666 /sys/class/drm/card0-DSI-1/dim_alpha
	chmod 0666 /sys/class/drm/card0-DSI-1/notify_dim
	chmod 0666 /sys/class/drm/card0-DSI-1/force_screenfp
	chmod 0666 /sys/class/drm/card0-DSI-1/native_display_p3_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/native_display_wide_color_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/native_display_srgb_color_mode
	chmod 0666 /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dynamic_dsi_clock
	chown radio radio /sys/devices/platform/soc/soc:qcom,dsi-display-primary/dynamic_dsi_clock
	chown radio radio /proc/force_reset
	chmod 0666 /sys/class/drm/card0-DSI-1/native_display_loading_effect_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/native_display_customer_srgb_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/native_display_customer_p3_mode
	chmod 0666 /sys/class/drm/card0-DSI-1/dimlayer_bl_en
	chmod 0666 /sys/class/drm/card0-DSI-1/dither_en
	chmod 0666 /sys/class/drm/card0-DSI-1/oplus_msd_aod
	chmod 0666  /sys/class/drm/card0-DSI-1/panel_serial_number_AT

	chmod 0666 /sys/class/drm/card0-DSI-1/osc_mode
	chown radio radio /sys/class/drm/card0-DSI-1/osc_mode

#   ken.lin@ASTI, 2019/6/21, add for fsc
    chown system system /sys/module/fsc/parameters/enable
    chmod 0664 /sys/module/fsc/parameters/enable

on boot
#ifdef VENDOR_EDIT
    chmod 0666 /dev/goodix_fp
    chmod 0660 /sys/devices/platform/soc/soc:fingerprint_detect/sensor_version
    chown system system /sys/devices/platform/soc/soc:fingerprint_detect/sensor_version
    chmod 0666 /proc/touchpanel/touch_hold
    chown system system /proc/touchpanel/touch_hold
    chmod 0664 sys/devices/platform/soc/soc:goodix_fp/screen_state
    chown system system sys/devices/platform/soc/soc:goodix_fp/screen_state
    chmod 0666 /dev/qseecom

    # access permission for egis
    chown system system /dev/esfp0
    chmod 0666 /dev/esfp0
    # access permission for egis navigation
    chmod 0666 /sys/devices/platform/egis_input/navigation_event
    chmod 0666 /sys/devices/platform/egis_input/navigation_enable
    chown system system /sys/devices/platform/egis_input/navigation_event
    chown system system /sys/devices/platform/egis_input/navigation_enable
#endif
    setprop ro.nfc.port "I2C"
    chmod 0666 /dev/pn553
    chown nfc nfc /dev/pn553
    chmod 0666 /dev/p73
    chown secure_element secure_element /dev/p73
#Leo@BSP 2020/04/17 add for qsee_log tz_log
    chmod 0666 /proc/tzdbg/qsee_log
    chmod 0666 /proc/tzdbg/log
#Norman@Connectivity 2020/04/24 add for default country code
    setprop ro.boot.wificountrycode 00

#martin.li@BSP, 2019/12/03,support for EngineeringMode tool start
   chown system system /proc/rf_cable_config
   chown system system /proc/rf_factory_mode
#martin.li@BSP, 2019/12/03,support for EngineeringMode tool end
#ifdef VENDOR_EDIT
#Set TCP MTU probing to automatic
   write /proc/sys/net/ipv4/tcp_mtu_probing 1
#endif /*VENDOR_EDIT*/

#ifdef VENDOR_EDIT
#tempest.chen@BSP 2020/12/07 add for light sensor and ultrasound proximity
    chmod 666 /dev/input/event1
    chmod 666 /dev/input/event2
    chmod 666 /dev/input/event8
    chmod 666 /dev/input/event10
#endif /*VENDOR_EDIT*/

#ifdef VENDOR_EDIT
#niku.huang@SYSTEM, 2020/12/30, Add for enable round corner
    setprop vendor.display.disable_rounded_corner 0
#endif /*VENDOR_EDIT*/

on init
    setprop vendor.boot.verifiedbootstate ${ro.boot.verifiedbootstate}
    setprop vendor.boot.hw_version ${ro.boot.hw_version}
    setprop vendor.boot.prj_version ${ro.boot.prj_version}
    setprop vendor.boot.rf_version ${ro.boot.rf_version}
    setprop vendor.rf.version ${ro.boot.rf_version}

    #@bsp, 2019/08/22 Add dash charging
    chown system system /dev/dash
    chmod 0664 /dev/dash
    #restorecon /dev/dash
    chown system system /dev/wlchg
    chmod 0664 /dev/wlchg
    #restorecon /dev/wlchg

on post-fs
#ifdef VENDOR_EDIT
#oscar.wei@SYSTEM, 2019/10/02, [AN-604] opdiagnose porting, create folder and binary file.
    mkdir /mnt/vendor/persist/OPDiagnose 0770 system system
    chmod 660 /mnt/vendor/persist/OPDiagnose/opdiagnosedata
    chown system system /mnt/vendor/persist/OPDiagnose/opdiagnosedata
#endif
    chmod 0664 /sys/module/qpnp_smb5/parameters/usb_connector_temp
    chown system system /sys/module/qpnp_smb5/parameters/usb_connector_temp
    chmod 0664 /sys/module/qpnp_smb5/parameters/disable_connector_protect
    chown system system /sys/module/qpnp_smb5/parameters/disable_connector_protect
    chmod 0664 /sys/module/qpnp_smb5/parameters/usb_interval_temp
    chown system system /sys/module/qpnp_smb5/parameters/usb_interval_temp
    chmod 0664 /sys/module/qpnp_smb5/parameters/call_on
    chown radio radio /sys/module/qpnp_smb5/parameters/call_on
    chmod 0666 /sys/module/qpnp_smb5/parameters/video_call_on
    chown system system /sys/module/qpnp_smb5/parameters/video_call_on
    chown system system /proc/skin_temp_thrd/fastchg_thd
    chown system system /proc/skin_temp_thrd/fastchg_lcdoff_thd
    chown system system /proc/skin_temp_thrd/norchg_thd
    chown system system /proc/skin_temp_thrd/norchg_lcdoff_thd
#ifdef VENDOR_EDIT
#brandon.zeng@Conn,2020/05/08. add for nfc pnscr tool
    chown system system /vendor/bin/nfc_trasmit_start.sh
    chmod 0777  /vendor/bin/nfc_trasmit_start.sh
    chown system system /vendor/bin/nfc_trasmit_stop.sh
    chmod 0777  /vendor/bin/nfc_trasmit_stop.sh
    chown system system vendor/bin/pnscr
    chmod 0777  vendor/bin/pnscr
#endif

#ifdef VENDOR_EDIT
#   /* create a empty file for wifi hal to write mac address */
    mkdir /mnt/vendor/persist/qca6390 0770 wifi wifi
    write /mnt/vendor/persist/qca6390/wlan_mac.bin ""
    chown wifi wifi /mnt/vendor/persist/qca6390/wlan_mac.bin
    copy /vendor/etc/wifi/qca6390/WCNSS_qcom_cfg.ini /mnt/vendor/persist/qca6390/WCNSS_qcom_cfg.ini
    chown wifi wifi /mnt/vendor/persist/qca6390/WCNSS_qcom_cfg.ini
#   /*create a empty file for wifi single point calibration*/
    mkdir /mnt/vendor/persist/copy 0770 wifi wifi
#   /* create a empty file for wifi hal to write qca6490 mac address */
    write /mnt/vendor/persist/wlan_mac.bin ""
    chown wifi wifi /mnt/vendor/persist/wlan_mac.bin
#   /* Implement the function of forced Chain0/1 insmod WCNSS_qcom_cfg.ini */
    copy /vendor/etc/wifi/WCNSS_qcom_cfg.ini /mnt/vendor/persist/WCNSS_qcom_cfg.ini
    chown wifi wifi /mnt/vendor/persist/WCNSS_qcom_cfg.ini
#endif

#ifdef VENDOR_EDIT
#henry.cao@system, add for engineermode
    mkdir /mnt/vendor/persist/engineermode  0777 system system
#endif
    chown system system /proc/ship_mode
    chown system system /dev/param

#ifdef VENDOR_EDIT
#create path for NV items

#ifdef VENDOR_EDIT
#ken.chenxm@SYSTEM, 2019/10/10, add for [OSP-3172] charging optimizated
    chown system system /sys/class/power_supply/battery/op_disable_charge
    chmod 660 /sys/class/power_supply/battery/op_disable_charge
    chown system system /sys/class/power_supply/bms/battery_h
    chmod 660 /sys/class/power_supply/bms/battery_h
#brian@BSP, 2021/3/4, add for [IKR-43692] charging optimizated
    chown system system /sys/class/power_supply/bms/full_available_capacity
    chmod 660 /sys/class/power_supply/bms/full_available_capacity
    chown system system /sys/class/power_supply/bms/full_charge_capacity_filtered
    chmod 660 /sys/class/power_supply/bms/full_charge_capacity_filtered
#endif
#ifdef VENDOR_EDIT
#randle.liu@optimization, 2020/04/24, [OSP-6116] avoid waking up when wireless charging disconnects
    chown system system /sys/class/power_supply/wireless/icon_delay
    chmod 660 /sys/class/power_supply/wireless/icon_delay
#endif
#jay.fa@OPTI, 2020/08/12, add for [OPTI-42] hypnus
    chown root system /sys/class/thermal/cooling_device0/cur_state
    chown root system /sys/class/thermal/cooling_device1/cur_state
    chown root system /sys/class/thermal/cooling_device2/cur_state
    chown root system /sys/class/kgsl/kgsl-3d0/max_pwrlevel
    chown root system /sys/class/kgsl/kgsl-3d0/min_pwrlevel
    chown root system /sys/class/thermal/cooling_device14/cur_state
    chmod 660 /sys/class/thermal/cooling_device0/cur_state
    chmod 660 /sys/class/thermal/cooling_device1/cur_state
    chmod 660 /sys/class/thermal/cooling_device2/cur_state
    chmod 660 /sys/class/kgsl/kgsl-3d0/max_pwrlevel
    chmod 660 /sys/class/kgsl/kgsl-3d0/min_pwrlevel
    chmod 660 /sys/class/thermal/cooling_device14/cur_state

on post-fs-data
    mkdir /data/vendor/oemnvitems 0771 radio radio
    #brandon.zeng@Conn,2020/08/11. move data path to post-fs-data
    mkdir /data/vendor/nfc 0770 nfc nfc
    # Ted.Lin@ASTI 2019/06/12 add for CONFIG_HOUSTON
    chown system system /sys/module/houston/parameters/fps_boost
    chown system system /sys/module/houston/parameters/fps_data_sync
    chown system system /sys/module/houston/parameters/perf_ready
    chown system system /sys/module/houston/parameters/ais_enable
    chown system system /sys/module/houston/parameters/sample_rate_ms
    chown system system /sys/module/houston/parameters/ht_enable
    chown system system /sys/module/houston/parameters/fps_boost_enable
    chown system system /sys/module/houston/parameters/fps_boost_strategy
    chown system system /sys/module/houston/parameters/tb_ctl
    chown system system /sys/module/houston/parameters/tb_enable
    chown system system /sys/module/houston/parameters/reset
    chown system system /sys/module/houston/parameters/hwui_boost_enable
    chown system system /sys/module/houston/parameters/fuse_boost
    chown system system /dev/ht_ctl
    chown system system /sys/module/pccore/parameters/params
    chown system system /sys/module/tpd/parameters/tpd_enable
    chown system system /sys/module/tpd/parameters/tpd_cmds
    chown system system /sys/module/tpd/parameters/tpd_id
    chown system system /sys/module/tpd/parameters/tpd_dynamic
    chown system system /sys/module/fuse/parameters/shortcircuit
    chown system system /sys/module/fuse/parameters/sct_mode
    # Jacky.Ho@OPTI 2020/09/23 add for [OSP-8617]
    chown system system /sys/module/houston/parameters/game_fps_pid
    chown system system /sys/module/houston/parameters/game_info
    # fps stabilizer
    chown system system /sys/module/houston/parameters/efps_max
    chown system system /sys/module/houston/parameters/fps_boost_strategy
    chown system system /sys/module/houston/parameters/egl_buf
    chown system system /sys/module/houston/parameters/ht_online_config_update

    # rock.lin@OPTI [OPTI-191] for power consumption
    chown system system /sys/module/cpufreq_bouncing/parameters/enable
    chown system system /sys/module/cpufreq_bouncing/parameters/config

    # Jacky.Ho@OPTI 2020/09/30 add for [OPTI-85]
    chown system system /sys/module/tpp/parameters/tpp_on
    chown system system /sys/module/tpp/parameters/strategy

# Ted.Lin@ASTI 2019/06/12 add for CONFIG_CONTROL_CENTER
    chown system system /dev/cc_ctl
    chown system system /proc/cc_ctl

#endif /* VENDOR_EDIT */

# rock.lin@OPTI 2020/06/11 add for CONFIG_RATP
    chown system system /sys/module/ratp/parameters/ratp_enable

#ifdef VENDOR_EDIT
# TomCheng@Core ,2020/06/22, HDCP provision key feature
    mkdir /mnt/vendor/persist/hdcp/media_dump 0770 mediaex mediadrm
    mkdir /mnt/vendor/persist/hdcp  775 media mediadrm
    restorecon /mnt/vendor/persist/hdcp
#endif

# ifdef VENDOR_EDIT
# denzel.chen@performance, 2020/05/12, add for OPBRITN-3462
    chmod 664 /sys/module/memplus_core/parameters/memory_plus_wake_memex
    chown system system /sys/module/memplus_core/parameters/memory_plus_wake_memex
# endif

    # neil.sun@Connectivity, 2020/08/12, add for wifi minidump
    mkdir /data/vendor/ramdump/wifi 0770 system system

#if OP_FEATURE_MM_ADSP_MINIDUMP == 1
# zhangrun@MM, 2020/09/12, implement to collect adsp minidump
    mkdir /data/vendor/ramdump/adsp 0770 system system
# endif

    # kimmy.yang@NETWORK, 20201223, add for SM8350 (SoC)
    mkdir /data/vendor/ramdump/modem 0770 system system

#ifdef VENDOR_EDIT online ISP tuning
    mkdir /data/vendor/camera_update 0777 camera camera
    write /data/vendor/camera_update/reservetuningbin0 ""
    write /data/vendor/camera_update/reservetuningbin1 ""
    write /data/vendor/camera_update/reservetuningbin2 ""
    write /data/vendor/camera_update/reservetuningbin3 ""
    write /data/vendor/camera_update/reservetuningbin4 ""
    write /data/vendor/camera_update/reservetuningbin5 ""
    write /data/vendor/camera_update/reservetuningbin6 ""

    chmod 0666 /data/vendor/camera_update/reservetuningbin0
    chmod 0666 /data/vendor/camera_update/reservetuningbin1
    chmod 0666 /data/vendor/camera_update/reservetuningbin2
    chmod 0666 /data/vendor/camera_update/reservetuningbin3
    chmod 0666 /data/vendor/camera_update/reservetuningbin4
    chmod 0666 /data/vendor/camera_update/reservetuningbin5
    chmod 0666 /data/vendor/camera_update/reservetuningbin6
#endif

# for battery charging off is call_state_change
# jinguozhi@wt.network,20210207,add for battery charging off is call_state_change
on property:persist.sys.chgdisabled=1
   write /sys/class/power_supply/battery/call_mode 1
on property:persist.sys.chgdisabled=0
   write /sys/class/power_supply/battery/call_mode 0

# add for SMT test enters WLAN FTM test in non-signaling
service wififtmserver /vendor/bin/sh vendor/bin/wifi_ftm
    class late_start
    user root
    group root
    disabled
    oneshot

# ted.lin@OPTU [OPTI-191] add for qcom boost config
on property:vendor.post_boot.parsed=1
    chown system system /sys/devices/system/cpu/cpu0/cpufreq/schedutil/target_loads
    chown system system /sys/devices/system/cpu/cpu4/cpufreq/schedutil/target_loads
    chown system system /sys/devices/system/cpu/cpu7/cpufreq/schedutil/target_loads
    chown system system /sys/devices/system/cpu/cpu7/core_ctl/busy_up_thres
    chown system system /sys/devices/system/cpu/cpu7/core_ctl/busy_down_thres

on property:vendor.wlan.ftm.up=1
    start wififtmserver

on property:persist.vendor.oem.wifi.chain=1
    copy /vendor/etc/wifi/WCNSS_qcom_cfg_setchain.ini /mnt/vendor/persist/qca6390/WCNSS_qcom_cfg.ini
    copy /vendor/etc/wifi/WCNSS_qcom_cfg_setchain.ini /mnt/vendor/persist/WCNSS_qcom_cfg.ini
    start service_setChain
on property:persist.vendor.oem.wifi.chain=2
    copy /vendor/etc/wifi/WCNSS_qcom_cfg_setchain.ini /mnt/vendor/persist/qca6390/WCNSS_qcom_cfg.ini
    copy /vendor/etc/wifi/WCNSS_qcom_cfg_setchain.ini /mnt/vendor/persist/WCNSS_qcom_cfg.ini
    start service_setChain
on property:persist.vendor.oem.wifi.chain=0
    copy /vendor/etc/wifi/qca6390/WCNSS_qcom_cfg.ini /mnt/vendor/persist/qca6390/WCNSS_qcom_cfg.ini
    copy /vendor/etc/wifi/WCNSS_qcom_cfg.ini /mnt/vendor/persist/WCNSS_qcom_cfg.ini
    start service_setChain
on property:persist.vendor.oem.wifi.chain=3
    copy /vendor/etc/wifi/WCNSS_qcom_cfg_roam.ini /mnt/vendor/persist/qca6390/WCNSS_qcom_cfg.ini
    copy /vendor/etc/wifi/WCNSS_qcom_cfg_roam.ini /mnt/vendor/persist/WCNSS_qcom_cfg.ini
service service_setChain  /vendor/bin/sh /vendor/bin/wifi_setChain ${persist.vendor.oem.wifi.chain}
    class main
    user root
    group root system
    disabled
    oneshot

on property:persist.vendor.oem.wifi.txenable=1
    start service_wifi_txEnable

service service_wifi_txEnable  /vendor/bin/sh /vendor/bin/wifi_txEnable
    class main
    user root
    group root system
    disabled
    oneshot

on init
    mkdir /dev/op_cgroup 0750 root system
    mount tmpfs none /dev/op_cgroup mode=0750,uid=0,gid=1000
    mkdir /dev/op_cgroup/freezer 0750 root system
    mount cgroup none /dev/op_cgroup/freezer  freezer
    chmod 777 /dev/op_cgroup/freezer
#ifdef VENDOR_EDIT
    setprop persist.vendor.mdm_helper.fail_action cold_reset,s3_reset,panic
#endif

# alex.huang@Connectivity, 2020/04/29, Porting *#8019# function
#ifdef VENDOR_EDIT
service wifisocket-mdm /system_ext/bin/diag_system_socket_log -a 181.157.1.200 -p 2500 -r 10000 -c 2
    user root
    group root system oem_2901
    disabled
    oneshot
    seclabel u:r:logserver:s0

service wifisocket-mdm-stop /system_ext/bin/diag_system_socket_log -k
    user root
    group root system oem_2901
    disabled
    oneshot
    seclabel u:r:logserver:s0

service oemsysd /vendor/bin/oem-system-daemon
    class main
    user root
    group root system oem_2901
    disabled
    seclabel u:r:ftmdaemon:s0

on property:vendor.service.wifi.socket.mdm.enable=1
    start oemsysd
    start wifisocket-mdm

on property:vendor.service.wifi.socket.mdm.enable=0
    stop oemsysd
    start wifisocket-mdm-stop

service wifisocket /vendor/bin/diag_socket_log -a 181.157.1.200 -p 2500 -r 10000 -c 1
    user root
    group root system oem_2901
    disabled
    oneshot

service wifisocket-stop /vendor/bin/diag_socket_log -k
    user root
    group root system oem_2901
    disabled
    oneshot

on property:vendor.service.wifi.socket.enable=1
    start oemsysd

on property:vendor.service.wifi.socket.enable=0
    stop oemsysd

service wifisocket-lahaina /vendor/bin/diag_socket_log -a 181.157.1.200 -p 2500 -r 10000 -c 1
    user root
    group root system oem_2901
    disabled
    oneshot

service wifisocket-lahaina-stop /vendor/bin/diag_socket_log -k
    user root
    group root system oem_2901
    disabled
    oneshot

on property:vendor.service.wifi.socket.lahaina.enable=0
    stop oemsysd

on property:vendor.service.wifi.socket.lahaina.enable=1
    start oemsysd

service wifisocket-nord /system_ext/bin/diag_system_socket_log -a 181.157.1.200 -p 2500 -r 10000 -c 1
    user root
    group root system oem_2901
    disabled
    oneshot
    seclabel u:r:logserver:s0

service wifisocket-nord-stop /system_ext/bin/diag_system_socket_log -k
    user root
    group root system oem_2901
    disabled
    oneshot
    seclabel u:r:logserver:s0

on property:vendor.service.wifi.socket.nord.enable=1
    start oemsysd
    start wifisocket-nord

on property:vendor.service.wifi.socket.nord.enable=0
    stop oemsysd
    start wifisocket-nord-stop
#endif

service ftmdaemon /system/vendor/bin/ftmdaemon -n
    class late_start
    user root
    group wifi root system oem_2901
    disabled
    oneshot
    seclabel u:r:ftmdaemon:s0

service wifi_ftm_up /vendor/bin/sh /vendor/bin/wifi_ftm_up
    class late_start
    user root
    group root
    disabled
    oneshot

service reload_wlan_driver /vendor/bin/sh /vendor/bin/reload_wlan_driver
    class late_start
    user root
    group root
    disabled
    oneshot
#ifdef VENDOR_EDIT
#yuquan.fei@Connectivity, 2020/05/06, porting wlan logs functions
service stop_pktlog /system/vendor/bin/stoppktlog
    class main
    user system
    group system wifi inet net_admin sdcard_rw media_rw diag
    disabled
    oneshot
#endif

# denzel.chen@performance, 2020/05/12, add for OPBRITN-3462
# system server cannot write to /proc/sys files,
# and chown/chmod does not work for /proc/sys/ entries.
# So proxy writes through init.
on property:sys.sysctl.watermark_boost_factor=*
    write /proc/sys/vm/watermark_boost_factor ${sys.sysctl.watermark_boost_factor}

#ifdef VENDOR_EDIT
on property:vendor.wlan.ftm.daemon=on
    start wifi_ftm_up
    start ftmdaemon

on property:vendor.wlan.ftm.daemon=off
    stop ftmdaemon
    start reload_wlan_driver

on property:vendor.wlan.write.con_mode=*
   write /sys/module/wlan/parameters/con_mode ${vendor.wlan.write.con_mode}

#len.nie@bsp, 2020/11/04. add for dump fingerprint data
on property:gf.debug.dump_path=*
    mkdir /sdcard/Android/data/gf_file 0755 system ext_data_rw

#endif

# ken.lin@ASTI, 2019/6/21, add for memplus
service memplus_config /vendor/bin/sh /vendor/etc/vendor.memplus.sh
    user root
    disabled
    oneshot
    seclabel u:r:vendor_qti_init_shell:s0

on property:persist.vendor.memplus.enable=*
    start memplus_config

on property:persist.sys.memplus.swappiness=*
    write /proc/sys/vm/swappiness ${persist.sys.memplus.swappiness}
on property:persist.sys.memplus.direct_swappiness=*
    write /proc/sys/vm/direct_swappiness ${persist.sys.memplus.direct_swappiness}

#ifdef VENDOR_EDIT
#brandon.zeng@Conn,2020/05/08. add for nfc pnscr tool
service nfctransmitstart /vendor/bin/sh /vendor/bin/nfc_trasmit_start.sh
    class late_start
    user nfc
    group nfc
    disabled
    oneshot

service nfctransmitstop /vendor/bin/sh /vendor/bin/nfc_trasmit_stop.sh
    class late_start
    user nfc
    group nfc
    disabled
    oneshot

on property:vendor.nfc.transmit.start=1
    start nfctransmitstart

on property:vendor.nfc.transmit.start=0
    stop nfctransmitstart

on property:vendor.nfc.transmit.stop=1
    start nfctransmitstop

on property:vendor.nfc.transmit.stop=0
    stop nfctransmitstop
#endif

#ifdef VENDOR_EDIT
on property:sys.usb.config=diag,adb && property:sys.usb.configfs=1
    start wifitestdiag

service wifitestdiag /vendor/bin/wifi_diag
    class main
    user root
    group root system oem_2901
    disabled
    seclabel u:r:ftmdaemon:s0
#endif

#ifdef VENDOR_EDIT
service vl53l1_daemon_main /vendor/bin/vl53l1_daemon_main
    class late_start
    user system
    group system
    socket vl53l1_daemon stream 660 system system
#endif

#oscar.wei@SYSTEM, 2019/10/02, [AN-604] opdiagnose porting : create opdiagnose service
service opdiagnose /system_ext/bin/OPDiagnoseservice
    class core
    user root
    group system

service opdiagdatacopy /system_ext/bin/OPDiagdataCopy
    class core
    user root
    group system everybody
    oneshot
    disabled

on property:vendor.copy.opdiagnose.data=1
    start opdiagdatacopy

service copy_qxdm_log /system_ext/bin/OPDiagdataCopy -q ${copy.qxdm.log}
    class core
    user root
    group system everybody
    oneshot
    disabled
#endif

#ifdef VENDOR_EDIT
#kim@bsp 2019/10/25 add to fix apsd wrong issue when boot with dash connected
on property:sys.boot_completed=1
    write /sys/module/smb5_lib/parameters/sys_boot_complete 1
#@bsp Add OTG switch
on property:persist.sys.oem.otg_support=true
    write /sys/class/power_supply/usb/otg_switch 1
    write /sys/class/oplus_chg/usb/otg_switch 1
on property:persist.sys.oem.otg_support=false
    write /sys/class/power_supply/usb/otg_switch 0
    write /sys/class/oplus_chg/usb/otg_switch 0
#endif

#ifdef VENDOR_EDIT
on property:persist.vendor.oem.wechat_cameraon=1
    write /sys/class/oplus_chg/common/camera_on 1
on property:persist.vendor.oem.wechat_cameraon=0
    write /sys/class/oplus_chg/common/camera_on 0
#endif

on property:vendor.sys.op.game=1
    write  /proc/sys/kernel/sched_skip_affinity 1

on property:vendor.sys.op.game=0
    write  /proc/sys/kernel/sched_skip_affinity 0

#ifdef VENDOR_EDIT
on property:vendor.wlan.sniffer.enabled=1
    start launch_sniffer
    setprop vendor.wlan.sniffer.status 1

on property:vendor.wlan.sniffer.enabled=0
    stop launch_sniffer
    start terminate_sniffer

service launch_sniffer /vendor/bin/sh /vendor/bin/launch_sniffer.sh ${vendor.wlan.sniffer.iface} ${vendor.wlan.sniffer.channel} ${vendor.wlan.sniffer.bandwidth}
    class main
    user root
    group root
    disabled
    oneshot

service terminate_sniffer /vendor/bin/sh /vendor/bin/terminate_sniffer.sh
    class main
    user root
    group root
    disabled
    oneshot

#v-krishna.rao@Connectivity, 2020/12/21 , servce to set iwpriv contention for btwifi coex debugging
on property:persist.vendor.oem.btwificoex.debug=1
    start startiwprivcontention

on property:persist.vendor.oem.btwificoex.debug=0
    start stopiwprivcontention

on property:wlan.driver.status=ok && property:persist.vendor.oem.btwificoex.debug=1
    start startiwprivcontention

service startiwprivcontention /vendor/bin/sh /vendor/bin/startcontention.sh 1
    class main
    user root
    group root
    disabled
    oneshot

service stopiwprivcontention /vendor/bin/sh /vendor/bin/startcontention.sh 0
    class main
    user root
    group root
    disabled
    oneshot

#endif

on property:vendor.sys.op.disable_ufstw=1
    write /sys/devices/platform/soc/1d84000.ufshc/ufstw_lu0/tw_enable 0

on property:vendor.sys.op.disable_ufstw=0
    write /sys/devices/platform/soc/1d84000.ufshc/ufstw_lu0/tw_enable 1

service filebuilderd /system_ext/bin/filebuilderd
    class core
    user root
    group root system
    disabled
    oneshot
    seclabel u:r:vold:s0

on property:sys.boot_completed=1 && property:persist.sys.ufs_hpb_disable=1
    write /sys/devices/platform/soc/1d84000.ufshc/ufshpb_lu0/release 171

on property:sys.boot_completed=1
    write /sys/devices/platform/soc/1d84000.ufshc/ufstw_lu0/tw_enable 1
    write /sys/devices/platform/soc/1d84000.ufshc/ufstw_lu0/flush_enable 1
    write /sys/devices/platform/soc/1d84000.ufshc/ufstw_lu0/flush_during_hibern_enter 1

#alden.zhang@OPTI, 2020/7/18. [OSP-8064], add for IOLIMIT
on property:persist.sys.iolimiter.enable=true
    write /proc/iolimit_enable 1
    write /sys/module/oneplus_healthinfo/parameters/ohm_action_ctrl Y
    chown system system /sys/module/oneplus_healthinfo
    chown system system /sys/module/oneplus_healthinfo/parameters
    chown system system /sys/module/oneplus_healthinfo/parameters/ohm_iowait_h_ms
    chown system system /sys/module/oneplus_healthinfo/parameters/ohm_iowait_l_ms
    chown system system /sys/module/oneplus_healthinfo/parameters/ohm_read_thresh
    chown system system /sys/module/oneplus_healthinfo/parameters/ohm_write_thresh
    chown system system /sys/module/oneplus_healthinfo/parameters/ohm_sample_time
    chown system system /sys/module/oneplus_healthinfo/parameters/ohm_action_ctrl
    chown system system /proc/iolimit_enable

#huangwen.chen#OPTI, 2020/9/16, [OPTI-43], add for zram writeback
on property:persist.vendor.oem.dump=0
    setprop persist.vendor.zwriteback.backup 0

on property:persist.vendor.oem.dump=1
    setprop persist.vendor.zwriteback.backup 1

#ifdef ODM_WT_EDIT Kai.Cao@ODM_WT.NW.SIM,BILLIE8-6704, 2020/07/13,Support single and dual card solutions
on property:ro.boot.rf_version=0 && property:ro.boot.project_codename=billie8
    setprop persist.radio.multisim.config "ssss"
on property:ro.boot.rf_version=0 && property:ro.boot.project_codename=billie8t
    setprop persist.radio.multisim.config "ssss"
#endif
