#!/system/bin/sh

idle=`getprop sys.boot_completed`
ims_volte=`getprop persist.ims.volte`
ims_vt=`getprop persist.ims.vt`
ims_vt_epdg=`getprop persist.ims.vt.epdg`
ims_rcs=`getprop persist.ims.rcs`

echo "config volte: $1"

if [ "$1" = "on" ]; then
    if [ "$ims_volte" = "true" ]; then
        setprop persist.radio.calls.on.ims true
        setprop persist.radio.jbims 1
        setprop persist.radio.domain.ps 0
        setprop persist.radio.vrte_logic 1
    fi

    if [ "$ims_vt" = "true" ]; then
        setprop persist.radio.VT_ENABLE 1
        setprop persist.radio.VT_HYBRID_ENABLE 1
        setprop persist.radio.ROTATION_ENABLE 1
        setprop persist.radio.REVERSE_QMI 0
        setprop persist.radio.RATE_ADAPT_ENABLE 1
    fi

    if [ "$ims_rcs" = "true" ]; then
        setprop persist.rcs.supported 1
    fi

    setprop persist.ims.enableADBLogs 1
    setprop persist.ims.enableDebugLogs 1
    setprop persist.rmnet.mux enabled

    if [ "$ims_vt_epdg" = "true" ]; then
    # epdg configuration
        setprop persist.cne.feature 1
        setprop persist.data.netmgrd.qos.enable true
        setprop persist.data.iwlan.enable true
        setprop persist.sys.cnd.iwlan 1
        setprop persist.cne.logging.qxdm 3974
    fi

    if [ "$idle" = "1" ]; then
        pm enable com.qualcomm.rcsbootstraputil
        pm enable com.qualcomm.rcsimsbootstraputil
    fi
elif [ "$1" = "off" ]; then
    if [ "$ims_volte" = "true" ]; then
        setprop persist.radio.calls.on.ims false
        setprop persist.radio.jbims 0
        setprop persist.radio.domain.ps 0
        setprop persist.radio.vrte_logic 0
    fi

    if [ "$ims_vt" = "true" ]; then
        setprop persist.radio.VT_ENABLE 0
        setprop persist.radio.VT_HYBRID_ENABLE 0
        setprop persist.radio.ROTATION_ENABLE 0
        setprop persist.radio.REVERSE_QMI 0
        setprop persist.radio.RATE_ADAPT_ENABLE 0
    fi

    if [ "$ims_rcs" = "true" ]; then
        setprop persist.rcs.supported 0
    fi

    setprop persist.ims.enableADBLogs 0
    setprop persist.ims.enableDebugLogs 0
    setprop persist.rmnet.mux disabled

    if [ "$ims_vt_epdg" = "true" ]; then
    # epdg configuration
        setprop persist.cne.feature 0
    #setprop persist.data.netmgrd.qos.enable false
        setprop persist.data.iwlan.enable false
        setprop persist.sys.cnd.iwlan 0
        setprop persist.cne.logging.qxdm 0
    fi

    if [ "$idle" = "1" ]; then
        pm disable com.qualcomm.rcsbootstraputil
        pm disable com.qualcomm.rcsimsbootstraputil
    fi
fi
