-
Notifications
You must be signed in to change notification settings - Fork 8
/
fix_brevent.sh
70 lines (59 loc) · 1.78 KB
/
fix_brevent.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
#!/system/bin/sh
echo "===卡顿修复脚本by Pzqqt==="
sfoa=/system/framework/oat/arm
sfs=/system/framework/services.jar
cstmp=/cache/STMP
echo ""
echo "=== Remount system & cache..."
/system/bin/mount -o rw,remount /system || busybox mount -o rw,remount /system
/system/bin/mount -o rw,remount /cache || busybox mount -o rw,remount /cache
mkdir $cstmp
unzip $sfs -d $cstmp > /dev/null 2>&1
if ! [ -f $cstmp/classes.dex ];then
rm -rf $cstmp
echo ""
echo "*** Can not found classes.dex in $sfs!"
echo ""
echo "*** Abort..."
exit 1
fi
rm -rf $cstmp
if [ -d $sfoa"64" ]; then
sfoa=$sfoa"64"
fi
echo ""
echo "=== Remove old odex & vdex..."
rm -rf $sfoa/services.vdex
rm -rf $sfoa/services.odex
if ! [ -f $sfoa/services.art ];then
if [ -f $sfoa/BAK/services.art ]; then
cp $sfoa/BAK/services.art $sfoa
chmod 0644 $sfoa/services.art
fi
fi
echo ""
echo "=== Generate new odex & vdex..."
/system/bin/dex2oat --dex-file=$sfs --input-vdex-fd=-1 --output-vdex=$sfoa/services.vdex --oat-file=$sfoa/services.odex
chmod 0644 $sfoa/services.vdex
chmod 0644 $sfoa/services.odex
echo ""
echo "=== Remove classes.dex from services.jar.."
zip -d $sfs classes.dex > /dev/null 2>&1
# mv /system/framework/services.jar /system/framework/services.jar.BAKK
# mv /system/framework/services.jar.bak /system/framework/services.jar
chmod 0644 $sfs
echo ""
echo "=== Remove Dalvik-cache file..."
rm -rf /data/dalvik-cache/arm/system@[email protected]@classes.dex
rm -rf /data/dalvik-cache/arm/system@[email protected]@classes.vdex
rm -rf /data/dalvik-cache/arm64/system@[email protected]@classes.dex
rm -rf /data/dalvik-cache/arm64/system@[email protected]@classes.vdex
echo ""
echo "=== Done!"
echo ""
echo "=== Reboot..."
sleep 2
reboot
echo ""
echo "*** If device does not reboot automatically, reboot yourself"
exit 0