-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathsig9-fix.sh
executable file
·103 lines (87 loc) · 2.15 KB
/
sig9-fix.sh
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
_c_magneta="\e[95m"
_c_green="\e[32m"
_c_red="\e[31m"
_c_blue="\e[34m"
RST="\e[0m"
die() {
echo -e "${_c_red}[E] ${*}${RST}"
exit 1
:
}
warn() {
echo -e "${_c_red}[W] ${*}${RST}"
:
}
shout() {
echo -e "${_c_blue}[-] ${*}${RST}"
:
}
lshout() {
echo -e "${_c_blue}-> ${*}${RST}"
:
}
msg() {
echo -e "${*} \e[0m" >&2
:
}
success() {
echo -e "${_c_green}${*} \e[0m" >&2
:
}
F=0
msg "${_c_magneta}Enter Auth port ( Port show in option enter six digit number): "
read -r authport
msg "${_c_magneta}Enter Auth pincode: "
read -r authpincode
msg "${_c_magneta}Enter debug port: "
read -r debugport
# Check is the device already conected somehow
if adb devices | grep -q "$authport" | grep "device" >> /dev/null; then
msg "Device is connected.."
else
pair() {
shout "Trying to pair"
adb pair localhost:"$authport" "$authpincode" || {
die "Connection Failed?"
}
}
connect() {
shout "Trying to enable adb over tcpip at 5813"
adb connect localhost:"$debugport" || {
warn "Failed to connect.."
shout "Trying to pair back"
[[ $F -gt 3 ]] && {
die "Failed to connect.. Max retry reached"
}
((F++))
pair
connect
}
}
pair
connect
success "Pairing localhost:$authport succeed.."
fi
success "Enabled"
shout "List connected devices.."
adb devices -l
success "ADB setup complete..."
shout "Trying to fix phantom service ${_c_green}forever"
# Freeze config
adb shell device_config \
set_sync_disabled_for_tests persistent || {
die "failed to freeze config [Try executing again]"
}
adb \
shell \
device_config \
put activity_manager \
max_phantom_processes 214181594 || {
die "Failed to set max_phantom_processes [Try executing again]"
}
success "current max_phantom_processes = $(adb shell device_config get activity_manager max_phantom_processes)"
msg "if you ever want to disable this fix run:"
msg "${_c_green} bash disable-fix.sh"
echo "Or"
msg "adb shell device_config set_sync_disabled_for_tests none ${RST} from your pc"