-
Notifications
You must be signed in to change notification settings - Fork 18
/
optimizer_script
68 lines (52 loc) · 2.16 KB
/
optimizer_script
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
@ECHO OFF
cls
set NLM=^
set NL=^^^%NLM%%NLM%^%NLM%%NLM%
SET divider=****************
echo %NL%OPTIMIZER
if not exist adb.exe (
echo %NL%%divider%
echo Unable to find adb. Please make sure you've installed ADB and this script is in adb platform-tools folder%NL%before running this script
echo %divider%
pause
EXIT /B 0
)
echo %NL%Checking connected devices. . .
adb.exe devices > devices.txt
if "%1"=="-v" (
type devices.txt
)
findstr /c:"device" devices.txt | find /c /v "" > temp.txt
set /p devicecount=<temp.txt
del temp.txt
del devices.txt
IF "%devicecount%"=="1" (
echo %divider%
ECHO No devices found. Please make sure your device is connected, USB debugging is enabled, and that they are authorised%NL%^(check screen for prompt^), then run the script again
echo %divider%
pause
EXIT /B 0
)
IF "%devicecount%" NEQ "2" (
echo %divider%
ECHO Multiple devices found, please disconnect all but the device you wish to use debloater script on, then run the script again
echo %divider%
pause
EXIT /B 0
)
for /F "delims=" %%a in ('adb.exe shell getprop ro.product.device') do set DEVICE=%%a
for /F "delims=" %%a in ('adb.exe shell getprop ro.build.product') do set PRODUCT=%%a
for /F "delims=" %%a in ('adb.exe shell getprop ro.build.id') do set ID=%%a
echo %NL%Detected: %DEVICE% (%PRODUCT%)
echo Firmware: %ID%
echo %NL%Optimizing using speed-profile. The time taken for this process to get completed is dependent on the amount of apps and SoC present in your device. Recent phones can complete this job under 5 mins while older mid range might take 15-20 mins%NL%Note that disconnecting your device during this optimization will abort the process
echo.
pause
cls
echo %NL%This is an automated process just wait until it's completed by itself%NL%(on Android 10 will display "Success", on Nougat-Pie it just a new prompt line). . .
adb.exe shell cmd package bg-dexopt-job
echo %NL%Optimization is now finished!
echo %NL%Anytime you clean flash, complete restore apps from titanium backup/migrate or from Google (Play Store) and you face battery drain or lags, You may choose to open the script back and run this command
echo%NL%Press any key to exit. . .
pause>nul
exit