Skip to content

Instantly share code, notes, and snippets.

@boboidream
Last active May 2, 2022 02:19
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save boboidream/5ae1ec328e6623774411f80580fdc134 to your computer and use it in GitHub Desktop.
Save boboidream/5ae1ec328e6623774411f80580fdc134 to your computer and use it in GitHub Desktop.
中兴 B860AV1.1-T 破解优化
#!/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.
adb connect 192.168.50.83 # 连接 IP 为 192.168.50.83 的电视盒子
adb shell # 进入盒子 bash 环境
# 输入此命令,然后用遥控对准电视按想用的按键,bash 界面会出现此按键的 ID 识别码,记下来。选两个按键,一个用作 iptv,一个用作当贝桌面(或其他)
getevent -c 1 /dev/input/event0
# 输入命令,获取当前桌面程序
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment