import /init.superuser.rc

on early-init
    write /proc/sys/kernel/ctrl-alt-del 1

    write /sys/module/xt_qtaguid/parameters/ctrl_write_limited N

    export force_s3tc_enable true
    export EGL_LOG_LEVEL info
#   export EGL_DRIVERS egl_dri2

    exec u:r:init:s0 -- /sbin/modprobe sdcardfs

on init

on fs
    mount_all /fstab.${ro.hardware}

on post-fs
    exec u:r:init:s0 -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh

on post-fs-data
    # 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
    mkdir /data/misc/dhcp 0770 dhcp dhcp

    mkdir /data/system 0775 system system
    chown wifi wifi /data/misc/wifi/wpa_supplicant.conf

    # Set indication (checked by vold) that we have finished this action
    setprop vold.post_fs_data_done 1

on boot
    setprop ro.radio.use-ppp yes
    setprop status.battery.state Slow
    setprop status.battery.level 5
    setprop status.battery.level_raw  50
    setprop status.battery.level_scale 9

    # merge from system.prop
    setprop ro.config.sync yes
    setprop app.setupwizard.disable 0
    setprop ro.alarm.volume.adjustable true
    setprop ro.simulated.phone false
    # disable red frame boarder in eng build
    setprop persist.sys.strictmode.visual 0
    setprop persist.sys.strictmode.disable 1
    # workaround for h.265 slowness
    setprop sys.media.vdec.drop 0

service wpa_supplicant /vendor/bin/hw/wpa_supplicant -dd \
    -O/data/vendor/wifi/wpa/sockets -puse_p2p_group_interface=1 \
    -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
    class main
    socket wpa_wlan0 dgram 660 wifi wifi
    disabled
    oneshot

service nativebridge /system/bin/enable_nativebridge
    class main
    disabled
    oneshot
    seclabel u:r:zygote:s0

service logcat /system/bin/logcat -b all -v threadtime -f /data/log.txt
    class debug

service btattach /system/bin/btattach
    class main
    disabled
    oneshot
    seclabel u:r:bluetooth:s0

service rtk_hciattach /vendor/bin/rtk_hciattach -n -s 115200 /dev/rtk_h5 rtk_h5
    class main
    disabled
    oneshot
    seclabel u:r:bluetooth:s0

service wacom-input /system/bin/wacom-input
    disabled
    oneshot
    seclabel u:r:inputflinger:s0

service tablet-mode /system/bin/tablet-mode
    disabled
    oneshot
    seclabel u:r:inputflinger:s0

service ctrl-alt-del /system/bin/input keyevent --longpress POWER
    disabled
    oneshot
    keycodes 97 100 111
    seclabel u:r:init:s0

on property:system_init.startsurfaceflinger=0
    # disable cursor blinking
    write /dev/tty0 "[?17;0;0c"
    start surfaceflinger
    stop console

on property:sys.boot_completed=1
    write /proc/sys/kernel/ctrl-alt-del 0
    exec u:r:init:s0 -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh bootcomplete

on property:net.dns1=*
    exec u:r:init:s0 -- /system/bin/logwrapper /system/bin/sh /system/etc/init.sh netconsole

on property:debug.logcat=1
    class_start debug

on property:persist.sys.nativebridge=1
    start nativebridge

on property:persist.sys.nativebridge=0
    stop nativebridge
