-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
BloatwareHatao.sh
353 lines (325 loc) · 12 KB
/
BloatwareHatao.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
#!/bin/bash
print_banner() {
local banner=(
"******************************************"
"* BloatwareHatao *"
"* Android Bloatware Removal Tool *"
"* v1.5.4 *"
"* ---------------------------- *"
"* by @ImKKingshuk *"
"* Github- https://github.com/ImKKingshuk *"
"******************************************"
)
local width=$(tput cols)
for line in "${banner[@]}"; do
printf "%*s\n" $(((${#line} + width) / 2)) "$line"
done
echo
}
check_for_updates() {
local current_version=$(cat version.txt)
local latest_version=$(curl -sSL "https://raw.githubusercontent.com/ImKKingshuk/BloatwareHatao/main/version.txt")
if [ "$latest_version" != "$current_version" ]; then
echo "A new version ($latest_version) is available. Updating Tool... Please Wait..."
update_tool
else
echo "You are using the latest version ($current_version)."
fi
}
update_tool() {
local repo_url="https://raw.githubusercontent.com/ImKKingshuk/BloatwareHatao/main"
curl -sSL "$repo_url/BloatwareHatao.sh" -o BloatwareHatao.sh
curl -sSL "$repo_url/version.txt" -o version.txt
echo "Tool has been updated to the latest version."
exec bash BloatwareHatao.sh
}
remove_bloatware() {
local manufacturer=$1
local os_version=$2
local cleaner_type=$3
local script_path="https://raw.githubusercontent.com/ImKKingshuk/BloatwareHatao/main/$cleaner_type/$manufacturer/$os_version.sh"
echo "Fetching bloatware removal script for OEM:$manufacturer OS:$os_version Cleaner:$cleaner_type... Please Wait..."
curl -sSL "$script_path" | bash
if [ $? -eq 0 ]; then
echo "Bloatware removal completed successfully."
else
echo "Error occurred during bloatware removal."
fi
}
remove_bloatware_manual() {
local package_name=$1
echo "Attempting to remove bloatware with package name: $package_name"
adb shell pm uninstall --user 0 "$package_name"
if [ $? -eq 0 ]; then
echo "Bloatware removal completed successfully."
else
echo "Error occurred during bloatware removal."
fi
}
show_cleaner_type_menu() {
echo "Select the cleaner type:"
echo "1. Bloatware Cleaner (Safe & Recommended)"
echo "2. Pro Bloatware Cleaner (Extra Cleaning)"
echo "3. Ultra Bloatware Cleaner (Extreme Cleaning)"
echo "4. Manual Bloatware Cleaner (Enter APK pkg & Clean)"
echo "5. Exit"
echo "--------------------------------------"
read -p "Enter your choice: " cleaner_type_choice
case $cleaner_type_choice in
1) cleaner_type="Safe" ;;
2) cleaner_type="Pro" ;;
3) cleaner_type="Ultra" ;;
4) manual_cleaner_menu ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_cleaner_type_menu ;;
esac
show_manufacturer_menu "$cleaner_type"
}
manual_cleaner_menu() {
echo "Manual Bloatware Cleaner"
echo "Enter the package name of the bloatware APK:"
echo "Example: com.example.bloatware"
echo "--------------------------------------"
read -p "Package Name: " package_name
echo "You have entered the package name: $package_name"
read -p "Are you sure you want to remove this bloatware? (Yes/No): " confirmation
case $confirmation in
[Yy][Ee][Ss]) remove_bloatware_manual "$package_name" ;;
[Nn][Oo]) echo "Bloatware removal cancelled." ;;
*) echo "Invalid choice. Bloatware removal cancelled." ;;
esac
}
show_manufacturer_menu() {
local cleaner_type=$1
echo "Select your device manufacturer:"
echo "1. Samsung"
echo "2. Xiaomi"
echo "3. Huawei"
echo "4. OnePlus"
echo "5. Vivo"
echo "6. OPPO"
echo "7. Realme"
echo "8. Nothing"
echo "9. Honor"
echo "10. Motorola"
echo "11. Meizu"
echo "12. Infinix"
echo "13. Exit"
echo "--------------------------------------"
read -p "Enter your choice: " manufacturer_choice
case $manufacturer_choice in
1) manufacturer="samsung" ;;
2) manufacturer="xiaomi" ;;
3) manufacturer="huawei" ;;
4) manufacturer="oneplus" ;;
5) manufacturer="vivo" ;;
6) manufacturer="oppo" ;;
7) manufacturer="realme" ;;
8) manufacturer="nothing" ;;
9) manufacturer="honor" ;;
10) manufacturer="motorola" ;;
11) manufacturer="meizu" ;;
12) manufacturer="infinix" ;;
13) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_manufacturer_menu "$cleaner_type" ;;
esac
show_os_version_menu "$manufacturer" "$cleaner_type"
}
show_os_version_menu() {
local manufacturer=$1
local cleaner_type=$2
echo "Select your $manufacturer's OS version:"
case $manufacturer in
"samsung")
echo "1. OneUI 6"
echo "2. OneUI 5"
echo "3. OneUI 4"
;;
"xiaomi")
echo "1. HyperOS 1"
echo "2. MIUI 14"
echo "3. MIUI 13"
;;
"huawei")
echo "1. EMUI 14"
echo "2. EMUI 13"
echo "3. EMUI 12"
;;
"oneplus")
echo "1. OxygenOS 14"
echo "2. OxygenOS 13"
echo "3. OxygenOS 12"
;;
"vivo")
echo "1. FuntouchOS 14"
echo "2. FuntouchOS 13"
echo "3. FuntouchOS 12"
;;
"oppo")
echo "1. ColorOS 14"
echo "2. ColorOS 13"
echo "3. ColorOS 12"
;;
"realme")
echo "1. RealmeUI 5"
echo "2. RealmeUI 4"
echo "3. RealmeUI 3"
;;
"nothing")
echo "1. NothingOS 3"
echo "2. NothingOS 2"
echo "3. NothingOS 1"
;;
"honor")
echo "1. MagicUI 8"
echo "2. MagicUI 7"
echo "3. MagicUI 6"
;;
"motorola")
echo "1. HelloUI 1"
echo "2. MyUX 13"
echo "3. MyUX 12"
;;
"meizu")
echo "1. FlymeAIOS 11"
echo "2. FlymeOS 10"
echo "3. FlymeOS 9"
;;
"infinix")
echo "1. XOS 14"
echo "2. XOS 13"
echo "3. XOS 12"
;;
esac
echo "4. Back"
echo "5. Exit"
echo "--------------------------------------"
read -p "Enter your choice: " os_choice
local os_version=""
case $manufacturer in
"samsung")
case $os_choice in
1) os_version="oneui-6" ;;
2) os_version="oneui-5" ;;
3) os_version="oneui-4" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"xiaomi")
case $os_choice in
1) os_version="hyperos-1" ;;
2) os_version="miui-14" ;;
3) os_version="miui-13" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"huawei")
case $os_choice in
1) os_version="emui-14" ;;
2) os_version="emui-13" ;;
3) os_version="emui-12" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"oneplus")
case $os_choice in
1) os_version="oxygenos-14" ;;
2) os_version="oxygenos-13" ;;
3) os_version="oxygenos-12" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"vivo")
case $os_choice in
1) os_version="funtouchos-14" ;;
2) os_version="funtouchos-13" ;;
3) os_version="funtouchos-12" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"oppo")
case $os_choice in
1) os_version="coloros-14" ;;
2) os_version="coloros-13" ;;
3) os_version="coloros-12" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"realme")
case $os_choice in
1) os_version="realmeui-5" ;;
2) os_version="realmeui-4" ;;
3) os_version="realmeui-3" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"nothing")
case $os_choice in
1) os_version="nothingos-3" ;;
2) os_version="nothingos-2" ;;
3) os_version="nothingos-1" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"honor")
case $os_choice in
1) os_version="magicos-8" ;;
2) os_version="magicos-7" ;;
3) os_version="magicos-6" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"motorola")
case $os_choice in
1) os_version="helloui-1" ;;
2) os_version="myux-13" ;;
3) os_version="myux-12" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"meizu")
case $os_choice in
1) os_version="flymeaios-11" ;;
2) os_version="flymeos-10" ;;
3) os_version="flymeos-9" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
"infinix")
case $os_choice in
1) os_version="xos-14" ;;
2) os_version="xos-13" ;;
3) os_version="xos-12" ;;
4) show_manufacturer_menu "$cleaner_type"; return ;;
5) echo "Exiting..."; exit ;;
*) echo "Invalid choice. Please try again."; show_os_version_menu "$manufacturer" "$cleaner_type"; return ;;
esac
;;
esac
remove_bloatware "$manufacturer" "$os_version" "$cleaner_type"
}
print_banner
check_for_updates
show_cleaner_type_menu