forked from tsukimio/systemui-bootloop
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathservice.sh
More file actions
72 lines (52 loc) · 1.82 KB
/
service.sh
File metadata and controls
72 lines (52 loc) · 1.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/system/bin/sh
#SystemUI bootloop saver by n3rd3x3, huge thanks to HuskyDG
MODDIR=${0%/*}
FILE="$0"; NAME="$1"; VALUE="$2"; MODID="/data/adb/modules/systemui-bootloop"; VX="$@"
abort(){ echo "$1"; exit 1; }
# based on canyie dreamland framework script
write_log(){
TEXT=$@; echo "[`date +%d%m%y` `date +%T`]: $TEXT" >>/cache/systemui-bootloop.log
}
exit_log(){
write_log "$@"; exit 0;
}
disable_modules(){
write_log "SystemUI is having trouble, so disable all modules and restart"
list="$(find /data/adb/modules/* -prune -type d)"
IFS=$"
"
for module in $list; do
echo -n >> $module/disable
done
reboot
exit
}
rm -rf /cache/systemui-bootloop.log.bak
mv -f /cache/systemui-bootloop.log /cache/systemui-bootloop.log.bak 2>/dev/null
write_log "systemui bootloop saver started"
SYSTEMUI_NICENAME=systemui
# Wait for systemui to start, may change later
sleep 20
SYSTEMUI_PID1=$(pgrep "$SYSTEMUI_NICENAME" | awk '{ print $1 '})
write_log "pid of systemui stage 1: $SYSTEMUI_PID1"
sleep 15
SYSTEMUI_PID2=$(pgrep "$SYSTEMUI_NICENAME" | awk '{ print $1 '})
write_log "pid of systemui stage 2: $SYSTEMUI_PID2"
sleep 15
SYSTEMUI_PID3=$(pgrep "$SYSTEMUI_NICENAME" | awk '{ print $1 '})
write_log "pid of systemui stage 3: $SYSTEMUI_PID3"
if [ "$SYSTEMUI_PID1" = "$SYSTEMUI_PID2" ] && [ "$SYSTEMUI_PID2" = "$SYSTEMUI_PID3" ]; then
if [ -z "$SYSTEMUI_PID1" ]; then
write_log "rip systemui, disabling modules"
disable_modules
else
exit_log "pid of 3rd stage systemui is the same"
fi
else
write_log "pid of 3rd stage systemui is different, continue check to make sure... "
fi
sleep 15
SYSTEMUI_PID4=$(pgrep "$SYSTEMUI_NICENAME" | awk '{ print $1 '})
write_log "pid of systemui stage 4: $SYSTEMUI_PID4"
[ "$SYSTEMUI_PID3" = "$SYSTEMUI_PID4" ] && exit_log "pid of systemui stage 3 and 4 is the same."
disable_modules