-
Notifications
You must be signed in to change notification settings - Fork 2
/
customize_framework.sh
executable file
·60 lines (52 loc) · 1.33 KB
/
customize_framework.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
#!/bin/bash
# $1: dir for miui
# $2: dir for original
OUT_MIUI_FRAMEWORK_DIR=$1
OUT_FRAMEWORK_DIR=$2
if [ "$OUT_FRAMEWORK_DIR" == "out/framework" ];then
cp ${OUT_FRAMEWORK_DIR/out\//}.jar.out/smali/android/widget/Editor*.smali $OUT_FRAMEWORK_DIR/smali/android/widget/
fi
APKTOOL="$PORT_ROOT/tools/apktool --quiet"
GIT_APPLY=$PORT_ROOT/tools/git.apply
BUILD_OUT=out
SEP_FRAME="framework2.jar.out"
function appendSmaliPart() {
for file in `find $1/smali -name *.part`
do
filepath=`dirname $file`
filename=`basename $file .part`
dstfile="out/$filepath/$filename"
cat $file >> $dstfile
done
}
function overlaySmali() {
for file in `find $1/smali -name *.smali`
do
filepath=`dirname $file`
cp -f $file out/$filepath
done
}
function applyPatch() {
for file in $1/*.patch
do
cp $file out/
cd out
git.apply `basename $file`
for file2 in `find $2 -name *.rej`
do
echo "$file2 fail"
exit 1
done
cd ..
done
}
if [ $2 = "$BUILD_OUT/framework" ]
then
applyPatch "overlay/framework"
fi
if [ $2 = "$BUILD_OUT/services" ]
then
applyPatch "overlay/services"
rm -rf $2/smali/com/android/server/power/ShutdownThread*
cp -rf $1/smali/com/android/server/power/ShutdownThread*.smali $2/smali/com/android/server/power/
fi