-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathdisable-fix.sh
92 lines (78 loc) · 1.84 KB
/
disable-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
#!/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 pairing code: "
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 "disabling sig9 fix.."
# Freeze config
adb shell device_config \
set_sync_disabled_for_tests none || {
die "Failed to disable.. [Try executing again]"
}
echo "✌️ Disabled"
echo "Changes may take place after a device restart.."
success "current max_phantom_processes = $(adb shell device_config get activity_manager max_phantom_processes)"