You've already forked revanced-patcher
mirror of
https://github.com/revanced/revanced-patcher
synced 2025-09-17 07:30:49 +02:00
Compare commits
88 Commits
v20.0.0-de
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
![]() |
24dc508cf7 | ||
![]() |
8255ca14a0 | ||
![]() |
f70e85778a | ||
![]() |
d21d2b10d1 | ||
![]() |
dd95d8cfea | ||
![]() |
e8358aba3d | ||
![]() |
42c5a75ef3 | ||
![]() |
81e6aed44a | ||
![]() |
b0d34719b1 | ||
![]() |
b160a2adc0 | ||
![]() |
33fadcbd0c | ||
![]() |
68db95b99b | ||
![]() |
4f2ef3c47c | ||
![]() |
062ae14936 | ||
![]() |
99f431897e | ||
![]() |
d80abbcd17 | ||
![]() |
509ecc81e1 | ||
![]() |
e4e66b0d8b | ||
![]() |
bb8771bb8b | ||
![]() |
754b02e4ca | ||
![]() |
fe5fb736cb | ||
![]() |
fc505a8726 | ||
![]() |
88a3252574 | ||
![]() |
ead701bdaf | ||
![]() |
0581dcf931 | ||
![]() |
62191e3c4a | ||
![]() |
1358d3fa10 | ||
![]() |
6712f0ea72 | ||
![]() |
0746c22743 | ||
![]() |
7f55868e6f | ||
![]() |
5d996def4d | ||
![]() |
49f4570164 | ||
![]() |
b8249789df | ||
![]() |
0abf1c6c02 | ||
![]() |
aa472eb985 | ||
![]() |
ab624f04f6 | ||
![]() |
21b5c079fb | ||
![]() |
5024204046 | ||
![]() |
a44802ef4e | ||
![]() |
4c1c34ad01 | ||
![]() |
b2aecb726d | ||
![]() |
851f9c7885 | ||
![]() |
ea6fc70caa | ||
![]() |
a2875d1d64 | ||
![]() |
2be6e97817 | ||
![]() |
348d0070e7 | ||
![]() |
d53aacdad4 | ||
![]() |
f1615b7ab5 | ||
![]() |
ffb1d880d7 | ||
![]() |
e95f13ae3e | ||
![]() |
e1b984d601 | ||
![]() |
c2dc29e061 | ||
![]() |
69f2f20fd9 | ||
![]() |
525beda18e | ||
![]() |
73d3cbf4ff | ||
![]() |
70278dd79d | ||
![]() |
5e98e9e30a | ||
![]() |
ac1aff5a1a | ||
![]() |
5481d0c54c | ||
![]() |
4604742d0f | ||
![]() |
4beb907a61 | ||
![]() |
7f44174d91 | ||
![]() |
d310246852 | ||
![]() |
dcc989243c | ||
![]() |
5227e98abf | ||
![]() |
8c4dd5b3a3 | ||
![]() |
736b3eebbf | ||
![]() |
b41a542952 | ||
![]() |
d21128fe2e | ||
![]() |
cf4374b8cf | ||
![]() |
8a30b0fa10 | ||
![]() |
11a911dc67 | ||
![]() |
6e3ba7419b | ||
![]() |
50a66ccfed | ||
![]() |
0be79840b1 | ||
![]() |
d8b4c60321 | ||
![]() |
f77e99e817 | ||
![]() |
ea26c486c0 | ||
![]() |
bebb734608 | ||
![]() |
d842f82d07 | ||
![]() |
82bab58ac2 | ||
![]() |
90b7631d9e | ||
![]() |
26d449e6d9 | ||
![]() |
49466060e3 | ||
![]() |
620ea5b852 | ||
![]() |
3e2168a2b2 | ||
![]() |
13c77967b1 | ||
![]() |
f57e571a14 |
4
.github/workflows/build_pull_request.yml
vendored
4
.github/workflows/build_pull_request.yml
vendored
@@ -12,12 +12,12 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v3
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
|
2
.github/workflows/open_pull_request.yml
vendored
2
.github/workflows/open_pull_request.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Open pull request
|
- name: Open pull request
|
||||||
uses: repo-sync/pull-request@v2
|
uses: repo-sync/pull-request@v2
|
||||||
|
9
.github/workflows/release.yml
vendored
9
.github/workflows/release.yml
vendored
@@ -10,10 +10,13 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v5
|
||||||
with:
|
with:
|
||||||
# Make sure the release step uses its own credentials:
|
# Make sure the release step uses its own credentials:
|
||||||
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
# https://github.com/cycjimmy/semantic-release-action#private-packages
|
||||||
@@ -21,7 +24,7 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v3
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
env:
|
env:
|
||||||
@@ -46,5 +49,5 @@ jobs:
|
|||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: npm exec semantic-release
|
run: npm exec semantic-release
|
||||||
|
@@ -23,7 +23,8 @@
|
|||||||
"assets": [
|
"assets": [
|
||||||
"CHANGELOG.md",
|
"CHANGELOG.md",
|
||||||
"gradle.properties"
|
"gradle.properties"
|
||||||
]
|
],
|
||||||
|
"message": "chore: Release v${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
|
213
CHANGELOG.md
213
CHANGELOG.md
@@ -1,3 +1,216 @@
|
|||||||
|
# [21.1.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v21.1.0-dev.3...v21.1.0-dev.4) (2025-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Correctly save XML files in UTF-8 by using a bufferedWriter ([#356](https://github.com/ReVanced/revanced-patcher/issues/356)) ([33fadcb](https://github.com/ReVanced/revanced-patcher/commit/33fadcbd0c7076b848bdca4d62a9c684d5781232))
|
||||||
|
|
||||||
|
# [21.1.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v21.1.0-dev.2...v21.1.0-dev.3) (2025-06-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Encode XML files as UTF-8 to fix compilation of resources ([#339](https://github.com/ReVanced/revanced-patcher/issues/339)) ([4f2ef3c](https://github.com/ReVanced/revanced-patcher/commit/4f2ef3c47cea76a26c464cfb45d4bb57fe7198b5))
|
||||||
|
|
||||||
|
# [21.1.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v21.1.0-dev.1...v21.1.0-dev.2) (2025-06-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Add back missing log by naming logger correctly ([#332](https://github.com/ReVanced/revanced-patcher/issues/332)) ([e4e66b0](https://github.com/ReVanced/revanced-patcher/commit/e4e66b0d8bb0986b79fb150b9c15da35b8e11561))
|
||||||
|
* Support UTF-8 chars when compiling instructions in Smali in non UTF-8 environments ([#331](https://github.com/ReVanced/revanced-patcher/issues/331)) ([bb8771b](https://github.com/ReVanced/revanced-patcher/commit/bb8771bb8b8ab1724d957e56f4de88c02684d87b))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Use option name as key for simplicity and consistency ([754b02e](https://github.com/ReVanced/revanced-patcher/commit/754b02e4ca66ec10764d5205c6643f2d86d0c6a2))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* Use a buffered writer to reduce IO overhead ([#347](https://github.com/ReVanced/revanced-patcher/issues/347)) ([99f4318](https://github.com/ReVanced/revanced-patcher/commit/99f431897eb9e607987fd5d09b879d7eda442f3e))
|
||||||
|
|
||||||
|
# [21.1.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v21.0.0...v21.1.0-dev.1) (2024-12-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add identity hash code to unnamed patches ([88a3252](https://github.com/ReVanced/revanced-patcher/commit/88a325257494939a79fb30dd51d60c5c52546755))
|
||||||
|
|
||||||
|
# [21.0.0](https://github.com/ReVanced/revanced-patcher/compare/v20.0.2...v21.0.0) (2024-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Match fingerprint before delegating the match property ([5d996de](https://github.com/ReVanced/revanced-patcher/commit/5d996def4d3de4e2bfc34562e5a6c7d89a8cddf0))
|
||||||
|
* Merge extension only when patch executes ([#315](https://github.com/ReVanced/revanced-patcher/issues/315)) ([aa472eb](https://github.com/ReVanced/revanced-patcher/commit/aa472eb9857145b53b49f843406a9764fbb7e5ce))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Improve Fingerprint API ([#316](https://github.com/ReVanced/revanced-patcher/issues/316)) ([0abf1c6](https://github.com/ReVanced/revanced-patcher/commit/0abf1c6c0279708fdef5cb66b141d07d17682693))
|
||||||
|
* Improve various APIs ([#317](https://github.com/ReVanced/revanced-patcher/issues/317)) ([b824978](https://github.com/ReVanced/revanced-patcher/commit/b8249789df8b90129f7b7ad0e523a8d0ceaab848))
|
||||||
|
* Move fingerprint match members to fingerprint for ease of access by using context receivers ([0746c22](https://github.com/ReVanced/revanced-patcher/commit/0746c22743a9561bae2284d234b151f2f8511ca5))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* Use smallest lookup map for strings ([1358d3f](https://github.com/ReVanced/revanced-patcher/commit/1358d3fa10cb8ba011b6b89cfe3684ecf9849d2f))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Various APIs have been changed.
|
||||||
|
* Many APIs have been changed.
|
||||||
|
|
||||||
|
# [21.0.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v21.0.0-dev.3...v21.0.0-dev.4) (2024-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* Use smallest lookup map for strings ([1358d3f](https://github.com/ReVanced/revanced-patcher/commit/1358d3fa10cb8ba011b6b89cfe3684ecf9849d2f))
|
||||||
|
|
||||||
|
# [21.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v21.0.0-dev.2...v21.0.0-dev.3) (2024-11-05)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Move fingerprint match members to fingerprint for ease of access by using context receivers ([0746c22](https://github.com/ReVanced/revanced-patcher/commit/0746c22743a9561bae2284d234b151f2f8511ca5))
|
||||||
|
|
||||||
|
# [21.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v21.0.0-dev.1...v21.0.0-dev.2) (2024-11-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Match fingerprint before delegating the match property ([5d996de](https://github.com/ReVanced/revanced-patcher/commit/5d996def4d3de4e2bfc34562e5a6c7d89a8cddf0))
|
||||||
|
|
||||||
|
# [21.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.2...v21.0.0-dev.1) (2024-10-27)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Merge extension only when patch executes ([#315](https://github.com/ReVanced/revanced-patcher/issues/315)) ([aa472eb](https://github.com/ReVanced/revanced-patcher/commit/aa472eb9857145b53b49f843406a9764fbb7e5ce))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Improve Fingerprint API ([#316](https://github.com/ReVanced/revanced-patcher/issues/316)) ([0abf1c6](https://github.com/ReVanced/revanced-patcher/commit/0abf1c6c0279708fdef5cb66b141d07d17682693))
|
||||||
|
* Improve various APIs ([#317](https://github.com/ReVanced/revanced-patcher/issues/317)) ([b824978](https://github.com/ReVanced/revanced-patcher/commit/b8249789df8b90129f7b7ad0e523a8d0ceaab848))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Various APIs have been changed.
|
||||||
|
* Many APIs have been changed.
|
||||||
|
|
||||||
|
## [20.0.2](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1...v20.0.2) (2024-10-17)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make it work on Android 12 and lower by using existing APIs ([#312](https://github.com/ReVanced/revanced-patcher/issues/312)) ([a44802e](https://github.com/ReVanced/revanced-patcher/commit/a44802ef4ebf59ae47213854ba761c81dadc51f3))
|
||||||
|
|
||||||
|
## [20.0.2-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1...v20.0.2-dev.1) (2024-10-15)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make it work on Android 12 and lower by using existing APIs ([#312](https://github.com/ReVanced/revanced-patcher/issues/312)) ([a44802e](https://github.com/ReVanced/revanced-patcher/commit/a44802ef4ebf59ae47213854ba761c81dadc51f3))
|
||||||
|
|
||||||
|
## [20.0.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0...v20.0.1) (2024-10-13)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Check for class type exactly instead of with contains ([#310](https://github.com/ReVanced/revanced-patcher/issues/310)) ([69f2f20](https://github.com/ReVanced/revanced-patcher/commit/69f2f20fd99162f91cd9c531dfe47d00d3152ead))
|
||||||
|
* Make it work on Android by not using APIs from JVM unavailable to Android. ([2be6e97](https://github.com/ReVanced/revanced-patcher/commit/2be6e97817437f40e17893dfff3bea2cd4c3ff9e))
|
||||||
|
* Use non-nullable type for options ([ea6fc70](https://github.com/ReVanced/revanced-patcher/commit/ea6fc70caab055251ad4d0d3f1b5cf53865abb85))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* Free memory earlier and remove negligible lookup maps ([d53aacd](https://github.com/ReVanced/revanced-patcher/commit/d53aacdad4ed3750ddae526fb307577ea36e6171))
|
||||||
|
|
||||||
|
## [20.0.1-dev.5](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.4...v20.0.1-dev.5) (2024-10-11)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Use non-nullable type for options ([ea6fc70](https://github.com/ReVanced/revanced-patcher/commit/ea6fc70caab055251ad4d0d3f1b5cf53865abb85))
|
||||||
|
|
||||||
|
## [20.0.1-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.3...v20.0.1-dev.4) (2024-10-07)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make it work on Android by not using APIs from JVM unavailable to Android. ([2be6e97](https://github.com/ReVanced/revanced-patcher/commit/2be6e97817437f40e17893dfff3bea2cd4c3ff9e))
|
||||||
|
|
||||||
|
## [20.0.1-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.2...v20.0.1-dev.3) (2024-10-03)
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* Free memory earlier and remove negligible lookup maps ([d53aacd](https://github.com/ReVanced/revanced-patcher/commit/d53aacdad4ed3750ddae526fb307577ea36e6171))
|
||||||
|
|
||||||
|
## [20.0.1-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v20.0.1-dev.1...v20.0.1-dev.2) (2024-10-01)
|
||||||
|
|
||||||
|
## [20.0.1-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0...v20.0.1-dev.1) (2024-09-18)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Check for class type exactly instead of with contains ([#310](https://github.com/ReVanced/revanced-patcher/issues/310)) ([69f2f20](https://github.com/ReVanced/revanced-patcher/commit/69f2f20fd99162f91cd9c531dfe47d00d3152ead))
|
||||||
|
|
||||||
|
# [20.0.0](https://github.com/ReVanced/revanced-patcher/compare/v19.3.1...v20.0.0) (2024-08-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Downgrade smali to fix dex compilation issue ([5227e98](https://github.com/ReVanced/revanced-patcher/commit/5227e98abfaa2ff1204eb20a0f2671f58c489930))
|
||||||
|
* Improve exception message wording ([5481d0c](https://github.com/ReVanced/revanced-patcher/commit/5481d0c54ccecc91cd8d15af1ba2d3285a33e5ab))
|
||||||
|
* Make constructor internal as supposed ([7f44174](https://github.com/ReVanced/revanced-patcher/commit/7f44174d91f0af0d50a83d80a7103c779241e094))
|
||||||
|
* Merge all extensions before initializing lookup maps ([8c4dd5b](https://github.com/ReVanced/revanced-patcher/commit/8c4dd5b3a309077fa9a3827b4931fc28b0517809))
|
||||||
|
* Use null for compatible package version when adding packages only ([736b3ee](https://github.com/ReVanced/revanced-patcher/commit/736b3eebbfdd7279b8d5fcfc5c46c9e3aadbee12))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add ability to create options outside of a patch ([d310246](https://github.com/ReVanced/revanced-patcher/commit/d310246852504b08a15f6376bbf25ac7c6fae76f))
|
||||||
|
* Convert APIs to Kotlin DSL ([#298](https://github.com/ReVanced/revanced-patcher/issues/298)) ([11a911d](https://github.com/ReVanced/revanced-patcher/commit/11a911dc674eb0801649949dd3f28dfeb00efe97))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* Various old APIs are removed, and DSL APIs are added instead.
|
||||||
|
|
||||||
|
# [20.0.0-dev.4](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0-dev.3...v20.0.0-dev.4) (2024-08-06)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Improve exception message wording ([bd434ce](https://github.com/ReVanced/revanced-patcher/commit/bd434ceb3394d1d5292e8b94e5bfd6da0e4e9c72))
|
||||||
|
|
||||||
|
# [20.0.0-dev.3](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0-dev.2...v20.0.0-dev.3) (2024-08-01)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Make constructor internal as supposed ([e95fcd1](https://github.com/ReVanced/revanced-patcher/commit/e95fcd1c0b641164bbf0840ec7e562aeb3bacc3e))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add ability to create options outside of a patch ([b8d763a](https://github.com/ReVanced/revanced-patcher/commit/b8d763a66e0601627dd71c8c24247726aa300146))
|
||||||
|
|
||||||
|
# [20.0.0-dev.2](https://github.com/ReVanced/revanced-patcher/compare/v20.0.0-dev.1...v20.0.0-dev.2) (2024-07-31)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* Downgrade smali to fix dex compilation issue ([714447d](https://github.com/ReVanced/revanced-patcher/commit/714447de70096bf736e8e1d31c14bb5f24195070))
|
||||||
|
* Merge all extensions before initializing lookup maps ([328aa87](https://github.com/ReVanced/revanced-patcher/commit/328aa876d8ed7826be3713754b6404195e9fe84b))
|
||||||
|
* Use null for compatible package version when adding packages only ([a8e8fa4](https://github.com/ReVanced/revanced-patcher/commit/a8e8fa4093deb8cffbd7a582409f41867f6b568b))
|
||||||
|
|
||||||
# [20.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v19.3.1...v20.0.0-dev.1) (2024-07-22)
|
# [20.0.0-dev.1](https://github.com/ReVanced/revanced-patcher/compare/v19.3.1...v20.0.0-dev.1) (2024-07-22)
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1,7 +1,22 @@
|
|||||||
public final class app/revanced/patcher/Fingerprint {
|
public final class app/revanced/patcher/Fingerprint {
|
||||||
public final fun getMatch ()Lapp/revanced/patcher/Match;
|
public final fun getClassDef (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;
|
||||||
public final fun match (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Z
|
public final fun getClassDefOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;
|
||||||
public final fun match (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;)Z
|
public final fun getMethod (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
||||||
|
public final fun getMethodOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
||||||
|
public final fun getOriginalClassDef (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lcom/android/tools/smali/dexlib2/iface/ClassDef;
|
||||||
|
public final fun getOriginalClassDefOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lcom/android/tools/smali/dexlib2/iface/ClassDef;
|
||||||
|
public final fun getOriginalMethod (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lcom/android/tools/smali/dexlib2/iface/Method;
|
||||||
|
public final fun getOriginalMethodOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lcom/android/tools/smali/dexlib2/iface/Method;
|
||||||
|
public final fun getPatternMatch (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/Match$PatternMatch;
|
||||||
|
public final fun getPatternMatchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Lapp/revanced/patcher/Match$PatternMatch;
|
||||||
|
public final fun getStringMatches (Lapp/revanced/patcher/patch/BytecodePatchContext;)Ljava/util/List;
|
||||||
|
public final fun getStringMatchesOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;)Ljava/util/List;
|
||||||
|
public final fun match (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/Match;
|
||||||
|
public final fun match (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/Match;
|
||||||
|
public final fun match (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/Match;
|
||||||
|
public final fun matchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/Match;
|
||||||
|
public final fun matchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/Match;
|
||||||
|
public final fun matchOrNull (Lapp/revanced/patcher/patch/BytecodePatchContext;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/Match;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/FingerprintBuilder {
|
public final class app/revanced/patcher/FingerprintBuilder {
|
||||||
@@ -18,32 +33,27 @@ public final class app/revanced/patcher/FingerprintBuilder {
|
|||||||
|
|
||||||
public final class app/revanced/patcher/FingerprintKt {
|
public final class app/revanced/patcher/FingerprintKt {
|
||||||
public static final fun fingerprint (ILkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/Fingerprint;
|
public static final fun fingerprint (ILkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/Fingerprint;
|
||||||
public static final fun fingerprint (Lapp/revanced/patcher/patch/BytecodePatchBuilder;ILkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/patch/BytecodePatchBuilder$InvokedFingerprint;
|
|
||||||
public static synthetic fun fingerprint$default (ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/Fingerprint;
|
public static synthetic fun fingerprint$default (ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/Fingerprint;
|
||||||
public static synthetic fun fingerprint$default (Lapp/revanced/patcher/patch/BytecodePatchBuilder;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/patch/BytecodePatchBuilder$InvokedFingerprint;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface annotation class app/revanced/patcher/InternalApi : java/lang/annotation/Annotation {
|
public abstract interface annotation class app/revanced/patcher/InternalApi : java/lang/annotation/Annotation {
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/Match {
|
public final class app/revanced/patcher/Match {
|
||||||
public fun <init> (Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lapp/revanced/patcher/Match$PatternMatch;Ljava/util/List;Lapp/revanced/patcher/patch/BytecodePatchContext;)V
|
public final fun getClassDef ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;
|
||||||
public final fun getClassDef ()Lcom/android/tools/smali/dexlib2/iface/ClassDef;
|
public final fun getMethod ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
||||||
public final fun getMethod ()Lcom/android/tools/smali/dexlib2/iface/Method;
|
public final fun getOriginalClassDef ()Lcom/android/tools/smali/dexlib2/iface/ClassDef;
|
||||||
public final fun getMutableClass ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;
|
public final fun getOriginalMethod ()Lcom/android/tools/smali/dexlib2/iface/Method;
|
||||||
public final fun getMutableMethod ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
|
||||||
public final fun getPatternMatch ()Lapp/revanced/patcher/Match$PatternMatch;
|
public final fun getPatternMatch ()Lapp/revanced/patcher/Match$PatternMatch;
|
||||||
public final fun getStringMatches ()Ljava/util/List;
|
public final fun getStringMatches ()Ljava/util/List;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/Match$PatternMatch {
|
public final class app/revanced/patcher/Match$PatternMatch {
|
||||||
public fun <init> (II)V
|
|
||||||
public final fun getEndIndex ()I
|
public final fun getEndIndex ()I
|
||||||
public final fun getStartIndex ()I
|
public final fun getStartIndex ()I
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/Match$StringMatch {
|
public final class app/revanced/patcher/Match$StringMatch {
|
||||||
public fun <init> (Ljava/lang/String;I)V
|
|
||||||
public final fun getIndex ()I
|
public final fun getIndex ()I
|
||||||
public final fun getString ()Ljava/lang/String;
|
public final fun getString ()Ljava/lang/String;
|
||||||
}
|
}
|
||||||
@@ -63,11 +73,14 @@ public final class app/revanced/patcher/Patcher : java/io/Closeable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/PatcherConfig {
|
public final class app/revanced/patcher/PatcherConfig {
|
||||||
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;Z)V
|
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/io/File;Ljava/lang/String;)V
|
||||||
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/io/File;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;)V
|
||||||
|
public synthetic fun <init> (Ljava/io/File;Ljava/io/File;Ljava/lang/String;Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/PatcherContext {
|
public final class app/revanced/patcher/PatcherContext : java/io/Closeable {
|
||||||
|
public fun close ()V
|
||||||
public final fun getPackageMetadata ()Lapp/revanced/patcher/PackageMetadata;
|
public final fun getPackageMetadata ()Lapp/revanced/patcher/PackageMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,40 +147,36 @@ public final class app/revanced/patcher/extensions/InstructionExtensions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/BytecodePatch : app/revanced/patcher/patch/Patch {
|
public final class app/revanced/patcher/patch/BytecodePatch : app/revanced/patcher/patch/Patch {
|
||||||
public final fun getExtension ()Ljava/io/InputStream;
|
public final fun getExtensionInputStream ()Ljava/util/function/Supplier;
|
||||||
public final fun getFingerprints ()Ljava/util/Set;
|
|
||||||
public fun toString ()Ljava/lang/String;
|
public fun toString ()Ljava/lang/String;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/BytecodePatchBuilder : app/revanced/patcher/patch/PatchBuilder {
|
public final class app/revanced/patcher/patch/BytecodePatchBuilder : app/revanced/patcher/patch/PatchBuilder {
|
||||||
public synthetic fun build$revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
|
public synthetic fun build$revanced_patcher ()Lapp/revanced/patcher/patch/Patch;
|
||||||
public final fun extendWith (Ljava/lang/String;)Lapp/revanced/patcher/patch/BytecodePatchBuilder;
|
public final fun extendWith (Ljava/lang/String;)Lapp/revanced/patcher/patch/BytecodePatchBuilder;
|
||||||
public final fun getExtension ()Ljava/io/InputStream;
|
public final fun getExtensionInputStream ()Ljava/util/function/Supplier;
|
||||||
public final fun invoke (Lapp/revanced/patcher/Fingerprint;)Lapp/revanced/patcher/patch/BytecodePatchBuilder$InvokedFingerprint;
|
public final fun setExtensionInputStream (Ljava/util/function/Supplier;)V
|
||||||
public final fun setExtension (Ljava/io/InputStream;)V
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/BytecodePatchBuilder$InvokedFingerprint {
|
public final class app/revanced/patcher/patch/BytecodePatchContext : app/revanced/patcher/patch/PatchContext, java/io/Closeable {
|
||||||
public fun <init> (Lapp/revanced/patcher/Fingerprint;)V
|
|
||||||
public final fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Lapp/revanced/patcher/Match;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/BytecodePatchContext : app/revanced/patcher/patch/PatchContext {
|
|
||||||
public final fun classBy (Lkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/proxy/ClassProxy;
|
public final fun classBy (Lkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/proxy/ClassProxy;
|
||||||
public final fun classByType (Ljava/lang/String;)Lapp/revanced/patcher/util/proxy/ClassProxy;
|
public fun close ()V
|
||||||
public synthetic fun get ()Ljava/lang/Object;
|
public synthetic fun get ()Ljava/lang/Object;
|
||||||
public fun get ()Ljava/util/Set;
|
public fun get ()Ljava/util/Set;
|
||||||
public final fun getClasses ()Lapp/revanced/patcher/util/ProxyClassList;
|
public final fun getClasses ()Lapp/revanced/patcher/util/ProxyClassList;
|
||||||
public final fun navigate (Lcom/android/tools/smali/dexlib2/iface/Method;)Lapp/revanced/patcher/util/MethodNavigator;
|
public final fun navigate (Lcom/android/tools/smali/dexlib2/iface/reference/MethodReference;)Lapp/revanced/patcher/util/MethodNavigator;
|
||||||
public final fun proxy (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/util/proxy/ClassProxy;
|
public final fun proxy (Lcom/android/tools/smali/dexlib2/iface/ClassDef;)Lapp/revanced/patcher/util/proxy/ClassProxy;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/Option {
|
public final class app/revanced/patcher/patch/Option {
|
||||||
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V
|
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V
|
||||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
|
public fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;)V
|
||||||
|
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/Object;Ljava/util/Map;Ljava/lang/String;ZLkotlin/reflect/KType;Lkotlin/jvm/functions/Function2;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
public final fun getDefault ()Ljava/lang/Object;
|
public final fun getDefault ()Ljava/lang/Object;
|
||||||
public final fun getDescription ()Ljava/lang/String;
|
public final fun getDescription ()Ljava/lang/String;
|
||||||
public final fun getKey ()Ljava/lang/String;
|
public final fun getKey ()Ljava/lang/String;
|
||||||
|
public final fun getName ()Ljava/lang/String;
|
||||||
public final fun getRequired ()Z
|
public final fun getRequired ()Z
|
||||||
public final fun getTitle ()Ljava/lang/String;
|
public final fun getTitle ()Ljava/lang/String;
|
||||||
public final fun getType ()Lkotlin/reflect/KType;
|
public final fun getType ()Lkotlin/reflect/KType;
|
||||||
@@ -203,25 +212,43 @@ public final class app/revanced/patcher/patch/OptionException$ValueValidationExc
|
|||||||
|
|
||||||
public final class app/revanced/patcher/patch/OptionKt {
|
public final class app/revanced/patcher/patch/OptionKt {
|
||||||
public static final fun booleanOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun booleanOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun booleanOption (Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun booleanOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun booleanOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun booleanOption$default (Ljava/lang/String;Ljava/lang/Boolean;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun booleansOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun booleansOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun booleansOption (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun booleansOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun booleansOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun booleansOption$default (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun floatOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun floatOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun floatOption (Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun floatOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun floatOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun floatOption$default (Ljava/lang/String;Ljava/lang/Float;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun floatsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun floatsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun floatsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun floatsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun intOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun intOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun intOption (Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun intOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun intOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun intOption$default (Ljava/lang/String;Ljava/lang/Integer;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun intsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun intsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun intsOption (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun intsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun intsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun intsOption$default (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun longOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun longOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun longOption (Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun longOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun longOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun longOption$default (Ljava/lang/String;Ljava/lang/Long;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun longsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun longsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun longsOption (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun longsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun longsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun longsOption$default (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun stringOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun stringOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun stringOption (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun stringOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun stringOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun stringOption$default (Ljava/lang/String;Ljava/lang/String;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static final fun stringsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
public static final fun stringsOption (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static final fun stringsOption (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;)Lapp/revanced/patcher/patch/Option;
|
||||||
public static synthetic fun stringsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
public static synthetic fun stringsOption$default (Lapp/revanced/patcher/patch/PatchBuilder;Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
|
public static synthetic fun stringsOption$default (Ljava/lang/String;Ljava/util/List;Ljava/util/Map;Ljava/lang/String;Ljava/lang/String;ZLkotlin/jvm/functions/Function2;ILjava/lang/Object;)Lapp/revanced/patcher/patch/Option;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/Options : java/util/Map, kotlin/jvm/internal/markers/KMappedMarker {
|
public final class app/revanced/patcher/patch/Options : java/util/Map, kotlin/jvm/internal/markers/KMappedMarker {
|
||||||
@@ -267,7 +294,7 @@ public final class app/revanced/patcher/patch/Options : java/util/Map, kotlin/jv
|
|||||||
}
|
}
|
||||||
|
|
||||||
public abstract class app/revanced/patcher/patch/Patch {
|
public abstract class app/revanced/patcher/patch/Patch {
|
||||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZLjava/util/Set;Ljava/util/Set;Ljava/util/Set;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/functions/Function2;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;ZLjava/util/Set;Ljava/util/Set;Ljava/util/Set;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||||
public final fun execute (Lapp/revanced/patcher/patch/PatchContext;)V
|
public final fun execute (Lapp/revanced/patcher/patch/PatchContext;)V
|
||||||
public final fun finalize (Lapp/revanced/patcher/patch/PatchContext;)V
|
public final fun finalize (Lapp/revanced/patcher/patch/PatchContext;)V
|
||||||
public final fun getCompatiblePackages ()Ljava/util/Set;
|
public final fun getCompatiblePackages ()Ljava/util/Set;
|
||||||
@@ -284,13 +311,13 @@ public abstract class app/revanced/patcher/patch/PatchBuilder {
|
|||||||
public final fun compatibleWith ([Ljava/lang/String;)V
|
public final fun compatibleWith ([Ljava/lang/String;)V
|
||||||
public final fun compatibleWith ([Lkotlin/Pair;)V
|
public final fun compatibleWith ([Lkotlin/Pair;)V
|
||||||
public final fun dependsOn ([Lapp/revanced/patcher/patch/Patch;)V
|
public final fun dependsOn ([Lapp/revanced/patcher/patch/Patch;)V
|
||||||
public final fun execute (Lkotlin/jvm/functions/Function2;)V
|
public final fun execute (Lkotlin/jvm/functions/Function1;)V
|
||||||
public final fun finalize (Lkotlin/jvm/functions/Function2;)V
|
public final fun finalize (Lkotlin/jvm/functions/Function1;)V
|
||||||
protected final fun getCompatiblePackages ()Ljava/util/Set;
|
protected final fun getCompatiblePackages ()Ljava/util/Set;
|
||||||
protected final fun getDependencies ()Ljava/util/Set;
|
protected final fun getDependencies ()Ljava/util/Set;
|
||||||
protected final fun getDescription ()Ljava/lang/String;
|
protected final fun getDescription ()Ljava/lang/String;
|
||||||
protected final fun getExecutionBlock ()Lkotlin/jvm/functions/Function2;
|
protected final fun getExecutionBlock ()Lkotlin/jvm/functions/Function1;
|
||||||
protected final fun getFinalizeBlock ()Lkotlin/jvm/functions/Function2;
|
protected final fun getFinalizeBlock ()Lkotlin/jvm/functions/Function1;
|
||||||
protected final fun getName ()Ljava/lang/String;
|
protected final fun getName ()Ljava/lang/String;
|
||||||
protected final fun getOptions ()Ljava/util/Set;
|
protected final fun getOptions ()Ljava/util/Set;
|
||||||
protected final fun getUse ()Z
|
protected final fun getUse ()Z
|
||||||
@@ -298,8 +325,8 @@ public abstract class app/revanced/patcher/patch/PatchBuilder {
|
|||||||
public final fun invoke (Ljava/lang/String;[Ljava/lang/String;)Lkotlin/Pair;
|
public final fun invoke (Ljava/lang/String;[Ljava/lang/String;)Lkotlin/Pair;
|
||||||
protected final fun setCompatiblePackages (Ljava/util/Set;)V
|
protected final fun setCompatiblePackages (Ljava/util/Set;)V
|
||||||
protected final fun setDependencies (Ljava/util/Set;)V
|
protected final fun setDependencies (Ljava/util/Set;)V
|
||||||
protected final fun setExecutionBlock (Lkotlin/jvm/functions/Function2;)V
|
protected final fun setExecutionBlock (Lkotlin/jvm/functions/Function1;)V
|
||||||
protected final fun setFinalizeBlock (Lkotlin/jvm/functions/Function2;)V
|
protected final fun setFinalizeBlock (Lkotlin/jvm/functions/Function1;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract interface class app/revanced/patcher/patch/PatchContext : java/util/function/Supplier {
|
public abstract interface class app/revanced/patcher/patch/PatchContext : java/util/function/Supplier {
|
||||||
@@ -376,18 +403,13 @@ public final class app/revanced/patcher/patch/ResourcePatchBuilder : app/revance
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/ResourcePatchContext : app/revanced/patcher/patch/PatchContext {
|
public final class app/revanced/patcher/patch/ResourcePatchContext : app/revanced/patcher/patch/PatchContext {
|
||||||
|
public final fun delete (Ljava/lang/String;)Z
|
||||||
|
public final fun document (Ljava/io/InputStream;)Lapp/revanced/patcher/util/Document;
|
||||||
|
public final fun document (Ljava/lang/String;)Lapp/revanced/patcher/util/Document;
|
||||||
public fun get ()Lapp/revanced/patcher/PatcherResult$PatchedResources;
|
public fun get ()Lapp/revanced/patcher/PatcherResult$PatchedResources;
|
||||||
public synthetic fun get ()Ljava/lang/Object;
|
public synthetic fun get ()Ljava/lang/Object;
|
||||||
public final fun get (Ljava/lang/String;Z)Ljava/io/File;
|
public final fun get (Ljava/lang/String;Z)Ljava/io/File;
|
||||||
public static synthetic fun get$default (Lapp/revanced/patcher/patch/ResourcePatchContext;Ljava/lang/String;ZILjava/lang/Object;)Ljava/io/File;
|
public static synthetic fun get$default (Lapp/revanced/patcher/patch/ResourcePatchContext;Ljava/lang/String;ZILjava/lang/Object;)Ljava/io/File;
|
||||||
public final fun getDocument ()Lapp/revanced/patcher/patch/ResourcePatchContext$DocumentOperatable;
|
|
||||||
public final fun stageDelete (Lkotlin/jvm/functions/Function1;)Z
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class app/revanced/patcher/patch/ResourcePatchContext$DocumentOperatable {
|
|
||||||
public fun <init> (Lapp/revanced/patcher/patch/ResourcePatchContext;)V
|
|
||||||
public final fun get (Ljava/io/InputStream;)Lapp/revanced/patcher/util/Document;
|
|
||||||
public final fun get (Ljava/lang/String;)Lapp/revanced/patcher/util/Document;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/util/Document : java/io/Closeable, org/w3c/dom/Document {
|
public final class app/revanced/patcher/util/Document : java/io/Closeable, org/w3c/dom/Document {
|
||||||
@@ -463,11 +485,12 @@ public final class app/revanced/patcher/util/Document : java/io/Closeable, org/w
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/util/MethodNavigator {
|
public final class app/revanced/patcher/util/MethodNavigator {
|
||||||
public final fun at (ILkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/MethodNavigator;
|
public final fun getValue (Ljava/lang/Void;Lkotlin/reflect/KProperty;)Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
||||||
public final fun at ([I)Lapp/revanced/patcher/util/MethodNavigator;
|
public final fun original ()Lcom/android/tools/smali/dexlib2/iface/Method;
|
||||||
public static synthetic fun at$default (Lapp/revanced/patcher/util/MethodNavigator;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/util/MethodNavigator;
|
public final fun stop ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
||||||
public final fun immutable ()Lcom/android/tools/smali/dexlib2/iface/Method;
|
public final fun to (ILkotlin/jvm/functions/Function1;)Lapp/revanced/patcher/util/MethodNavigator;
|
||||||
public final fun mutable ()Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;
|
public final fun to ([I)Lapp/revanced/patcher/util/MethodNavigator;
|
||||||
|
public static synthetic fun to$default (Lapp/revanced/patcher/util/MethodNavigator;ILkotlin/jvm/functions/Function1;ILjava/lang/Object;)Lapp/revanced/patcher/util/MethodNavigator;
|
||||||
}
|
}
|
||||||
|
|
||||||
public final class app/revanced/patcher/util/ProxyClassList : java/util/List, kotlin/jvm/internal/markers/KMutableList {
|
public final class app/revanced/patcher/util/ProxyClassList : java/util/List, kotlin/jvm/internal/markers/KMutableList {
|
||||||
|
@@ -36,25 +36,28 @@ repositories {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(libs.kotlinx.coroutines.core)
|
|
||||||
implementation(libs.xpp3)
|
|
||||||
implementation(libs.smali)
|
|
||||||
implementation(libs.multidexlib2)
|
|
||||||
implementation(libs.apktool.lib)
|
|
||||||
implementation(libs.kotlin.reflect)
|
|
||||||
|
|
||||||
// TODO: Convert project to KMP.
|
// TODO: Convert project to KMP.
|
||||||
compileOnly(libs.android) {
|
compileOnly(libs.android) {
|
||||||
// Exclude, otherwise the org.w3c.dom API breaks.
|
// Exclude, otherwise the org.w3c.dom API breaks.
|
||||||
exclude(group = "xerces", module = "xmlParserAPIs")
|
exclude(group = "xerces", module = "xmlParserAPIs")
|
||||||
}
|
}
|
||||||
testImplementation(libs.kotlin.test)
|
|
||||||
|
implementation(libs.apktool.lib)
|
||||||
|
implementation(libs.kotlin.reflect)
|
||||||
|
implementation(libs.kotlinx.coroutines.core)
|
||||||
|
implementation(libs.multidexlib2)
|
||||||
|
implementation(libs.smali)
|
||||||
|
implementation(libs.xpp3)
|
||||||
|
|
||||||
testImplementation(libs.mockk)
|
testImplementation(libs.mockk)
|
||||||
|
testImplementation(libs.kotlin.test)
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
compilerOptions {
|
compilerOptions {
|
||||||
jvmTarget.set(JvmTarget.JVM_11)
|
jvmTarget.set(JvmTarget.JVM_11)
|
||||||
|
|
||||||
|
freeCompilerArgs = listOf("-Xcontext-receivers")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -89,9 +89,9 @@ val patcherResult = Patcher(PatcherConfig(apkFile = File("some.apk"))).use { pat
|
|||||||
runBlocking {
|
runBlocking {
|
||||||
patcher().collect { patchResult ->
|
patcher().collect { patchResult ->
|
||||||
if (patchResult.exception != null)
|
if (patchResult.exception != null)
|
||||||
logger.info("\"${patchResult.patch}\" failed:\n${patchResult.exception}")
|
logger.info { "\"${patchResult.patch}\" failed:\n${patchResult.exception}" }
|
||||||
else
|
else
|
||||||
logger.info("\"${patchResult.patch}\" succeeded")
|
logger.info { "\"${patchResult.patch}\" succeeded" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -72,6 +72,10 @@ To start developing patches with ReVanced Patcher, you must prepare a developmen
|
|||||||
|
|
||||||
Throughout the documentation, [ReVanced Patches](https://github.com/revanced/revanced-patches) will be used as an example project.
|
Throughout the documentation, [ReVanced Patches](https://github.com/revanced/revanced-patches) will be used as an example project.
|
||||||
|
|
||||||
|
> [!NOTE]
|
||||||
|
> To start a fresh project,
|
||||||
|
> you can use the [ReVanced Patches template](https://github.com/revanced/revanced-patches-template).
|
||||||
|
|
||||||
1. Clone the repository
|
1. Clone the repository
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -73,26 +73,26 @@ package app.revanced.patches.ads
|
|||||||
val disableAdsPatch = bytecodePatch(
|
val disableAdsPatch = bytecodePatch(
|
||||||
name = "Disable ads",
|
name = "Disable ads",
|
||||||
description = "Disable ads in the app.",
|
description = "Disable ads in the app.",
|
||||||
) {
|
) {
|
||||||
compatibleWith("com.some.app"("1.0.0"))
|
compatibleWith("com.some.app"("1.0.0"))
|
||||||
|
|
||||||
// Resource patch disables ads by patching resource files.
|
// Patches can depend on other patches, executing them first.
|
||||||
dependsOn(disableAdsResourcePatch)
|
dependsOn(disableAdsResourcePatch)
|
||||||
|
|
||||||
// Precompiled DEX file to be merged into the patched app.
|
// Merge precompiled DEX files into the patched app, before the patch is executed.
|
||||||
extendWith("disable-ads.rve")
|
extendWith("disable-ads.rve")
|
||||||
|
|
||||||
// Fingerprint to find the method to patch.
|
|
||||||
val showAdsMatch by showAdsFingerprint {
|
|
||||||
// More about fingerprints on the next page of the documentation.
|
|
||||||
}
|
|
||||||
|
|
||||||
// Business logic of the patch to disable ads in the app.
|
// Business logic of the patch to disable ads in the app.
|
||||||
execute {
|
execute {
|
||||||
|
// Fingerprint to find the method to patch.
|
||||||
|
val showAdsFingerprint = fingerprint {
|
||||||
|
// More about fingerprints on the next page of the documentation.
|
||||||
|
}
|
||||||
|
|
||||||
// In the method that shows ads,
|
// In the method that shows ads,
|
||||||
// call DisableAdsPatch.shouldDisableAds() from the extension (precompiled DEX file)
|
// call DisableAdsPatch.shouldDisableAds() from the extension (precompiled DEX file)
|
||||||
// to enable or disable ads.
|
// to enable or disable ads.
|
||||||
showAdsMatch.mutableMethod.addInstructions(
|
showAdsFingerprint.method.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
invoke-static {}, LDisableAdsPatch;->shouldDisableAds()Z
|
invoke-static {}, LDisableAdsPatch;->shouldDisableAds()Z
|
||||||
@@ -115,18 +115,18 @@ val disableAdsPatch = bytecodePatch(
|
|||||||
Patches can have options to get and set before a patch is executed.
|
Patches can have options to get and set before a patch is executed.
|
||||||
Options are useful for making patches configurable.
|
Options are useful for making patches configurable.
|
||||||
After loading the patches using `PatchLoader`, options can be set for a patch.
|
After loading the patches using `PatchLoader`, options can be set for a patch.
|
||||||
Multiple types are already inbuilt in ReVanced Patcher and are supported by any application that uses ReVanced Patcher.
|
Multiple types are already built into ReVanced Patcher and are supported by any application that uses ReVanced Patcher.
|
||||||
|
|
||||||
To define an option, use available `option` functions:
|
To define an option, use the available `option` functions:
|
||||||
|
|
||||||
```kt
|
```kt
|
||||||
val patch = bytecodePatch(name = "Patch") {
|
val patch = bytecodePatch(name = "Patch") {
|
||||||
// Add an inbuilt option and delegate it to a property.
|
// Add an inbuilt option and delegate it to a property.
|
||||||
val value by stringOption(key = "option")
|
val value by stringOption(name = "Inbuilt option")
|
||||||
|
|
||||||
// Add an option with a custom type and delegate it to a property.
|
// Add an option with a custom type and delegate it to a property.
|
||||||
val string by option<String>(key = "string")
|
val string by option<String>(name = "String option")
|
||||||
|
|
||||||
execute {
|
execute {
|
||||||
println(value)
|
println(value)
|
||||||
println(string)
|
println(string)
|
||||||
@@ -139,19 +139,31 @@ Options of a patch can be set after loading the patches with `PatchLoader` by ob
|
|||||||
```kt
|
```kt
|
||||||
loadPatchesJar(patches).apply {
|
loadPatchesJar(patches).apply {
|
||||||
// Type is checked at runtime.
|
// Type is checked at runtime.
|
||||||
first { it.name == "Patch" }.options["option"] = "Value"
|
first { it.name == "Patch" }.options["Option"] = "Value"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
The type of an option can be obtained from the `type` property of the option:
|
The type of an option can be obtained from the `type` property of the option:
|
||||||
|
|
||||||
```kt
|
```kt
|
||||||
option.type // The KType of the option.
|
option.type // The KType of the option. Captures the full type information of the option.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Options can be declared outside a patch and added to a patch manually:
|
||||||
|
|
||||||
|
```kt
|
||||||
|
val option = stringOption(name = "Option")
|
||||||
|
|
||||||
|
bytecodePatch(name = "Patch") {
|
||||||
|
val value by option()
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
This is useful when the same option is referenced in multiple patches.
|
||||||
|
|
||||||
### 🧩 Extensions
|
### 🧩 Extensions
|
||||||
|
|
||||||
An extension is a precompiled DEX file that is merged into the patched app before a patch is executed.
|
An extension is a precompiled DEX file merged into the patched app before a patch is executed.
|
||||||
While patches are compile-time constructs, extensions are runtime constructs
|
While patches are compile-time constructs, extensions are runtime constructs
|
||||||
that extend the patched app with additional classes.
|
that extend the patched app with additional classes.
|
||||||
|
|
||||||
@@ -171,20 +183,18 @@ and use it in a patch:
|
|||||||
```kt
|
```kt
|
||||||
val patch = bytecodePatch(name = "Complex patch") {
|
val patch = bytecodePatch(name = "Complex patch") {
|
||||||
extendWith("complex-patch.rve")
|
extendWith("complex-patch.rve")
|
||||||
|
|
||||||
val match by methodFingerprint()
|
execute {
|
||||||
|
fingerprint.method.addInstructions(0, "invoke-static { }, LComplexPatch;->doSomething()V")
|
||||||
execute {
|
|
||||||
match.mutableMethod.addInstructions(0, "invoke-static { }, LComplexPatch;->doSomething()V")
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
ReVanced Patcher merges the classes from the extension into `context.classes` before executing the patch.
|
ReVanced Patcher merges the classes from the extension into `context.classes` before executing the patch.
|
||||||
When the patch is executed, it can reference the classes and methods from the extension.
|
When the patch is executed, it can reference the classes and methods from the extension.
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
>
|
>
|
||||||
> The [ReVanced Patches template](https://github.com/ReVanced/revanced-patches-template) repository
|
> The [ReVanced Patches template](https://github.com/ReVanced/revanced-patches-template) repository
|
||||||
> is a template project to create patches and extensions.
|
> is a template project to create patches and extensions.
|
||||||
|
|
||||||
@@ -201,9 +211,9 @@ A simple real-world example would be a patch that opens a resource file of the a
|
|||||||
Other patches that depend on this patch can write to the file, and the finalization block can close the file.
|
Other patches that depend on this patch can write to the file, and the finalization block can close the file.
|
||||||
|
|
||||||
```kt
|
```kt
|
||||||
val patch = bytecodePatch(name = "Patch") {
|
val patch = bytecodePatch(name = "Patch") {
|
||||||
dependsOn(
|
dependsOn(
|
||||||
bytecodePatch(name = "Dependency") {
|
bytecodePatch(name = "Dependency") {
|
||||||
execute {
|
execute {
|
||||||
print("1")
|
print("1")
|
||||||
}
|
}
|
||||||
@@ -232,17 +242,17 @@ The same order is followed for multiple patches depending on the patch.
|
|||||||
|
|
||||||
## 💡 Additional tips
|
## 💡 Additional tips
|
||||||
|
|
||||||
- When using ´PatchLoader` to load patches, only patches with a name are loaded.
|
- When using `PatchLoader` to load patches, only patches with a name are loaded.
|
||||||
Refer to the inline documentation of `PatchLoader` for detailed information.
|
Refer to the inline documentation of `PatchLoader` for detailed information.
|
||||||
- Patches can depend on others. Dependencies are executed first.
|
- Patches can depend on others. Dependencies are executed first.
|
||||||
The dependent patch will not be executed if a dependency raises an exception while executing.
|
The dependent patch will not be executed if a dependency raises an exception while executing.
|
||||||
- A patch can declare compatibility with specific packages and versions,
|
- A patch can declare compatibility with specific packages and versions,
|
||||||
but patches can still be executed on any package or version.
|
but patches can still be executed on any package or version.
|
||||||
It is recommended to declare compatibility to present known compatible packages and versions.
|
It is recommended that compatibility is specified to present known compatible packages and versions.
|
||||||
- If `compatibleWith` is not used, the patch is treated as compatible with any package
|
- If `compatibleWith` is not used, the patch is treated as compatible with any package
|
||||||
- If a package is specified with no versions, the patch is compatible with any version of the package
|
- If a package is specified with no versions, the patch is compatible with any version of the package
|
||||||
- If an empty array of versions is specified, the patch is not compatible with any version of the package.
|
- If an empty array of versions is specified, the patch is not compatible with any version of the package.
|
||||||
This is useful for declaring incompatibility with a specific package.
|
This is useful for declaring incompatibility with a specific package.
|
||||||
- A patch can raise a `PatchException` at any time of execution to indicate that the patch failed to execute.
|
- A patch can raise a `PatchException` at any time of execution to indicate that the patch failed to execute.
|
||||||
|
|
||||||
## ⏭️ What's next
|
## ⏭️ What's next
|
||||||
|
@@ -96,21 +96,21 @@ Example of patches:
|
|||||||
@Surpress("unused")
|
@Surpress("unused")
|
||||||
val bytecodePatch = bytecodePatch {
|
val bytecodePatch = bytecodePatch {
|
||||||
execute {
|
execute {
|
||||||
// TODO
|
// More about this on the next page of the documentation.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Surpress("unused")
|
@Surpress("unused")
|
||||||
val rawResourcePatch = rawResourcePatch {
|
val rawResourcePatch = rawResourcePatch {
|
||||||
execute {
|
execute {
|
||||||
// TODO
|
// More about this on the next page of the documentation.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Surpress("unused")
|
@Surpress("unused")
|
||||||
val resourcePatch = rawResourcePatch {
|
val resourcePatch = resourcePatch {
|
||||||
execute {
|
execute {
|
||||||
// TODO
|
// More about this on the next page of the documentation.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
110
docs/4_apis.md
110
docs/4_apis.md
@@ -4,18 +4,107 @@ A handful of APIs are available to make patch development easier and more effici
|
|||||||
|
|
||||||
## 📙 Overview
|
## 📙 Overview
|
||||||
|
|
||||||
1. 👹 Mutate classes with `context.proxy(ClassDef)`
|
1. 👹 Create mutable replacements of classes with `proxy(ClassDef)`
|
||||||
2. 🔍 Find and proxy existing classes with `classBy(Predicate)` and `classByType(String)`
|
2. 🔍 Find and create mutable replaces with `classBy(Predicate)`
|
||||||
3. 🏃 Easily access referenced methods recursively by index with `MethodNavigator`
|
3. 🏃 Navigate method calls recursively by index with `navigate(Method)`
|
||||||
4. 🔨 Make use of extension functions from `BytecodeUtils` and `ResourceUtils` with certain applications
|
4. 💾 Read and write resource files with `get(String, Boolean)` and `delete(String)`
|
||||||
(Available in ReVanced Patches)
|
5. 📃 Read and write DOM files using `document(String)` and `document(InputStream)`
|
||||||
5. 💾 Read and write (decoded) resources with `ResourcePatchContext.get(Path, Boolean)`
|
|
||||||
6. 📃 Read and write DOM files using `ResourcePatchContext.document`
|
|
||||||
|
|
||||||
### 🧰 APIs
|
### 🧰 APIs
|
||||||
|
|
||||||
> [!WARNING]
|
#### 👹 `proxy(ClassDef)`
|
||||||
> This section is still under construction and may be incomplete.
|
|
||||||
|
By default, the classes are immutable, meaning they cannot be modified.
|
||||||
|
To make a class mutable, use the `proxy(ClassDef)` function.
|
||||||
|
This function creates a lazy mutable copy of the class definition.
|
||||||
|
Accessing the property will replace the original class definition with the mutable copy,
|
||||||
|
thus allowing you to make changes to the class. Subsequent accesses will return the same mutable copy.
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
val mutableClass = proxy(classDef)
|
||||||
|
mutableClass.methods.add(Method())
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🔍 `classBy(Predicate)`
|
||||||
|
|
||||||
|
The `classBy(Predicate)` function is an alternative to finding and creating mutable classes by a predicate.
|
||||||
|
It automatically proxies the class definition, making it mutable.
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
// Alternative to proxy(classes.find { it.name == "Lcom/example/MyClass;" })?.classDef
|
||||||
|
val classDef = classBy { it.name == "Lcom/example/MyClass;" }?.classDef
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 🏃 `navigate(Method).at(index)`
|
||||||
|
|
||||||
|
The `navigate(Method)` function allows you to navigate method calls recursively by index.
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
// Sequentially navigate to the instructions at index 1 within 'someMethod'.
|
||||||
|
val method = navigate(someMethod).to(1).original() // original() returns the original immutable method.
|
||||||
|
|
||||||
|
// Further navigate to the second occurrence where the instruction's opcode is 'INVOKEVIRTUAL'.
|
||||||
|
// stop() returns the mutable copy of the method.
|
||||||
|
val method = navigate(someMethod).to(2) { instruction -> instruction.opcode == Opcode.INVOKEVIRTUAL }.stop()
|
||||||
|
|
||||||
|
// Alternatively, to stop(), you can delegate the method to a variable.
|
||||||
|
val method by navigate(someMethod).to(1)
|
||||||
|
|
||||||
|
// You can chain multiple calls to at() to navigate deeper into the method.
|
||||||
|
val method by navigate(someMethod).to(1).to(2, 3, 4).to(5)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 💾 `get(String, Boolean)` and `delete(String)`
|
||||||
|
|
||||||
|
The `get(String, Boolean)` function returns a `File` object that can be used to read and write resource files.
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
val file = get("res/values/strings.xml")
|
||||||
|
val content = file.readText()
|
||||||
|
file.writeText(content)
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The `delete` function can mark files for deletion when the APK is rebuilt.
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
delete("res/values/strings.xml")
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
#### 📃 `document(String)` and `document(InputStream)`
|
||||||
|
|
||||||
|
The `document` function is used to read and write DOM files.
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
document("res/values/strings.xml").use { document ->
|
||||||
|
val element = doc.createElement("string").apply {
|
||||||
|
textContent = "Hello, World!"
|
||||||
|
}
|
||||||
|
document.documentElement.appendChild(element)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
You can also read documents from an `InputStream`:
|
||||||
|
|
||||||
|
```kt
|
||||||
|
execute {
|
||||||
|
val inputStream = classLoader.getResourceAsStream("some.xml")
|
||||||
|
document(inputStream).use { document ->
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
## 🎉 Afterword
|
## 🎉 Afterword
|
||||||
|
|
||||||
@@ -23,5 +112,6 @@ ReVanced Patcher is a powerful library to patch Android applications, offering a
|
|||||||
that outlive app updates. Patches make up ReVanced; without you, the community of patch developers,
|
that outlive app updates. Patches make up ReVanced; without you, the community of patch developers,
|
||||||
ReVanced would not be what it is today. We hope that this documentation has been helpful to you
|
ReVanced would not be what it is today. We hope that this documentation has been helpful to you
|
||||||
and are excited to see what you will create with ReVanced Patcher. If you have any questions or need help,
|
and are excited to see what you will create with ReVanced Patcher. If you have any questions or need help,
|
||||||
talk to us on one of our platforms linked on [revanced.app](https://revanced.app) or open an issue in case of a bug or feature request,
|
talk to us on one of our platforms linked on [revanced.app](https://revanced.app) or open an issue in case of a bug or
|
||||||
|
feature request,
|
||||||
ReVanced
|
ReVanced
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
version = 20.0.0-dev.1
|
version = 21.1.0-dev.4
|
||||||
|
@@ -1,20 +1,22 @@
|
|||||||
[versions]
|
[versions]
|
||||||
android = "4.1.1.4"
|
android = "4.1.1.4"
|
||||||
apktool-lib = "2.9.3"
|
apktool-lib = "2.10.1.1"
|
||||||
kotlin = "1.9.22"
|
binary-compatibility-validator = "0.18.1"
|
||||||
kotlinx-coroutines-core = "1.7.3"
|
kotlin = "2.0.20"
|
||||||
mockk = "1.13.10"
|
kotlinx-coroutines-core = "1.10.2"
|
||||||
|
mockk = "1.14.5"
|
||||||
multidexlib2 = "3.0.3.r3"
|
multidexlib2 = "3.0.3.r3"
|
||||||
smali = "3.0.5"
|
# Tracking https://github.com/google/smali/issues/64.
|
||||||
binary-compatibility-validator = "0.14.0"
|
#noinspection GradleDependency
|
||||||
|
smali = "3.0.9"
|
||||||
xpp3 = "1.1.4c"
|
xpp3 = "1.1.4c"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
android = { module = "com.google.android:android", version.ref = "android" }
|
android = { module = "com.google.android:android", version.ref = "android" }
|
||||||
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
|
||||||
apktool-lib = { module = "app.revanced:apktool-lib", version.ref = "apktool-lib" }
|
apktool-lib = { module = "app.revanced:apktool-lib", version.ref = "apktool-lib" }
|
||||||
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
|
||||||
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinx-coroutines-core" }
|
||||||
|
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }
|
||||||
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
|
mockk = { module = "io.mockk:mockk", version.ref = "mockk" }
|
||||||
multidexlib2 = { module = "app.revanced:multidexlib2", version.ref = "multidexlib2" }
|
multidexlib2 = { module = "app.revanced:multidexlib2", version.ref = "multidexlib2" }
|
||||||
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
|
smali = { module = "com.android.tools.smali:smali", version.ref = "smali" }
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
8
gradle/wrapper/gradle-wrapper.properties
vendored
8
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,8 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
distributionSha256Sum=d725d707bfabd4dfdc958c624003b3c80accc03f7037b5122c4b1d0ef15cecab
|
||||||
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dist
|
zipStorePath=wrapper/dists
|
||||||
|
22
gradlew
vendored
22
gradlew
vendored
@@ -15,6 +15,8 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
#
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
#
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
#
|
#
|
||||||
@@ -55,7 +57,7 @@
|
|||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
@@ -83,7 +85,9 @@ done
|
|||||||
# This is normally unused
|
# This is normally unused
|
||||||
# shellcheck disable=SC2034
|
# shellcheck disable=SC2034
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
|
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
|
||||||
|
' "$PWD" ) || exit
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
@@ -144,7 +148,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
@@ -152,7 +156,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
|||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
# shellcheck disable=SC3045
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
@@ -201,11 +205,11 @@ fi
|
|||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
# Collect all arguments for the java command:
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
# and any embedded shellness will be escaped.
|
||||||
# double quotes to make sure that they get re-expanded; and
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
22
gradlew.bat
vendored
22
gradlew.bat
vendored
@@ -13,6 +13,8 @@
|
|||||||
@rem See the License for the specific language governing permissions and
|
@rem See the License for the specific language governing permissions and
|
||||||
@rem limitations under the License.
|
@rem limitations under the License.
|
||||||
@rem
|
@rem
|
||||||
|
@rem SPDX-License-Identifier: Apache-2.0
|
||||||
|
@rem
|
||||||
|
|
||||||
@if "%DEBUG%"=="" @echo off
|
@if "%DEBUG%"=="" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@@ -43,11 +45,11 @@ set JAVA_EXE=java.exe
|
|||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if %ERRORLEVEL% equ 0 goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
@@ -57,11 +59,11 @@ set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
|||||||
|
|
||||||
if exist "%JAVA_EXE%" goto execute
|
if exist "%JAVA_EXE%" goto execute
|
||||||
|
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
|
||||||
echo.
|
echo. 1>&2
|
||||||
echo Please set the JAVA_HOME variable in your environment to match the
|
echo Please set the JAVA_HOME variable in your environment to match the 1>&2
|
||||||
echo location of your Java installation.
|
echo location of your Java installation. 1>&2
|
||||||
|
|
||||||
goto fail
|
goto fail
|
||||||
|
|
||||||
|
4013
package-lock.json
generated
4013
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,7 +3,7 @@
|
|||||||
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
||||||
"@semantic-release/changelog": "^6.0.3",
|
"@semantic-release/changelog": "^6.0.3",
|
||||||
"@semantic-release/git": "^10.0.1",
|
"@semantic-release/git": "^10.0.1",
|
||||||
"gradle-semantic-release-plugin": "^1.9.1",
|
"gradle-semantic-release-plugin": "^1.10.1",
|
||||||
"semantic-release": "^23.0.2"
|
"semantic-release": "^24.2.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@@ -39,9 +39,6 @@ class Patcher(private val config: PatcherConfig) : Closeable {
|
|||||||
patch.addRecursively()
|
patch.addRecursively()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Patch<*>.anyRecursively(predicate: (Patch<*>) -> Boolean): Boolean =
|
|
||||||
predicate(this) || dependencies.any { dependency -> dependency.anyRecursively(predicate) }
|
|
||||||
|
|
||||||
context.allPatches.let { allPatches ->
|
context.allPatches.let { allPatches ->
|
||||||
// Check, if what kind of resource mode is required.
|
// Check, if what kind of resource mode is required.
|
||||||
config.resourceMode = if (allPatches.any { patch -> patch.anyRecursively { it is ResourcePatch } }) {
|
config.resourceMode = if (allPatches.any { patch -> patch.anyRecursively { it is ResourcePatch } }) {
|
||||||
@@ -94,11 +91,16 @@ class Patcher(private val config: PatcherConfig) : Closeable {
|
|||||||
}.also { executedPatches[this] = it }
|
}.also { executedPatches[this] = it }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prevent from decoding the app manifest twice if it is not needed.
|
// Prevent decoding the app manifest twice if it is not needed.
|
||||||
if (config.resourceMode != ResourcePatchContext.ResourceMode.NONE) {
|
if (config.resourceMode != ResourcePatchContext.ResourceMode.NONE) {
|
||||||
context.resourceContext.decodeResources(config.resourceMode)
|
context.resourceContext.decodeResources(config.resourceMode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logger.info("Initializing lookup maps")
|
||||||
|
|
||||||
|
// Accessing the lazy lookup maps to initialize them.
|
||||||
|
context.bytecodeContext.lookupMaps
|
||||||
|
|
||||||
logger.info("Executing patches")
|
logger.info("Executing patches")
|
||||||
|
|
||||||
val executedPatches = LinkedHashMap<Patch<*>, PatchResult>()
|
val executedPatches = LinkedHashMap<Patch<*>, PatchResult>()
|
||||||
@@ -146,7 +148,7 @@ class Patcher(private val config: PatcherConfig) : Closeable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() = context.bytecodeContext.lookupMaps.close()
|
override fun close() = context.close()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile and save patched APK files.
|
* Compile and save patched APK files.
|
||||||
|
@@ -12,16 +12,32 @@ import java.util.logging.Logger
|
|||||||
* @param temporaryFilesPath A path to a folder to store temporary files in.
|
* @param temporaryFilesPath A path to a folder to store temporary files in.
|
||||||
* @param aaptBinaryPath A path to a custom aapt binary.
|
* @param aaptBinaryPath A path to a custom aapt binary.
|
||||||
* @param frameworkFileDirectory A path to the directory to cache the framework file in.
|
* @param frameworkFileDirectory A path to the directory to cache the framework file in.
|
||||||
* @param multithreadingDexFileWriter Whether to use multiple threads for writing dex files.
|
|
||||||
* This has impact on memory usage and performance.
|
|
||||||
*/
|
*/
|
||||||
class PatcherConfig(
|
class PatcherConfig(
|
||||||
internal val apkFile: File,
|
internal val apkFile: File,
|
||||||
private val temporaryFilesPath: File = File("revanced-temporary-files"),
|
private val temporaryFilesPath: File = File("revanced-temporary-files"),
|
||||||
aaptBinaryPath: String? = null,
|
aaptBinaryPath: File? = null,
|
||||||
frameworkFileDirectory: String? = null,
|
frameworkFileDirectory: String? = null,
|
||||||
internal val multithreadingDexFileWriter: Boolean = false,
|
|
||||||
) {
|
) {
|
||||||
|
/**
|
||||||
|
* The configuration for the patcher.
|
||||||
|
*
|
||||||
|
* @param apkFile The apk file to patch.
|
||||||
|
* @param temporaryFilesPath A path to a folder to store temporary files in.
|
||||||
|
* @param aaptBinaryPath A path to a custom aapt binary.
|
||||||
|
* @param frameworkFileDirectory A path to the directory to cache the framework file in.
|
||||||
|
*/
|
||||||
|
@Deprecated(
|
||||||
|
"Use the constructor with a File for aaptBinaryPath instead.",
|
||||||
|
ReplaceWith("PatcherConfig(apkFile, temporaryFilesPath, aaptBinaryPath?.let { File(it) }, frameworkFileDirectory)"),
|
||||||
|
)
|
||||||
|
constructor(
|
||||||
|
apkFile: File,
|
||||||
|
temporaryFilesPath: File = File("revanced-temporary-files"),
|
||||||
|
aaptBinaryPath: String? = null,
|
||||||
|
frameworkFileDirectory: String? = null,
|
||||||
|
) : this(apkFile, temporaryFilesPath, aaptBinaryPath?.let { File(it) }, frameworkFileDirectory)
|
||||||
|
|
||||||
private val logger = Logger.getLogger(PatcherConfig::class.java.name)
|
private val logger = Logger.getLogger(PatcherConfig::class.java.name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,8 +52,7 @@ class PatcherConfig(
|
|||||||
*/
|
*/
|
||||||
internal val resourceConfig =
|
internal val resourceConfig =
|
||||||
Config.getDefaultConfig().apply {
|
Config.getDefaultConfig().apply {
|
||||||
useAapt2 = true
|
aaptBinary = aaptBinaryPath
|
||||||
aaptPath = aaptBinaryPath ?: ""
|
|
||||||
frameworkDirectory = frameworkFileDirectory
|
frameworkDirectory = frameworkFileDirectory
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -5,6 +5,7 @@ import app.revanced.patcher.patch.Patch
|
|||||||
import app.revanced.patcher.patch.ResourcePatchContext
|
import app.revanced.patcher.patch.ResourcePatchContext
|
||||||
import brut.androlib.apk.ApkInfo
|
import brut.androlib.apk.ApkInfo
|
||||||
import brut.directory.ExtFile
|
import brut.directory.ExtFile
|
||||||
|
import java.io.Closeable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A context for the patcher containing the current state of the patcher.
|
* A context for the patcher containing the current state of the patcher.
|
||||||
@@ -12,7 +13,7 @@ import brut.directory.ExtFile
|
|||||||
* @param config The configuration for the patcher.
|
* @param config The configuration for the patcher.
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
class PatcherContext internal constructor(config: PatcherConfig) {
|
class PatcherContext internal constructor(config: PatcherConfig): Closeable {
|
||||||
/**
|
/**
|
||||||
* [PackageMetadata] of the supplied [PatcherConfig.apkFile].
|
* [PackageMetadata] of the supplied [PatcherConfig.apkFile].
|
||||||
*/
|
*/
|
||||||
@@ -37,4 +38,6 @@ class PatcherContext internal constructor(config: PatcherConfig) {
|
|||||||
* The context for patches containing the current state of the bytecode.
|
* The context for patches containing the current state of the bytecode.
|
||||||
*/
|
*/
|
||||||
internal val bytecodeContext = BytecodePatchContext(config)
|
internal val bytecodeContext = BytecodePatchContext(config)
|
||||||
|
|
||||||
|
override fun close() = bytecodeContext.close()
|
||||||
}
|
}
|
||||||
|
@@ -29,12 +29,12 @@ class PatcherResult internal constructor(
|
|||||||
* @param resourcesApk The compiled resources.apk file.
|
* @param resourcesApk The compiled resources.apk file.
|
||||||
* @param otherResources The directory containing other resources files.
|
* @param otherResources The directory containing other resources files.
|
||||||
* @param doNotCompress List of files that should not be compressed.
|
* @param doNotCompress List of files that should not be compressed.
|
||||||
* @param deleteResources List of predicates about resources that should be deleted.
|
* @param deleteResources List of resources that should be deleted.
|
||||||
*/
|
*/
|
||||||
class PatchedResources internal constructor(
|
class PatchedResources internal constructor(
|
||||||
val resourcesApk: File?,
|
val resourcesApk: File?,
|
||||||
val otherResources: File?,
|
val otherResources: File?,
|
||||||
val doNotCompress: Set<String>,
|
val doNotCompress: Set<String>,
|
||||||
val deleteResources: Set<(String) -> Boolean>,
|
val deleteResources: Set<String>,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@@ -14,6 +14,7 @@ import com.android.tools.smali.dexlib2.iface.ClassDef
|
|||||||
import com.android.tools.smali.dexlib2.iface.DexFile
|
import com.android.tools.smali.dexlib2.iface.DexFile
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||||
import lanchon.multidexlib2.BasicDexFileNamer
|
import lanchon.multidexlib2.BasicDexFileNamer
|
||||||
import lanchon.multidexlib2.DexIO
|
import lanchon.multidexlib2.DexIO
|
||||||
@@ -21,7 +22,6 @@ import lanchon.multidexlib2.MultiDexIO
|
|||||||
import lanchon.multidexlib2.RawDexIO
|
import lanchon.multidexlib2.RawDexIO
|
||||||
import java.io.Closeable
|
import java.io.Closeable
|
||||||
import java.io.FileFilter
|
import java.io.FileFilter
|
||||||
import java.io.InputStream
|
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.logging.Logger
|
import java.util.logging.Logger
|
||||||
|
|
||||||
@@ -31,8 +31,10 @@ import java.util.logging.Logger
|
|||||||
* @param config The [PatcherConfig] used to create this context.
|
* @param config The [PatcherConfig] used to create this context.
|
||||||
*/
|
*/
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
class BytecodePatchContext internal constructor(private val config: PatcherConfig) : PatchContext<Set<PatcherResult.PatchedDexFile>> {
|
class BytecodePatchContext internal constructor(private val config: PatcherConfig) :
|
||||||
private val logger = Logger.getLogger(BytecodePatchContext::class.java.name)
|
PatchContext<Set<PatcherResult.PatchedDexFile>>,
|
||||||
|
Closeable {
|
||||||
|
private val logger = Logger.getLogger(this::class.java.name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* [Opcodes] of the supplied [PatcherConfig.apkFile].
|
* [Opcodes] of the supplied [PatcherConfig.apkFile].
|
||||||
@@ -58,44 +60,37 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
internal val lookupMaps by lazy { LookupMaps(classes) }
|
internal val lookupMaps by lazy { LookupMaps(classes) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Merge an extension to [classes].
|
* Merge the extension of [bytecodePatch] into the [BytecodePatchContext].
|
||||||
|
* If no extension is present, the function will return early.
|
||||||
*
|
*
|
||||||
* @param extensionInputStream The input stream of the extension to merge.
|
* @param bytecodePatch The [BytecodePatch] to merge the extension of.
|
||||||
*/
|
*/
|
||||||
internal fun merge(extensionInputStream: InputStream) {
|
internal fun mergeExtension(bytecodePatch: BytecodePatch) {
|
||||||
val extension = extensionInputStream.readAllBytes()
|
bytecodePatch.extensionInputStream?.get()?.use { extensionStream ->
|
||||||
|
RawDexIO.readRawDexFile(extensionStream, 0, null).classes.forEach { classDef ->
|
||||||
|
val existingClass = lookupMaps.classesByType[classDef.type] ?: run {
|
||||||
|
logger.fine { "Adding class \"$classDef\"" }
|
||||||
|
|
||||||
RawDexIO.readRawDexFile(extension, 0, null).classes.forEach { classDef ->
|
classes += classDef
|
||||||
val existingClass = lookupMaps.classesByType[classDef.type] ?: run {
|
lookupMaps.classesByType[classDef.type] = classDef
|
||||||
logger.fine("Adding class \"$classDef\"")
|
|
||||||
|
|
||||||
lookupMaps.classesByType[classDef.type] = classDef
|
return@forEach
|
||||||
classes += classDef
|
|
||||||
|
|
||||||
return@forEach
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.fine("Class \"$classDef\" exists already. Adding missing methods and fields.")
|
|
||||||
|
|
||||||
existingClass.merge(classDef, this@BytecodePatchContext).let { mergedClass ->
|
|
||||||
// If the class was merged, replace the original class with the merged class.
|
|
||||||
if (mergedClass === existingClass) {
|
|
||||||
return@let
|
|
||||||
}
|
}
|
||||||
|
|
||||||
classes -= existingClass
|
logger.fine { "Class \"$classDef\" exists already. Adding missing methods and fields." }
|
||||||
classes += mergedClass
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
existingClass.merge(classDef, this@BytecodePatchContext).let { mergedClass ->
|
||||||
* Find a class by its type using a contains check.
|
// If the class was merged, replace the original class with the merged class.
|
||||||
*
|
if (mergedClass === existingClass) {
|
||||||
* @param type The type of the class.
|
return@let
|
||||||
* @return A proxy for the first class that matches the type.
|
}
|
||||||
*/
|
|
||||||
fun classByType(type: String) = classBy { type in it.type }
|
classes -= existingClass
|
||||||
|
classes += mergedClass
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} ?: logger.fine("No extension to merge")
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a class with a predicate.
|
* Find a class with a predicate.
|
||||||
@@ -113,9 +108,9 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
*
|
*
|
||||||
* @return A proxy for the class.
|
* @return A proxy for the class.
|
||||||
*/
|
*/
|
||||||
fun proxy(classDef: ClassDef) = this@BytecodePatchContext.classes.proxyPool.find {
|
fun proxy(classDef: ClassDef) = classes.proxyPool.find {
|
||||||
it.immutableClass.type == classDef.type
|
it.immutableClass.type == classDef.type
|
||||||
} ?: ClassProxy(classDef).also { this@BytecodePatchContext.classes.proxyPool.add(it) }
|
} ?: ClassProxy(classDef).also { classes.proxyPool.add(it) }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Navigate a method.
|
* Navigate a method.
|
||||||
@@ -124,7 +119,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
*
|
*
|
||||||
* @return A [MethodNavigator] for the method.
|
* @return A [MethodNavigator] for the method.
|
||||||
*/
|
*/
|
||||||
fun navigate(method: Method) = MethodNavigator(this@BytecodePatchContext, method)
|
fun navigate(method: MethodReference) = MethodNavigator(method)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile bytecode from the [BytecodePatchContext].
|
* Compile bytecode from the [BytecodePatchContext].
|
||||||
@@ -135,6 +130,9 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
override fun get(): Set<PatcherResult.PatchedDexFile> {
|
override fun get(): Set<PatcherResult.PatchedDexFile> {
|
||||||
logger.info("Compiling patched dex files")
|
logger.info("Compiling patched dex files")
|
||||||
|
|
||||||
|
// Free up memory before compiling the dex files.
|
||||||
|
lookupMaps.close()
|
||||||
|
|
||||||
val patchedDexFileResults =
|
val patchedDexFileResults =
|
||||||
config.patchedFiles.resolve("dex").also {
|
config.patchedFiles.resolve("dex").also {
|
||||||
it.deleteRecursively() // Make sure the directory is empty.
|
it.deleteRecursively() // Make sure the directory is empty.
|
||||||
@@ -142,7 +140,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
}.apply {
|
}.apply {
|
||||||
MultiDexIO.writeDexFile(
|
MultiDexIO.writeDexFile(
|
||||||
true,
|
true,
|
||||||
if (config.multithreadingDexFileWriter) -1 else 1,
|
-1,
|
||||||
this,
|
this,
|
||||||
BasicDexFileNamer(),
|
BasicDexFileNamer(),
|
||||||
object : DexFile {
|
object : DexFile {
|
||||||
@@ -152,7 +150,7 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
override fun getOpcodes() = this@BytecodePatchContext.opcodes
|
override fun getOpcodes() = this@BytecodePatchContext.opcodes
|
||||||
},
|
},
|
||||||
DexIO.DEFAULT_MAX_DEX_POOL_SIZE,
|
DexIO.DEFAULT_MAX_DEX_POOL_SIZE,
|
||||||
) { _, entryName, _ -> logger.info("Compiled $entryName") }
|
) { _, entryName, _ -> logger.info { "Compiled $entryName" } }
|
||||||
}.listFiles(FileFilter { it.isFile })!!.map {
|
}.listFiles(FileFilter { it.isFile })!!.map {
|
||||||
PatcherResult.PatchedDexFile(it.name, it.inputStream())
|
PatcherResult.PatchedDexFile(it.name, it.inputStream())
|
||||||
}.toSet()
|
}.toSet()
|
||||||
@@ -168,47 +166,21 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
* @param classes The list of classes to create the lookup maps from.
|
* @param classes The list of classes to create the lookup maps from.
|
||||||
*/
|
*/
|
||||||
internal class LookupMaps internal constructor(classes: List<ClassDef>) : Closeable {
|
internal class LookupMaps internal constructor(classes: List<ClassDef>) : Closeable {
|
||||||
/**
|
|
||||||
* Classes associated by their type.
|
|
||||||
*/
|
|
||||||
internal val classesByType = classes.associateBy { it.type }.toMutableMap()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* All methods and the class they are a member of.
|
|
||||||
*/
|
|
||||||
internal val allMethods = MethodClassPairs()
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Methods associated by its access flags, return type and parameter.
|
|
||||||
*/
|
|
||||||
internal val methodsBySignature = MethodClassPairsLookupMap()
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Methods associated by strings referenced in it.
|
* Methods associated by strings referenced in it.
|
||||||
*/
|
*/
|
||||||
internal val methodsByStrings = MethodClassPairsLookupMap()
|
internal val methodsByStrings = MethodClassPairsLookupMap()
|
||||||
|
|
||||||
|
// Lookup map for fast checking if a class exists by its type.
|
||||||
|
val classesByType = mutableMapOf<String, ClassDef>().apply {
|
||||||
|
classes.forEach { classDef -> put(classDef.type, classDef) }
|
||||||
|
}
|
||||||
|
|
||||||
init {
|
init {
|
||||||
classes.forEach { classDef ->
|
classes.forEach { classDef ->
|
||||||
classDef.methods.forEach { method ->
|
classDef.methods.forEach { method ->
|
||||||
val methodClassPair: MethodClassPair = method to classDef
|
val methodClassPair: MethodClassPair = method to classDef
|
||||||
|
|
||||||
// For fingerprints with no access or return type specified.
|
|
||||||
allMethods += methodClassPair
|
|
||||||
|
|
||||||
val accessFlagsReturnKey = method.accessFlags.toString() + method.returnType.first()
|
|
||||||
|
|
||||||
// Add <access><returnType> as the key.
|
|
||||||
methodsBySignature[accessFlagsReturnKey] = methodClassPair
|
|
||||||
|
|
||||||
// Add <access><returnType>[parameters] as the key.
|
|
||||||
methodsBySignature[
|
|
||||||
buildString {
|
|
||||||
append(accessFlagsReturnKey)
|
|
||||||
appendParameters(method.parameterTypes)
|
|
||||||
},
|
|
||||||
] = methodClassPair
|
|
||||||
|
|
||||||
// Add strings contained in the method as the key.
|
// Add strings contained in the method as the key.
|
||||||
method.instructionsOrNull?.forEach instructions@{ instruction ->
|
method.instructionsOrNull?.forEach instructions@{ instruction ->
|
||||||
if (instruction.opcode != Opcode.CONST_STRING && instruction.opcode != Opcode.CONST_STRING_JUMBO) {
|
if (instruction.opcode != Opcode.CONST_STRING && instruction.opcode != Opcode.CONST_STRING_JUMBO) {
|
||||||
@@ -226,34 +198,16 @@ class BytecodePatchContext internal constructor(private val config: PatcherConfi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
internal companion object {
|
|
||||||
/**
|
|
||||||
* Appends a string based on the parameter reference types of this method.
|
|
||||||
*/
|
|
||||||
internal fun StringBuilder.appendParameters(parameters: Iterable<CharSequence>) {
|
|
||||||
// Maximum parameters to use in the signature key.
|
|
||||||
// Some apps have methods with an incredible number of parameters (over 100 parameters have been seen).
|
|
||||||
// To keep the signature map from becoming needlessly bloated,
|
|
||||||
// group together in the same map entry all methods with the same access/return and 5 or more parameters.
|
|
||||||
// The value of 5 was chosen based on local performance testing and is not set in stone.
|
|
||||||
val maxSignatureParameters = 5
|
|
||||||
// Must append a unique value before the parameters to distinguish this key includes the parameters.
|
|
||||||
// If this is not appended, then methods with no parameters
|
|
||||||
// will collide with different keys that specify access/return but omit the parameters.
|
|
||||||
append("p:")
|
|
||||||
parameters.forEachIndexed { index, parameter ->
|
|
||||||
if (index >= maxSignatureParameters) return
|
|
||||||
append(parameter.first())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun close() {
|
override fun close() {
|
||||||
allMethods.clear()
|
|
||||||
methodsBySignature.clear()
|
|
||||||
methodsByStrings.clear()
|
methodsByStrings.clear()
|
||||||
|
classesByType.clear()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun close() {
|
||||||
|
lookupMaps.close()
|
||||||
|
classes.clear()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -10,9 +10,9 @@ import brut.androlib.ApkDecoder
|
|||||||
import brut.androlib.apk.UsesFramework
|
import brut.androlib.apk.UsesFramework
|
||||||
import brut.androlib.res.Framework
|
import brut.androlib.res.Framework
|
||||||
import brut.androlib.res.ResourcesDecoder
|
import brut.androlib.res.ResourcesDecoder
|
||||||
|
import brut.androlib.res.decoder.AndroidManifestPullStreamDecoder
|
||||||
import brut.androlib.res.decoder.AndroidManifestResourceParser
|
import brut.androlib.res.decoder.AndroidManifestResourceParser
|
||||||
import brut.androlib.res.decoder.XmlPullStreamDecoder
|
import brut.androlib.res.xml.ResXmlUtils
|
||||||
import brut.androlib.res.xml.ResXmlPatcher
|
|
||||||
import brut.directory.ExtFile
|
import brut.directory.ExtFile
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.io.OutputStream
|
import java.io.OutputStream
|
||||||
@@ -32,78 +32,81 @@ class ResourcePatchContext internal constructor(
|
|||||||
private val logger = Logger.getLogger(ResourcePatchContext::class.java.name)
|
private val logger = Logger.getLogger(ResourcePatchContext::class.java.name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read and write documents in the [PatcherConfig.apkFiles].
|
* Read a document from an [InputStream].
|
||||||
*/
|
*/
|
||||||
val document = DocumentOperatable()
|
fun document(inputStream: InputStream) = Document(inputStream)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Predicate to delete resources from [PatcherConfig.apkFiles].
|
* Read and write documents in the [PatcherConfig.apkFiles].
|
||||||
*/
|
*/
|
||||||
private val deleteResources = mutableSetOf<(String) -> Boolean>()
|
fun document(path: String) = Document(get(path))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set of resources from [PatcherConfig.apkFiles] to delete.
|
||||||
|
*/
|
||||||
|
private val deleteResources = mutableSetOf<String>()
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decode resources of [PatcherConfig.apkFile].
|
* Decode resources of [PatcherConfig.apkFile].
|
||||||
*
|
*
|
||||||
* @param mode The [ResourceMode] to use.
|
* @param mode The [ResourceMode] to use.
|
||||||
*/
|
*/
|
||||||
internal fun decodeResources(mode: ResourceMode) =
|
internal fun decodeResources(mode: ResourceMode) = with(packageMetadata.apkInfo) {
|
||||||
with(packageMetadata.apkInfo) {
|
config.initializeTemporaryFilesDirectories()
|
||||||
config.initializeTemporaryFilesDirectories()
|
|
||||||
|
|
||||||
// Needed to decode resources.
|
// Needed to decode resources.
|
||||||
val resourcesDecoder = ResourcesDecoder(config.resourceConfig, this)
|
val resourcesDecoder = ResourcesDecoder(config.resourceConfig, this)
|
||||||
|
|
||||||
if (mode == ResourceMode.FULL) {
|
if (mode == ResourceMode.FULL) {
|
||||||
logger.info("Decoding resources")
|
logger.info("Decoding resources")
|
||||||
|
|
||||||
resourcesDecoder.decodeResources(config.apkFiles)
|
resourcesDecoder.decodeResources(config.apkFiles)
|
||||||
resourcesDecoder.decodeManifest(config.apkFiles)
|
resourcesDecoder.decodeManifest(config.apkFiles)
|
||||||
|
|
||||||
// Needed to record uncompressed files.
|
// Needed to record uncompressed files.
|
||||||
val apkDecoder = ApkDecoder(config.resourceConfig, this)
|
ApkDecoder(this, config.resourceConfig).recordUncompressedFiles(resourcesDecoder.resFileMapping)
|
||||||
apkDecoder.recordUncompressedFiles(resourcesDecoder.resFileMapping)
|
|
||||||
|
|
||||||
usesFramework =
|
usesFramework =
|
||||||
UsesFramework().apply {
|
UsesFramework().apply {
|
||||||
ids = resourcesDecoder.resTable.listFramePackages().map { it.id }
|
ids = resourcesDecoder.resTable.listFramePackages().map { it.id }
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logger.info("Decoding app manifest")
|
|
||||||
|
|
||||||
// Decode manually instead of using resourceDecoder.decodeManifest
|
|
||||||
// because it does not support decoding to an OutputStream.
|
|
||||||
XmlPullStreamDecoder(
|
|
||||||
AndroidManifestResourceParser(resourcesDecoder.resTable),
|
|
||||||
resourcesDecoder.resXmlSerializer,
|
|
||||||
).decodeManifest(
|
|
||||||
apkFile.directory.getFileInput("AndroidManifest.xml"),
|
|
||||||
// Older Android versions do not support OutputStream.nullOutputStream()
|
|
||||||
object : OutputStream() {
|
|
||||||
override fun write(b: Int) { // Do nothing.
|
|
||||||
}
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// Get the package name and version from the manifest using the XmlPullStreamDecoder.
|
|
||||||
// XmlPullStreamDecoder.decodeManifest() sets metadata.apkInfo.
|
|
||||||
packageMetadata.let { metadata ->
|
|
||||||
metadata.packageName = resourcesDecoder.resTable.packageRenamed
|
|
||||||
versionInfo.let {
|
|
||||||
metadata.packageVersion = it.versionName ?: it.versionCode
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
The ResTable if flagged as sparse if the main package is not loaded, which is the case here,
|
|
||||||
because ResourcesDecoder.decodeResources loads the main package
|
|
||||||
and not XmlPullStreamDecoder.decodeManifest.
|
|
||||||
See ARSCDecoder.readTableType for more info.
|
|
||||||
|
|
||||||
Set this to false again to prevent the ResTable from being flagged as sparse falsely.
|
|
||||||
*/
|
|
||||||
metadata.apkInfo.sparseResources = false
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
logger.info("Decoding app manifest")
|
||||||
|
|
||||||
|
// Decode manually instead of using resourceDecoder.decodeManifest
|
||||||
|
// because it does not support decoding to an OutputStream.
|
||||||
|
AndroidManifestPullStreamDecoder(
|
||||||
|
AndroidManifestResourceParser(resourcesDecoder.resTable),
|
||||||
|
resourcesDecoder.newXmlSerializer(),
|
||||||
|
).decode(
|
||||||
|
apkFile.directory.getFileInput("AndroidManifest.xml"),
|
||||||
|
// Older Android versions do not support OutputStream.nullOutputStream()
|
||||||
|
object : OutputStream() {
|
||||||
|
override fun write(b: Int) { // Do nothing.
|
||||||
|
}
|
||||||
|
},
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get the package name and version from the manifest using the XmlPullStreamDecoder.
|
||||||
|
// AndroidManifestPullStreamDecoder.decode() sets metadata.apkInfo.
|
||||||
|
packageMetadata.let { metadata ->
|
||||||
|
metadata.packageName = resourcesDecoder.resTable.packageRenamed
|
||||||
|
versionInfo.let {
|
||||||
|
metadata.packageVersion = it.versionName ?: it.versionCode
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
The ResTable if flagged as sparse if the main package is not loaded, which is the case here,
|
||||||
|
because ResourcesDecoder.decodeResources loads the main package
|
||||||
|
and not AndroidManifestPullStreamDecoder.decode.
|
||||||
|
See ARSCDecoder.readTableType for more info.
|
||||||
|
|
||||||
|
Set this to false again to prevent the ResTable from being flagged as sparse falsely.
|
||||||
|
*/
|
||||||
|
metadata.apkInfo.sparseResources = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compile resources in [PatcherConfig.apkFiles].
|
* Compile resources in [PatcherConfig.apkFiles].
|
||||||
@@ -125,10 +128,10 @@ class ResourcePatchContext internal constructor(
|
|||||||
AaptInvoker(
|
AaptInvoker(
|
||||||
config.resourceConfig,
|
config.resourceConfig,
|
||||||
packageMetadata.apkInfo,
|
packageMetadata.apkInfo,
|
||||||
).invokeAapt(
|
).invoke(
|
||||||
resources.resolve("resources.apk"),
|
resources.resolve("resources.apk"),
|
||||||
config.apkFiles.resolve("AndroidManifest.xml").also {
|
config.apkFiles.resolve("AndroidManifest.xml").also {
|
||||||
ResXmlPatcher.fixingPublicAttrsInProviderAttributes(it)
|
ResXmlUtils.fixingPublicAttrsInProviderAttributes(it)
|
||||||
},
|
},
|
||||||
config.apkFiles.resolve("res"),
|
config.apkFiles.resolve("res"),
|
||||||
null,
|
null,
|
||||||
@@ -201,11 +204,11 @@ class ResourcePatchContext internal constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stage a file to be deleted from [PatcherConfig.apkFile].
|
* Mark a file for deletion when the APK is rebuilt.
|
||||||
*
|
*
|
||||||
* @param shouldDelete The predicate to stage the file for deletion given its name.
|
* @param name The name of the file to delete.
|
||||||
*/
|
*/
|
||||||
fun stageDelete(shouldDelete: (String) -> Boolean) = deleteResources.add(shouldDelete)
|
fun delete(name: String) = deleteResources.add(name)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* How to handle resources decoding and compiling.
|
* How to handle resources decoding and compiling.
|
||||||
@@ -227,10 +230,4 @@ class ResourcePatchContext internal constructor(
|
|||||||
*/
|
*/
|
||||||
NONE,
|
NONE,
|
||||||
}
|
}
|
||||||
|
|
||||||
inner class DocumentOperatable {
|
|
||||||
operator fun get(inputStream: InputStream) = Document(inputStream)
|
|
||||||
|
|
||||||
operator fun get(path: String) = Document(this@ResourcePatchContext[path])
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -60,7 +60,7 @@ internal object ClassMerger {
|
|||||||
|
|
||||||
if (missingMethods.isEmpty()) return this
|
if (missingMethods.isEmpty()) return this
|
||||||
|
|
||||||
logger.fine("Found ${missingMethods.size} missing methods")
|
logger.fine { "Found ${missingMethods.size} missing methods" }
|
||||||
|
|
||||||
return asMutableClass().apply {
|
return asMutableClass().apply {
|
||||||
methods.addAll(missingMethods.map { it.toMutable() })
|
methods.addAll(missingMethods.map { it.toMutable() })
|
||||||
@@ -80,7 +80,7 @@ internal object ClassMerger {
|
|||||||
|
|
||||||
if (missingFields.isEmpty()) return this
|
if (missingFields.isEmpty()) return this
|
||||||
|
|
||||||
logger.fine("Found ${missingFields.size} missing fields")
|
logger.fine { "Found ${missingFields.size} missing fields" }
|
||||||
|
|
||||||
return asMutableClass().apply {
|
return asMutableClass().apply {
|
||||||
fields.addAll(missingFields.map { it.toMutable() })
|
fields.addAll(missingFields.map { it.toMutable() })
|
||||||
@@ -100,7 +100,7 @@ internal object ClassMerger {
|
|||||||
context.traverseClassHierarchy(this) {
|
context.traverseClassHierarchy(this) {
|
||||||
if (accessFlags.isPublic()) return@traverseClassHierarchy
|
if (accessFlags.isPublic()) return@traverseClassHierarchy
|
||||||
|
|
||||||
logger.fine("Publicizing ${this.type}")
|
logger.fine { "Publicizing ${this.type}" }
|
||||||
|
|
||||||
accessFlags = accessFlags.toPublic()
|
accessFlags = accessFlags.toPublic()
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ internal object ClassMerger {
|
|||||||
|
|
||||||
if (brokenFields.isEmpty()) return this
|
if (brokenFields.isEmpty()) return this
|
||||||
|
|
||||||
logger.fine("Found ${brokenFields.size} broken fields")
|
logger.fine { "Found ${brokenFields.size} broken fields" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a field public.
|
* Make a field public.
|
||||||
@@ -153,7 +153,7 @@ internal object ClassMerger {
|
|||||||
|
|
||||||
if (brokenMethods.isEmpty()) return this
|
if (brokenMethods.isEmpty()) return this
|
||||||
|
|
||||||
logger.fine("Found ${brokenMethods.size} methods")
|
logger.fine { "Found ${brokenMethods.size} methods" }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Make a method public.
|
* Make a method public.
|
||||||
@@ -179,7 +179,9 @@ internal object ClassMerger {
|
|||||||
callback: MutableClass.() -> Unit,
|
callback: MutableClass.() -> Unit,
|
||||||
) {
|
) {
|
||||||
callback(targetClass)
|
callback(targetClass)
|
||||||
this.classByType(targetClass.superclass ?: return)?.mutableClass?.let {
|
|
||||||
|
targetClass.superclass ?: return
|
||||||
|
this.classBy { targetClass.superclass == it.type }?.mutableClass?.let {
|
||||||
traverseClassHierarchy(it, callback)
|
traverseClassHierarchy(it, callback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,7 @@ import java.io.Closeable
|
|||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import javax.xml.parsers.DocumentBuilderFactory
|
import javax.xml.parsers.DocumentBuilderFactory
|
||||||
|
import javax.xml.transform.OutputKeys
|
||||||
import javax.xml.transform.TransformerFactory
|
import javax.xml.transform.TransformerFactory
|
||||||
import javax.xml.transform.dom.DOMSource
|
import javax.xml.transform.dom.DOMSource
|
||||||
import javax.xml.transform.stream.StreamResult
|
import javax.xml.transform.stream.StreamResult
|
||||||
@@ -34,15 +35,22 @@ class Document internal constructor(
|
|||||||
readerCount.remove(it)
|
readerCount.remove(it)
|
||||||
}
|
}
|
||||||
|
|
||||||
it.outputStream().use { stream ->
|
val transformer = TransformerFactory.newInstance().newTransformer()
|
||||||
TransformerFactory.newInstance()
|
// Set to UTF-16 to prevent surrogate pairs from being escaped to invalid numeric character references, but save as UTF-8.
|
||||||
.newTransformer()
|
if (isAndroid) {
|
||||||
.transform(DOMSource(this), StreamResult(stream))
|
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-16")
|
||||||
|
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes")
|
||||||
|
it.bufferedWriter(charset = Charsets.UTF_8).use { writer ->
|
||||||
|
transformer.transform(DOMSource(this), StreamResult(writer))
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
transformer.transform(DOMSource(this), StreamResult(it))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private companion object {
|
private companion object {
|
||||||
private val readerCount = mutableMapOf<File, Int>()
|
private val readerCount = mutableMapOf<File, Int>()
|
||||||
|
private val isAndroid = System.getProperty("java.runtime.name") == "Android Runtime"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user