Skip to content
This repository was archived by the owner on Oct 17, 2020. It is now read-only.

Commit bcf03f7

Browse files
committed
Move unity-addons to be in unity repo
1 parent aa1f57d commit bcf03f7

File tree

289 files changed

+12147
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

289 files changed

+12147
-4
lines changed

.gitmodules

-3
This file was deleted.

common/addon

-1
This file was deleted.
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# APK-Patcher Lite - Flashable Zip Template for Modifying System APKs On-Device
2+
3+
## Information
4+
This is a modified version of APK-Patcher that will delete / inject files into System APK files instead of using a baksmali / apktool method.
5+
6+
The method used here is a similar method used in my ROMs to patch files, where instead of having to have like for example 4 SystemUI files, I only needed to keep the actual files that were changed. This method could also be used quite easily to apply OTA updates or addons on already pre-modified APK files.
7+
8+
9+
## Usage
10+
* Copy your pre-compiled resource files (including .dex files) to the patch folder, removing the .apk part of the filename (ie: SystemUI)
11+
12+
* Create a file in scripts with the same name (ie: SystemUI.sh) if you want to delete any existing files from the APK
13+
14+
* Make edits to envvar.sh, and also to extracmd.sh if needed
15+
16+
### Properties / Variables
17+
* apklist="";
18+
19+
**apklist** is a string containing the list of APKs to be patched included in the patch zip, separated by spaces between the quotes. Each APK is automatically found recursively in /system, then copied to the working directory to be decompiled and acted on, then copied back to /system.
20+
21+
Modify config.sh to add your apklist
22+
23+
Multiple files can be patched, put a space between the filenames (ie: apklist="file1.apk file2.apk";)
24+
25+
26+
### extracmd.sh
27+
Modify the extracmd.sh to add any additional commands to be performed at the end of the patching process that aren't patch-related (/data file changes,
28+
29+
30+
### scripts/$apkname.sh
31+
* fileremove="";
32+
33+
$apkname is the name of the folder that you put your resources files in. Copy scripts_sample.sh and rename it to your APK (ie: SystemUI.sh)
34+
35+
Multiple files can be deleted, put a space between the paths (ie: fileremove="/res/drawable/file1.png /res/drawable/file1.png";)
36+
37+
## Credits:
38+
* by djb77 @ xda-developers
39+
* Based on [APK-Patcher](https://github.com/osm0sis/APK-Patcher) by osm0sis @ xda-developers

common/addon/APK-Patcher-Lite/extracmd.sh

Whitespace-only changes.
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# APK-Patcher Lite: Recovery Flashable Zip
2+
# by djb77 @ xda-developers
3+
# Based on APK-Patcher by osm0sis @ xda-developers
4+
#
5+
# APK-Patcher Lite Changelog:
6+
#
7+
# - Initial transformation to Lite vesrion, based on the APK
8+
# Patching method used for TGP ROM.
9+
# - Removed Baksmali / Smail / Apktool support, instead it will
10+
# now copy pre-compiled files (xml, dex etc) to the APK file.
11+
# - New script added to remove unwanted files from the APK,
12+
# a sample is located at scripts/apkname.sh.
13+
# Please rename the .sh to the APK name you want to work on.
14+
15+
# working directory variables
16+
ap=$MODPATH/common/addon/APK-Patcher;
17+
patch=$ap/patch;
18+
script=$ap/script;
19+
20+
# set up extracted files and directories
21+
rm -f $patch/placeholder $script/placeholder
22+
chmod -R 755 $ap/$ARCH32/tools $script $ap/*.sh;
23+
cp -R $ap/tools $UF 2>/dev/null
24+
25+
ui_print " ";
26+
ui_print "- Running APK Patcher Lite by djb77 @ xda-developers-";
27+
ui_print " Based on APK Patcher by osm0sis @ xda-developers";
28+
ui_print " ";
29+
30+
ui_print " Patching files...";
31+
cd $ap;
32+
for target in $apklist; do
33+
ui_print " $target";
34+
apkname=$(basename $target .apk);
35+
36+
# copy in target system file to patch
37+
sysfile=`find /system -mindepth 2 -name $target`;
38+
cp -fp $sysfile $ap;
39+
40+
# file patches
41+
if [ -d $patch/$apkname ]; then
42+
mv $apkname.apk $apkname.zip;
43+
44+
# delete unwanted files
45+
if [ -f $script/$apkname.sh ]; then
46+
ui_print " Removing files...";
47+
. $script/$apkname.sh;
48+
for remove in $fileremove; do
49+
zip -d $apkname.zip $remove;
50+
done
51+
fi;
52+
53+
# continue patching
54+
ui_print " Inject files";
55+
cd $patch/$apkname;
56+
zip -r -9 $ap/$apkname.zip *;
57+
if [ -f resources.arsc ]; then
58+
zip -r -0 $ap/$apkname.zip resources.arsc;
59+
fi;
60+
cd $ap;
61+
mv $apkname.zip $apkname.apk;
62+
fi;
63+
64+
# zipalign updated file
65+
cp -f $target $apkname-preopt.apk;
66+
rm $target;
67+
zipalign -p 4 $apkname-preopt.apk $target;
68+
69+
# copy patched file back to system
70+
cp_ch $ap/$target $UNITY$sysfile;
71+
done;
72+
ui_print " ";
73+
74+
# extra required non-patch changes
75+
. $ap/extracmd.sh;
76+
77+
cd /

common/addon/APK-Patcher-Lite/patch/placeholder

Whitespace-only changes.

common/addon/APK-Patcher-Lite/script/placeholder

Whitespace-only changes.
667 KB
Binary file not shown.
Binary file not shown.
566 KB
Binary file not shown.
Binary file not shown.
1.67 KB
Binary file not shown.

0 commit comments

Comments
 (0)