# Raven/Oriole specific init.rc

on init
    # NFC streset tool name
    setprop persist.vendor.nfc.streset libstreset21
    setprop persist.vendor.se.streset libstreset21

on init && property:ro.vendor.factory=1
    import /vendor/etc/init/hw/init.factory.rc

on early-boot
    # Wait for insmod_sh to finish all common modules
    wait_for_prop vendor.common.modules.ready 1
    start insmod_sh_raviole

# Disables fingerprint antispoof on PROTO1.0 devices
on boot && property:ro.build.type=eng && \
           property:ro.revision=PROTO1.0 && \
           property:persist.vendor.fingerprint.disable.fake.override=none
    setprop vendor.fingerprint.disable.fake 100

# Overrides fingerprint antispoof if following persist sysprops are set
on boot && property:ro.build.type=eng && \
           property:persist.vendor.fingerprint.disable.fake.override=0
    setprop vendor.fingerprint.disable.fake ${persist.vendor.fingerprint.disable.fake.override}

on boot && property:ro.build.type=eng && \
           property:persist.vendor.fingerprint.disable.fake.override=1
    setprop vendor.fingerprint.disable.fake ${persist.vendor.fingerprint.disable.fake.override}

on boot && property:ro.build.type=eng && \
           property:persist.vendor.fingerprint.disable.fake.override=100
    setprop vendor.fingerprint.disable.fake ${persist.vendor.fingerprint.disable.fake.override}

service insmod_sh_raviole /vendor/bin/insmod.sh /vendor_dlkm/etc/init.insmod.${ro.hardware}.cfg
    class main
    user root
    group root system
    disabled
    oneshot

on post-fs-data
    # Fingerprint
    chown system system /dev/goodix_fp
    exec_background - system shell -- /vendor/bin/trusty_apploader /vendor/firmware/g6.app

    # Speaker amp permission
    chmod 644 /mnt/vendor/persist/audio/speaker.cal

    # Start the twoshay touch service
    start twoshay

    # Allow secure_element group to read / write ST33 SPI state
    chown secure_element secure_element  /sys/class/st33spi/st33spi/st33spi_state
    chmod 0660  /sys/class/st33spi/st33spi/st33spi_state

on property:ro.revision=PROTO1.0
    setprop persist.fingerprint.ghbm true

# SecureElement eSE2 cts mode
on property:persist.vendor.se.ese2.mode=ctsmode
    write /sys/class/st33spi/st33spi/st33spi_state 33

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