mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-07 18:03:55 +01:00
Compare commits
319 Commits
v3.0.0-dev
...
v4.8.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6768f98dd7 | ||
|
|
0d63b137aa | ||
|
|
a6d2cf5a93 | ||
|
|
fe461c1d14 | ||
|
|
6b33cd2d8f | ||
|
|
c727c6f19d | ||
|
|
49db0cee1b | ||
|
|
531955a111 | ||
|
|
e53cc9bba9 | ||
|
|
fc43dd709f | ||
|
|
3a018ff002 | ||
|
|
86f11480e7 | ||
|
|
0190d5a5c9 | ||
|
|
50735fabbc | ||
|
|
653631703c | ||
|
|
2587508944 | ||
|
|
533f9a964d | ||
|
|
fb0b3bd673 | ||
|
|
96e17cf4de | ||
|
|
a7bd0b111e | ||
|
|
7ecd992def | ||
|
|
217d3c69ba | ||
|
|
e329e1dd1a | ||
|
|
6a8b669ba2 | ||
|
|
6fd46ad9b6 | ||
|
|
50ddb680ed | ||
|
|
cc7f79d903 | ||
|
|
57274b5435 | ||
|
|
8295b7a22e | ||
|
|
366f754a6a | ||
|
|
c272333adb | ||
|
|
ef6c00a520 | ||
|
|
58ce37b0d3 | ||
|
|
4b7e12f995 | ||
|
|
2e59965bb5 | ||
|
|
426f405407 | ||
|
|
f85f518fc9 | ||
|
|
f3972d313f | ||
|
|
04a72d52de | ||
|
|
be76e49a8b | ||
|
|
fa1c616014 | ||
|
|
e97aaf4aae | ||
|
|
92c90ec208 | ||
|
|
b4e8beb8ec | ||
|
|
f2fe0d5c6f | ||
|
|
3d3197701c | ||
|
|
1ac612798b | ||
|
|
e1ed1aee69 | ||
|
|
795ccac990 | ||
|
|
da55410a2b | ||
|
|
e7983411a7 | ||
|
|
182748cb16 | ||
|
|
122f04219f | ||
|
|
80763bcef6 | ||
|
|
b80bb8969c | ||
|
|
2a86a670f0 | ||
|
|
dba37b834d | ||
|
|
3ad4eb8dbc | ||
|
|
0e88306f3f | ||
|
|
87cb63f2e7 | ||
|
|
0fead38701 | ||
|
|
19a31019c2 | ||
|
|
61758414c2 | ||
|
|
b4ee8b6da4 | ||
|
|
e86e3d88cf | ||
|
|
8cf444962c | ||
|
|
48bf632dbe | ||
|
|
03e91d4251 | ||
|
|
8caf70719e | ||
|
|
2f28e95252 | ||
|
|
d819e7bbe9 | ||
|
|
fef5f35788 | ||
|
|
80034bc70a | ||
|
|
c40911a815 | ||
|
|
1a53a93cd2 | ||
|
|
2e68c65c9f | ||
|
|
6f8d92827b | ||
|
|
ab2260acfd | ||
|
|
9b3c060acb | ||
|
|
bbc4a6bfa0 | ||
|
|
4df9b9d5b1 | ||
|
|
eebf72f476 | ||
|
|
a27296223f | ||
|
|
77a9a56e2d | ||
|
|
3df3441385 | ||
|
|
86def3efea | ||
|
|
bc9a612824 | ||
|
|
f378ddc6d5 | ||
|
|
7f852e8f32 | ||
|
|
5b7b134d73 | ||
|
|
df9361ea2b | ||
|
|
8c226c4bdc | ||
|
|
c87f8a376d | ||
|
|
cb4b6514db | ||
|
|
5a172c9deb | ||
|
|
a9f418a19f | ||
|
|
5b0360c067 | ||
|
|
069f26de20 | ||
|
|
46ff5b8b92 | ||
|
|
69721509bf | ||
|
|
0bd0c827a4 | ||
|
|
cbae1383ca | ||
|
|
2679fad25f | ||
|
|
08c4468ff1 | ||
|
|
7c981f6759 | ||
|
|
2fcd786cc7 | ||
|
|
60ace80cbd | ||
|
|
e6a468cf7a | ||
|
|
38392de4a1 | ||
|
|
bc8bc8c798 | ||
|
|
76805e4f31 | ||
|
|
d18719c59c | ||
|
|
743a02f983 | ||
|
|
8306f70fd1 | ||
|
|
5d71f23471 | ||
|
|
122ef68a4b | ||
|
|
b2a7a65bc0 | ||
|
|
32139f151b | ||
|
|
e55364ca87 | ||
|
|
5cca42121a | ||
|
|
7b0365360e | ||
|
|
7f8b7c08b2 | ||
|
|
058acff28c | ||
|
|
060b2c2323 | ||
|
|
bcce7bee9a | ||
|
|
d3f83230f8 | ||
|
|
0ad377bb4c | ||
|
|
9917ddd9c1 | ||
|
|
951ebc54ca | ||
|
|
3b4b21ff2e | ||
|
|
2f2ad3e584 | ||
|
|
f9ae1a46d2 | ||
|
|
e386313deb | ||
|
|
f2edae2ac1 | ||
|
|
c153979981 | ||
|
|
2fe9060944 | ||
|
|
212a94cbb3 | ||
|
|
16eee2f03f | ||
|
|
4937fa5fbd | ||
|
|
a6f5dd933f | ||
|
|
97c4682ccc | ||
|
|
6742cd9232 | ||
|
|
5b2cc10adb | ||
|
|
dbad6252fb | ||
|
|
0f7ed841d1 | ||
|
|
d33d7d8f35 | ||
|
|
3200da8657 | ||
|
|
348e42a374 | ||
|
|
cbbac445b6 | ||
|
|
1593d1352a | ||
|
|
c6fedaa7bc | ||
|
|
d070aebec4 | ||
|
|
d583256f06 | ||
|
|
fc67d284f7 | ||
|
|
d3f3f81b75 | ||
|
|
8e8600c7c3 | ||
|
|
ea33863083 | ||
|
|
a6d8e4210f | ||
|
|
1e3356808d | ||
|
|
43359b95eb | ||
|
|
afe7f0605e | ||
|
|
8916789f7a | ||
|
|
0d14aa1191 | ||
|
|
376dda6e81 | ||
|
|
ff8b58b645 | ||
|
|
f4b888be56 | ||
|
|
e775bc2cae | ||
|
|
5c566753a8 | ||
|
|
968ebf9f50 | ||
|
|
75c510d876 | ||
|
|
72528cb2f1 | ||
|
|
81d79111cf | ||
|
|
33036092b4 | ||
|
|
f5f88092b6 | ||
|
|
0434d8812b | ||
|
|
ec38b8e51c | ||
|
|
96f9b73c74 | ||
|
|
1502fe1f7f | ||
|
|
824d094394 | ||
|
|
010471a745 | ||
|
|
3343b5cb12 | ||
|
|
1bf9582437 | ||
|
|
ea09d4b520 | ||
|
|
53b29ea270 | ||
|
|
fd11e2b969 | ||
|
|
65a32ee52e | ||
|
|
7b2e32d88c | ||
|
|
f18edb262d | ||
|
|
8b1cdd5c6a | ||
|
|
3bd41fb67f | ||
|
|
19a9d113d9 | ||
|
|
61ee51b856 | ||
|
|
2c50c25a36 | ||
|
|
f5e7bf6e98 | ||
|
|
bba35d5cb5 | ||
|
|
1be4f4cf55 | ||
|
|
047069ca8a | ||
|
|
7bfdd8bc59 | ||
|
|
b8cb735291 | ||
|
|
c86f0a249f | ||
|
|
663acf0bc5 | ||
|
|
6f92659277 | ||
|
|
7cb8af6a16 | ||
|
|
bbed64fd4b | ||
|
|
acee384a90 | ||
|
|
1d7d31e979 | ||
|
|
781b8e2d40 | ||
|
|
6ecf53fd8f | ||
|
|
8c2f895e52 | ||
|
|
ec3371ffb5 | ||
|
|
44e36fead6 | ||
|
|
3b0ecdd7a7 | ||
|
|
279ac0dc28 | ||
|
|
31824713d7 | ||
|
|
be6a35fde6 | ||
|
|
d28d9f13bc | ||
|
|
2295ce5e9d | ||
|
|
55fb1ebd9d | ||
|
|
15a83a6d28 | ||
|
|
9ea58bf185 | ||
|
|
11d6eca36e | ||
|
|
eac360ee7c | ||
|
|
9acf15f571 | ||
|
|
126fe48ce6 | ||
|
|
32d2037083 | ||
|
|
aca1dd6074 | ||
|
|
30c6749f61 | ||
|
|
08c30791ae | ||
|
|
002f11a854 | ||
|
|
861e9a399e | ||
|
|
795aee13e4 | ||
|
|
09f29e6119 | ||
|
|
784aa2f246 | ||
|
|
4ddd5a0b8f | ||
|
|
1482e7e1e8 | ||
|
|
806e94481c | ||
|
|
edcb6eac6d | ||
|
|
4dced95d54 | ||
|
|
62c9085096 | ||
|
|
50a9f09703 | ||
|
|
9633b4eef0 | ||
|
|
2a94ad681c | ||
|
|
9e79e9e72c | ||
|
|
429badef1a | ||
|
|
138b2f8960 | ||
|
|
60d70e5877 | ||
|
|
2debdc1056 | ||
|
|
ad1ea4661f | ||
|
|
eac46ca216 | ||
|
|
14e2c07329 | ||
|
|
9175e50f5d | ||
|
|
2318c0811f | ||
|
|
bc44eb710d | ||
|
|
4bb86f9ec6 | ||
|
|
387ceef6cd | ||
|
|
5ba59261f2 | ||
|
|
a89ab13949 | ||
|
|
ef3932c8e6 | ||
|
|
9d3dd4d50a | ||
|
|
1ecb6b2a6c | ||
|
|
21136d76cd | ||
|
|
c4b3d0fde0 | ||
|
|
9148bdfd1c | ||
|
|
e2b2b7424b | ||
|
|
b12a14c4d0 | ||
|
|
44082095ba | ||
|
|
987e4e7e91 | ||
|
|
4fd77b130a | ||
|
|
47aa56a06e | ||
|
|
47f2de4bc8 | ||
|
|
36b929c3b3 | ||
|
|
7109d8e088 | ||
|
|
c91df0f29c | ||
|
|
2c83b86297 | ||
|
|
5ceda29fce | ||
|
|
fcacd0f30d | ||
|
|
4f0c756b36 | ||
|
|
8ad9d7dedd | ||
|
|
b81c99920b | ||
|
|
cfb23652e1 | ||
|
|
26565fdb91 | ||
|
|
5a14b17338 | ||
|
|
b9ee4625b6 | ||
|
|
7a98270e4a | ||
|
|
5633048550 | ||
|
|
49c5e16c2e | ||
|
|
a46f9ddd2d | ||
|
|
40684cd1fe | ||
|
|
0f829ed747 | ||
|
|
c10956ba14 | ||
|
|
36fc818f90 | ||
|
|
3ae2dbaad7 | ||
|
|
9c843cbf6e | ||
|
|
7387323de5 | ||
|
|
22f32865a2 | ||
|
|
5f8b96466f | ||
|
|
42ae7b3f2a | ||
|
|
7b56550a0a | ||
|
|
e6766c3a5f | ||
|
|
e840d03d63 | ||
|
|
37c461f5c7 | ||
|
|
6202072061 | ||
|
|
f03e57b112 | ||
|
|
e2e0efd7ae | ||
|
|
a4a4822ed8 | ||
|
|
6b35561394 | ||
|
|
19f74bcdb1 | ||
|
|
dbe123c93c | ||
|
|
693d8a0f56 | ||
|
|
6a03c1f8c3 | ||
|
|
e820724111 | ||
|
|
ba58edbd7f | ||
|
|
a6d7c633f5 | ||
|
|
17f44ca780 | ||
|
|
3bd66406cc | ||
|
|
536b354fd6 | ||
|
|
e6a1573c59 | ||
|
|
d63288cc3e | ||
|
|
aaad91333f |
3
.editorconfig
Normal file
3
.editorconfig
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[*.{kt,kts}]
|
||||||
|
ktlint_code_style = intellij_idea
|
||||||
|
ktlint_standard_no-wildcard-imports = disabled
|
||||||
@@ -71,7 +71,7 @@ body:
|
|||||||
Before creating a new feature request, please keep the following in mind:
|
Before creating a new feature request, please keep the following in mind:
|
||||||
|
|
||||||
- **Do not submit a duplicate feature request**: You can review existing feature requests [here](https://github.com/ReVanced/revanced-patches/labels/Feature%20request).
|
- **Do not submit a duplicate feature request**: You can review existing feature requests [here](https://github.com/ReVanced/revanced-patches/labels/Feature%20request).
|
||||||
- **Review the contribution guidelines**: Make sure your bug report adheres to it. You can find the guidelines [here](https://github.com/ReVanced/revanced-patches/blob/main/CONTRIBUTING.md).
|
- **Review the contribution guidelines**: Make sure your feature request adheres to it. You can find the guidelines [here](https://github.com/ReVanced/revanced-patches/blob/main/CONTRIBUTING.md).
|
||||||
- **Do not use the issue page for support**: If you need help or have questions, check out other platforms on [revanced.app](https://revanced.app).
|
- **Do not use the issue page for support**: If you need help or have questions, check out other platforms on [revanced.app](https://revanced.app).
|
||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
22
.github/dependabot.yml
vendored
Normal file
22
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: github-actions
|
||||||
|
labels: []
|
||||||
|
directory: /
|
||||||
|
target-branch: dev
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
|
||||||
|
- package-ecosystem: npm
|
||||||
|
labels: []
|
||||||
|
directory: /
|
||||||
|
target-branch: dev
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
|
|
||||||
|
- package-ecosystem: gradle
|
||||||
|
labels: []
|
||||||
|
directory: /
|
||||||
|
target-branch: dev
|
||||||
|
schedule:
|
||||||
|
interval: monthly
|
||||||
25
.github/workflows/build_pull_request.yml
vendored
Normal file
25
.github/workflows/build_pull_request.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Build pull request
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- dev
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Cache Gradle
|
||||||
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
run: ./gradlew build --no-daemon
|
||||||
34
.github/workflows/pull_strings.yml
vendored
Normal file
34
.github/workflows/pull_strings.yml
vendored
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
name: Pull strings
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: 0 0 1 * *
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
pull:
|
||||||
|
name: Pull strings
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Pull strings
|
||||||
|
uses: crowdin/github-action@v1
|
||||||
|
with:
|
||||||
|
config: crowdin.yml
|
||||||
|
download_translations: true
|
||||||
|
localization_branch_name: feat/translations
|
||||||
|
create_pull_request: true
|
||||||
|
pull_request_title: "chore: Sync translations"
|
||||||
|
pull_request_body: "Sync translations from [crowdin.com/project/revanced](https://crowdin.com/project/revanced)"
|
||||||
|
pull_request_base_branch_name: "dev"
|
||||||
|
commit_message: "chore: Sync translations"
|
||||||
|
github_user_name: revanced-bot
|
||||||
|
github_user_email: github@revanced.app
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||||
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||||
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||||
27
.github/workflows/push_strings.yml
vendored
Normal file
27
.github/workflows/push_strings.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
name: Push strings
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
push:
|
||||||
|
paths:
|
||||||
|
- /src/main/resources/addresources/values/strings.xml
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
push:
|
||||||
|
name: Push strings
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Push strings
|
||||||
|
uses: crowdin/github-action@v1
|
||||||
|
with:
|
||||||
|
config: crowdin.yml
|
||||||
|
upload_sources: true
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||||
|
CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }}
|
||||||
|
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }}
|
||||||
28
.github/workflows/release.yml
vendored
28
.github/workflows/release.yml
vendored
@@ -6,10 +6,6 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- dev
|
- dev
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
@@ -24,24 +20,30 @@ jobs:
|
|||||||
persist-credentials: false
|
persist-credentials: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Cache Node modules
|
|
||||||
uses: actions/cache@v3
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
node_modules
|
|
||||||
key: npm-${{ hashFiles('package-lock.json') }}
|
|
||||||
|
|
||||||
- name: Cache Gradle
|
- name: Cache Gradle
|
||||||
uses: burrunan/gradle-cache-action@v1
|
uses: burrunan/gradle-cache-action@v1
|
||||||
|
|
||||||
- name: Build with Gradle
|
- name: Build
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
run: ./gradlew generateMeta clean
|
run: ./gradlew generateMeta clean
|
||||||
|
|
||||||
- name: Setup semantic-release
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: "lts/*"
|
||||||
|
cache: 'npm'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
run: npm install
|
run: npm install
|
||||||
|
|
||||||
|
- name: Import GPG key
|
||||||
|
uses: crazy-max/ghaction-import-gpg@v6
|
||||||
|
with:
|
||||||
|
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
|
||||||
|
passphrase: ${{ secrets.GPG_PASSPHRASE }}
|
||||||
|
fingerprint: ${{ env.GPG_FINGERPRINT }}
|
||||||
|
|
||||||
- name: Release
|
- name: Release
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
GITHUB_TOKEN: ${{ secrets.REPOSITORY_PUSH_ACCESS }}
|
||||||
|
|||||||
18
.github/workflows/update-gradle-wrapper.yml
vendored
Normal file
18
.github/workflows/update-gradle-wrapper.yml
vendored
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
name: Update Gradle wrapper
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 0 1 * *"
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Update Gradle Wrapper
|
||||||
|
uses: gradle-update/update-gradle-wrapper-action@v1
|
||||||
|
with:
|
||||||
|
target-branch: dev
|
||||||
@@ -33,7 +33,7 @@
|
|||||||
{
|
{
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"path": "build/libs/*.jar"
|
"path": "build/libs/revanced-patches*"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "patches.json"
|
"path": "patches.json"
|
||||||
|
|||||||
1062
CHANGELOG.md
1062
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -64,15 +64,15 @@ This document describes how to contribute to ReVanced Patches.
|
|||||||
|
|
||||||
## 📖 Resources to help you get started
|
## 📖 Resources to help you get started
|
||||||
|
|
||||||
* The [documentation](https://github.com/ReVanced/revanced-patches/tree/docs/docs) provides the fundamentals of patches
|
* The [documentation](https://github.com/ReVanced/revanced-patcher/tree/docs/docs) contains the fundamentals
|
||||||
and everything necessary to create your own patch from scratch
|
of ReVanced Patcher and how to use ReVanced Patcher to create patches
|
||||||
* [Our backlog](https://github.com/orgs/ReVanced/projects/12) is where we keep track of what we're working on
|
* [Our backlog](https://github.com/orgs/ReVanced/projects/12) is where we keep track of what we're working on
|
||||||
* [Issues](https://github.com/ReVanced/revanced-patches/issues) are where we keep track of bugs and feature requests
|
* [Issues](https://github.com/ReVanced/revanced-patches/issues) are where we keep track of bugs and feature requests
|
||||||
|
|
||||||
## 🙏 Submitting a feature request
|
## 🙏 Submitting a feature request
|
||||||
|
|
||||||
Features can be requested by opening an issue using the
|
Features can be requested by opening an issue using the
|
||||||
[Feature request issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Feature+request&projects=&template=feature-request.yml&title=feat%3A+).
|
[Feature request issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Feature+request&projects=&template=feature_request.yml&title=feat%3A+).
|
||||||
|
|
||||||
> **Note**
|
> **Note**
|
||||||
> Requests can be accepted or rejected at the discretion of maintainers of ReVanced Patches.
|
> Requests can be accepted or rejected at the discretion of maintainers of ReVanced Patches.
|
||||||
@@ -81,7 +81,7 @@ Features can be requested by opening an issue using the
|
|||||||
## 🐞 Submitting a bug report
|
## 🐞 Submitting a bug report
|
||||||
|
|
||||||
If you encounter a bug while using ReVanced Patches, open an issue using the
|
If you encounter a bug while using ReVanced Patches, open an issue using the
|
||||||
[Bug report issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Bug+report&projects=&template=bug-report.yml&title=bug%3A+).
|
[Bug report issue template](https://github.com/ReVanced/revanced-patches/issues/new?assignees=&labels=Bug+report&projects=&template=bug_report.yml&title=bug%3A+).
|
||||||
|
|
||||||
## 🧑⚖️ Guidelines for requesting or contributing patches
|
## 🧑⚖️ Guidelines for requesting or contributing patches
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ are unaffected by this change.
|
|||||||
|
|
||||||
## 📝 How to contribute
|
## 📝 How to contribute
|
||||||
|
|
||||||
1. Before contributing, it is recommended to open an issue to discuss your change
|
1. Before contributing, it is recommended to open an issue to discuss your change
|
||||||
with the maintainers of ReVanced Patches. This will help you determine whether your change is acceptable
|
with the maintainers of ReVanced Patches. This will help you determine whether your change is acceptable
|
||||||
and whether it is worth your time to implement it
|
and whether it is worth your time to implement it
|
||||||
2. Development happens on the `dev` branch. Fork the repository and create your branch from `dev`
|
2. Development happens on the `dev` branch. Fork the repository and create your branch from `dev`
|
||||||
|
|||||||
22
README.md
22
README.md
@@ -67,7 +67,7 @@ This repository contains a collection of ReVanced Patches.
|
|||||||
|
|
||||||
## ❓ About
|
## ❓ About
|
||||||
|
|
||||||
Patches are small modifications to Android apps that allow you to change the behaviour of or add new features,
|
Patches are small modifications to Android apps that allow you to change the behavior of or add new features,
|
||||||
block ads, customize the appearance, and much more.
|
block ads, customize the appearance, and much more.
|
||||||
|
|
||||||
## 💪 Features
|
## 💪 Features
|
||||||
@@ -77,11 +77,11 @@ Some of the features the patches provide are:
|
|||||||
* 🚫 **Block ads**: Say goodbye to ads
|
* 🚫 **Block ads**: Say goodbye to ads
|
||||||
* ⭐ **Customize your app**: Personalize the appearance of apps with various layouts and themes
|
* ⭐ **Customize your app**: Personalize the appearance of apps with various layouts and themes
|
||||||
* 🪄 **Add new features**: Extend the functionality of apps with lots of new features
|
* 🪄 **Add new features**: Extend the functionality of apps with lots of new features
|
||||||
* ⚙️ **Miscellaneous and general purpose**: Rename packages, enable debugging, disable screen capture restrictions,
|
* ⚙️ **Miscellaneous and general purpose**: Rename packages, enable debugging, disable screen capture restrictions,
|
||||||
export activities, etc.
|
export activities, etc.
|
||||||
* ✨ **And much more!**
|
* ✨ **And much more!**
|
||||||
|
|
||||||
For a full list of all available patches, visit [revanced.app/patches](https://revanced.app/patches).
|
For a complete list of all available patches, visit [revanced.app/patches](https://revanced.app/patches).
|
||||||
|
|
||||||
## 🚀 How to get started
|
## 🚀 How to get started
|
||||||
|
|
||||||
@@ -93,17 +93,13 @@ You can use [ReVanced CLI](https://github.com/ReVanced/revanced-cli) or [ReVance
|
|||||||
|
|
||||||
Thank you for considering contributing to ReVanced Patches. You can find the contribution guidelines [here](CONTRIBUTING.md).
|
Thank you for considering contributing to ReVanced Patches. You can find the contribution guidelines [here](CONTRIBUTING.md).
|
||||||
|
|
||||||
### 📃 Documentation
|
|
||||||
|
|
||||||
The documentation provides the fundamentals of patches and everything necessary to create your own patch from scratch.
|
|
||||||
You can find it [here](https://github.com/ReVanced/revanced-patches/tree/docs/docs).
|
|
||||||
|
|
||||||
### 🛠️ Building
|
### 🛠️ Building
|
||||||
|
|
||||||
In order to build ReVanced Patches, you can follow the [ReVanced documentation](https://github.com/ReVanced/revanced-documentation).
|
To build ReVanced Patches, you can follow the [ReVanced documentation](https://github.com/ReVanced/revanced-documentation).
|
||||||
|
|
||||||
## 📜 Licence
|
## 📜 Licence
|
||||||
|
|
||||||
ReVanced Patches is licensed under the GPLv3 licence. Please see the [licence file](LICENSE) for more information.
|
ReVanced Patches is licensed under the GPLv3 license. Please see the [license file](LICENSE) for more information.
|
||||||
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced patches as long as you track changes/dates in source files.
|
[tl;dr](https://www.tldrlegal.com/license/gnu-general-public-license-v3-gpl-3) you may copy, distribute and modify ReVanced Patches as long as you track changes/dates in source files.
|
||||||
Any modifications to ReVanced Patches must also be made available under the GPL along with build & install instructions.
|
Any modifications to ReVanced Patches must also be made available under the GPL,
|
||||||
|
along with build & install instructions.
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,11 @@
|
|||||||
import org.gradle.kotlin.dsl.support.listFilesOrdered
|
import org.gradle.kotlin.dsl.support.listFilesOrdered
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.9.10"
|
alias(libs.plugins.kotlin)
|
||||||
alias(libs.plugins.binary.compatibility.validator)
|
alias(libs.plugins.binary.compatibility.validator)
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
|
signing
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "app.revanced"
|
group = "app.revanced"
|
||||||
@@ -12,7 +14,14 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
google()
|
google()
|
||||||
maven { url = uri("https://jitpack.io") }
|
maven {
|
||||||
|
// A repository must be specified for some reason. "registry" is a dummy.
|
||||||
|
url = uri("https://maven.pkg.github.com/revanced/registry")
|
||||||
|
credentials {
|
||||||
|
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
|
||||||
|
password = project.findProperty("gpr.key") as String? ?: System.getenv("GITHUB_TOKEN")
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
@@ -22,34 +31,38 @@ dependencies {
|
|||||||
implementation(libs.guava)
|
implementation(libs.guava)
|
||||||
// Used in JsonGenerator.
|
// Used in JsonGenerator.
|
||||||
implementation(libs.gson)
|
implementation(libs.gson)
|
||||||
|
|
||||||
// A dependency to the Android library unfortunately fails the build, which is why this is required.
|
|
||||||
compileOnly(project("dummy"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
kotlin {
|
||||||
jvmToolchain(11)
|
compilerOptions {
|
||||||
}
|
jvmTarget.set(JvmTarget.JVM_11)
|
||||||
|
|
||||||
tasks.withType(Jar::class) {
|
|
||||||
exclude("app/revanced/meta")
|
|
||||||
|
|
||||||
manifest {
|
|
||||||
attributes["Name"] = "ReVanced Patches"
|
|
||||||
attributes["Description"] = "Patches for ReVanced."
|
|
||||||
attributes["Version"] = version
|
|
||||||
attributes["Timestamp"] = System.currentTimeMillis().toString()
|
|
||||||
attributes["Source"] = "git@github.com:revanced/revanced-patches.git"
|
|
||||||
attributes["Author"] = "ReVanced"
|
|
||||||
attributes["Contact"] = "contact@revanced.app"
|
|
||||||
attributes["Origin"] = "https://revanced.app"
|
|
||||||
attributes["License"] = "GNU General Public License v3.0"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
java {
|
||||||
|
targetCompatibility = JavaVersion.VERSION_11
|
||||||
|
}
|
||||||
|
|
||||||
tasks {
|
tasks {
|
||||||
register<DefaultTask>("generateBundle") {
|
withType(Jar::class) {
|
||||||
description = "Generate dex files from build and bundle them in the jar file"
|
exclude("app/revanced/meta")
|
||||||
|
|
||||||
|
manifest {
|
||||||
|
attributes["Name"] = "ReVanced Patches"
|
||||||
|
attributes["Description"] = "Patches for ReVanced."
|
||||||
|
attributes["Version"] = version
|
||||||
|
attributes["Timestamp"] = System.currentTimeMillis().toString()
|
||||||
|
attributes["Source"] = "git@github.com:revanced/revanced-patches.git"
|
||||||
|
attributes["Author"] = "ReVanced"
|
||||||
|
attributes["Contact"] = "contact@revanced.app"
|
||||||
|
attributes["Origin"] = "https://revanced.app"
|
||||||
|
attributes["License"] = "GNU General Public License v3.0"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
register("buildDexJar") {
|
||||||
|
description = "Build and add a DEX to the JAR file"
|
||||||
|
group = "build"
|
||||||
|
|
||||||
dependsOn(build)
|
dependsOn(build)
|
||||||
|
|
||||||
@@ -57,39 +70,50 @@ tasks {
|
|||||||
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
|
val d8 = File(System.getenv("ANDROID_HOME")).resolve("build-tools")
|
||||||
.listFilesOrdered().last().resolve("d8").absolutePath
|
.listFilesOrdered().last().resolve("d8").absolutePath
|
||||||
|
|
||||||
val artifacts = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
val patchesJar = configurations.archives.get().allArtifacts.files.files.first().absolutePath
|
||||||
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
|
val workingDirectory = layout.buildDirectory.dir("libs").get().asFile
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
workingDir = workingDirectory
|
workingDir = workingDirectory
|
||||||
commandLine = listOf(d8, artifacts)
|
commandLine = listOf(d8, "--release", patchesJar)
|
||||||
}
|
}
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
workingDir = workingDirectory
|
workingDir = workingDirectory
|
||||||
commandLine = listOf("zip", "-u", artifacts, "classes.dex")
|
commandLine = listOf("zip", "-u", patchesJar, "classes.dex")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
register<JavaExec>("generateMeta") {
|
register<JavaExec>("generatePatchesFiles") {
|
||||||
description = "Generate metadata for this bundle"
|
description = "Generate patches files"
|
||||||
|
|
||||||
dependsOn(build)
|
dependsOn(build)
|
||||||
|
|
||||||
classpath = sourceSets["main"].runtimeClasspath
|
classpath = sourceSets["main"].runtimeClasspath
|
||||||
mainClass.set("app.revanced.meta.PatchesFileGenerator")
|
mainClass.set("app.revanced.generator.MainKt")
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required to run tasks because Gradle semantic-release plugin runs the publish task.
|
// Needed by gradle-semantic-release-plugin.
|
||||||
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
// Tracking: https://github.com/KengoTODA/gradle-semantic-release-plugin/issues/435
|
||||||
named("publish") {
|
publish {
|
||||||
dependsOn("generateBundle")
|
dependsOn("buildDexJar")
|
||||||
dependsOn("generateMeta")
|
dependsOn("generatePatchesFiles")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
publishing {
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "GitHubPackages"
|
||||||
|
url = uri("https://maven.pkg.github.com/revanced/revanced-patches")
|
||||||
|
credentials {
|
||||||
|
username = System.getenv("GITHUB_ACTOR")
|
||||||
|
password = System.getenv("GITHUB_TOKEN")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
publications {
|
publications {
|
||||||
create<MavenPublication>("revanced-patches-publication") {
|
create<MavenPublication>("revanced-patches-publication") {
|
||||||
from(components["java"])
|
from(components["java"])
|
||||||
@@ -120,4 +144,10 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signing {
|
||||||
|
useGpgCmd()
|
||||||
|
|
||||||
|
sign(publishing.publications["revanced-patches-publication"])
|
||||||
|
}
|
||||||
|
|||||||
8
crowdin.yml
Normal file
8
crowdin.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
project_id_env: "CROWDIN_PROJECT_ID"
|
||||||
|
api_token_env: "CROWDIN_PERSONAL_TOKEN"
|
||||||
|
|
||||||
|
preserve_hierarchy: false
|
||||||
|
files:
|
||||||
|
- source: src/main/resources/addresources/values/strings.xml
|
||||||
|
translation: src/main/resources/addresources/values-%android_code%/strings.xml
|
||||||
|
skip_untranslated_strings: true
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
plugins {
|
|
||||||
id("java")
|
|
||||||
}
|
|
||||||
|
|
||||||
java {
|
|
||||||
toolchain {
|
|
||||||
languageVersion.set(JavaLanguageVersion.of(11))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
package android.os;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
public final class Environment {
|
|
||||||
public static File getExternalStorageDirectory() {
|
|
||||||
throw new UnsupportedOperationException("Stub");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 3.0.0-dev.2
|
version = 4.8.0-dev.5
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
[versions]
|
[versions]
|
||||||
revanced-patcher = "19.1.0"
|
revanced-patcher = "19.3.1"
|
||||||
smali = "3.0.3"
|
smali = "3.0.5"
|
||||||
guava = "32.1.2-jre"
|
guava = "33.0.0-jre"
|
||||||
gson = "2.10.1"
|
gson = "2.10.1"
|
||||||
binary-compatibility-validator = "0.13.2"
|
binary-compatibility-validator = "0.14.0"
|
||||||
|
kotlin = "1.9.22"
|
||||||
|
|
||||||
[libraries]
|
[libraries]
|
||||||
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
revanced-patcher = { module = "app.revanced:revanced-patcher", version.ref = "revanced-patcher" }
|
||||||
@@ -13,3 +14,4 @@ gson = { module = "com.google.code.gson:gson", version.ref = "gson" }
|
|||||||
|
|
||||||
[plugins]
|
[plugins]
|
||||||
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
|
binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator" }
|
||||||
|
kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
|
||||||
|
|||||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
4
gradle/wrapper/gradle-wrapper.properties
vendored
4
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,6 @@
|
|||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||||
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
|
distributionSha256Sum=9631d53cf3e74bfa726893aee1f8994fee4e060c401335946dba2156f440f24c
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dist
|
zipStorePath=wrapper/dist
|
||||||
17
gradlew
vendored
17
gradlew
vendored
@@ -83,7 +83,8 @@ 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 "${APP_HOME:-./}" > /dev/null && pwd -P ) || 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 +145,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 +153,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 +202,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" \
|
||||||
|
|||||||
5450
package-lock.json
generated
5450
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
|||||||
{
|
{
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@saithodev/semantic-release-backmerge": "^3.2.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.8.0",
|
"gradle-semantic-release-plugin": "^1.9.1",
|
||||||
"semantic-release": "^22.0.8"
|
"semantic-release": "^23.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,9 +1,7 @@
|
|||||||
include("dummy")
|
|
||||||
|
|
||||||
rootProject.name = "revanced-patches"
|
rootProject.name = "revanced-patches"
|
||||||
|
|
||||||
buildCache {
|
buildCache {
|
||||||
local {
|
local {
|
||||||
isEnabled = !System.getenv().containsKey("CI")
|
isEnabled = "CI" !in System.getenv()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
package app.revanced.meta
|
package app.revanced.generator
|
||||||
|
|
||||||
import app.revanced.patcher.PatchSet
|
import app.revanced.patcher.PatchSet
|
||||||
import app.revanced.patcher.patch.Patch
|
import app.revanced.patcher.patch.Patch
|
||||||
import com.google.gson.GsonBuilder
|
import com.google.gson.GsonBuilder
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class JsonGenerator : PatchesFileGenerator {
|
internal class JsonPatchesFileGenerator : PatchesFileGenerator {
|
||||||
override fun generate(patches: PatchSet) = patches.map {
|
override fun generate(patches: PatchSet) = patches.map {
|
||||||
JsonPatch(
|
JsonPatch(
|
||||||
it.name!!,
|
it.name!!,
|
||||||
@@ -20,9 +20,9 @@ internal class JsonGenerator : PatchesFileGenerator {
|
|||||||
option.values,
|
option.values,
|
||||||
option.title,
|
option.title,
|
||||||
option.description,
|
option.description,
|
||||||
option.required
|
option.required,
|
||||||
)
|
)
|
||||||
}
|
},
|
||||||
)
|
)
|
||||||
}.let {
|
}.let {
|
||||||
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
|
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
|
||||||
@@ -35,7 +35,7 @@ internal class JsonGenerator : PatchesFileGenerator {
|
|||||||
val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
|
val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
|
||||||
val use: Boolean = true,
|
val use: Boolean = true,
|
||||||
val requiresIntegrations: Boolean = false,
|
val requiresIntegrations: Boolean = false,
|
||||||
val options: List<Option>
|
val options: List<Option>,
|
||||||
) {
|
) {
|
||||||
class Option(
|
class Option(
|
||||||
val key: String,
|
val key: String,
|
||||||
@@ -46,4 +46,4 @@ internal class JsonGenerator : PatchesFileGenerator {
|
|||||||
val required: Boolean,
|
val required: Boolean,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
12
src/main/kotlin/app/revanced/generator/Main.kt
Normal file
12
src/main/kotlin/app/revanced/generator/Main.kt
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.generator
|
||||||
|
|
||||||
|
import app.revanced.patcher.PatchBundleLoader
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
internal fun main() = PatchBundleLoader.Jar(
|
||||||
|
File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first(),
|
||||||
|
).also { loader ->
|
||||||
|
if (loader.isEmpty()) throw IllegalStateException("No patches found")
|
||||||
|
}.let { bundle ->
|
||||||
|
arrayOf(JsonPatchesFileGenerator()).forEach { generator -> generator.generate(bundle) }
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.revanced.generator
|
||||||
|
|
||||||
|
import app.revanced.patcher.PatchSet
|
||||||
|
|
||||||
|
internal interface PatchesFileGenerator {
|
||||||
|
fun generate(patches: PatchSet)
|
||||||
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package app.revanced.meta
|
|
||||||
|
|
||||||
import app.revanced.patcher.PatchBundleLoader
|
|
||||||
import app.revanced.patcher.PatchSet
|
|
||||||
import java.io.File
|
|
||||||
|
|
||||||
internal interface PatchesFileGenerator {
|
|
||||||
fun generate(patches: PatchSet)
|
|
||||||
|
|
||||||
private companion object {
|
|
||||||
@JvmStatic
|
|
||||||
fun main(args: Array<String>) = PatchBundleLoader.Jar(
|
|
||||||
File("build/libs/").listFiles { it -> it.name.endsWith(".jar") }!!.first()
|
|
||||||
).also { loader ->
|
|
||||||
if (loader.isEmpty()) throw IllegalStateException("No patches found")
|
|
||||||
}.let { bundle ->
|
|
||||||
arrayOf(JsonGenerator()).forEach { generator -> generator.generate(bundle) }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -7,29 +7,34 @@ import app.revanced.patcher.patch.annotation.Patch
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Export all activities",
|
name = "Export all activities",
|
||||||
description = "Makes all app activities exportable.",
|
description = "Makes all app activities exportable.",
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object ExportAllActivitiesPatch : ResourcePatch() {
|
object ExportAllActivitiesPatch : ResourcePatch() {
|
||||||
private const val EXPORTED_FLAG = "android:exported"
|
private const val EXPORTED_FLAG = "android:exported"
|
||||||
|
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
val document = editor.file
|
val document = editor.file
|
||||||
|
|
||||||
val activities = document.getElementsByTagName("activity")
|
val activities = document.getElementsByTagName("activity")
|
||||||
|
|
||||||
for(i in 0..activities.length) {
|
for (i in 0..activities.length) {
|
||||||
activities.item(i)?.apply {
|
activities.item(i)?.apply {
|
||||||
val exportedAttribute = attributes.getNamedItem(EXPORTED_FLAG)
|
val exportedAttribute = attributes.getNamedItem(EXPORTED_FLAG)
|
||||||
|
|
||||||
if (exportedAttribute != null) {
|
if (exportedAttribute != null) {
|
||||||
if (exportedAttribute.nodeValue != "true")
|
if (exportedAttribute.nodeValue != "true") {
|
||||||
exportedAttribute.nodeValue = "true"
|
exportedAttribute.nodeValue = "true"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Reason why the attribute is added in the case it does not exist:
|
// Reason why the attribute is added in the case it does not exist:
|
||||||
// https://github.com/revanced/revanced-patches/pull/1751/files#r1141481604
|
// https://github.com/revanced/revanced-patches/pull/1751/files#r1141481604
|
||||||
else document.createAttribute(EXPORTED_FLAG)
|
else {
|
||||||
.apply { value = "true" }
|
document.createAttribute(EXPORTED_FLAG)
|
||||||
.let(attributes::setNamedItem)
|
.apply { value = "true" }
|
||||||
|
.let(attributes::setNamedItem)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ package app.revanced.patches.all.connectivity.wifi.spoof
|
|||||||
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||||
import app.revanced.patches.all.misc.transformation.IMethodCall
|
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||||
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
||||||
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
||||||
@@ -17,8 +17,8 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
|||||||
requiresIntegrations = true
|
requiresIntegrations = true
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpoofWifiPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
|
object SpoofWifiPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/all/connectivity/wifi/spoof/SpoofWifiPatch"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX = "Lapp/revanced/integrations/all/connectivity/wifi/spoof/SpoofWifiPatch"
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
||||||
|
|
||||||
override fun filterMap(
|
override fun filterMap(
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import app.revanced.patcher.patch.annotation.Patch
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Predictive back gesture",
|
name = "Predictive back gesture",
|
||||||
description = "Enables the predictive back gesture introduced on Android 13.",
|
description = "Enables the predictive back gesture introduced on Android 13.",
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object PredictiveBackGesturePatch : ResourcePatch() {
|
object PredictiveBackGesturePatch : ResourcePatch() {
|
||||||
|
|||||||
@@ -8,16 +8,18 @@ import org.w3c.dom.Element
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Enable Android debugging",
|
name = "Enable Android debugging",
|
||||||
description = "Enables Android debugging capabilities. This can slow down the app.",
|
description = "Enables Android debugging capabilities. This can slow down the app.",
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object EnableAndroidDebuggingPatch : ResourcePatch() {
|
object EnableAndroidDebuggingPatch : ResourcePatch() {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { dom ->
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
val applicationNode = dom
|
val document = editor.file
|
||||||
.file
|
|
||||||
.getElementsByTagName("application")
|
val applicationNode =
|
||||||
.item(0) as Element
|
document
|
||||||
|
.getElementsByTagName("application")
|
||||||
|
.item(0) as Element
|
||||||
|
|
||||||
// set application as debuggable
|
// set application as debuggable
|
||||||
applicationNode.setAttribute("android:debuggable", "true")
|
applicationNode.setAttribute("android:debuggable", "true")
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package app.revanced.patches.all.misc.hex
|
||||||
|
|
||||||
|
import app.revanced.patcher.patch.PatchException
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.registerNewPatchOption
|
||||||
|
import app.revanced.patches.shared.misc.hex.BaseHexPatch
|
||||||
|
import app.revanced.util.Utils.trimIndentMultiline
|
||||||
|
import app.revanced.patcher.patch.Patch as PatchClass
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hex",
|
||||||
|
description = "Replaces a hexadecimal patterns of bytes of files in an APK.",
|
||||||
|
use = false,
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
class HexPatch : BaseHexPatch() {
|
||||||
|
// TODO: Instead of stringArrayOption, use a custom option type to work around
|
||||||
|
// https://github.com/ReVanced/revanced-library/issues/48.
|
||||||
|
// Replace the custom option type with a stringArrayOption once the issue is resolved.
|
||||||
|
private val replacementsOption by registerNewPatchOption<PatchClass<*>, List<String>>(
|
||||||
|
key = "replacements",
|
||||||
|
title = "Replacements",
|
||||||
|
description = """
|
||||||
|
Hexadecimal patterns to search for and replace with another in a target file.
|
||||||
|
|
||||||
|
A pattern is a sequence of case insensitive strings, each representing hexadecimal bytes, separated by spaces.
|
||||||
|
An example pattern is 'aa 01 02 FF'.
|
||||||
|
|
||||||
|
Every pattern must be followed by a pipe ('|'), the replacement pattern,
|
||||||
|
another pipe ('|'), and the path to the file to make the changes in relative to the APK root.
|
||||||
|
The replacement pattern must have the same length as the original pattern.
|
||||||
|
|
||||||
|
Full example of a valid input:
|
||||||
|
'aa 01 02 FF|00 00 00 00|path/to/file'
|
||||||
|
""".trimIndentMultiline(),
|
||||||
|
required = true,
|
||||||
|
valueType = "StringArray",
|
||||||
|
)
|
||||||
|
|
||||||
|
override val replacements
|
||||||
|
get() = replacementsOption!!.map { from ->
|
||||||
|
val (pattern, replacementPattern, targetFilePath) = try {
|
||||||
|
from.split("|", limit = 3)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw PatchException(
|
||||||
|
"Invalid input: $from.\n" +
|
||||||
|
"Every pattern must be followed by a pipe ('|'), " +
|
||||||
|
"the replacement pattern, another pipe ('|'), " +
|
||||||
|
"and the path to the file to make the changes in relative to the APK root. ",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Replacement(pattern, replacementPattern, targetFilePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import app.revanced.patcher.data.ResourceContext
|
|||||||
import app.revanced.patcher.patch.ResourcePatch
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.all.misc.debugging.EnableAndroidDebuggingPatch
|
import app.revanced.patches.all.misc.debugging.EnableAndroidDebuggingPatch
|
||||||
|
import app.revanced.util.Utils.trimIndentMultiline
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
@@ -11,16 +12,17 @@ import java.io.File
|
|||||||
name = "Override certificate pinning",
|
name = "Override certificate pinning",
|
||||||
description = "Overrides certificate pinning, allowing to inspect traffic via a proxy.",
|
description = "Overrides certificate pinning, allowing to inspect traffic via a proxy.",
|
||||||
dependencies = [EnableAndroidDebuggingPatch::class],
|
dependencies = [EnableAndroidDebuggingPatch::class],
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object OverrideCertificatePinningPatch : ResourcePatch() {
|
object OverrideCertificatePinningPatch : ResourcePatch() {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
val resXmlDirectory = context["res/xml"]
|
val resXmlDirectory = context.get("res/xml")
|
||||||
|
|
||||||
// Add android:networkSecurityConfig="@xml/network_security_config" and the "networkSecurityConfig" attribute if it does not exist.
|
// Add android:networkSecurityConfig="@xml/network_security_config" and the "networkSecurityConfig" attribute if it does not exist.
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
val document = editor.file
|
val document = editor.file
|
||||||
|
|
||||||
val applicationNode = document.getElementsByTagName("application").item(0) as Element
|
val applicationNode = document.getElementsByTagName("application").item(0) as Element
|
||||||
|
|
||||||
if (!applicationNode.hasAttribute("networkSecurityConfig")) {
|
if (!applicationNode.hasAttribute("networkSecurityConfig")) {
|
||||||
@@ -31,10 +33,8 @@ object OverrideCertificatePinningPatch : ResourcePatch() {
|
|||||||
|
|
||||||
// In case the file does not exist create the "network_security_config.xml" file.
|
// In case the file does not exist create the "network_security_config.xml" file.
|
||||||
File(resXmlDirectory, "network_security_config.xml").apply {
|
File(resXmlDirectory, "network_security_config.xml").apply {
|
||||||
if (!exists()) {
|
writeText(
|
||||||
createNewFile()
|
"""
|
||||||
writeText(
|
|
||||||
"""
|
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<network-security-config>
|
<network-security-config>
|
||||||
<base-config cleartextTrafficPermitted="true">
|
<base-config cleartextTrafficPermitted="true">
|
||||||
@@ -54,22 +54,8 @@ object OverrideCertificatePinningPatch : ResourcePatch() {
|
|||||||
</trust-anchors>
|
</trust-anchors>
|
||||||
</debug-overrides>
|
</debug-overrides>
|
||||||
</network-security-config>
|
</network-security-config>
|
||||||
"""
|
""".trimIndentMultiline(),
|
||||||
)
|
)
|
||||||
} else {
|
|
||||||
// If the file already exists.
|
|
||||||
readText().let { text ->
|
|
||||||
if (!text.contains("<certificates src=\"user\" />")) {
|
|
||||||
writeText(
|
|
||||||
text.replace(
|
|
||||||
"<trust-anchors>",
|
|
||||||
"<trust-anchors>\n<certificates src=\"user\" overridePins=\"true\" />\n<certificates src=\"system\" />"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,21 +10,22 @@ import java.io.Closeable
|
|||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Change package name",
|
name = "Change package name",
|
||||||
description = "Appends \".revanced\" to the package name by default.",
|
description = "Appends \".revanced\" to the package name by default. Changing the package name of the app can lead to unexpected issues.",
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object ChangePackageNamePatch : ResourcePatch(), Closeable {
|
object ChangePackageNamePatch : ResourcePatch(), Closeable {
|
||||||
private val packageNameOption = stringPatchOption(
|
private val packageNameOption =
|
||||||
key = "packageName",
|
stringPatchOption(
|
||||||
default = "Default",
|
key = "packageName",
|
||||||
values = mapOf("Default" to "Default"),
|
default = "Default",
|
||||||
title = "Package name",
|
values = mapOf("Default" to "Default"),
|
||||||
description = "The name of the package to rename the app to.",
|
title = "Package name",
|
||||||
required = true
|
description = "The name of the package to rename the app to.",
|
||||||
) {
|
required = true,
|
||||||
it == "Default" || it!!.matches(Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$"))
|
) {
|
||||||
}
|
it == "Default" || it!!.matches(Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$"))
|
||||||
|
}
|
||||||
|
|
||||||
private lateinit var context: ResourceContext
|
private lateinit var context: ResourceContext
|
||||||
|
|
||||||
@@ -41,22 +42,29 @@ object ChangePackageNamePatch : ResourcePatch(), Closeable {
|
|||||||
* @throws PatchOptionException.ValueValidationException If the package name is invalid.
|
* @throws PatchOptionException.ValueValidationException If the package name is invalid.
|
||||||
*/
|
*/
|
||||||
fun setOrGetFallbackPackageName(fallbackPackageName: String): String {
|
fun setOrGetFallbackPackageName(fallbackPackageName: String): String {
|
||||||
val packageName = this.packageNameOption.value!!
|
val packageName = packageNameOption.value!!
|
||||||
|
|
||||||
return if (packageName == this.packageNameOption.default)
|
return if (packageName == packageNameOption.default) {
|
||||||
fallbackPackageName.also { this.packageNameOption.value = it }
|
fallbackPackageName.also { packageNameOption.value = it }
|
||||||
else
|
} else {
|
||||||
packageName
|
packageName
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun close() = context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
override fun close() =
|
||||||
val manifest = editor.file.getElementsByTagName("manifest").item(0) as Element
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
val originalPackageName = manifest.getAttribute("package")
|
val document = editor.file
|
||||||
|
|
||||||
var replacementPackageName = this.packageNameOption.value
|
val replacementPackageName = packageNameOption.value
|
||||||
if (replacementPackageName == this.packageNameOption.default)
|
|
||||||
replacementPackageName = "$originalPackageName.revanced"
|
|
||||||
|
|
||||||
manifest.setAttribute("package", replacementPackageName)
|
val manifest = document.getElementsByTagName("manifest").item(0) as Element
|
||||||
}
|
manifest.setAttribute(
|
||||||
}
|
"package",
|
||||||
|
if (replacementPackageName != packageNameOption.default) {
|
||||||
|
replacementPackageName
|
||||||
|
} else {
|
||||||
|
"${manifest.getAttribute("package")}.revanced"
|
||||||
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,290 @@
|
|||||||
|
package app.revanced.patches.all.misc.resources
|
||||||
|
|
||||||
|
import app.revanced.patcher.PatchClass
|
||||||
|
import app.revanced.patcher.data.ResourceContext
|
||||||
|
import app.revanced.patcher.patch.PatchException
|
||||||
|
import app.revanced.patcher.patch.ResourcePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.util.DomFileEditor
|
||||||
|
import app.revanced.patches.all.misc.resources.AddResourcesPatch.resources
|
||||||
|
import app.revanced.util.*
|
||||||
|
import app.revanced.util.resource.ArrayResource
|
||||||
|
import app.revanced.util.resource.BaseResource
|
||||||
|
import app.revanced.util.resource.StringResource
|
||||||
|
import org.w3c.dom.Node
|
||||||
|
import java.io.Closeable
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identifier of an app. For example, `youtube`.
|
||||||
|
*/
|
||||||
|
private typealias AppId = String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An identifier of a patch. For example, `ad.general.HideAdsPatch`.
|
||||||
|
*/
|
||||||
|
private typealias PatchId = String
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A set of resources of a patch.
|
||||||
|
*/
|
||||||
|
private typealias PatchResources = MutableSet<BaseResource>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of resources belonging to a patch.
|
||||||
|
*/
|
||||||
|
private typealias AppResources = MutableMap<PatchId, PatchResources>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of resources belonging to an app.
|
||||||
|
*/
|
||||||
|
private typealias Resources = MutableMap<AppId, AppResources>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The value of a resource.
|
||||||
|
* For example, `values` or `values-de`.
|
||||||
|
*/
|
||||||
|
private typealias Value = String
|
||||||
|
|
||||||
|
@Patch(description = "Add resources such as strings or arrays to the app.")
|
||||||
|
object AddResourcesPatch : ResourcePatch(), MutableMap<Value, MutableSet<BaseResource>> by mutableMapOf(), Closeable {
|
||||||
|
private lateinit var context: ResourceContext
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A map of all resources associated by their value staged by [execute].
|
||||||
|
*/
|
||||||
|
private lateinit var resources: Map<Value, Resources>
|
||||||
|
|
||||||
|
/*
|
||||||
|
The strategy of this patch is to stage resources present in `/resources/addresources`.
|
||||||
|
These resources are organized by their respective value and patch.
|
||||||
|
|
||||||
|
On AddResourcesPatch#execute, all resources are staged in a temporary map.
|
||||||
|
After that, other patches that depend on AddResourcesPatch can call
|
||||||
|
AddResourcesPatch#invoke(PatchClass) to stage resources belonging to that patch
|
||||||
|
from the temporary map to AddResourcesPatch.
|
||||||
|
|
||||||
|
After all patches that depend on AddResourcesPatch have been executed,
|
||||||
|
AddResourcesPatch#close is finally called to add all staged resources to the app.
|
||||||
|
*/
|
||||||
|
override fun execute(context: ResourceContext) {
|
||||||
|
this.context = context
|
||||||
|
|
||||||
|
resources =
|
||||||
|
buildMap {
|
||||||
|
/**
|
||||||
|
* Puts resources under `/resources/addresources/<value>/<resourceKind>.xml` into the map.
|
||||||
|
*
|
||||||
|
* @param value The value of the resource. For example, `values` or `values-de`.
|
||||||
|
* @param resourceKind The kind of the resource. For example, `strings` or `arrays`.
|
||||||
|
* @param transform A function that transforms the [Node]s from the XML files to a [BaseResource].
|
||||||
|
*/
|
||||||
|
fun addResources(
|
||||||
|
value: Value,
|
||||||
|
resourceKind: String,
|
||||||
|
transform: (Node) -> BaseResource,
|
||||||
|
) {
|
||||||
|
inputStreamFromBundledResource(
|
||||||
|
"addresources",
|
||||||
|
"$value/$resourceKind.xml",
|
||||||
|
)?.let { stream ->
|
||||||
|
// Add the resources associated with the given value to the map,
|
||||||
|
// instead of overwriting it.
|
||||||
|
// This covers the example case such as adding strings and arrays of the same value.
|
||||||
|
getOrPut(value, ::mutableMapOf).apply {
|
||||||
|
context.xmlEditor[stream].use { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
document.getElementsByTagName("app").asSequence().forEach { app ->
|
||||||
|
val appId = app.attributes.getNamedItem("id").textContent
|
||||||
|
|
||||||
|
getOrPut(appId, ::mutableMapOf).apply {
|
||||||
|
app.forEachChildElement { patch ->
|
||||||
|
val patchId = patch.attributes.getNamedItem("id").textContent
|
||||||
|
|
||||||
|
getOrPut(patchId, ::mutableSetOf).apply {
|
||||||
|
patch.forEachChildElement { resourceNode ->
|
||||||
|
val resource = transform(resourceNode)
|
||||||
|
|
||||||
|
add(resource)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Stage all resources to a temporary map.
|
||||||
|
// Staged resources consumed by AddResourcesPatch#invoke(PatchClass)
|
||||||
|
// are later used in AddResourcesPatch#close.
|
||||||
|
try {
|
||||||
|
val addStringResources = { value: Value ->
|
||||||
|
addResources(value, "strings", StringResource::fromNode)
|
||||||
|
}
|
||||||
|
Locale.getISOLanguages().asSequence().map { "values-$it" }.forEach { addStringResources(it) }
|
||||||
|
addStringResources("values")
|
||||||
|
|
||||||
|
addResources("values", "arrays", ArrayResource::fromNode)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
throw PatchException("Failed to read resources", e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a [BaseResource] to the map using [MutableMap.getOrPut].
|
||||||
|
*
|
||||||
|
* @param value The value of the resource. For example, `values` or `values-de`.
|
||||||
|
* @param resource The resource to add.
|
||||||
|
*
|
||||||
|
* @return True if the resource was added, false if it already existed.
|
||||||
|
*/
|
||||||
|
operator fun invoke(
|
||||||
|
value: Value,
|
||||||
|
resource: BaseResource,
|
||||||
|
) = getOrPut(value, ::mutableSetOf).add(resource)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a list of [BaseResource]s to the map using [MutableMap.getOrPut].
|
||||||
|
*
|
||||||
|
* @param value The value of the resource. For example, `values` or `values-de`.
|
||||||
|
* @param resources The resources to add.
|
||||||
|
*
|
||||||
|
* @return True if the resources were added, false if they already existed.
|
||||||
|
*/
|
||||||
|
operator fun invoke(
|
||||||
|
value: Value,
|
||||||
|
resources: Iterable<BaseResource>,
|
||||||
|
) = getOrPut(value, ::mutableSetOf).addAll(resources)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a [StringResource].
|
||||||
|
*
|
||||||
|
* @param name The name of the string resource.
|
||||||
|
* @param value The value of the string resource.
|
||||||
|
* @param formatted Whether the string resource is formatted. Defaults to `true`.
|
||||||
|
* @param resourceValue The value of the resource. For example, `values` or `values-de`.
|
||||||
|
*
|
||||||
|
* @return True if the resource was added, false if it already existed.
|
||||||
|
*/
|
||||||
|
operator fun invoke(
|
||||||
|
name: String,
|
||||||
|
value: String,
|
||||||
|
formatted: Boolean = true,
|
||||||
|
resourceValue: Value = "values",
|
||||||
|
) = invoke(resourceValue, StringResource(name, value, formatted))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds an [ArrayResource].
|
||||||
|
*
|
||||||
|
* @param name The name of the array resource.
|
||||||
|
* @param items The items of the array resource.
|
||||||
|
*
|
||||||
|
* @return True if the resource was added, false if it already existed.
|
||||||
|
*/
|
||||||
|
operator fun invoke(
|
||||||
|
name: String,
|
||||||
|
items: List<String>,
|
||||||
|
) = invoke("values", ArrayResource(name, items))
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Puts all resources of any [Value] staged in [resources] for the given [PatchClass] to [AddResourcesPatch].
|
||||||
|
*
|
||||||
|
* @param patch The class of the patch to add resources for.
|
||||||
|
* @param parseIds A function that parses the [AppId] and [PatchId] from the given [PatchClass].
|
||||||
|
* This is used to access the resources in [resources] to stage them in [AddResourcesPatch].
|
||||||
|
* The default implementation assumes that the [PatchClass] qualified name has the following format:
|
||||||
|
* `<any>.<any>.<any>.<app id>.<patch id>`.
|
||||||
|
*
|
||||||
|
* @return True if any resources were added, false if none were added.
|
||||||
|
*
|
||||||
|
* @see AddResourcesPatch.close
|
||||||
|
*/
|
||||||
|
operator fun invoke(
|
||||||
|
patch: PatchClass,
|
||||||
|
parseIds: PatchClass.() -> Pair<AppId, PatchId> = {
|
||||||
|
val qualifiedName = qualifiedName ?: throw PatchException("Patch qualified name is null")
|
||||||
|
|
||||||
|
// This requires qualifiedName to have the following format:
|
||||||
|
// `<any>.<any>.<any>.<app id>.<patch id>`
|
||||||
|
with(qualifiedName.split(".")) {
|
||||||
|
if (size < 5) throw PatchException("Patch qualified name has invalid format")
|
||||||
|
|
||||||
|
val appId = this[3]
|
||||||
|
val patchId = subList(4, size).joinToString(".")
|
||||||
|
|
||||||
|
appId to patchId
|
||||||
|
}
|
||||||
|
},
|
||||||
|
): Boolean {
|
||||||
|
val (appId, patchId) = patch.parseIds()
|
||||||
|
|
||||||
|
var result = false
|
||||||
|
|
||||||
|
// Stage resources for the given patch to AddResourcesPatch associated with their value.
|
||||||
|
resources.forEach { (value, resources) ->
|
||||||
|
resources[appId]?.get(patchId)?.let { patchResources ->
|
||||||
|
if (invoke(value, patchResources)) result = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds all resources staged in [AddResourcesPatch] to the app.
|
||||||
|
* This is called after all patches that depend on [AddResourcesPatch] have been executed.
|
||||||
|
*/
|
||||||
|
override fun close() {
|
||||||
|
operator fun MutableMap<String, Pair<DomFileEditor, Node>>.invoke(
|
||||||
|
value: Value,
|
||||||
|
resource: BaseResource,
|
||||||
|
) {
|
||||||
|
// TODO: Fix open-closed principle violation by modifying BaseResource#serialize so that it accepts
|
||||||
|
// a Value and the map of documents. It will then get or put the document suitable for its resource type
|
||||||
|
// to serialize itself to it.
|
||||||
|
val resourceFileName =
|
||||||
|
when (resource) {
|
||||||
|
is StringResource -> "strings"
|
||||||
|
is ArrayResource -> "arrays"
|
||||||
|
else -> throw NotImplementedError("Unsupported resource type")
|
||||||
|
}
|
||||||
|
|
||||||
|
getOrPut(resourceFileName) {
|
||||||
|
val targetFile =
|
||||||
|
context.get("res/$value/$resourceFileName.xml").also {
|
||||||
|
it.parentFile?.mkdirs()
|
||||||
|
it.createNewFile()
|
||||||
|
}
|
||||||
|
|
||||||
|
context.xmlEditor[targetFile.path].let { editor ->
|
||||||
|
val document = editor.file
|
||||||
|
|
||||||
|
// Save the target node here as well
|
||||||
|
// in order to avoid having to call document.getNode("resources")
|
||||||
|
// but also save the document so that it can be closed later.
|
||||||
|
editor to document.getNode("resources")
|
||||||
|
}
|
||||||
|
}.let { (_, targetNode) ->
|
||||||
|
targetNode.addResource(resource) { invoke(value, it) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
forEach { (value, resources) ->
|
||||||
|
// A map of document associated by their kind (e.g. strings, arrays).
|
||||||
|
// Each document is accompanied by the target node to which resources are added.
|
||||||
|
// A map is used because Map#getOrPut allows opening a new document for the duration of a resource value.
|
||||||
|
// This is done to prevent having to open the files for every resource that is added.
|
||||||
|
// Instead, it is cached once and reused for resources of the same value.
|
||||||
|
// This map is later accessed to close all documents for the current resource value.
|
||||||
|
val documents = mutableMapOf<String, Pair<DomFileEditor, Node>>()
|
||||||
|
|
||||||
|
resources.forEach { resource -> documents(value, resource) }
|
||||||
|
|
||||||
|
documents.values.forEach { (document, _) -> document.close() }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,13 +9,12 @@ import com.android.tools.smali.dexlib2.iface.Method
|
|||||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
|
||||||
@Suppress("MemberVisibilityCanBePrivate")
|
@Suppress("MemberVisibilityCanBePrivate")
|
||||||
abstract class AbstractTransformInstructionsPatch<T> : BytecodePatch() {
|
abstract class BaseTransformInstructionsPatch<T> : BytecodePatch(emptySet()) {
|
||||||
|
|
||||||
abstract fun filterMap(
|
abstract fun filterMap(
|
||||||
classDef: ClassDef,
|
classDef: ClassDef,
|
||||||
method: Method,
|
method: Method,
|
||||||
instruction: Instruction,
|
instruction: Instruction,
|
||||||
instructionIndex: Int
|
instructionIndex: Int,
|
||||||
): T?
|
): T?
|
||||||
|
|
||||||
abstract fun transform(mutableMethod: MutableMethod, entry: T)
|
abstract fun transform(mutableMethod: MutableMethod, entry: T)
|
||||||
@@ -2,7 +2,7 @@ package app.revanced.patches.all.screencapture.removerestriction
|
|||||||
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||||
import app.revanced.patches.all.misc.transformation.IMethodCall
|
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||||
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
||||||
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
||||||
@@ -18,9 +18,9 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
|||||||
requiresIntegrations = true
|
requiresIntegrations = true
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object RemoveCaptureRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
|
object RemoveCaptureRestrictionPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
|
||||||
"Lapp/revanced/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch"
|
"Lapp/revanced/integrations/all/screencapture/removerestriction/RemoveScreencaptureRestrictionPatch"
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
||||||
// Information about method calls we want to replace
|
// Information about method calls we want to replace
|
||||||
enum class MethodCall(
|
enum class MethodCall(
|
||||||
|
|||||||
@@ -8,16 +8,17 @@ import org.w3c.dom.Element
|
|||||||
@Patch(description = "Sets allowAudioPlaybackCapture in manifest to true.")
|
@Patch(description = "Sets allowAudioPlaybackCapture in manifest to true.")
|
||||||
internal object RemoveCaptureRestrictionResourcePatch : ResourcePatch() {
|
internal object RemoveCaptureRestrictionResourcePatch : ResourcePatch() {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
// create an xml editor instance
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { dom ->
|
val document = editor.file
|
||||||
|
|
||||||
// get the application node
|
// get the application node
|
||||||
val applicationNode = dom
|
val applicationNode =
|
||||||
.file
|
document
|
||||||
.getElementsByTagName("application")
|
.getElementsByTagName("application")
|
||||||
.item(0) as Element
|
.item(0) as Element
|
||||||
|
|
||||||
// set allowAudioPlaybackCapture attribute to true
|
// set allowAudioPlaybackCapture attribute to true
|
||||||
applicationNode.setAttribute("android:allowAudioPlaybackCapture", "true")
|
applicationNode.setAttribute("android:allowAudioPlaybackCapture", "true")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import app.revanced.patcher.data.BytecodeContext
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||||
import app.revanced.patches.all.misc.transformation.IMethodCall
|
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||||
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
import app.revanced.patches.all.misc.transformation.Instruction35cInfo
|
||||||
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
import app.revanced.patches.all.misc.transformation.filterMapInstruction35c
|
||||||
@@ -22,9 +22,9 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
|||||||
requiresIntegrations = true,
|
requiresIntegrations = true,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Instruction35cInfo>() {
|
object RemoveScreenshotRestrictionPatch : BaseTransformInstructionsPatch<Instruction35cInfo>() {
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX =
|
||||||
"Lapp/revanced/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch"
|
"Lapp/revanced/integrations/all/screenshot/removerestriction/RemoveScreenshotRestrictionPatch"
|
||||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
private const val INTEGRATIONS_CLASS_DESCRIPTOR = "$INTEGRATIONS_CLASS_DESCRIPTOR_PREFIX;"
|
||||||
|
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
@@ -71,7 +71,7 @@ object RemoveScreenshotRestrictionPatch : AbstractTransformInstructionsPatch<Ins
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ModifyLayoutParamsFlags : AbstractTransformInstructionsPatch<Pair<Instruction22c, Int>>() {
|
private class ModifyLayoutParamsFlags : BaseTransformInstructionsPatch<Pair<Instruction22c, Int>>() {
|
||||||
override fun filterMap(
|
override fun filterMap(
|
||||||
classDef: ClassDef,
|
classDef: ClassDef,
|
||||||
method: Method,
|
method: Method,
|
||||||
|
|||||||
@@ -3,10 +3,9 @@ package app.revanced.patches.all.telephony.sim.spoof
|
|||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.patch.options.PatchOption
|
|
||||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
import app.revanced.patches.all.misc.transformation.AbstractTransformInstructionsPatch
|
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
@@ -24,27 +23,30 @@ import java.util.*
|
|||||||
use = false,
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpoofSimCountryPatch : AbstractTransformInstructionsPatch<Pair<Int, String>>() {
|
object SpoofSimCountryPatch : BaseTransformInstructionsPatch<Pair<Int, String>>() {
|
||||||
private val isoValidator: PatchOption<String>.(String?) -> Boolean =
|
private val countries = Locale.getISOCountries().associateBy { Locale("", it).displayCountry }
|
||||||
{ it: String? -> it?.uppercase() in Locale.getISOCountries() || it == null }
|
|
||||||
|
|
||||||
private val networkCountryIso by stringPatchOption(
|
private val networkCountryIso by isoCountryPatchOption(
|
||||||
"networkCountryIso",
|
"networkCountryIso",
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"Network ISO Country Code",
|
"Network ISO Country Code",
|
||||||
"ISO-3166-1 alpha-2 country code equivalent of the MCC (Mobile Country Code) " +
|
|
||||||
"of the current registered operator or the cell nearby.",
|
|
||||||
validator = isoValidator
|
|
||||||
)
|
)
|
||||||
|
|
||||||
private val simCountryIso by stringPatchOption(
|
private val simCountryIso by isoCountryPatchOption(
|
||||||
"simCountryIso",
|
"simCountryIso",
|
||||||
null,
|
|
||||||
null,
|
|
||||||
"Sim ISO Country Code",
|
"Sim ISO Country Code",
|
||||||
|
)
|
||||||
|
|
||||||
|
private fun isoCountryPatchOption(
|
||||||
|
key: String,
|
||||||
|
title: String,
|
||||||
|
) = stringPatchOption(
|
||||||
|
key,
|
||||||
|
null,
|
||||||
|
countries,
|
||||||
|
title,
|
||||||
"ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.",
|
"ISO-3166-1 alpha-2 country code equivalent for the SIM provider's country code.",
|
||||||
validator = isoValidator
|
false,
|
||||||
|
validator = { it: String? -> it == null || it.uppercase() in countries.values }
|
||||||
)
|
)
|
||||||
|
|
||||||
override fun filterMap(
|
override fun filterMap(
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.amazon.deeplinking
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object DeepLinkingFingerprint : MethodFingerprint(
|
||||||
|
"Z",
|
||||||
|
parameters = listOf("L"),
|
||||||
|
accessFlags = AccessFlags.PRIVATE.value,
|
||||||
|
strings = listOf("https://www.", "android.intent.action.VIEW")
|
||||||
|
)
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package app.revanced.patches.amazon.deeplinking
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Always allow deep-linking",
|
||||||
|
description = "Open Amazon links, even if the app is not set to handle Amazon links.",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.amazon.mShop.android.shopping")]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object DeepLinkingPatch : BytecodePatch(
|
||||||
|
setOf(DeepLinkingFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
DeepLinkingFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
const/4 v0, 0x1
|
||||||
|
return v0
|
||||||
|
"""
|
||||||
|
) ?: throw DeepLinkingFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@ import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerp
|
|||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Unlock pro",
|
name = "Unlock pro",
|
||||||
compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio")]
|
compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio", ["2.2 build 016"])]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object UnlockProPatch : BytecodePatch(
|
object UnlockProPatch : BytecodePatch(
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import app.revanced.util.returnEarly
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Remove root detection",
|
name = "Remove root detection",
|
||||||
description = "Removes the check for root permissions and unlocked bootloader.",
|
description = "Removes the check for root permissions and unlocked bootloader.",
|
||||||
compatiblePackages = [CompatiblePackage("at.gv.oe.app", ["3.0.2"])]
|
compatiblePackages = [CompatiblePackage("at.gv.oe.app")]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object RootDetectionPatch : BytecodePatch(
|
object RootDetectionPatch : BytecodePatch(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import app.revanced.patches.idaustria.detection.signature.fingerprints.SpoofSign
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Spoof signature",
|
name = "Spoof signature",
|
||||||
description = "Spoofs the signature of the app.",
|
description = "Spoofs the signature of the app.",
|
||||||
compatiblePackages = [CompatiblePackage("at.gv.oe.app", ["3.0.2"])]
|
compatiblePackages = [CompatiblePackage("at.gv.oe.app")]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpoofSignaturePatch : BytecodePatch(
|
object SpoofSignaturePatch : BytecodePatch(
|
||||||
|
|||||||
@@ -1,102 +1,63 @@
|
|||||||
package app.revanced.patches.instagram.patches.ads.timeline
|
package app.revanced.patches.instagram.patches.ads.timeline
|
||||||
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.smali.ExternalLabel
|
import app.revanced.patcher.util.smali.ExternalLabel
|
||||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.MediaFingerprint
|
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.IsAdCheckOneFingerprint
|
||||||
|
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.IsAdCheckTwoFingerprint
|
||||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ShowAdFingerprint
|
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ShowAdFingerprint
|
||||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.GenericMediaAdFingerprint
|
import app.revanced.util.exception
|
||||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.MediaAdFingerprint
|
|
||||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.PaidPartnershipAdFingerprint
|
|
||||||
import app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads.ShoppingAdFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Hide timeline ads",
|
name = "Hide timeline ads",
|
||||||
description = "Removes ads from the timeline.",
|
compatiblePackages = [CompatiblePackage("com.instagram.android")],
|
||||||
compatiblePackages = [CompatiblePackage("com.instagram.android", ["275.0.0.27.98"])]
|
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object HideTimelineAdsPatch : BytecodePatch(
|
object HideTimelineAdsPatch : BytecodePatch(
|
||||||
setOf(
|
setOf(
|
||||||
ShowAdFingerprint,
|
ShowAdFingerprint,
|
||||||
MediaFingerprint,
|
IsAdCheckOneFingerprint,
|
||||||
PaidPartnershipAdFingerprint // Unlike the other ads this one is resolved from all classes.
|
IsAdCheckTwoFingerprint,
|
||||||
)
|
),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
// region Resolve required methods to check for ads.
|
// The exact function of the following methods is unknown.
|
||||||
|
// They are used to check if a post is an ad.
|
||||||
|
val isAdCheckOneMethod = IsAdCheckOneFingerprint.result?.method ?: throw IsAdCheckOneFingerprint.exception
|
||||||
|
val isAdCheckTwoMethod = IsAdCheckTwoFingerprint.result?.method ?: throw IsAdCheckTwoFingerprint.exception
|
||||||
|
|
||||||
ShowAdFingerprint.result ?: throw ShowAdFingerprint.exception
|
ShowAdFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
// The register that holds the post object.
|
||||||
|
val postRegister = getInstruction<FiveRegisterInstruction>(1).registerC
|
||||||
|
|
||||||
PaidPartnershipAdFingerprint.result ?: throw PaidPartnershipAdFingerprint.exception
|
// At this index the check for an ad can be performed.
|
||||||
|
val checkIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
MediaFingerprint.result?.let {
|
// If either check returns true, the post is an ad and is hidden by returning false.
|
||||||
GenericMediaAdFingerprint.resolve(context, it.classDef)
|
|
||||||
ShoppingAdFingerprint.resolve(context, it.classDef)
|
|
||||||
|
|
||||||
return@let
|
|
||||||
} ?: throw MediaFingerprint.exception
|
|
||||||
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
ShowAdFingerprint.result!!.apply {
|
|
||||||
// region Create instructions.
|
|
||||||
|
|
||||||
val scanStart = scanResult.patternScanResult!!.startIndex
|
|
||||||
val jumpIndex = scanStart - 1
|
|
||||||
|
|
||||||
val mediaInstanceRegister = mutableMethod.getInstruction<FiveRegisterInstruction>(scanStart).registerC
|
|
||||||
val freeRegister = mutableMethod.getInstruction<OneRegisterInstruction>(jumpIndex).registerA
|
|
||||||
|
|
||||||
val returnFalseLabel = "an_ad"
|
|
||||||
|
|
||||||
val checkForAdInstructions =
|
|
||||||
listOf(GenericMediaAdFingerprint, PaidPartnershipAdFingerprint, ShoppingAdFingerprint)
|
|
||||||
.map(MediaAdFingerprint::toString)
|
|
||||||
.joinToString("\n") {
|
|
||||||
"""
|
|
||||||
invoke-virtual {v$mediaInstanceRegister}, $it
|
|
||||||
move-result v$freeRegister
|
|
||||||
if-nez v$freeRegister, :$returnFalseLabel
|
|
||||||
""".trimIndent()
|
|
||||||
}.let { "$it\nconst/4 v0, 0x1\nreturn v0" }
|
|
||||||
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Patch.
|
|
||||||
|
|
||||||
val insertIndex = scanStart + 3
|
|
||||||
|
|
||||||
mutableMethod.addInstructionsWithLabels(
|
|
||||||
insertIndex,
|
|
||||||
checkForAdInstructions,
|
|
||||||
ExternalLabel(
|
|
||||||
returnFalseLabel,
|
|
||||||
mutableMethod.getInstruction(mutableMethod.implementation!!.instructions.size - 2 /* return false = ad */)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
// endregion
|
|
||||||
|
|
||||||
// region Jump to checks for ads from previous patch.
|
|
||||||
|
|
||||||
mutableMethod.apply {
|
|
||||||
addInstructionsWithLabels(
|
addInstructionsWithLabels(
|
||||||
jumpIndex + 1,
|
checkIndex,
|
||||||
"if-nez v$freeRegister, :start_check",
|
"""
|
||||||
ExternalLabel("start_check", getInstruction(insertIndex))
|
invoke-virtual { v$postRegister }, $isAdCheckOneMethod
|
||||||
|
move-result v0
|
||||||
|
if-nez v0, :hide_ad
|
||||||
|
|
||||||
|
invoke-static { v$postRegister }, $isAdCheckTwoMethod
|
||||||
|
move-result v0
|
||||||
|
if-eqz v0, :not_an_ad
|
||||||
|
|
||||||
|
:hide_ad
|
||||||
|
const/4 v0, 0x0 # Returning false to hide the ad.
|
||||||
|
return v0
|
||||||
|
""",
|
||||||
|
ExternalLabel("not_an_ad", getInstruction(checkIndex)),
|
||||||
)
|
)
|
||||||
}.removeInstruction(jumpIndex)
|
}
|
||||||
|
} ?: throw ShowAdFingerprint.exception
|
||||||
// endregion
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object IsAdCheckOneFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
parameters = listOf(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.XOR_INT_LIT8,
|
||||||
|
Opcode.IF_NE,
|
||||||
|
Opcode.RETURN,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
),
|
||||||
|
)
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal object GenericMediaAdFingerprint : MediaAdFingerprint(
|
internal object IsAdCheckTwoFingerprint : MethodFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
parameters = listOf("L"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
@@ -12,7 +18,5 @@ internal object GenericMediaAdFingerprint : MediaAdFingerprint(
|
|||||||
Opcode.IF_EQZ,
|
Opcode.IF_EQZ,
|
||||||
Opcode.CONST_4,
|
Opcode.CONST_4,
|
||||||
Opcode.RETURN,
|
Opcode.RETURN,
|
||||||
)
|
),
|
||||||
) {
|
)
|
||||||
override fun toString() = result!!.method.toString()
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
|
|
||||||
internal object MediaFingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("force_overlay", "Media#updateFields", "live_reels_metadata")
|
|
||||||
)
|
|
||||||
@@ -10,16 +10,12 @@ internal object ShowAdFingerprint : MethodFingerprint(
|
|||||||
AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.FINAL,
|
||||||
listOf("L", "L", "Z", "Z"),
|
listOf("L", "L", "Z", "Z"),
|
||||||
opcodes = listOf(
|
opcodes = listOf(
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IF_NE,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
Opcode.INVOKE_STATIC,
|
Opcode.INVOKE_STATIC,
|
||||||
Opcode.MOVE_RESULT,
|
Opcode.MOVE_RESULT,
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
Opcode.RETURN,
|
Opcode.RETURN,
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.ClassDef
|
|
||||||
import com.android.tools.smali.dexlib2.iface.Method
|
|
||||||
|
|
||||||
internal abstract class MediaAdFingerprint(
|
|
||||||
returnType: String? = "Z",
|
|
||||||
accessFlags: Int? = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
parameters: Iterable<String>? = listOf(),
|
|
||||||
opcodes: Iterable<Opcode>?,
|
|
||||||
customFingerprint: ((methodDef: Method, classDef: ClassDef) -> Boolean)? = null
|
|
||||||
) : MethodFingerprint(
|
|
||||||
returnType,
|
|
||||||
accessFlags,
|
|
||||||
parameters,
|
|
||||||
opcodes,
|
|
||||||
customFingerprint = customFingerprint
|
|
||||||
) {
|
|
||||||
abstract override fun toString(): String
|
|
||||||
}
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
|
||||||
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
|
||||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
|
||||||
|
|
||||||
internal object PaidPartnershipAdFingerprint : MediaAdFingerprint(
|
|
||||||
"V",
|
|
||||||
null,
|
|
||||||
listOf("L", "L"),
|
|
||||||
listOf(
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
Opcode.IPUT_BOOLEAN
|
|
||||||
),
|
|
||||||
customFingerprint = { methodDef, _ ->
|
|
||||||
methodDef.definingClass.endsWith("ClipsEditMetadataController;")
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
override fun toString() = result!!.let {
|
|
||||||
val adCheckIndex = it.scanResult.patternScanResult!!.startIndex
|
|
||||||
val adCheckInstruction = it.method.implementation!!.instructions.elementAt(adCheckIndex)
|
|
||||||
|
|
||||||
val adCheckMethod = (adCheckInstruction as ReferenceInstruction).reference as MethodReference
|
|
||||||
|
|
||||||
adCheckMethod.toString()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
package app.revanced.patches.instagram.patches.ads.timeline.fingerprints.ads
|
|
||||||
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
internal object ShoppingAdFingerprint : MediaAdFingerprint(
|
|
||||||
opcodes = listOf(
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.XOR_INT_LIT8,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
)
|
|
||||||
) {
|
|
||||||
override fun toString() = result!!.method.toString()
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package app.revanced.patches.mifitness.misc.locale
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.mifitness.misc.locale.fingerprints.SyncBluetoothLanguageFingerprint
|
||||||
|
import app.revanced.patches.mifitness.misc.login.FixLoginPatch
|
||||||
|
import app.revanced.util.exception
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Force English locale",
|
||||||
|
description = "Forces wearable devices to use the English locale.",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.xiaomi.wearable")],
|
||||||
|
dependencies = [FixLoginPatch::class],
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object ForceEnglishLocalePatch : BytecodePatch(
|
||||||
|
setOf(SyncBluetoothLanguageFingerprint),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
SyncBluetoothLanguageFingerprint.result?.let {
|
||||||
|
val resolvePhoneLocaleInstruction = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val registerIndexToUpdate =
|
||||||
|
getInstruction<OneRegisterInstruction>(resolvePhoneLocaleInstruction).registerA
|
||||||
|
|
||||||
|
replaceInstruction(
|
||||||
|
resolvePhoneLocaleInstruction,
|
||||||
|
"const-string v$registerIndexToUpdate, \"en_gb\"",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw SyncBluetoothLanguageFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.mifitness.misc.locale.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object SyncBluetoothLanguageFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass == "Lcom/xiaomi/fitness/devicesettings/DeviceSettingsSyncer;" &&
|
||||||
|
methodDef.name == "syncBluetoothLanguage"
|
||||||
|
},
|
||||||
|
opcodes = listOf(Opcode.MOVE_RESULT_OBJECT),
|
||||||
|
)
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.revanced.patches.mifitness.misc.login
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.mifitness.misc.login.fingerprints.XiaomiAccountManagerConstructorFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Fix login",
|
||||||
|
description = "Fixes login for uncertified Mi Fitness app",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.xiaomi.wearable")],
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object FixLoginPatch : BytecodePatch(
|
||||||
|
setOf(XiaomiAccountManagerConstructorFingerprint),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
XiaomiAccountManagerConstructorFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
|
0,
|
||||||
|
"const/16 p2, 0x0",
|
||||||
|
) ?: throw XiaomiAccountManagerConstructorFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package app.revanced.patches.mifitness.misc.login.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
internal object XiaomiAccountManagerConstructorFingerprint : MethodFingerprint(
|
||||||
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.CONSTRUCTOR,
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass == "Lcom/xiaomi/passport/accountmanager/XiaomiAccountManager;"
|
||||||
|
},
|
||||||
|
parameters = listOf(
|
||||||
|
"Landroid/content/Context;",
|
||||||
|
"Z",
|
||||||
|
),
|
||||||
|
)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package app.revanced.patches.music.ad.video
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsParentFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hide music video ads",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object HideMusicVideoAds : BytecodePatch(
|
||||||
|
setOf(ShowMusicVideoAdsParentFingerprint),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
ShowMusicVideoAdsParentFingerprint.result?.let {
|
||||||
|
val showMusicVideoAdsMethod = context
|
||||||
|
.toMethodWalker(it.mutableMethod)
|
||||||
|
.nextMethod(it.scanResult.patternScanResult!!.startIndex + 1, true).getMethod() as MutableMethod
|
||||||
|
|
||||||
|
showMusicVideoAdsMethod.addInstruction(0, "const/4 p1, 0x0")
|
||||||
|
} ?: throw ShowMusicVideoAdsParentFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("This patch class has been renamed to HideMusicVideoAds.")
|
||||||
|
object MusicVideoAdsPatch : BytecodePatch(
|
||||||
|
dependencies = setOf(HideMusicVideoAds::class),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
package app.revanced.patches.music.ad.video
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsConstructorFingerprint
|
|
||||||
import app.revanced.patches.music.ad.video.fingerprints.ShowMusicVideoAdsFingerprint
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Music video ads",
|
|
||||||
description = "Removes ads in the music player.",
|
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object MusicVideoAdsPatch : BytecodePatch(
|
|
||||||
setOf(ShowMusicVideoAdsConstructorFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
ShowMusicVideoAdsFingerprint.resolve(context, ShowMusicVideoAdsConstructorFingerprint.result!!.classDef)
|
|
||||||
|
|
||||||
val result = ShowMusicVideoAdsFingerprint.result!!
|
|
||||||
|
|
||||||
result.mutableMethod.addInstruction(
|
|
||||||
result.scanResult.patternScanResult!!.startIndex,
|
|
||||||
"""
|
|
||||||
const/4 p1, 0x0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
package app.revanced.patches.music.ad.video.fingerprints
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
|
||||||
internal object ShowMusicVideoAdsConstructorFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L"), listOf(
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
Opcode.RETURN_VOID
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
package app.revanced.patches.music.ad.video.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
internal object ShowMusicVideoAdsFingerprint : MethodFingerprint(
|
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf("Z"), listOf(
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.RETURN_VOID
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.music.ad.video.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object ShowMusicVideoAdsParentFingerprint : MethodFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
),
|
||||||
|
strings = listOf("maybeRegenerateCpnAndStatsClient called unexpectedly, but no error."),
|
||||||
|
)
|
||||||
@@ -10,13 +10,12 @@ import app.revanced.patches.music.audio.codecs.fingerprints.CodecsLockFingerprin
|
|||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Codecs unlock",
|
|
||||||
description = "Adds more audio codec options. The new audio codecs usually result in better audio quality.",
|
description = "Adds more audio codec options. The new audio codecs usually result in better audio quality.",
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Deprecated("This patch is no longer needed as the feature is now enabled by default.")
|
||||||
object CodecsUnlockPatch : BytecodePatch(
|
object CodecsUnlockPatch : BytecodePatch(
|
||||||
setOf(CodecsLockFingerprint, AllCodecsReferenceFingerprint)
|
setOf(CodecsLockFingerprint, AllCodecsReferenceFingerprint),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
val codecsLockResult = CodecsLockFingerprint.result!!
|
val codecsLockResult = CodecsLockFingerprint.result!!
|
||||||
@@ -25,13 +24,13 @@ object CodecsUnlockPatch : BytecodePatch(
|
|||||||
|
|
||||||
val scanResultStartIndex = codecsLockResult.scanResult.patternScanResult!!.startIndex
|
val scanResultStartIndex = codecsLockResult.scanResult.patternScanResult!!.startIndex
|
||||||
val instructionIndex = scanResultStartIndex +
|
val instructionIndex = scanResultStartIndex +
|
||||||
if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) {
|
if (implementation.instructions[scanResultStartIndex - 1].opcode == Opcode.CHECK_CAST) {
|
||||||
// for 5.16.xx and lower
|
// for 5.16.xx and lower
|
||||||
-3
|
-3
|
||||||
} else {
|
} else {
|
||||||
// since 5.17.xx
|
// since 5.17.xx
|
||||||
-2
|
-2
|
||||||
}
|
}
|
||||||
|
|
||||||
val allCodecsResult = AllCodecsReferenceFingerprint.result!!
|
val allCodecsResult = AllCodecsReferenceFingerprint.result!!
|
||||||
val allCodecsMethod =
|
val allCodecsMethod =
|
||||||
@@ -41,7 +40,7 @@ object CodecsUnlockPatch : BytecodePatch(
|
|||||||
|
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
instructionIndex,
|
instructionIndex,
|
||||||
"invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction()
|
"invoke-static {}, ${allCodecsMethod.definingClass}->${allCodecsMethod.name}()Ljava/util/Set;".toInstruction(),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,31 +1,36 @@
|
|||||||
package app.revanced.patches.music.audio.exclusiveaudio
|
package app.revanced.patches.music.audio.exclusiveaudio
|
||||||
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint
|
import app.revanced.patches.music.audio.exclusiveaudio.fingerprints.AllowExclusiveAudioPlaybackFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Exclusive audio playback",
|
name = "Enable exclusive audio playback",
|
||||||
description = "Enables the option to play audio without video.",
|
description = "Enables the option to play audio without video.",
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object ExclusiveAudioPatch : BytecodePatch(
|
object EnableExclusiveAudioPlayback : BytecodePatch(
|
||||||
setOf(AllowExclusiveAudioPlaybackFingerprint)
|
setOf(AllowExclusiveAudioPlaybackFingerprint),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply {
|
AllowExclusiveAudioPlaybackFingerprint.result?.mutableMethod?.apply {
|
||||||
addInstructions(
|
addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
const/4 v0, 0x1
|
const/4 v0, 0x1
|
||||||
return v0
|
return v0
|
||||||
"""
|
""",
|
||||||
)
|
)
|
||||||
} ?: throw AllowExclusiveAudioPlaybackFingerprint.exception
|
} ?: throw AllowExclusiveAudioPlaybackFingerprint.exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("This patch class has been renamed to EnableExclusiveAudioPlayback.")
|
||||||
|
object ExclusiveAudioPatch : BytecodePatch(emptySet()) {
|
||||||
|
override fun execute(context: BytecodeContext) = EnableExclusiveAudioPlayback.execute(context)
|
||||||
|
}
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
package app.revanced.patches.music.audio.exclusiveaudio.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
|
||||||
internal object ExclusiveAudioFingerprint : MethodFingerprint(
|
|
||||||
"V",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
|
||||||
listOf("L", "Z"),
|
|
||||||
listOf(
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQ,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.NOP,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.INVOKE_VIRTUAL,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.RETURN_VOID
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,25 +1,32 @@
|
|||||||
package app.revanced.patches.music.interaction.permanentshuffle
|
package app.revanced.patches.music.interaction.permanentshuffle
|
||||||
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint
|
import app.revanced.patches.music.interaction.permanentshuffle.fingerprints.DisableShuffleFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Permanent shuffle",
|
name = "Permanent shuffle",
|
||||||
description = "Permanently remember your shuffle preference " +
|
description = "Permanently remember your shuffle preference " +
|
||||||
"even if the playlist ends or another track is played.",
|
"even if the playlist ends or another track is played.",
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object PermanentShuffleTogglePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) {
|
object PermanentShufflePatch : BytecodePatch(setOf(DisableShuffleFingerprint)) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
|
DisableShuffleFingerprint.result?.mutableMethod?.addInstruction(0, "return-void")
|
||||||
?: throw DisableShuffleFingerprint.exception
|
?: throw DisableShuffleFingerprint.exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("This patch class has been renamed to PermanentShufflePatch.")
|
||||||
|
object PermanentShuffleTogglePatch : BytecodePatch(
|
||||||
|
dependencies = setOf(PermanentShufflePatch::class),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,34 +0,0 @@
|
|||||||
package app.revanced.patches.music.layout.compactheader
|
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
|
||||||
import app.revanced.patches.music.layout.compactheader.fingerprints.CompactHeaderConstructorFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction11x
|
|
||||||
|
|
||||||
@Patch(
|
|
||||||
name = "Compact header",
|
|
||||||
description = "Hides the music category bar at the top of the homepage.",
|
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
|
||||||
use = false
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object CompactHeaderPatch : BytecodePatch(
|
|
||||||
setOf(CompactHeaderConstructorFingerprint)
|
|
||||||
) {
|
|
||||||
override fun execute(context: BytecodeContext) {
|
|
||||||
val result = CompactHeaderConstructorFingerprint.result!!
|
|
||||||
val method = result.mutableMethod
|
|
||||||
|
|
||||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
|
||||||
val register = (method.implementation!!.instructions[insertIndex - 1] as BuilderInstruction11x).registerA
|
|
||||||
method.addInstructions(
|
|
||||||
insertIndex, """
|
|
||||||
const/16 v2, 0x8
|
|
||||||
invoke-virtual {v${register}, v2}, Landroid/view/View;->setVisibility(I)V
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.music.layout.compactheader
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.music.layout.compactheader.fingerprints.ConstructCategoryBarFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hide category bar",
|
||||||
|
description = "Hides the category bar at the top of the homepage.",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
|
use = false,
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object HideCategoryBar : BytecodePatch(
|
||||||
|
setOf(ConstructCategoryBarFingerprint),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
ConstructCategoryBarFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.startIndex
|
||||||
|
val register = getInstruction<OneRegisterInstruction>(insertIndex - 1).registerA
|
||||||
|
|
||||||
|
addInstructions(
|
||||||
|
insertIndex,
|
||||||
|
"""
|
||||||
|
const/16 v2, 0x8
|
||||||
|
invoke-virtual {v$register, v2}, Landroid/view/View;->setVisibility(I)V
|
||||||
|
""",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw ConstructCategoryBarFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Deprecated("This patch class has been renamed to HideCategoryBar.")
|
||||||
|
object CompactHeaderPatch : BytecodePatch(
|
||||||
|
dependencies = setOf(HideCategoryBar::class),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,19 +5,19 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
|||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal object CompactHeaderConstructorFingerprint : MethodFingerprint(
|
internal object ConstructCategoryBarFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR, listOf("L", "L", "L", "L", "L"), listOf(
|
"V",
|
||||||
Opcode.INVOKE_DIRECT,
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
Opcode.IPUT_OBJECT,
|
listOf("Landroid/content/Context;", "L", "L", "L"),
|
||||||
Opcode.IPUT_OBJECT,
|
listOf(
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
Opcode.CONST,
|
Opcode.CONST,
|
||||||
Opcode.CONST_4,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.INVOKE_STATIC,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.CHECK_CAST
|
Opcode.IPUT_OBJECT,
|
||||||
)
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
@@ -1,26 +1,39 @@
|
|||||||
package app.revanced.patches.music.layout.minimizedplayback
|
package app.revanced.patches.music.layout.minimizedplayback
|
||||||
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
|
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.BackgroundPlaybackDisableFingerprint
|
||||||
|
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Minimized playback music",
|
name = "Minimized playback",
|
||||||
description = "Enables minimized playback on Kids music.",
|
description = "Unlocks options for picture-in-picture and background playback.",
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object MinimizedPlaybackPatch : BytecodePatch(setOf(MinimizedPlaybackManagerFingerprint)) {
|
object MinimizedPlaybackPatch : BytecodePatch(
|
||||||
override fun execute(context: BytecodeContext) =
|
setOf(
|
||||||
MinimizedPlaybackManagerFingerprint.result?.mutableMethod?.addInstruction(
|
KidsMinimizedPlaybackPolicyControllerFingerprint,
|
||||||
|
BackgroundPlaybackDisableFingerprint,
|
||||||
|
),
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
KidsMinimizedPlaybackPolicyControllerFingerprint.result?.mutableMethod?.addInstruction(
|
||||||
|
0,
|
||||||
|
"return-void",
|
||||||
|
) ?: throw KidsMinimizedPlaybackPolicyControllerFingerprint.exception
|
||||||
|
|
||||||
|
BackgroundPlaybackDisableFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
0,
|
0,
|
||||||
"""
|
"""
|
||||||
return-void
|
const/4 v0, 0x1
|
||||||
"""
|
return v0
|
||||||
) ?: throw MinimizedPlaybackManagerFingerprint.exception
|
""",
|
||||||
|
) ?: throw BackgroundPlaybackDisableFingerprint.exception
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patches.music.layout.minimizedplayback.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object BackgroundPlaybackDisableFingerprint : MethodFingerprint(
|
||||||
|
"Z",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
|
listOf("L"),
|
||||||
|
listOf(
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IGET,
|
||||||
|
Opcode.AND_INT_LIT16,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.SGET_OBJECT,
|
||||||
|
Opcode.IGET,
|
||||||
|
),
|
||||||
|
)
|
||||||
@@ -5,7 +5,7 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
|||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
|
internal object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
listOf("I", "L", "Z"),
|
listOf("I", "L", "Z"),
|
||||||
@@ -22,5 +22,5 @@ internal object MinimizedPlaybackManagerFingerprint : MethodFingerprint(
|
|||||||
Opcode.CONST_4,
|
Opcode.CONST_4,
|
||||||
Opcode.IF_NE,
|
Opcode.IF_NE,
|
||||||
Opcode.IPUT_BOOLEAN,
|
Opcode.IPUT_BOOLEAN,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
@@ -2,41 +2,57 @@ package app.revanced.patches.music.layout.premium
|
|||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint
|
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumFingerprint
|
||||||
import app.revanced.patches.music.layout.premium.fingerprints.HideGetPremiumParentFingerprint
|
import app.revanced.patches.music.layout.premium.fingerprints.MembershipSettingsFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Hide get premium",
|
name = "Hide 'Get Music Premium' label",
|
||||||
description = "Removes all \"Get Premium\" evidences from the avatar menu.",
|
description = "Hides the \"Get Music Premium\" label from the account menu and settings.",
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object HideGetPremiumPatch : BytecodePatch(setOf(HideGetPremiumParentFingerprint)) {
|
object HideGetPremiumPatch : BytecodePatch(
|
||||||
|
setOf(
|
||||||
|
HideGetPremiumFingerprint,
|
||||||
|
MembershipSettingsFingerprint,
|
||||||
|
),
|
||||||
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
val parentResult = HideGetPremiumParentFingerprint.result!!
|
HideGetPremiumFingerprint.result?.let {
|
||||||
HideGetPremiumFingerprint.resolve(context, parentResult.classDef)
|
it.mutableMethod.apply {
|
||||||
|
val insertIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
val startIndex = parentResult.scanResult.patternScanResult!!.startIndex
|
val setVisibilityInstruction = getInstruction<FiveRegisterInstruction>(insertIndex)
|
||||||
|
val getPremiumViewRegister = setVisibilityInstruction.registerC
|
||||||
|
val visibilityRegister = setVisibilityInstruction.registerD
|
||||||
|
|
||||||
val parentMethod = parentResult.mutableMethod
|
replaceInstruction(
|
||||||
parentMethod.replaceInstruction(
|
insertIndex,
|
||||||
startIndex,
|
"const/16 v$visibilityRegister, 0x8",
|
||||||
"""
|
)
|
||||||
const/4 v1, 0x0
|
|
||||||
"""
|
|
||||||
)
|
|
||||||
|
|
||||||
val result = HideGetPremiumFingerprint.result!!
|
addInstruction(
|
||||||
val method = result.mutableMethod
|
insertIndex + 1,
|
||||||
method.addInstruction(
|
"invoke-virtual {v$getPremiumViewRegister, v$visibilityRegister}, " +
|
||||||
startIndex,
|
"Landroid/view/View;->setVisibility(I)V",
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} ?: throw HideGetPremiumFingerprint.exception
|
||||||
|
|
||||||
|
MembershipSettingsFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
|
0,
|
||||||
"""
|
"""
|
||||||
const/16 v0, 0x8
|
const/4 v0, 0x0
|
||||||
"""
|
return-object v0
|
||||||
)
|
""",
|
||||||
|
) ?: throw MembershipSettingsFingerprint.exception
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,11 +6,15 @@ import com.android.tools.smali.dexlib2.AccessFlags
|
|||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal object HideGetPremiumFingerprint : MethodFingerprint(
|
internal object HideGetPremiumFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
|
"V",
|
||||||
|
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
listOf(),
|
||||||
|
listOf(
|
||||||
Opcode.IF_NEZ,
|
Opcode.IF_NEZ,
|
||||||
Opcode.CONST_16,
|
Opcode.CONST_16,
|
||||||
Opcode.GOTO,
|
Opcode.GOTO,
|
||||||
Opcode.NOP,
|
Opcode.NOP,
|
||||||
Opcode.INVOKE_VIRTUAL
|
Opcode.INVOKE_VIRTUAL,
|
||||||
)
|
),
|
||||||
|
listOf("FEmusic_history", "FEmusic_offline"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -5,15 +5,16 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
|||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
internal object HideGetPremiumParentFingerprint : MethodFingerprint(
|
internal object MembershipSettingsFingerprint : MethodFingerprint(
|
||||||
"V", AccessFlags.PUBLIC or AccessFlags.FINAL, listOf(), listOf(
|
returnType = "Ljava/lang/CharSequence;",
|
||||||
Opcode.IGET_BOOLEAN,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
Opcode.CONST_4,
|
opcodes = listOf(
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
Opcode.IGET_OBJECT,
|
||||||
|
Opcode.INVOKE_INTERFACE,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.INVOKE_VIRTUAL,
|
Opcode.INVOKE_VIRTUAL,
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
Opcode.INVOKE_STATIC
|
Opcode.IF_EQZ,
|
||||||
),
|
Opcode.IGET_OBJECT
|
||||||
listOf("FEmusic_history"),
|
)
|
||||||
)
|
)
|
||||||
@@ -1,71 +1,84 @@
|
|||||||
package app.revanced.patches.music.layout.upgradebutton
|
package app.revanced.patches.music.layout.upgradebutton
|
||||||
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.newLabel
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patcher.util.smali.toInstructions
|
import app.revanced.patcher.util.smali.toInstructions
|
||||||
import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
import app.revanced.patches.music.layout.upgradebutton.fingerprints.PivotBarConstructorFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
import app.revanced.util.getReference
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction22t
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction22c
|
|
||||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Remove upgrade button",
|
name = "Remove upgrade button",
|
||||||
description = "Removes the upgrade tab from the pivot bar.",
|
description = "Removes the upgrade tab from the pivot bar.",
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object RemoveUpgradeButtonPatch : BytecodePatch(
|
object RemoveUpgradeButtonPatch : BytecodePatch(
|
||||||
setOf(PivotBarConstructorFingerprint)
|
setOf(PivotBarConstructorFingerprint),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) {
|
override fun execute(context: BytecodeContext) {
|
||||||
val result = PivotBarConstructorFingerprint.result!!
|
PivotBarConstructorFingerprint.result?.let {
|
||||||
val implementation = result.mutableMethod.implementation!!
|
it.mutableMethod.apply {
|
||||||
|
val pivotBarElementFieldReference = getInstruction(it.scanResult.patternScanResult!!.endIndex - 1)
|
||||||
|
.getReference<FieldReference>()
|
||||||
|
|
||||||
val pivotBarElementFieldRef =
|
val register = (getInstructions().first() as Instruction35c).registerC
|
||||||
(implementation.instructions[result.scanResult.patternScanResult!!.endIndex - 1] as Instruction22c).reference
|
|
||||||
|
|
||||||
val register = (implementation.instructions.first() as Instruction35c).registerC
|
// First compile all the needed instructions.
|
||||||
// first compile all the needed instructions
|
val instructionList = """
|
||||||
val instructionList = """
|
invoke-interface { v0 }, Ljava/util/List;->size()I
|
||||||
invoke-interface { v0 }, Ljava/util/List;->size()I
|
move-result v1
|
||||||
move-result v1
|
const/4 v2, 0x4
|
||||||
const/4 v2, 0x4
|
invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
|
||||||
invoke-interface {v0, v2}, Ljava/util/List;->remove(I)Ljava/lang/Object;
|
iput-object v0, v$register, $pivotBarElementFieldReference
|
||||||
iput-object v0, v$register, $pivotBarElementFieldRef
|
""".toInstructions().toMutableList()
|
||||||
""".toInstructions().toMutableList()
|
|
||||||
|
|
||||||
|
val endIndex = it.scanResult.patternScanResult!!.endIndex
|
||||||
|
|
||||||
val endIndex = result.scanResult.patternScanResult!!.endIndex
|
// Replace the instruction to retain the label at given index.
|
||||||
|
replaceInstruction(
|
||||||
|
endIndex - 1,
|
||||||
|
instructionList[0], // invoke-interface.
|
||||||
|
)
|
||||||
|
// Do not forget to remove this instruction since we added it already.
|
||||||
|
instructionList.removeFirst()
|
||||||
|
|
||||||
// replace the instruction to retain the label at given index
|
val exitInstruction = instructionList.last() // iput-object
|
||||||
implementation.replaceInstruction(
|
addInstruction(
|
||||||
endIndex - 1, instructionList[0] // invoke-interface
|
endIndex,
|
||||||
)
|
exitInstruction,
|
||||||
// do not forget to remove this instruction since we added it already
|
)
|
||||||
instructionList.removeFirst()
|
// Do not forget to remove this instruction since we added it already.
|
||||||
|
instructionList.removeLast()
|
||||||
|
|
||||||
val exitInstruction = instructionList.last() // iput-object
|
// Add the necessary if statement to remove the upgrade tab button in case it exists.
|
||||||
implementation.addInstruction(
|
instructionList.add(
|
||||||
endIndex, exitInstruction
|
2, // if-le.
|
||||||
)
|
BuilderInstruction22t(
|
||||||
// do not forget to remove this instruction since we added it already
|
Opcode.IF_LE,
|
||||||
instructionList.removeLast()
|
1,
|
||||||
|
2,
|
||||||
|
newLabel(endIndex),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
// add the necessary if statement to remove the upgrade tab button in case it exists
|
addInstructions(
|
||||||
instructionList.add(
|
endIndex,
|
||||||
2, // if-le
|
instructionList,
|
||||||
BuilderInstruction22t(
|
)
|
||||||
Opcode.IF_LE, 1, 2, implementation.newLabelForIndex(endIndex)
|
}
|
||||||
)
|
} ?: throw PivotBarConstructorFingerprint.exception
|
||||||
)
|
|
||||||
|
|
||||||
implementation.addInstructions(
|
|
||||||
endIndex, instructionList
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,62 +1,20 @@
|
|||||||
package app.revanced.patches.music.layout.upgradebutton.fingerprints
|
package app.revanced.patches.music.layout.upgradebutton.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
|
||||||
internal object PivotBarConstructorFingerprint : MethodFingerprint(
|
internal object PivotBarConstructorFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
listOf("L", "Z"),
|
listOf("L", "Z"),
|
||||||
listOf(
|
listOf(
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_OBJECT,
|
|
||||||
Opcode.IPUT_BOOLEAN,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IF_NEZ,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.NEW_INSTANCE,
|
|
||||||
Opcode.INVOKE_DIRECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.CONST,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.SGET_OBJECT,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.INVOKE_INTERFACE,
|
|
||||||
Opcode.MOVE_RESULT_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.CONST,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
Opcode.CHECK_CAST,
|
||||||
Opcode.INVOKE_INTERFACE,
|
Opcode.INVOKE_INTERFACE,
|
||||||
Opcode.GOTO,
|
Opcode.GOTO,
|
||||||
Opcode.NOP,
|
Opcode.NOP,
|
||||||
Opcode.IPUT_OBJECT,
|
Opcode.IPUT_OBJECT,
|
||||||
Opcode.RETURN_VOID
|
Opcode.RETURN_VOID,
|
||||||
)
|
),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,15 +2,16 @@ package app.revanced.patches.music.misc.gms
|
|||||||
|
|
||||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption
|
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
import app.revanced.patches.music.misc.gms.fingerprints.*
|
import app.revanced.patches.music.misc.gms.fingerprints.*
|
||||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch
|
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.misc.gms.fingerprints.CastContextFetchFingerprint
|
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
|
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
fromPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
fromPackageName = MUSIC_PACKAGE_NAME,
|
||||||
toPackageName = MUSIC_PACKAGE_NAME,
|
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
||||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||||
earlyReturnFingerprints = setOf(
|
earlyReturnFingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
ServiceCheckFingerprint,
|
||||||
@@ -19,7 +20,9 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
|||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
),
|
),
|
||||||
abstractGmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
mainActivityOnCreateFingerprint = MusicActivityOnCreateFingerprint,
|
||||||
|
integrationsPatchDependency = IntegrationsPatch::class,
|
||||||
|
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||||
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
|
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
ServiceCheckFingerprint,
|
||||||
@@ -28,7 +31,7 @@ object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
|||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
PrimeMethodFingerprint,
|
PrimeMethodFingerprint,
|
||||||
)
|
),
|
||||||
) {
|
) {
|
||||||
override val gmsCoreVendor by gmsCoreVendorOption
|
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@ package app.revanced.patches.music.misc.gms
|
|||||||
|
|
||||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportResourcePatch
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportResourcePatch
|
||||||
|
|
||||||
object GmsCoreSupportResourcePatch : AbstractGmsCoreSupportResourcePatch(
|
object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch(
|
||||||
fromPackageName = MUSIC_PACKAGE_NAME,
|
fromPackageName = MUSIC_PACKAGE_NAME,
|
||||||
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
||||||
spoofedPackageSignature = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
spoofedPackageSignature = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.music.misc.gms.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object MusicActivityOnCreateFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
parameters = listOf("Landroid/os/Bundle;"),
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "onCreate" && classDef.type.endsWith("/MusicActivity;")
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -1,14 +1,12 @@
|
|||||||
package app.revanced.patches.music.misc.gms.fingerprints
|
package app.revanced.patches.music.misc.gms.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
|
||||||
internal object ServiceCheckFingerprint : MethodFingerprint(
|
internal object ServiceCheckFingerprint : MethodFingerprint(
|
||||||
"V",
|
"V",
|
||||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
listOf("L", "I"),
|
listOf("L", "I"),
|
||||||
strings = listOf("Google Play Services not available")
|
strings = listOf("Google Play Services not available"),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.music.misc.integrations
|
||||||
|
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.music.misc.integrations.fingerprints.ApplicationInitFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch
|
||||||
|
|
||||||
|
@Patch(requiresIntegrations = true)
|
||||||
|
object IntegrationsPatch : BaseIntegrationsPatch(
|
||||||
|
setOf(ApplicationInitFingerprint),
|
||||||
|
)
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.revanced.patches.music.misc.integrations.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object ApplicationInitFingerprint : IntegrationsFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
parameters = emptyList(),
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.NEW_INSTANCE,
|
||||||
|
Opcode.INVOKE_DIRECT,
|
||||||
|
Opcode.INVOKE_VIRTUAL
|
||||||
|
),
|
||||||
|
strings = listOf("activity"),
|
||||||
|
customFingerprint = { methodDef, _ -> methodDef.name == "onCreate" },
|
||||||
|
)
|
||||||
@@ -1,26 +1,12 @@
|
|||||||
package app.revanced.patches.music.premium.backgroundplay
|
package app.revanced.patches.music.premium.backgroundplay
|
||||||
|
|
||||||
import app.revanced.util.exception
|
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
import app.revanced.patches.music.layout.minimizedplayback.MinimizedPlaybackPatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
@Deprecated("This patch has been merged into MinimizedPlaybackPatch.")
|
||||||
import app.revanced.patches.music.premium.backgroundplay.fingerprints.BackgroundPlaybackDisableFingerprint
|
object BackgroundPlayPatch : BytecodePatch(
|
||||||
|
dependencies = setOf(MinimizedPlaybackPatch::class),
|
||||||
|
) {
|
||||||
@Patch(
|
override fun execute(context: BytecodeContext) {
|
||||||
name = "Background play",
|
}
|
||||||
description = "Enables playing music in the background.",
|
}
|
||||||
compatiblePackages = [CompatiblePackage("com.google.android.apps.youtube.music")]
|
|
||||||
)
|
|
||||||
@Suppress("unused")
|
|
||||||
object BackgroundPlayPatch : BytecodePatch(setOf(BackgroundPlaybackDisableFingerprint)) {
|
|
||||||
override fun execute(context: BytecodeContext) =
|
|
||||||
BackgroundPlaybackDisableFingerprint.result?.mutableMethod?.addInstructions(
|
|
||||||
0, """
|
|
||||||
const/4 v0, 0x1
|
|
||||||
return v0
|
|
||||||
"""
|
|
||||||
) ?: throw BackgroundPlaybackDisableFingerprint.exception
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
package app.revanced.patches.music.premium.backgroundplay.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.annotation.FuzzyPatternScanMethod
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
import com.android.tools.smali.dexlib2.Opcode
|
|
||||||
|
|
||||||
|
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
|
||||||
internal object BackgroundPlaybackDisableFingerprint : MethodFingerprint(
|
|
||||||
"Z", AccessFlags.PUBLIC or AccessFlags.STATIC, listOf("L"), listOf(
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.AND_INT_LIT16,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IF_NEZ,
|
|
||||||
Opcode.SGET_OBJECT,
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.CONST,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.IF_NEZ,
|
|
||||||
Opcode.SGET_OBJECT,
|
|
||||||
Opcode.IGET,
|
|
||||||
Opcode.IF_NE,
|
|
||||||
Opcode.IGET_OBJECT,
|
|
||||||
Opcode.CHECK_CAST,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.SGET_OBJECT,
|
|
||||||
Opcode.GOTO,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.IGET_BOOLEAN,
|
|
||||||
Opcode.IF_EQZ,
|
|
||||||
Opcode.CONST_4,
|
|
||||||
Opcode.RETURN,
|
|
||||||
Opcode.RETURN,
|
|
||||||
Opcode.RETURN
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package app.revanced.patches.myfitnesspal.ads
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.myfitnesspal.ads.fingerprints.IsPremiumUseCaseImplFingerprint
|
||||||
|
import app.revanced.patches.myfitnesspal.ads.fingerprints.MainActivityNavigateToNativePremiumUpsellFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hide ads",
|
||||||
|
description = "Hides most of the ads across the app.",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.myfitnesspal.android")]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object HideAdsPatch : BytecodePatch(
|
||||||
|
setOf(IsPremiumUseCaseImplFingerprint, MainActivityNavigateToNativePremiumUpsellFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
// Overwrite the premium status specifically for ads.
|
||||||
|
IsPremiumUseCaseImplFingerprint.result?.mutableMethod?.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"""
|
||||||
|
sget-object v0, Ljava/lang/Boolean;->TRUE:Ljava/lang/Boolean;
|
||||||
|
return-object v0
|
||||||
|
"""
|
||||||
|
) ?: throw IsPremiumUseCaseImplFingerprint.exception
|
||||||
|
|
||||||
|
// Prevent the premium upsell dialog from showing when the main activity is launched.
|
||||||
|
// In other places that are premium-only the dialog will still show.
|
||||||
|
MainActivityNavigateToNativePremiumUpsellFingerprint.result?.mutableMethod?.replaceInstructions(
|
||||||
|
0,
|
||||||
|
"return-void"
|
||||||
|
) ?: throw MainActivityNavigateToNativePremiumUpsellFingerprint.exception
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.myfitnesspal.ads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object IsPremiumUseCaseImplFingerprint : MethodFingerprint(
|
||||||
|
accessFlags = AccessFlags.PUBLIC.value,
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
classDef.type.endsWith("IsPremiumUseCaseImpl;") && methodDef.name == "doWork"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.revanced.patches.myfitnesspal.ads.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
object MainActivityNavigateToNativePremiumUpsellFingerprint : MethodFingerprint(
|
||||||
|
returnType = "V",
|
||||||
|
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
classDef.type.endsWith("MainActivity;") && methodDef.name == "navigateToNativePremiumUpsell"
|
||||||
|
}
|
||||||
|
)
|
||||||
@@ -6,23 +6,24 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
|||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import org.w3c.dom.Element
|
import org.w3c.dom.Element
|
||||||
|
|
||||||
|
|
||||||
@Patch(
|
@Patch(
|
||||||
name = "Remove broadcasts restriction",
|
name = "Remove broadcasts restriction",
|
||||||
description = "Enables starting/stopping NetGuard via broadcasts.",
|
description = "Enables starting/stopping NetGuard via broadcasts.",
|
||||||
compatiblePackages = [CompatiblePackage("eu.faircode.netguard")],
|
compatiblePackages = [CompatiblePackage("eu.faircode.netguard")],
|
||||||
use = false
|
use = false,
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object RemoveBroadcastsRestrictionPatch : ResourcePatch() {
|
object RemoveBroadcastsRestrictionPatch : ResourcePatch() {
|
||||||
override fun execute(context: ResourceContext) {
|
override fun execute(context: ResourceContext) {
|
||||||
context.xmlEditor["AndroidManifest.xml"].use { dom ->
|
context.xmlEditor["AndroidManifest.xml"].use { editor ->
|
||||||
val applicationNode = dom
|
val document = editor.file
|
||||||
.file
|
|
||||||
.getElementsByTagName("application")
|
|
||||||
.item(0) as Element
|
|
||||||
|
|
||||||
applicationNode.getElementsByTagName("receiver").also { list ->
|
val applicationNode =
|
||||||
|
document
|
||||||
|
.getElementsByTagName("application")
|
||||||
|
.item(0) as Element
|
||||||
|
|
||||||
|
applicationNode.getElementsByTagName("receiver").also { list ->
|
||||||
for (i in 0 until list.length) {
|
for (i in 0 until list.length) {
|
||||||
val element = list.item(i) as? Element ?: continue
|
val element = list.item(i) as? Element ?: continue
|
||||||
if (element.getAttribute("android:name") == "eu.faircode.netguard.WidgetAdmin") {
|
if (element.getAttribute("android:name") == "eu.faircode.netguard.WidgetAdmin") {
|
||||||
|
|||||||
@@ -0,0 +1,115 @@
|
|||||||
|
package app.revanced.patches.openinghours.misc.fix.crash
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.extensions.newLabel
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.openinghours.misc.fix.crash.fingerprints.SetPlaceFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21t
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Fix crash",
|
||||||
|
compatiblePackages = [CompatiblePackage("de.simon.openinghours", ["1.0"])],
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object FixCrashPatch : BytecodePatch(
|
||||||
|
setOf(SetPlaceFingerprint),
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
SetPlaceFingerprint.result?.let {
|
||||||
|
val indexedInstructions = it.mutableMethod.getInstructions().withIndex().toList()
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function replaces all `checkNotNull` instructions in the integer interval
|
||||||
|
* from [startIndex] to [endIndex], both inclusive. In place of the `checkNotNull`
|
||||||
|
* instruction an if-null check is inserted. If the if-null check yields that
|
||||||
|
* the value is indeed null, we jump to a newly created label at `endIndex + 1`.
|
||||||
|
*/
|
||||||
|
fun avoidNullPointerException(startIndex: Int, endIndex: Int) {
|
||||||
|
val continueLabel = it.mutableMethod.newLabel(endIndex + 1)
|
||||||
|
|
||||||
|
for (index in startIndex..endIndex) {
|
||||||
|
val instruction = indexedInstructions[index].value
|
||||||
|
|
||||||
|
if (!instruction.isCheckNotNullInstruction) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
val checkNotNullInstruction = instruction as FiveRegisterInstruction
|
||||||
|
val originalRegister = checkNotNullInstruction.registerC
|
||||||
|
|
||||||
|
it.mutableMethod.replaceInstruction(
|
||||||
|
index,
|
||||||
|
BuilderInstruction21t(
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
originalRegister,
|
||||||
|
continueLabel,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val getOpeningHoursIndex = getIndicesOfInvoke(
|
||||||
|
indexedInstructions,
|
||||||
|
"Lde/simon/openinghours/models/Place;",
|
||||||
|
"getOpeningHours",
|
||||||
|
)
|
||||||
|
|
||||||
|
val setWeekDayTextIndex = getIndexOfInvoke(
|
||||||
|
indexedInstructions,
|
||||||
|
"Lde/simon/openinghours/views/custom/PlaceCard;",
|
||||||
|
"setWeekDayText",
|
||||||
|
)
|
||||||
|
|
||||||
|
val startCalculateStatusIndex = getIndexOfInvoke(
|
||||||
|
indexedInstructions,
|
||||||
|
"Lde/simon/openinghours/views/custom/PlaceCard;",
|
||||||
|
"startCalculateStatus",
|
||||||
|
)
|
||||||
|
|
||||||
|
// Replace the Intrinsics;->checkNotNull instructions with a null check
|
||||||
|
// and jump to our newly created label if it returns true.
|
||||||
|
// This avoids the NullPointerExceptions.
|
||||||
|
avoidNullPointerException(getOpeningHoursIndex[1], startCalculateStatusIndex)
|
||||||
|
avoidNullPointerException(getOpeningHoursIndex[0], setWeekDayTextIndex)
|
||||||
|
} ?: throw SetPlaceFingerprint.exception
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun isInvokeInstruction(instruction: Instruction, className: String, methodName: String): Boolean {
|
||||||
|
val methodRef = instruction.getReference<MethodReference>() ?: return false
|
||||||
|
return methodRef.definingClass == className && methodRef.name == methodName
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getIndicesOfInvoke(
|
||||||
|
instructions: List<IndexedValue<Instruction>>,
|
||||||
|
className: String,
|
||||||
|
methodName: String,
|
||||||
|
): List<Int> = instructions.mapNotNull { (index, instruction) ->
|
||||||
|
if (isInvokeInstruction(instruction, className, methodName)) {
|
||||||
|
index
|
||||||
|
} else {
|
||||||
|
null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getIndexOfInvoke(
|
||||||
|
instructions: List<IndexedValue<Instruction>>,
|
||||||
|
className: String,
|
||||||
|
methodName: String,
|
||||||
|
): Int = instructions.first { (_, instruction) ->
|
||||||
|
isInvokeInstruction(instruction, className, methodName)
|
||||||
|
}.index
|
||||||
|
|
||||||
|
private val Instruction.isCheckNotNullInstruction
|
||||||
|
get() = isInvokeInstruction(this, "Lkotlin/jvm/internal/Intrinsics;", "checkNotNull")
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package app.revanced.patches.openinghours.misc.fix.crash.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object SetPlaceFingerprint : MethodFingerprint(
|
||||||
|
"V",
|
||||||
|
parameters = listOf("Lde/simon/openinghours/models/Place;"),
|
||||||
|
customFingerprint = { methodDef, _ ->
|
||||||
|
methodDef.definingClass == "Lde/simon/openinghours/views/custom/PlaceCard;" &&
|
||||||
|
methodDef.name == "setPlace"
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -14,7 +14,7 @@ import kotlin.random.Random
|
|||||||
name = "Spoof device ID",
|
name = "Spoof device ID",
|
||||||
description = "Spoofs device ID to mitigate manual bans by developers.",
|
description = "Spoofs device ID to mitigate manual bans by developers.",
|
||||||
dependencies = [SignatureDetectionPatch::class],
|
dependencies = [SignatureDetectionPatch::class],
|
||||||
compatiblePackages = [CompatiblePackage("com.microblink.photomath")]
|
compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])]
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object SpoofDeviceIdPatch : BytecodePatch(
|
object SpoofDeviceIdPatch : BytecodePatch(
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.revanced.patches.photomath.misc.annoyances
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.photomath.detection.signature.SignatureDetectionPatch
|
||||||
|
import app.revanced.patches.photomath.misc.annoyances.fingerprints.HideUpdatePopupFingerprint
|
||||||
|
import app.revanced.util.exception
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hide update popup",
|
||||||
|
description = "Prevents the update popup from showing up.",
|
||||||
|
dependencies = [SignatureDetectionPatch::class],
|
||||||
|
compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])]
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object HideUpdatePopupPatch : BytecodePatch(
|
||||||
|
setOf(HideUpdatePopupFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) = HideUpdatePopupFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
|
2, // Insert after the null check.
|
||||||
|
"return-void"
|
||||||
|
) ?: throw HideUpdatePopupFingerprint.exception
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package app.revanced.patches.photomath.misc.annoyances.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object HideUpdatePopupFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { _, classDef ->
|
||||||
|
// The popup is shown only in the main activity
|
||||||
|
classDef.type == "Lcom/microblink/photomath/main/activity/MainActivity;"
|
||||||
|
},
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST_HIGH16,
|
||||||
|
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.alpha(1.0f)
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.CONST_WIDE_16,
|
||||||
|
Opcode.INVOKE_VIRTUAL, // ViewPropertyAnimator.setDuration(1000L)
|
||||||
|
),
|
||||||
|
accessFlags = AccessFlags.FINAL or AccessFlags.PUBLIC,
|
||||||
|
returnType = "V",
|
||||||
|
)
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
package app.revanced.patches.photomath.misc.bookpoint
|
package app.revanced.patches.photomath.misc.unlock.bookpoint
|
||||||
|
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
import app.revanced.patcher.data.BytecodeContext
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
||||||
import app.revanced.patcher.patch.BytecodePatch
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
import app.revanced.patcher.patch.annotation.Patch
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
import app.revanced.patches.photomath.misc.bookpoint.fingerprints.IsBookpointEnabledFingerprint
|
import app.revanced.patches.photomath.misc.unlock.bookpoint.fingerprints.IsBookpointEnabledFingerprint
|
||||||
|
|
||||||
@Patch(description = "Enables textbook access")
|
@Patch(description = "Enables textbook access")
|
||||||
internal object EnableBookpointPatch : BytecodePatch(
|
internal object EnableBookpointPatch : BytecodePatch(
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user