#!/system/bin/sh
#----------------------------------------
# Author: boboidream
# Email: me@wenboz.com
# Version: 0.0.3
# Date: 2018.08.29
#----------------------------------------
boot='iptv' # iptv | dangbei
code_iptv='0001 00fb 00000001'
code_dangbei='0001 00ad 00000001'
id_iptv='com.ihome.android.launcher/com.ihome.android.launcher2.activity.MainActivity'
id_dangbei='com.dangbei.tvlauncher/com.dangbei.tvlauncher.IndexActivity'
func_test() {
mount -o remount,rw /system
local PN=`busybox basename $0`
local Pnum=`busybox pgrep -f $PN|busybox wc -l`
if [ $Pnum -gt 1 ]; then
echo "dtchange.sh running"
exit 2
fi
}
func_init() {
if [ $boot = 'dangbei' ]; then
open_dangbei
else
local res1=`svc wifi disable`
while [ "$(getprop net.zte.eth.netstate)" != "CONNECTED" ]
do
sleep 0.5
done
sleep 1 && am start -n $id_iptv
fi
}
open_iptv() {
local netstate=$(getprop net.zte.eth.netstate)
echo "eth0: $netstate"
am start -n $id_iptv &
if [ "$netstate" != "CONNECTED" ]; then
local res1=`svc wifi disable`
echo "$(date +%X) iptv_wifi_down: $res1"
local res2=`ifconfig eth0 up`
echo "$(date +%X) iptv_eth0_up: $res2"
fi
}
open_dangbei() {
local netstate=$(getprop net.zte.wifi.netstate)
echo "wifi: $netstate"
am start -n $id_dangbei &
if [ "$netstate" != "CONNECTED" ]; then
local res1=`ifconfig eth0 down`
echo "$(date +%X) init_eth0_down: $res1"
local res2=`svc wifi enable`
echo "$(date +%X) init_wifi_up: $res2"
fi
}
main() {
while [ 1 ]; do
local rm_code=$(getevent -c 1 /dev/input/event0)
if [ "$rm_code" = "$code_iptv" ] ; then
open_iptv
fi
if [ "$rm_code" = "$code_dangbei" ] ; then
open_dangbei
fi
sleep 1
done
}
func_test
func_init
main
# advice: add com.dangbei.tvlauncher & com.ihome.android.launcher to
# /system/etc/BannedKillBackgroundProcessesWhiteList.ini
# keep desktop app run in background.
中兴 B860AV1.1-T 破解优化
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.