433 Commits

Author SHA1 Message Date
oSumAtrIX
35b85b2c29
Build log strings in suppliers 2024-10-27 15:59:52 +01:00
oSumAtrIX
92eaba8081
feat: Improve Fingerprint API
Fingerprints can now be matched easily without having to add them to a patch first.

BREAKING CHANGE: Many APIs have been changed.
2024-10-27 04:31:43 +01:00
oSumAtrIX
7be0cd8548
fix: Merge extension only when patch executes 2024-10-26 23:23:36 +02:00
LisoUseInAIKyrios
a44802ef4e
fix: Make it work on Android 12 and lower by using existing APIs (#312)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-10-15 13:39:33 +02:00
oSumAtrIX
ea6fc70caa
fix: Use non-nullable type for options 2024-10-11 05:28:15 +02:00
oSumAtrIX
2be6e97817
fix: Make it work on Android by not using APIs from JVM unavailable to Android. 2024-10-07 18:25:43 +02:00
oSumAtrIX
d53aacdad4
perf: Free memory earlier and remove negligible lookup maps
Negligible lookup maps used for matching fingerprints have been removed to reduce the likelihood of OOM when the maps are instantiated, commonly observed with 400M RAM. Additionally, lookup maps previously kept for the duration of the patcher instance are now cleared before the classes are compiled. This reduces the likelihood of OOM when compiling classes.
On a related note, a linear increase in memory usage is observed with every compiled class until all classes are compiled implying compiled classes not being freed by GC because they are still referenced. After compiling a class, the class is technically free-able though. The classes are assumed to be referenced in the `multidexlib2` library that takes the list of all classes to compile multiple DEX with and seems to hold the reference to all these classes in memory until all DEX are compiled. A clever fix would involve splitting the list of classes into chunks and getting rid of the list of all classes so that after every DEX compilation, the corresponding split of classes can be freed.
2024-10-03 16:06:42 +02:00
oSumAtrIX
69f2f20fd9
fix: Check for class type exactly instead of with contains (#310) 2024-09-18 14:36:15 +02:00
oSumAtrIX
5481d0c54c fix: Improve exception message wording 2024-08-06 16:53:42 +02:00
oSumAtrIX
7f44174d91 fix: Make constructor internal as supposed 2024-08-06 16:53:42 +02:00
oSumAtrIX
d310246852 feat: Add ability to create options outside of a patch 2024-08-06 16:53:42 +02:00
oSumAtrIX
5227e98abf fix: Downgrade smali to fix dex compilation issue 2024-08-06 16:53:42 +02:00
oSumAtrIX
8c4dd5b3a3 fix: Merge all extensions before initializing lookup maps 2024-08-06 16:53:42 +02:00
oSumAtrIX
736b3eebbf fix: Use null for compatible package version when adding packages only 2024-08-06 16:53:42 +02:00
oSumAtrIX
b41a542952 refactor: Convert method bodies to single expression functions 2024-08-06 16:53:42 +02:00
oSumAtrIX
d21128fe2e build(Needs bump): Bump dependencies 2024-08-06 16:53:42 +02:00
oSumAtrIX
11a911dc67 feat: Convert APIs to Kotlin DSL (#298)
This commit converts various APIs to Kotlin DSL.

BREAKING CHANGE: Various old APIs are removed, and DSL APIs are added instead.
2024-08-06 16:53:42 +02:00
Vologhat
d8b4c60321 refactor: Simplify mapping classes to their names (#290)
Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
2024-08-06 16:53:42 +02:00
oSumAtrIX
d842f82d07 chore: Lint code 2024-08-06 16:53:42 +02:00
oSumAtrIX
90b7631d9e refactor: Properly abstract Patch#execute function 2024-08-06 16:53:42 +02:00
oSumAtrIX
cc183062ab
chore: Fix inline comment 2024-02-15 02:46:14 +01:00
oSumAtrIX
55a5d3bd4e
chore: Fix warnings 2024-02-13 05:27:50 +01:00
oSumAtrIX
f1d7217495
feat: Read and write arbitrary files in APK files
This commit allows reading and writing arbitrary files in an APK file. Additionally it allows deleting files from APK files. A `RawResourcePatch` class has been added which has access to `ResourceContext` but ReVanced Patcher will not decode APK resources. A regular `ResourcePatch` can read and write arbitrary files from an APK file, unless they are decoded to `PatcherConfig.apkFiles`. On attempt to get a file from `PatcherConfig.apkFiles` if the second parameter is true, it will read and write the raw resource file from the original APK to `PatcherConfig.apkFiles` if it does not exist. With this commit, many APIs have been deprecated as well, such as `DomFileEditor` and instead a `Document` has been added.
2024-02-13 03:40:39 +01:00
oSumAtrIX
c9a82608f7
fix: Use Patch#toString to get patch class name, when no name available 2024-01-27 04:06:15 +01:00
oSumAtrIX
4a9184597b
feat: Add PatchExtensions#registerNewPatchOption function to simplify instantiation and registration of patch options 2023-12-22 03:20:50 +01:00
oSumAtrIX
0a482f8c9a
refactor: Reduce duplicate code by using a common function to register options 2023-12-22 03:09:42 +01:00
oSumAtrIX
716825f232
fix: Accept PatchSet in PatchesConsumer#acceptPatches
This deprecates accepting `List<Patch<*>>`
2023-12-01 23:10:23 +01:00
oSumAtrIX
462fbe2cad
feat: Add constructor to initialize patches without annotations 2023-11-29 20:26:20 +01:00
oSumAtrIX
7aeae93f3d
feat: Retrieve annotations in super and interface classes 2023-11-29 01:14:46 +01:00
oSumAtrIX
f1de9b39ef
perf: Use a hash set for fast lookup 2023-11-28 20:17:46 +01:00
oSumAtrIX
db5b0ed7be
refactor: Convert extension property to member 2023-11-28 20:17:02 +01:00
oSumAtrIX
9f28a01c03
refactor: Group related extension functions together 2023-11-28 19:59:18 +01:00
oSumAtrIX
80407b6102
chore: Lint code 2023-11-26 05:57:41 +01:00
oSumAtrIX
12c43072cb
refactor: Include class of method in call expression 2023-11-03 23:31:15 +01:00
oSumAtrIX
a46e948b5a
feat: Add PatchOption#valueType to handle type erasure
Without this new property, it is not possible to infer the type without abusing `ClassCastException` at runtime to infer the type of the option value.

BREAKING CHANGE: This changes the signature of the `PatchOption` constructor.
2023-10-24 22:33:10 +02:00
oSumAtrIX
aed1eac315
fix: Only allow setting MethodFingerprint#result privately
BREAKING CHANGE: The `MethodFingerprint#result` member can now only be set inside `MethodFingerprint`.
2023-10-23 01:52:43 +02:00
oSumAtrIX
54a2f8f16f
refactor!: Remove Fingerprint interface
It served no purpose so far.

BREAKING CHANGE: The `Fingerprint` interface is no longer present.
2023-10-23 01:52:04 +02:00
oSumAtrIX
2ca543ffb9
refactor: Move lookup related classes and members to own file 2023-10-23 01:51:48 +02:00
oSumAtrIX
58e7f815a5
refactor: Move MethodFingerprintResult to own file 2023-10-23 01:51:34 +02:00
oSumAtrIX
15b38fc841
refactor: Simplify method implementation 2023-10-23 01:50:54 +02:00
oSumAtrIX
e2ca50729d
refactor: Convert extension functions to member functions
BREAKING CHANGE: Some extension functions are now member functions.
2023-10-23 01:50:53 +02:00
oSumAtrIX
6192089b71
refactor: Change data classes to actual classes
The data class members did not serve any actual purpose.

BREAKING CHANGE: This gets rid of data class members.
2023-10-23 01:49:57 +02:00
oSumAtrIX
a4212f6bf9
refactor: Remove deprecated classes and members
BREAKING CHANGE: Some deprecated classes and members are not present anymore.
2023-10-23 01:49:23 +02:00
oSumAtrIX
124a2e9d3e
refactor: Move files to simplify package structure
BREAKING CHANGE: Classes and members have changed packages.
2023-10-23 01:48:52 +02:00
oSumAtrIX
a76ac04214
fix: Do not set patch fields if they are empty 2023-10-22 18:08:28 +02:00
oSumAtrIX
54ac1394a9
feat: Use a map for PatchOption#values
This allows to display a string representation associated to the option value.
2023-10-22 17:07:22 +02:00
oSumAtrIX
56ce9ec2f9
feat: Make PatchOption#values nullable
There is no difference semantically, but this change allows passing null as a parameter which is simpler than having to use `emptySet()`.
2023-10-22 16:07:01 +02:00
oSumAtrIX
098c2c1efa
chore: Test default option value 2023-10-22 02:50:26 +02:00
oSumAtrIX
64343e5a7c
chore: Test resetting options 2023-10-22 02:49:44 +02:00
oSumAtrIX
0caf6caeb9
refactor: Simplify patch option tests 2023-10-22 02:46:51 +02:00