mirror of
https://github.com/revanced/revanced-patches.git
synced 2025-12-08 18:33:57 +01:00
Compare commits
47 Commits
v2.203.0-d
...
v3.2.0-dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 | ||
|
|
a98c178ca7 | ||
|
|
4672118e88 | ||
|
|
5587a5c869 | ||
|
|
55bc7ecbae |
16
.github/dependabot.yml
vendored
Normal file
16
.github/dependabot.yml
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
version: 2
|
||||
updates:
|
||||
- package-ecosystem: github-actions
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
|
||||
- package-ecosystem: npm
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
|
||||
- package-ecosystem: gradle
|
||||
directory: /
|
||||
schedule:
|
||||
interval: monthly
|
||||
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
|
||||
185
CHANGELOG.md
185
CHANGELOG.md
@@ -1,3 +1,188 @@
|
||||
# [3.2.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v3.2.0-dev.1...v3.2.0-dev.2) (2023-12-19)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Public API:** Deprecate `HideEmailAddressPatch` ([866bceb](https://github.com/ReVanced/revanced-patches/commit/866bcebdd990b964d3dfd5aea792e7fffaedbf44))
|
||||
* **YouTube:** Remove `Hide email address` patch ([3b84305](https://github.com/ReVanced/revanced-patches/commit/3b84305a6b97800cb147f86c642f19689548aca5))
|
||||
|
||||
# [3.2.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v3.1.0...v3.2.0-dev.1) (2023-12-18)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - SponsorBlock:** Export local statistics with saved settings ([f8365b4](https://github.com/ReVanced/revanced-patches/commit/f8365b4e3585328506887022ac6168045ac110b9))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Public API:** Make `BottomControlsResource#addControls` public ([#2514](https://github.com/ReVanced/revanced-patches/issues/2514)) ([f4e2257](https://github.com/ReVanced/revanced-patches/commit/f4e2257072ca02003f7c272d6c0c8ef1aa6032ae))
|
||||
|
||||
# [3.1.0](https://github.com/ReVanced/revanced-patches/compare/v3.0.1...v3.1.0) (2023-12-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Boost for Reddit - Spoof client:** Fix account login by removing user agent patch ([42a5de9](https://github.com/ReVanced/revanced-patches/commit/42a5de98becee7fc027c3e7143e071a3447f7077))
|
||||
* Solve build errors by using correct syntax ([3f5a5bf](https://github.com/ReVanced/revanced-patches/commit/3f5a5bf2ab061e7be2f430dc3f5fd64d5c842677))
|
||||
* **Sync for Reddit - Spoof client:** Fix account login by removing user agent patch ([d90786e](https://github.com/ReVanced/revanced-patches/commit/d90786e26d9c0e581284aab0d9d6d5097da2bfda))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **IconPackStudio - Unlock pro:** Constrain to last working version ([#3410](https://github.com/ReVanced/revanced-patches/issues/3410)) ([fb6ee8a](https://github.com/ReVanced/revanced-patches/commit/fb6ee8a8976b64477171f70229e161188c39efcd))
|
||||
|
||||
# [3.1.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v3.0.1...v3.1.0-dev.1) (2023-12-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **Boost for Reddit - Spoof client:** Fix account login by removing user agent patch ([42a5de9](https://github.com/ReVanced/revanced-patches/commit/42a5de98becee7fc027c3e7143e071a3447f7077))
|
||||
* Solve build errors by using correct syntax ([3f5a5bf](https://github.com/ReVanced/revanced-patches/commit/3f5a5bf2ab061e7be2f430dc3f5fd64d5c842677))
|
||||
* **Sync for Reddit - Spoof client:** Fix account login by removing user agent patch ([d90786e](https://github.com/ReVanced/revanced-patches/commit/d90786e26d9c0e581284aab0d9d6d5097da2bfda))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **IconPackStudio - Unlock pro:** Constrain to last working version ([#3410](https://github.com/ReVanced/revanced-patches/issues/3410)) ([fb6ee8a](https://github.com/ReVanced/revanced-patches/commit/fb6ee8a8976b64477171f70229e161188c39efcd))
|
||||
|
||||
## [3.0.1](https://github.com/ReVanced/revanced-patches/compare/v3.0.0...v3.0.1) (2023-12-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube Music - GmsCore support:** Change from correct package name to prevent the patch from failing ([284a7f0](https://github.com/ReVanced/revanced-patches/commit/284a7f0b1a7b46e36b5f3dd132bb36d6d3fef584))
|
||||
|
||||
## [3.0.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v3.0.0...v3.0.1-dev.1) (2023-12-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube Music - GmsCore support:** Change from correct package name to prevent the patch from failing ([284a7f0](https://github.com/ReVanced/revanced-patches/commit/284a7f0b1a7b46e36b5f3dd132bb36d6d3fef584))
|
||||
|
||||
# [3.0.0](https://github.com/ReVanced/revanced-patches/compare/v2.202.0...v3.0.0) (2023-12-12)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Use correct class loader to load resources ([1d5f1f8](https://github.com/ReVanced/revanced-patches/commit/1d5f1f83be1f4eb78381887cd59f1649f1ed6d71))
|
||||
* **YouTube - GmsCore support:** Check for availability earlier to prevent crashing without any notice ([dab8900](https://github.com/ReVanced/revanced-patches/commit/dab8900e22498a86c7a1c2fd8f1bcc29dec1272c))
|
||||
* **YouTube - Minimized playback:** Fix PIP incorrectly shown for some Shorts playback ([#3364](https://github.com/ReVanced/revanced-patches/issues/3364)) ([84607ff](https://github.com/ReVanced/revanced-patches/commit/84607ff5f4bd30d328cdc4e1d46070a86d6c56bf))
|
||||
* **YouTube - Return YouTube Dislike:** Prevent the first Short opened from freezing the UI ([#3359](https://github.com/ReVanced/revanced-patches/issues/3359)) ([e024409](https://github.com/ReVanced/revanced-patches/commit/e024409219bfbccc32c337d95da24b7146b6c7b7))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow choosing the vendor of GmsCore via patch options ([#3347](https://github.com/ReVanced/revanced-patches/issues/3347)) ([161261c](https://github.com/ReVanced/revanced-patches/commit/161261cfeab4616764d20efe46fcfd483299741c))
|
||||
* **Infinity for Reddit - Spoof client:** Support latest version ([ca42fd9](https://github.com/ReVanced/revanced-patches/commit/ca42fd93656eae6a5f5f0086e3cf574fb6f4f11e))
|
||||
* **Infinity for Reddit:** Add `Unlock subscription` patch ([840b29e](https://github.com/ReVanced/revanced-patches/commit/840b29e9891243a4ccabb6ade5ad6ac92984efc2))
|
||||
* **Photomath:** Constrain patches to last working version ([f9a5dc6](https://github.com/ReVanced/revanced-patches/commit/f9a5dc6c91f37e9d7018e631739ca61511940d29))
|
||||
* Publish as a library ([#3356](https://github.com/ReVanced/revanced-patches/issues/3356)) ([4b878ee](https://github.com/ReVanced/revanced-patches/commit/4b878eeeda7d8b97ddd0911077b701c36dec5e43))
|
||||
* **Tiktok:** Bump compatibility to `32.5.3` ([#3389](https://github.com/ReVanced/revanced-patches/issues/3389)) ([96cdc10](https://github.com/ReVanced/revanced-patches/commit/96cdc102dd64e3134ec0ac5cc22c956b80c95e0b))
|
||||
* **Twitch - Settings:** Support version `16.1.0` and `15.4.1` ([#3377](https://github.com/ReVanced/revanced-patches/issues/3377)) ([062310d](https://github.com/ReVanced/revanced-patches/commit/062310dcc3923568c96171420c7fb9c0c2144233))
|
||||
* **Twitter - Dynamic Color:** Remove blue icon and update app name ([#3384](https://github.com/ReVanced/revanced-patches/issues/3384)) ([3db6615](https://github.com/ReVanced/revanced-patches/commit/3db6615568e399aa13dac093868df3d0e1ebc4c3))
|
||||
* **YouTube - Alternative Thumbnails:** Add option to use DeArrow ([#3378](https://github.com/ReVanced/revanced-patches/issues/3378)) ([41217f6](https://github.com/ReVanced/revanced-patches/commit/41217f61e600e47dd6812864bff22ee054521d3c))
|
||||
* **YouTube:** Add `Change start page` patch ([ad9ba37](https://github.com/ReVanced/revanced-patches/commit/ad9ba37c0568bd303d807b3ddf1a22daa8f8ec59))
|
||||
* **YouTube:** Clarify patch descriptions ([#3350](https://github.com/ReVanced/revanced-patches/issues/3350)) ([f2b9df4](https://github.com/ReVanced/revanced-patches/commit/f2b9df4e22a1c537cbd383087a3d724c3cdc1784))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **Tiktok:** This removes a patch but consolidates it into another.
|
||||
* Various APIs have been moved to `GmsCoreSupportAbstractPatch`
|
||||
|
||||
# [3.0.0-dev.11](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.10...v3.0.0-dev.11) (2023-12-12)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Tiktok:** Bump compatibility to `32.5.3` ([#3389](https://github.com/ReVanced/revanced-patches/issues/3389)) ([96cdc10](https://github.com/ReVanced/revanced-patches/commit/96cdc102dd64e3134ec0ac5cc22c956b80c95e0b))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* **Tiktok:** This removes a patch but consolidates it into another.
|
||||
|
||||
# [3.0.0-dev.10](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.9...v3.0.0-dev.10) (2023-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Add `Change start page` patch ([ad9ba37](https://github.com/ReVanced/revanced-patches/commit/ad9ba37c0568bd303d807b3ddf1a22daa8f8ec59))
|
||||
|
||||
# [3.0.0-dev.9](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.8...v3.0.0-dev.9) (2023-12-11)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - GmsCore support:** Check for availability earlier to prevent crashing without any notice ([dab8900](https://github.com/ReVanced/revanced-patches/commit/dab8900e22498a86c7a1c2fd8f1bcc29dec1272c))
|
||||
|
||||
# [3.0.0-dev.8](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.7...v3.0.0-dev.8) (2023-12-11)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube - Alternative Thumbnails:** Add option to use DeArrow ([#3378](https://github.com/ReVanced/revanced-patches/issues/3378)) ([41217f6](https://github.com/ReVanced/revanced-patches/commit/41217f61e600e47dd6812864bff22ee054521d3c))
|
||||
|
||||
# [3.0.0-dev.7](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.6...v3.0.0-dev.7) (2023-12-07)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Twitter - Dynamic Color:** Remove blue icon and update app name ([#3384](https://github.com/ReVanced/revanced-patches/issues/3384)) ([3db6615](https://github.com/ReVanced/revanced-patches/commit/3db6615568e399aa13dac093868df3d0e1ebc4c3))
|
||||
|
||||
# [3.0.0-dev.6](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.5...v3.0.0-dev.6) (2023-12-05)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Twitch - Settings:** Support version `16.1.0` and `15.4.1` ([#3377](https://github.com/ReVanced/revanced-patches/issues/3377)) ([062310d](https://github.com/ReVanced/revanced-patches/commit/062310dcc3923568c96171420c7fb9c0c2144233))
|
||||
|
||||
# [3.0.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.4...v3.0.0-dev.5) (2023-12-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* Use correct class loader to load resources ([1d5f1f8](https://github.com/ReVanced/revanced-patches/commit/1d5f1f83be1f4eb78381887cd59f1649f1ed6d71))
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **Photomath:** Constrain patches to last working version ([f9a5dc6](https://github.com/ReVanced/revanced-patches/commit/f9a5dc6c91f37e9d7018e631739ca61511940d29))
|
||||
|
||||
# [3.0.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.3...v3.0.0-dev.4) (2023-12-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Minimized playback:** Fix PIP incorrectly shown for some Shorts playback ([#3364](https://github.com/ReVanced/revanced-patches/issues/3364)) ([84607ff](https://github.com/ReVanced/revanced-patches/commit/84607ff5f4bd30d328cdc4e1d46070a86d6c56bf))
|
||||
|
||||
# [3.0.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.2...v3.0.0-dev.3) (2023-12-04)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **YouTube - Return YouTube Dislike:** Prevent the first Short opened from freezing the UI ([#3359](https://github.com/ReVanced/revanced-patches/issues/3359)) ([e024409](https://github.com/ReVanced/revanced-patches/commit/e024409219bfbccc32c337d95da24b7146b6c7b7))
|
||||
|
||||
# [3.0.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v3.0.0-dev.1...v3.0.0-dev.2) (2023-12-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* **YouTube:** Clarify patch descriptions ([#3350](https://github.com/ReVanced/revanced-patches/issues/3350)) ([f2b9df4](https://github.com/ReVanced/revanced-patches/commit/f2b9df4e22a1c537cbd383087a3d724c3cdc1784))
|
||||
|
||||
# [3.0.0-dev.1](https://github.com/ReVanced/revanced-patches/compare/v2.203.0-dev.2...v3.0.0-dev.1) (2023-12-02)
|
||||
|
||||
|
||||
### Features
|
||||
|
||||
* Allow choosing the vendor of GmsCore via patch options ([#3347](https://github.com/ReVanced/revanced-patches/issues/3347)) ([161261c](https://github.com/ReVanced/revanced-patches/commit/161261cfeab4616764d20efe46fcfd483299741c))
|
||||
|
||||
|
||||
### BREAKING CHANGES
|
||||
|
||||
* Various APIs have been moved to `GmsCoreSupportAbstractPatch`
|
||||
|
||||
# [2.203.0-dev.2](https://github.com/ReVanced/revanced-patches/compare/v2.203.0-dev.1...v2.203.0-dev.2) (2023-12-02)
|
||||
|
||||
|
||||
|
||||
@@ -309,20 +309,16 @@ public final class app/revanced/patches/music/misc/androidauto/BypassCertificate
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/misc/microg/MicroGBytecodePatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/music/misc/microg/MicroGBytecodePatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public final class app/revanced/patches/music/misc/gms/Constants {
|
||||
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/Constants;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/misc/microg/MicroGResourcePatch : app/revanced/patcher/patch/ResourcePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/music/misc/microg/MicroGResourcePatch;
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
public final class app/revanced/patches/music/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/GmsCoreSupportPatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/misc/microg/shared/Constants {
|
||||
public static final field INSTANCE Lapp/revanced/patches/music/misc/microg/shared/Constants;
|
||||
public final class app/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/GmsCoreSupportResourcePatch;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
@@ -422,7 +418,6 @@ public final class app/revanced/patches/reddit/customclients/baconreader/api/Spo
|
||||
public final class app/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/boostforreddit/api/SpoofClientPatch;
|
||||
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public fun patchUserAgent (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch : app/revanced/patches/reddit/customclients/AbstractSpoofClientPatch {
|
||||
@@ -486,7 +481,6 @@ public final class app/revanced/patches/reddit/customclients/syncforreddit/api/S
|
||||
public static final field INSTANCE Lapp/revanced/patches/reddit/customclients/syncforreddit/api/SpoofClientPatch;
|
||||
public fun patchClientId (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public fun patchMiscellaneous (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public fun patchUserAgent (Ljava/util/Set;Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/reddit/customclients/syncforreddit/detection/piracy/DisablePiracyDetectionPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
@@ -525,6 +519,10 @@ public final class app/revanced/patches/serviceportalbund/detection/root/RootDet
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/shared/fingerprints/HomeActivityFingerprint : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch$IntegrationsFingerprint {
|
||||
public static final field INSTANCE Lapp/revanced/patches/shared/fingerprints/HomeActivityFingerprint;
|
||||
}
|
||||
|
||||
public abstract class app/revanced/patches/shared/integrations/AbstractIntegrationsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public fun <init> (Ljava/lang/String;Ljava/util/Set;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
@@ -573,6 +571,26 @@ public final class app/revanced/patches/shared/misc/fix/verticalscroll/VerticalS
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public abstract class app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Lapp/revanced/patcher/fingerprint/MethodFingerprint;Ljava/util/Set;Lapp/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch;Ljava/util/Set;Ljava/util/Set;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public abstract class app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch : app/revanced/patcher/patch/ResourcePatch {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;)V
|
||||
public synthetic fun <init> (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/util/Set;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
protected final fun getGmsCoreVendor ()Ljava/lang/String;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
|
||||
public static final field GET_GMS_CORE_VENDOR_METHOD_NAME Ljava/lang/String;
|
||||
public static final field INSTANCE Lapp/revanced/patches/shared/misc/gms/fingerprints/GmsCoreSupportFingerprint;
|
||||
}
|
||||
|
||||
public abstract class app/revanced/patches/shared/settings/AbstractSettingsResourcePatch : app/revanced/patcher/patch/ResourcePatch, java/io/Closeable {
|
||||
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V
|
||||
public fun close ()V
|
||||
@@ -641,7 +659,9 @@ public final class app/revanced/patches/shared/settings/preference/impl/ListPref
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/shared/settings/preference/impl/NonInteractivePreference : app/revanced/patches/shared/settings/preference/BasePreference {
|
||||
public fun <init> (Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;)V
|
||||
public fun <init> (Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/lang/String;Z)V
|
||||
public synthetic fun <init> (Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Lapp/revanced/patches/shared/settings/preference/impl/StringResource;Ljava/lang/String;ZILkotlin/jvm/internal/DefaultConstructorMarker;)V
|
||||
public final fun getSelectable ()Z
|
||||
public fun serialize (Lorg/w3c/dom/Document;Lkotlin/jvm/functions/Function1;)Lorg/w3c/dom/Element;
|
||||
}
|
||||
|
||||
@@ -792,12 +812,6 @@ public final class app/revanced/patches/ticktick/misc/themeunlock/UnlockProPatch
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/tiktok/ad/HideAdsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/tiktok/ad/HideAdsPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/tiktok/feedfilter/FeedFilterPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/tiktok/feedfilter/FeedFilterPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
@@ -1320,6 +1334,16 @@ public final class app/revanced/patches/youtube/layout/spoofappversion/SpoofAppV
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startpage/ChangeStartPagePatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint : app/revanced/patcher/fingerprint/MethodFingerprint {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startpage/fingerprints/StartActivityFingerprint;
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/startupshortsreset/DisableResumingShortsOnStartupPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
@@ -1347,7 +1371,6 @@ public final class app/revanced/patches/youtube/layout/theme/ThemeBytecodePatch
|
||||
|
||||
public final class app/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/layout/thumbnails/AlternativeThumbnailsPatch;
|
||||
public final fun addImageUrlErrorCallbackHook (Ljava/lang/String;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
@@ -1394,6 +1417,18 @@ public final class app/revanced/patches/youtube/misc/fix/playback/SpoofSignature
|
||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportPatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/gms/GmsCoreSupportPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/AbstractGmsCoreSupportResourcePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/gms/GmsCoreSupportResourcePatch;
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/integrations/AbstractIntegrationsPatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/integrations/IntegrationsPatch;
|
||||
}
|
||||
@@ -1421,18 +1456,6 @@ public final class app/revanced/patches/youtube/misc/litho/filter/LithoFilterPat
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/microg/MicroGBytecodePatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/microg/MicroGBytecodePatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/microg/MicroGResourcePatch : app/revanced/patcher/patch/ResourcePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/microg/MicroGResourcePatch;
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
}
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch : app/revanced/patcher/patch/BytecodePatch {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/minimizedplayback/MinimizedPlaybackPatch;
|
||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||
@@ -1441,6 +1464,7 @@ public final class app/revanced/patches/youtube/misc/minimizedplayback/Minimized
|
||||
|
||||
public final class app/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch : app/revanced/patcher/patch/ResourcePatch, java/io/Closeable {
|
||||
public static final field INSTANCE Lapp/revanced/patches/youtube/misc/playercontrols/BottomControlsResourcePatch;
|
||||
public final fun addControls (Ljava/lang/String;)V
|
||||
public fun close ()V
|
||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import org.gradle.kotlin.dsl.support.listFilesOrdered
|
||||
|
||||
plugins {
|
||||
kotlin("jvm") version "1.9.10"
|
||||
kotlin("jvm") version "1.9.21"
|
||||
alias(libs.plugins.binary.compatibility.validator)
|
||||
`maven-publish`
|
||||
}
|
||||
@@ -49,7 +49,7 @@ tasks.withType(Jar::class) {
|
||||
|
||||
tasks {
|
||||
register<DefaultTask>("generateBundle") {
|
||||
description = "Generate dex files from build and bundle them in the jar file"
|
||||
description = "Generate DEX files and add them in the JAR file"
|
||||
|
||||
dependsOn(build)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
org.gradle.parallel = true
|
||||
org.gradle.caching = true
|
||||
kotlin.code.style = official
|
||||
version = 2.203.0-dev.2
|
||||
version = 3.2.0-dev.2
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
[versions]
|
||||
revanced-patcher = "19.1.0"
|
||||
smali = "3.0.3"
|
||||
guava = "32.1.2-jre"
|
||||
guava = "32.1.3-jre"
|
||||
gson = "2.10.1"
|
||||
binary-compatibility-validator = "0.13.2"
|
||||
|
||||
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
8
gradle/wrapper/gradle-wrapper.properties
vendored
8
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,6 +1,8 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
|
||||
distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae
|
||||
distributionSha256Sum=9d926787066a081739e8200858338b4a69e837c3a821a33aca9db09dd4a41026
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dist
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
17
gradlew
vendored
17
gradlew
vendored
@@ -83,7 +83,8 @@ done
|
||||
# This is normally unused
|
||||
# shellcheck disable=SC2034
|
||||
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.
|
||||
MAX_FD=maximum
|
||||
@@ -144,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
case $MAX_FD in #(
|
||||
max*)
|
||||
# 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 ) ||
|
||||
warn "Could not query maximum file descriptor limit"
|
||||
esac
|
||||
@@ -152,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
'' | soft) :;; #(
|
||||
*)
|
||||
# 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" ||
|
||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||
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.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Collect all arguments for the java command;
|
||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
||||
# shell script including quotes and variable substitutions, so put them in
|
||||
# double quotes to make sure that they get re-expanded; and
|
||||
# * put everything else in single quotes, so that it's not re-expanded.
|
||||
# Collect all arguments for the java command:
|
||||
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||
# and any embedded shellness will be escaped.
|
||||
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||
# treated as '${Hostname}' itself on the command line.
|
||||
|
||||
set -- \
|
||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||
|
||||
4463
package-lock.json
generated
4463
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"devDependencies": {
|
||||
"@saithodev/semantic-release-backmerge": "^3.2.1",
|
||||
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
||||
"@semantic-release/changelog": "^6.0.3",
|
||||
"@semantic-release/git": "^10.0.1",
|
||||
"gradle-semantic-release-plugin": "^1.8.0",
|
||||
"semantic-release": "^22.0.8"
|
||||
"semantic-release": "^22.0.12"
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -4,6 +4,6 @@ rootProject.name = "revanced-patches"
|
||||
|
||||
buildCache {
|
||||
local {
|
||||
isEnabled = !System.getenv().containsKey("CI")
|
||||
isEnabled = "CI" !in System.getenv()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ import app.revanced.patches.iconpackstudio.misc.pro.fingerprints.CheckProFingerp
|
||||
|
||||
@Patch(
|
||||
name = "Unlock pro",
|
||||
compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio")]
|
||||
compatiblePackages = [CompatiblePackage("ginlemon.iconpackstudio", ["2.2 build 016"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object UnlockProPatch : BytecodePatch(
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package app.revanced.patches.music.misc.gms
|
||||
|
||||
object Constants {
|
||||
internal const val REVANCED_MUSIC_PACKAGE_NAME = "app.revanced.android.apps.youtube.music"
|
||||
internal const val MUSIC_PACKAGE_NAME = "com.google.android.apps.youtube.music"
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
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.REVANCED_MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption
|
||||
import app.revanced.patches.music.misc.gms.fingerprints.*
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch
|
||||
import app.revanced.patches.youtube.misc.gms.fingerprints.CastContextFetchFingerprint
|
||||
|
||||
@Suppress("unused")
|
||||
object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
||||
fromPackageName = MUSIC_PACKAGE_NAME,
|
||||
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||
earlyReturnFingerprints = setOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
),
|
||||
abstractGmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||
compatiblePackages = setOf(CompatiblePackage("com.google.android.apps.youtube.music")),
|
||||
fingerprints = setOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeMethodFingerprint,
|
||||
)
|
||||
) {
|
||||
override val gmsCoreVendor by gmsCoreVendorOption
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
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.REVANCED_MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportResourcePatch
|
||||
|
||||
object GmsCoreSupportResourcePatch : AbstractGmsCoreSupportResourcePatch(
|
||||
fromPackageName = MUSIC_PACKAGE_NAME,
|
||||
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
||||
spoofedPackageSignature = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
package app.revanced.patches.music.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
package app.revanced.patches.music.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -1,18 +1,18 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object GooglePlayUtilityFingerprint : MethodFingerprint(
|
||||
"I",
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
listOf("L", "I"),
|
||||
strings = listOf(
|
||||
"This should never happen.",
|
||||
"MetadataValueReader",
|
||||
"GooglePlayServicesUtil",
|
||||
"com.android.vending",
|
||||
"android.hardware.type.embedded"
|
||||
)
|
||||
package app.revanced.patches.music.misc.gms.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object GooglePlayUtilityFingerprint : MethodFingerprint(
|
||||
"I",
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
listOf("L", "I"),
|
||||
strings = listOf(
|
||||
"This should never happen.",
|
||||
"MetadataValueReader",
|
||||
"GooglePlayServicesUtil",
|
||||
"com.android.vending",
|
||||
"android.hardware.type.embedded"
|
||||
)
|
||||
)
|
||||
@@ -1,8 +1,8 @@
|
||||
package app.revanced.patches.youtube.misc.microg.fingerprints
|
||||
package app.revanced.patches.music.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object PrimeFingerprint : MethodFingerprint(
|
||||
internal object PrimeMethodFingerprint : MethodFingerprint(
|
||||
strings = listOf("com.google.android.GoogleCamera", "com.android.vending")
|
||||
)
|
||||
@@ -1,15 +1,14 @@
|
||||
package app.revanced.patches.music.misc.microg.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
|
||||
|
||||
|
||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||
internal object ServiceCheckFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
listOf("L", "I"),
|
||||
strings = listOf("Google Play Services not available")
|
||||
)
|
||||
package app.revanced.patches.music.misc.gms.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
|
||||
|
||||
|
||||
internal object ServiceCheckFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
listOf("L", "I"),
|
||||
strings = listOf("Google Play Services not available")
|
||||
)
|
||||
@@ -1,70 +0,0 @@
|
||||
package app.revanced.patches.music.misc.microg
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.patches.music.misc.microg.fingerprints.*
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
||||
import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
|
||||
|
||||
@Patch(
|
||||
name = "Vanced MicroG support",
|
||||
description = "Allows YouTube Music to run without root and under a different package name.",
|
||||
dependencies = [
|
||||
ChangePackageNamePatch::class,
|
||||
MicroGResourcePatch::class,
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.apps.youtube.music"
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object MicroGBytecodePatch : BytecodePatch(
|
||||
setOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeFingerprint,
|
||||
)
|
||||
) {
|
||||
// NOTE: the previous patch also replaced the following strings, but it seems like they are not needed:
|
||||
// - "com.google.android.gms.chimera.GmsIntentOperationService",
|
||||
// - "com.google.android.gms.phenotype.internal.IPhenotypeCallbacks",
|
||||
// - "com.google.android.gms.phenotype.internal.IPhenotypeService",
|
||||
// - "com.google.android.gms.phenotype.PACKAGE_NAME",
|
||||
// - "com.google.android.gms.phenotype.UPDATE",
|
||||
// - "com.google.android.gms.phenotype",
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(REVANCED_MUSIC_PACKAGE_NAME)
|
||||
|
||||
MicroGBytecodeHelper.patchBytecode(
|
||||
context,
|
||||
arrayOf(
|
||||
MicroGBytecodeHelper.packageNameTransform(
|
||||
MUSIC_PACKAGE_NAME,
|
||||
packageName
|
||||
)
|
||||
),
|
||||
MicroGBytecodeHelper.PrimeMethodTransformationData(
|
||||
PrimeFingerprint,
|
||||
MUSIC_PACKAGE_NAME,
|
||||
packageName
|
||||
),
|
||||
listOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
package app.revanced.patches.music.misc.microg
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_APP_NAME
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME
|
||||
import app.revanced.patches.music.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
|
||||
import app.revanced.util.microg.MicroGManifestHelper
|
||||
import app.revanced.util.microg.MicroGResourceHelper
|
||||
|
||||
|
||||
@Patch(
|
||||
description = "Resource patch to allow YouTube Music ReVanced to run without root " +
|
||||
"and under a different package name.",
|
||||
dependencies = [ChangePackageNamePatch::class]
|
||||
)
|
||||
object MicroGResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(REVANCED_MUSIC_PACKAGE_NAME)
|
||||
|
||||
// update manifest
|
||||
MicroGResourceHelper.patchManifest(
|
||||
context,
|
||||
MUSIC_PACKAGE_NAME,
|
||||
packageName,
|
||||
REVANCED_MUSIC_APP_NAME
|
||||
)
|
||||
|
||||
// add metadata to the manifest
|
||||
MicroGManifestHelper.addSpoofingMetadata(
|
||||
context,
|
||||
SPOOFED_PACKAGE_NAME,
|
||||
SPOOFED_PACKAGE_SIGNATURE
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.music.misc.microg.shared
|
||||
|
||||
object Constants {
|
||||
internal const val REVANCED_MUSIC_APP_NAME = "YT Music ReVanced"
|
||||
internal const val REVANCED_MUSIC_PACKAGE_NAME = "app.revanced.android.apps.youtube.music"
|
||||
internal const val MUSIC_PACKAGE_NAME = "com.google.android.apps.youtube.music"
|
||||
internal const val SPOOFED_PACKAGE_NAME = MUSIC_PACKAGE_NAME
|
||||
internal const val SPOOFED_PACKAGE_SIGNATURE = "afb0fed5eeaebdd86f56a97742f4b6b33ef59875"
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import kotlin.random.Random
|
||||
name = "Spoof device ID",
|
||||
description = "Spoofs device ID to mitigate manual bans by developers.",
|
||||
dependencies = [SignatureDetectionPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("com.microblink.photomath")]
|
||||
compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object SpoofDeviceIdPatch : BytecodePatch(
|
||||
|
||||
@@ -13,7 +13,7 @@ import app.revanced.patches.photomath.misc.unlockplus.fingerprints.IsPlusUnlocke
|
||||
@Patch(
|
||||
name = "Unlock plus",
|
||||
dependencies = [SignatureDetectionPatch::class, EnableBookpointPatch::class],
|
||||
compatiblePackages = [CompatiblePackage("com.microblink.photomath")]
|
||||
compatiblePackages = [CompatiblePackage("com.microblink.photomath", ["8.32.0"])]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object UnlockPlusPatch : BytecodePatch(
|
||||
|
||||
@@ -4,7 +4,6 @@ import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprintResult
|
||||
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.Constants.OAUTH_USER_AGENT
|
||||
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.GetClientIdFingerprint
|
||||
import app.revanced.patches.reddit.customclients.boostforreddit.api.fingerprints.LoginActivityOnCreateFingerprint
|
||||
|
||||
@@ -25,20 +24,4 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
|
||||
"""
|
||||
)
|
||||
}
|
||||
|
||||
override fun Set<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {
|
||||
first().let { result ->
|
||||
result.mutableMethod.apply {
|
||||
val insertIndex = result.scanResult.patternScanResult!!.endIndex
|
||||
|
||||
addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
const-string v7, "$OAUTH_USER_AGENT"
|
||||
invoke-virtual {v4, v7}, Landroid/webkit/WebSettings;->setUserAgentString(Ljava/lang/String;)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
package app.revanced.patches.reddit.customclients.syncforreddit.api
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
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.fingerprint.MethodFingerprintResult
|
||||
import app.revanced.patches.reddit.customclients.AbstractSpoofClientPatch
|
||||
import app.revanced.patches.reddit.customclients.Constants.OAUTH_USER_AGENT
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetAuthorizationStringFingerprint
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.GetBearerTokenFingerprint
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.ImgurImageAPIFingerprint
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.api.fingerprints.LoadBrowserURLFingerprint
|
||||
import app.revanced.patches.reddit.customclients.syncforreddit.detection.piracy.DisablePiracyDetectionPatch
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
@@ -76,18 +75,4 @@ object SpoofClientPatch : AbstractSpoofClientPatch(
|
||||
"const-string v1, \"https://api.imgur.com/3/image\""
|
||||
)
|
||||
}
|
||||
|
||||
override fun Set<MethodFingerprintResult>.patchUserAgent(context: BytecodeContext) {
|
||||
first().let { result ->
|
||||
val insertIndex = result.scanResult.patternScanResult!!.startIndex
|
||||
|
||||
result.mutableMethod.addInstructions(
|
||||
insertIndex,
|
||||
"""
|
||||
const-string v0, "$OAUTH_USER_AGENT"
|
||||
invoke-virtual {p1, v0}, Landroid/webkit/WebSettings;->setUserAgentString(Ljava/lang/String;)V
|
||||
"""
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package app.revanced.patches.shared.fingerprints
|
||||
|
||||
import app.revanced.patches.shared.integrations.AbstractIntegrationsPatch.IntegrationsFingerprint
|
||||
|
||||
object HomeActivityFingerprint : IntegrationsFingerprint(
|
||||
customFingerprint = { methodDef, classDef ->
|
||||
methodDef.name == "onCreate" && classDef.type.endsWith("Shell_HomeActivity;")
|
||||
},
|
||||
)
|
||||
@@ -0,0 +1,307 @@
|
||||
package app.revanced.patches.shared.misc.gms
|
||||
|
||||
import app.revanced.patcher.PatchClass
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constants.ACTIONS
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constants.AUTHORITIES
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch.Constants.PERMISSIONS
|
||||
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint
|
||||
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_METHOD_NAME
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.getReference
|
||||
import app.revanced.util.returnEarly
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
||||
import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
/**
|
||||
* A patch that allows Google apps to run without root and under a different package name
|
||||
* by using GmsCore instead of Google Play Services.
|
||||
*
|
||||
* @param fromPackageName The package name of the original app.
|
||||
* @param toPackageName The package name to fall back to if no custom package name is specified in patch options.
|
||||
* @param primeMethodFingerprint The fingerprint of the "prime" method that needs to be patched.
|
||||
* @param earlyReturnFingerprints The fingerprints of methods that need to be returned early.
|
||||
* @param abstractGmsCoreSupportResourcePatch The corresponding resource patch that is used to patch the resources.
|
||||
* @param dependencies Additional dependencies of this patch.
|
||||
* @param compatiblePackages The compatible packages of this patch.
|
||||
* @param fingerprints The fingerprints of this patch.
|
||||
*/
|
||||
abstract class AbstractGmsCoreSupportPatch(
|
||||
private val fromPackageName: String,
|
||||
private val toPackageName: String,
|
||||
private val primeMethodFingerprint: MethodFingerprint,
|
||||
private val earlyReturnFingerprints: Set<MethodFingerprint>,
|
||||
abstractGmsCoreSupportResourcePatch: AbstractGmsCoreSupportResourcePatch,
|
||||
dependencies: Set<PatchClass> = setOf(),
|
||||
compatiblePackages: Set<CompatiblePackage>? = null,
|
||||
fingerprints: Set<MethodFingerprint> = emptySet(),
|
||||
) : BytecodePatch(
|
||||
name = "GmsCore support",
|
||||
description = "Allows Google apps to run without root and under a different package name " +
|
||||
"by using GmsCore instead of Google Play Services.",
|
||||
dependencies = setOf(ChangePackageNamePatch::class, abstractGmsCoreSupportResourcePatch::class) + dependencies,
|
||||
compatiblePackages = compatiblePackages,
|
||||
fingerprints = setOf(GmsCoreSupportFingerprint) + fingerprints,
|
||||
requiresIntegrations = true
|
||||
) {
|
||||
init {
|
||||
// Manually register all options of the resource patch so that they are visible in the patch API.
|
||||
abstractGmsCoreSupportResourcePatch.options.values.forEach(options::register)
|
||||
}
|
||||
|
||||
internal abstract val gmsCoreVendor: String?
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(toPackageName)
|
||||
|
||||
// Transform all strings using all provided transforms, first match wins.
|
||||
val transformations = arrayOf(
|
||||
::commonTransform,
|
||||
::contentUrisTransform,
|
||||
packageNameTransform(fromPackageName, packageName)
|
||||
)
|
||||
context.transformStringReferences transform@{ string ->
|
||||
transformations.forEach { transform ->
|
||||
transform(string)?.let { transformedString -> return@transform transformedString }
|
||||
}
|
||||
|
||||
return@transform null
|
||||
}
|
||||
|
||||
// Specific method that needs to be patched.
|
||||
transformPrimeMethod(packageName)
|
||||
|
||||
// Return these methods early to prevent the app from crashing.
|
||||
earlyReturnFingerprints.toList().returnEarly()
|
||||
|
||||
// Change the vendor of GmsCore in ReVanced Integrations.
|
||||
GmsCoreSupportFingerprint.result?.mutableClass?.methods
|
||||
?.single { it.name == GET_GMS_CORE_VENDOR_METHOD_NAME }
|
||||
?.replaceInstruction(0, "const-string v0, \"$gmsCoreVendor\"")
|
||||
?: throw GmsCoreSupportFingerprint.exception
|
||||
}
|
||||
|
||||
private fun BytecodeContext.transformStringReferences(transform: (str: String) -> String?) = classes.forEach {
|
||||
val mutableClass by lazy {
|
||||
proxy(it).mutableClass
|
||||
}
|
||||
|
||||
it.methods.forEach classLoop@{ methodDef ->
|
||||
val implementation = methodDef.implementation ?: return@classLoop
|
||||
|
||||
val mutableMethod by lazy {
|
||||
mutableClass.methods.first { MethodUtil.methodSignaturesMatch(it, methodDef) }
|
||||
}
|
||||
|
||||
implementation.instructions.forEachIndexed insnLoop@{ index, instruction ->
|
||||
val string = ((instruction as? Instruction21c)?.reference as? StringReference)?.string
|
||||
?: return@insnLoop
|
||||
|
||||
// Apply transformation.
|
||||
val transformedString = transform(string) ?: return@insnLoop
|
||||
|
||||
mutableMethod.replaceInstruction(
|
||||
index,
|
||||
BuilderInstruction21c(
|
||||
Opcode.CONST_STRING,
|
||||
instruction.registerA,
|
||||
ImmutableStringReference(transformedString)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// region Collection of transformations that are applied to all strings.
|
||||
|
||||
private fun commonTransform(referencedString: String): String? =
|
||||
when (referencedString) {
|
||||
"com.google",
|
||||
"com.google.android.gms",
|
||||
in PERMISSIONS,
|
||||
in ACTIONS,
|
||||
in AUTHORITIES -> referencedString.replace("com.google", gmsCoreVendor!!)
|
||||
|
||||
// No vendor prefix for whatever reason...
|
||||
"subscribedfeeds" -> "$gmsCoreVendor.subscribedfeeds"
|
||||
else -> null
|
||||
}
|
||||
|
||||
private fun contentUrisTransform(str: String): String? {
|
||||
// only when content:// uri
|
||||
if (str.startsWith("content://")) {
|
||||
// check if matches any authority
|
||||
for (authority in AUTHORITIES) {
|
||||
val uriPrefix = "content://$authority"
|
||||
if (str.startsWith(uriPrefix)) {
|
||||
return str.replace(
|
||||
uriPrefix,
|
||||
"content://${authority.replace("com.google", gmsCoreVendor!!)}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// gms also has a 'subscribedfeeds' authority, check for that one too
|
||||
val subFeedsUriPrefix = "content://subscribedfeeds"
|
||||
if (str.startsWith(subFeedsUriPrefix)) {
|
||||
return str.replace(subFeedsUriPrefix, "content://$gmsCoreVendor.subscribedfeeds")
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
|
||||
}
|
||||
|
||||
private fun packageNameTransform(fromPackageName: String, toPackageName: String): (String) -> String? = { string ->
|
||||
when (string) {
|
||||
"$fromPackageName.SuggestionsProvider",
|
||||
"$fromPackageName.fileprovider" -> string.replace(fromPackageName, toPackageName)
|
||||
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
|
||||
private fun transformPrimeMethod(packageName: String) {
|
||||
primeMethodFingerprint.result?.mutableMethod?.apply {
|
||||
var register = 2
|
||||
|
||||
val index = getInstructions().indexOfFirst {
|
||||
if (it.getReference<StringReference>()?.string != fromPackageName) return@indexOfFirst false
|
||||
|
||||
register = (it as OneRegisterInstruction).registerA
|
||||
return@indexOfFirst true
|
||||
}
|
||||
|
||||
replaceInstruction(index, "const-string v$register, \"$packageName\"")
|
||||
} ?: throw primeMethodFingerprint.exception
|
||||
}
|
||||
|
||||
/**
|
||||
* A collection of permissions, intents and content provider authorities
|
||||
* that are present in GmsCore which need to be transformed.
|
||||
*
|
||||
* NOTE: The following were present, but it seems like they are not needed to be transformed:
|
||||
* - com.google.android.gms.chimera.GmsIntentOperationService
|
||||
* - com.google.android.gms.phenotype.internal.IPhenotypeCallbacks
|
||||
* - com.google.android.gms.phenotype.internal.IPhenotypeService
|
||||
* - com.google.android.gms.phenotype.PACKAGE_NAME
|
||||
* - com.google.android.gms.phenotype.UPDATE
|
||||
* - com.google.android.gms.phenotype
|
||||
*/
|
||||
private object Constants {
|
||||
/**
|
||||
* A list of all permissions.
|
||||
*/
|
||||
val PERMISSIONS = listOf(
|
||||
// C2DM / GCM
|
||||
"com.google.android.c2dm.permission.RECEIVE",
|
||||
"com.google.android.c2dm.permission.SEND",
|
||||
"com.google.android.gtalkservice.permission.GTALK_SERVICE",
|
||||
|
||||
// GAuth
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.cp",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.local",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.mail",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.writely",
|
||||
)
|
||||
|
||||
/**
|
||||
* All intent actions.
|
||||
*/
|
||||
val ACTIONS = listOf(
|
||||
// location
|
||||
"com.google.android.gms.location.places.ui.PICK_PLACE",
|
||||
"com.google.android.gms.location.places.GeoDataApi",
|
||||
"com.google.android.gms.location.places.PlacesApi",
|
||||
"com.google.android.gms.location.places.PlaceDetectionApi",
|
||||
"com.google.android.gms.wearable.MESSAGE_RECEIVED",
|
||||
|
||||
// C2DM / GCM
|
||||
"com.google.android.c2dm.intent.REGISTER",
|
||||
"com.google.android.c2dm.intent.REGISTRATION",
|
||||
"com.google.android.c2dm.intent.UNREGISTER",
|
||||
"com.google.android.c2dm.intent.RECEIVE",
|
||||
"com.google.iid.TOKEN_REQUEST",
|
||||
"com.google.android.gcm.intent.SEND",
|
||||
|
||||
// car
|
||||
"com.google.android.gms.car.service.START",
|
||||
|
||||
// people
|
||||
"com.google.android.gms.people.service.START",
|
||||
|
||||
// wearable
|
||||
"com.google.android.gms.wearable.BIND",
|
||||
|
||||
// auth
|
||||
"com.google.android.gsf.login",
|
||||
"com.google.android.gsf.action.GET_GLS",
|
||||
"com.google.android.gms.common.account.CHOOSE_ACCOUNT",
|
||||
"com.google.android.gms.auth.login.LOGIN",
|
||||
"com.google.android.gms.auth.api.credentials.PICKER",
|
||||
"com.google.android.gms.auth.api.credentials.service.START",
|
||||
"com.google.android.gms.auth.service.START",
|
||||
"com.google.firebase.auth.api.gms.service.START",
|
||||
"com.google.android.gms.auth.be.appcert.AppCertService",
|
||||
|
||||
// fido
|
||||
"com.google.android.gms.fido.fido2.privileged.START",
|
||||
|
||||
// games
|
||||
"com.google.android.gms.games.service.START",
|
||||
"com.google.android.gms.games.PLAY_GAMES_UPGRADE",
|
||||
|
||||
// chimera
|
||||
"com.google.android.gms.chimera",
|
||||
|
||||
// fonts
|
||||
"com.google.android.gms.fonts",
|
||||
|
||||
// phenotype
|
||||
"com.google.android.gms.phenotype.service.START",
|
||||
|
||||
// location
|
||||
"com.google.android.gms.location.reporting.service.START",
|
||||
|
||||
// misc
|
||||
"com.google.android.gms.gmscompliance.service.START",
|
||||
"com.google.android.gms.oss.licenses.service.START",
|
||||
"com.google.android.gms.safetynet.service.START",
|
||||
"com.google.android.gms.tapandpay.service.BIND"
|
||||
)
|
||||
|
||||
/**
|
||||
* All content provider authorities.
|
||||
*/
|
||||
val AUTHORITIES = listOf(
|
||||
// gsf
|
||||
"com.google.android.gsf.gservices",
|
||||
"com.google.settings",
|
||||
|
||||
// auth
|
||||
"com.google.android.gms.auth.accounts",
|
||||
|
||||
// chimera
|
||||
"com.google.android.gms.chimera",
|
||||
|
||||
// fonts
|
||||
"com.google.android.gms.fonts",
|
||||
|
||||
// phenotype
|
||||
"com.google.android.gms.phenotype"
|
||||
)
|
||||
}
|
||||
|
||||
// endregion
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package app.revanced.patches.shared.misc.gms
|
||||
|
||||
import app.revanced.patcher.PatchClass
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.util.mergeStrings
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.Node
|
||||
|
||||
/**
|
||||
* Abstract resource patch that allows Google apps to run without root and under a different package name
|
||||
* by using GmsCore instead of Google Play Services.
|
||||
*
|
||||
* @param fromPackageName The package name of the original app.
|
||||
* @param toPackageName The package name to fall back to if no custom package name is specified in patch options.
|
||||
* @param spoofedPackageSignature The signature of the package to spoof to.
|
||||
* @param dependencies Additional dependencies of this patch.
|
||||
*/
|
||||
abstract class AbstractGmsCoreSupportResourcePatch(
|
||||
private val fromPackageName: String,
|
||||
private val toPackageName: String,
|
||||
private val spoofedPackageSignature: String,
|
||||
dependencies: Set<PatchClass> = setOf()
|
||||
) : ResourcePatch(dependencies = setOf(ChangePackageNamePatch::class) + dependencies) {
|
||||
internal val gmsCoreVendorOption = stringPatchOption(
|
||||
key = "gmsCoreVendor",
|
||||
default = "com.mgoogle",
|
||||
values = mapOf(
|
||||
"Vanced" to "com.mgoogle",
|
||||
"ReVanced" to "app.revanced"
|
||||
),
|
||||
title = "GmsCore Vendor",
|
||||
description = "The group id of the GmsCore vendor.",
|
||||
required = true
|
||||
) { it!!.matches(Regex("^[a-z]\\w*(\\.[a-z]\\w*)+\$")) }
|
||||
|
||||
protected val gmsCoreVendor by gmsCoreVendorOption
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
context.mergeStrings("gms/host/values/strings.xml")
|
||||
context.patchManifest()
|
||||
context.addSpoofingMetadata()
|
||||
}
|
||||
|
||||
/**
|
||||
* Add metadata to manifest to support spoofing the package name and signature of GmsCore.
|
||||
*/
|
||||
private fun ResourceContext.addSpoofingMetadata() {
|
||||
fun Node.adoptChild(tagName: String, block: Element.() -> Unit) {
|
||||
val child = ownerDocument.createElement(tagName)
|
||||
child.block()
|
||||
appendChild(child)
|
||||
}
|
||||
|
||||
xmlEditor["AndroidManifest.xml"].use {
|
||||
val applicationNode = it
|
||||
.file
|
||||
.getElementsByTagName("application")
|
||||
.item(0)
|
||||
|
||||
// Spoof package name and signature.
|
||||
applicationNode.adoptChild("meta-data") {
|
||||
setAttribute("android:name", "$gmsCoreVendor.android.gms.SPOOFED_PACKAGE_NAME")
|
||||
setAttribute("android:value", fromPackageName)
|
||||
}
|
||||
|
||||
applicationNode.adoptChild("meta-data") {
|
||||
setAttribute("android:name", "$gmsCoreVendor.android.gms.SPOOFED_PACKAGE_SIGNATURE")
|
||||
setAttribute("android:value", spoofedPackageSignature)
|
||||
}
|
||||
|
||||
// GmsCore presence detection in ReVanced Integrations.
|
||||
applicationNode.adoptChild("meta-data") {
|
||||
// TODO: The name of this metadata should be dynamic.
|
||||
setAttribute("android:name", "app.revanced.MICROG_PACKAGE_NAME")
|
||||
setAttribute("android:value", "$gmsCoreVendor.android.gms")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch the manifest to support GmsCore.
|
||||
*/
|
||||
private fun ResourceContext.patchManifest() {
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(toPackageName)
|
||||
|
||||
val manifest = this["AndroidManifest.xml"].readText()
|
||||
this["AndroidManifest.xml"].writeText(
|
||||
manifest.replace(
|
||||
"package=\"$fromPackageName",
|
||||
"package=\"$packageName"
|
||||
).replace(
|
||||
"android:authorities=\"$fromPackageName",
|
||||
"android:authorities=\"$packageName"
|
||||
).replace(
|
||||
"$fromPackageName.permission.C2D_MESSAGE",
|
||||
"$packageName.permission.C2D_MESSAGE"
|
||||
).replace(
|
||||
"$fromPackageName.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION",
|
||||
"$packageName.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
|
||||
).replace(
|
||||
"com.google.android.c2dm",
|
||||
"$gmsCoreVendor.android.c2dm"
|
||||
).replace(
|
||||
"</queries>",
|
||||
"<package android:name=\"$gmsCoreVendor.android.gms\"/></queries>"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package app.revanced.patches.shared.misc.gms.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
object GmsCoreSupportFingerprint : MethodFingerprint(
|
||||
customFingerprint = { _, classDef ->
|
||||
classDef.type.endsWith("GmsCoreSupport;")
|
||||
}
|
||||
) {
|
||||
const val GET_GMS_CORE_VENDOR_METHOD_NAME = "getGmsCoreVendor"
|
||||
}
|
||||
@@ -9,7 +9,7 @@ import org.w3c.dom.Element
|
||||
*
|
||||
* @param key The key of the preference.
|
||||
* @param title The title of the preference.
|
||||
* @param tag The tag of the preference.
|
||||
* @param tag The full class name for the preference.
|
||||
* @param summary The summary of the preference.
|
||||
*/
|
||||
abstract class BasePreference(
|
||||
|
||||
@@ -14,15 +14,21 @@ import org.w3c.dom.Element
|
||||
*
|
||||
* @param title The title of the preference.
|
||||
* @param summary The summary of the text preference.
|
||||
* @param selectable If this preference responds to tapping.
|
||||
* Setting to 'true' restores the horizontal dividers on the top and bottom,
|
||||
* but tapping will still do nothing since this Preference has no key.
|
||||
*/
|
||||
class NonInteractivePreference(
|
||||
title: StringResource,
|
||||
summary: StringResource,
|
||||
) : BasePreference(null, title, summary, "Preference") {
|
||||
summary: StringResource?,
|
||||
tag: String = "Preference",
|
||||
// If androidx.preference is later used, this can be changed to the show top/bottom dividers feature.
|
||||
val selectable: Boolean = false
|
||||
) : BasePreference(null, title, summary, tag) {
|
||||
override fun serialize(ownerDocument: Document, resourceCallback: (BaseResource) -> Unit): Element {
|
||||
return super.serialize(ownerDocument, resourceCallback).apply {
|
||||
addSummary(summary?.also { resourceCallback.invoke(it)
|
||||
setAttribute("android:selectable", false.toString())
|
||||
setAttribute("android:selectable", selectable.toString())
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
package app.revanced.patches.tiktok.ad
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.tiktok.ad.fingerprints.ConvertHelpFeedItemListFingerprint
|
||||
import app.revanced.patches.tiktok.ad.fingerprints.FeedItemListCloneFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Patch(
|
||||
name = "Hide ads",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["30.8.4"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["30.8.4"])
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object HideAdsPatch : BytecodePatch(
|
||||
setOf(FeedItemListCloneFingerprint, ConvertHelpFeedItemListFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
listOf(
|
||||
FeedItemListCloneFingerprint,
|
||||
ConvertHelpFeedItemListFingerprint
|
||||
).forEach { fingerprint ->
|
||||
val method = fingerprint.result!!.mutableMethod
|
||||
// iterate all instructions in the clone method
|
||||
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
||||
// conditions for the instruction we need
|
||||
if (instruction.opcode.ordinal != Opcode.IPUT_OBJECT.ordinal) continue
|
||||
val preloadAdsFieldInstruction = (instruction as? ReferenceInstruction)
|
||||
if ((preloadAdsFieldInstruction?.reference as? FieldReference)?.name != "preloadAds") continue
|
||||
|
||||
// set null instead of the field "preloadAds"
|
||||
val overrideRegister = (preloadAdsFieldInstruction as TwoRegisterInstruction).registerA
|
||||
method.addInstruction(
|
||||
index,
|
||||
"const/4 v$overrideRegister, 0x0"
|
||||
)
|
||||
return@forEach
|
||||
}
|
||||
throw PatchException("Can not find required instruction.")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package app.revanced.patches.tiktok.ad.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object ConvertHelpFeedItemListFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/ConvertHelp;") &&
|
||||
methodDef.name.endsWith("${'$'}FeedItemList")
|
||||
}
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.tiktok.ad.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object FeedItemListCloneFingerprint : MethodFingerprint(
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/FeedItemList;") && methodDef.name == "clone"
|
||||
}
|
||||
)
|
||||
@@ -1,8 +1,8 @@
|
||||
package app.revanced.patches.tiktok.feedfilter
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstructions
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
@@ -10,31 +10,35 @@ import app.revanced.patches.tiktok.feedfilter.fingerprints.FeedApiServiceLIZFing
|
||||
import app.revanced.patches.tiktok.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsStatusLoadFingerprint
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Feed filter",
|
||||
description = "Filters tiktok videos: removing ads, removing livestreams.",
|
||||
description = "Removes ads, livestreams, stories, image videos " +
|
||||
"and videos with a specific amount of views or likes from the feed.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.ss.android.ugc.trill"),
|
||||
CompatiblePackage("com.zhiliaoapp.musically")
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object FeedFilterPatch : BytecodePatch(setOf(FeedApiServiceLIZFingerprint, SettingsStatusLoadFingerprint)) {
|
||||
object FeedFilterPatch : BytecodePatch(
|
||||
setOf(FeedApiServiceLIZFingerprint, SettingsStatusLoadFingerprint)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val method = FeedApiServiceLIZFingerprint.result!!.mutableMethod
|
||||
for ((index, instruction) in method.implementation!!.instructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.RETURN_OBJECT) continue
|
||||
val feedItemsRegister = (instruction as OneRegisterInstruction).registerA
|
||||
method.addInstruction(
|
||||
index,
|
||||
"invoke-static {v$feedItemsRegister}, Lapp/revanced/tiktok/feedfilter/FeedItemsFilter;->filter(Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;)V"
|
||||
FeedApiServiceLIZFingerprint.result?.mutableMethod?.apply {
|
||||
val returnFeedItemInstruction = getInstructions().first { it.opcode == Opcode.RETURN_OBJECT }
|
||||
val feedItemsRegister = (returnFeedItemInstruction as OneRegisterInstruction).registerA
|
||||
|
||||
addInstruction(
|
||||
returnFeedItemInstruction.location.index,
|
||||
"invoke-static { v$feedItemsRegister }, " +
|
||||
"Lapp/revanced/tiktok/feedfilter/FeedItemsFilter;->filter(Lcom/ss/android/ugc/aweme/feed/model/FeedItemList;)V"
|
||||
)
|
||||
break
|
||||
}
|
||||
} ?: throw FeedApiServiceLIZFingerprint.exception
|
||||
|
||||
SettingsStatusLoadFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package app.revanced.patches.tiktok.feedfilter.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object FeedApiServiceLIZFingerprint : MethodFingerprint(
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC or AccessFlags.SYNTHETIC,
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/FeedApiService;") && methodDef.name == "LIZ"
|
||||
methodDef.definingClass.endsWith("/FeedApiService;") && methodDef.name == "fetchFeedList"
|
||||
}
|
||||
)
|
||||
@@ -4,10 +4,9 @@ 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.addInstructionsWithLabels
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstructions
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.PatchException
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
@@ -18,18 +17,19 @@ import app.revanced.patches.tiktok.interaction.downloads.fingerprints.DownloadPa
|
||||
import app.revanced.patches.tiktok.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsStatusLoadFingerprint
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Downloads",
|
||||
description = "Removes download restrictions and changes the default path to download to.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["30.8.4"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["30.8.4"])
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
@@ -43,86 +43,83 @@ object DownloadsPatch : BytecodePatch(
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val method1 = ACLCommonShareFingerprint.result!!.mutableMethod
|
||||
method1.replaceInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
val method2 = ACLCommonShareFingerprint2.result!!.mutableMethod
|
||||
method2.replaceInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x2
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
//Download videos without watermark.
|
||||
val method3 = ACLCommonShareFingerprint3.result!!.mutableMethod
|
||||
method3.addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/tiktok/download/DownloadsPatch;->shouldRemoveWatermark()Z
|
||||
move-result v0
|
||||
if-eqz v0, :noremovewatermark
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
:noremovewatermark
|
||||
nop
|
||||
"""
|
||||
)
|
||||
//Change the download path patch
|
||||
val method4 = DownloadPathParentFingerprint.result!!.mutableMethod
|
||||
val implementation4 = method4.implementation
|
||||
val instructions = implementation4!!.instructions
|
||||
var targetOffset = -1
|
||||
//Search for the target method called instruction offset.
|
||||
for ((index, instruction) in instructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.CONST_STRING) continue
|
||||
val reference = (instruction as ReferenceInstruction).reference as StringReference
|
||||
if (reference.string != "video/mp4") continue
|
||||
val targetInstruction = instructions[index + 1]
|
||||
if (targetInstruction.opcode != Opcode.INVOKE_STATIC) continue
|
||||
targetOffset = index + 1
|
||||
break
|
||||
}
|
||||
if (targetOffset == -1) throw PatchException("Can not find download path uri method.")
|
||||
//Change videos' download path.
|
||||
val downloadUriMethod = context
|
||||
.toMethodWalker(DownloadPathParentFingerprint.result!!.method)
|
||||
.nextMethod(targetOffset, true)
|
||||
.getMethod() as MutableMethod
|
||||
downloadUriMethod.implementation!!.instructions.forEachIndexed { index, instruction ->
|
||||
if (instruction.opcode == Opcode.SGET_OBJECT) {
|
||||
val overrideRegister = (instruction as OneRegisterInstruction).registerA
|
||||
downloadUriMethod.addInstructions(
|
||||
index + 1,
|
||||
fun MethodFingerprint.getMethod() = result?.mutableMethod ?: throw exception
|
||||
|
||||
mapOf<MethodFingerprint, MutableMethod.() -> Unit>(
|
||||
ACLCommonShareFingerprint to {
|
||||
replaceInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/tiktok/download/DownloadsPatch;->getDownloadPath()Ljava/lang/String;
|
||||
move-result-object v$overrideRegister
|
||||
const/4 v0, 0x0
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
}
|
||||
if (instruction.opcode == Opcode.CONST_STRING) {
|
||||
val string = ((instruction as ReferenceInstruction).reference as StringReference).string
|
||||
if (string.contains("/Camera")) {
|
||||
val overrideRegister = (instruction as OneRegisterInstruction).registerA
|
||||
val overrideString = string.replace("/Camera", "")
|
||||
downloadUriMethod.replaceInstruction(
|
||||
index,
|
||||
"""
|
||||
const-string v$overrideRegister, "$overrideString"
|
||||
"""
|
||||
},
|
||||
ACLCommonShareFingerprint2 to {
|
||||
replaceInstructions(
|
||||
0,
|
||||
"""
|
||||
const/4 v0, 0x2
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
},
|
||||
// Download videos without watermark.
|
||||
ACLCommonShareFingerprint3 to {
|
||||
addInstructionsWithLabels(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/tiktok/download/DownloadsPatch;->shouldRemoveWatermark()Z
|
||||
move-result v0
|
||||
if-eqz v0, :noremovewatermark
|
||||
const/4 v0, 0x1
|
||||
return v0
|
||||
:noremovewatermark
|
||||
nop
|
||||
"""
|
||||
)
|
||||
},
|
||||
// Change the download path patch.
|
||||
DownloadPathParentFingerprint to {
|
||||
val targetIndex = indexOfFirstInstruction { opcode == Opcode.INVOKE_STATIC }
|
||||
val downloadUriMethod = context
|
||||
.toMethodWalker(this)
|
||||
.nextMethod(targetIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
|
||||
val firstIndex = downloadUriMethod.indexOfFirstInstruction {
|
||||
opcode == Opcode.INVOKE_DIRECT && ((this as Instruction35c).reference as MethodReference).name == "<init>"
|
||||
}
|
||||
val secondIndex = downloadUriMethod.indexOfFirstInstruction {
|
||||
opcode == Opcode.INVOKE_STATIC && ((this as Instruction35c).reference as MethodReference).returnType.contains(
|
||||
"Uri"
|
||||
)
|
||||
}
|
||||
|
||||
downloadUriMethod.addInstructions(
|
||||
secondIndex,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/tiktok/download/DownloadsPatch;->getDownloadPath()Ljava/lang/String;
|
||||
move-result-object v0
|
||||
"""
|
||||
)
|
||||
|
||||
downloadUriMethod.addInstructions(
|
||||
firstIndex,
|
||||
"""
|
||||
invoke-static {}, Lapp/revanced/tiktok/download/DownloadsPatch;->getDownloadPath()Ljava/lang/String;
|
||||
move-result-object v0
|
||||
"""
|
||||
)
|
||||
},
|
||||
SettingsStatusLoadFingerprint to {
|
||||
addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableDownload()V"
|
||||
)
|
||||
}
|
||||
).forEach { (fingerprint, patch) ->
|
||||
fingerprint.getMethod().patch()
|
||||
}
|
||||
val method5 = SettingsStatusLoadFingerprint.result!!.mutableMethod
|
||||
method5.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/tiktok/settingsmenu/SettingsStatus;->enableDownload()V"
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,13 +3,22 @@ package app.revanced.patches.tiktok.interaction.downloads.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 DownloadPathParentFingerprint : MethodFingerprint(
|
||||
"V",
|
||||
AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
"L",
|
||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||
strings = listOf(
|
||||
"code",
|
||||
"reason",
|
||||
"params insufficient"
|
||||
"video/mp4"
|
||||
),
|
||||
parameters = listOf(
|
||||
"L",
|
||||
"L"
|
||||
),
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_STRING,
|
||||
Opcode.INVOKE_STATIC,
|
||||
Opcode.MOVE_RESULT_OBJECT,
|
||||
Opcode.RETURN_OBJECT
|
||||
)
|
||||
)
|
||||
@@ -7,27 +7,36 @@ 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.tiktok.interaction.speed.fingerprints.SpeedControlParentFingerprint
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.util.indexOfFirstInstruction
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Playback speed",
|
||||
description = "Enables the playback speed option for all videos.",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.ss.android.ugc.trill"),
|
||||
CompatiblePackage("com.zhiliaoapp.musically")
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object PlaybackSpeedPatch : BytecodePatch(setOf(SpeedControlParentFingerprint)) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val parentMethod = SpeedControlParentFingerprint.result!!.mutableMethod
|
||||
val parentMethodInstructions = parentMethod.implementation!!.instructions
|
||||
for ((index, instruction) in parentMethodInstructions.withIndex()) {
|
||||
if (instruction.opcode != Opcode.INVOKE_VIRTUAL) continue
|
||||
SpeedControlParentFingerprint.result?.mutableMethod?.apply {
|
||||
val targetMethodCallIndex = indexOfFirstInstruction {
|
||||
if (opcode == Opcode.INVOKE_STATIC) {
|
||||
val paramsTypes = ((this as Instruction35c).reference as MethodReference).parameterTypes
|
||||
paramsTypes.size == 1 && paramsTypes[0].contains("/Aweme;")
|
||||
} else false
|
||||
}
|
||||
|
||||
val isSpeedEnableMethod = context
|
||||
.toMethodWalker(parentMethod)
|
||||
.nextMethod(index, true)
|
||||
.toMethodWalker(this)
|
||||
.nextMethod(targetMethodCallIndex, true)
|
||||
.getMethod() as MutableMethod
|
||||
|
||||
isSpeedEnableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
@@ -35,7 +44,6 @@ object PlaybackSpeedPatch : BytecodePatch(setOf(SpeedControlParentFingerprint))
|
||||
return v0
|
||||
"""
|
||||
)
|
||||
break
|
||||
}
|
||||
} ?: throw SpeedControlParentFingerprint.exception
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,9 @@ import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object SpeedControlParentFingerprint : MethodFingerprint(
|
||||
returnType = "L",
|
||||
accessFlags = AccessFlags.PRIVATE or AccessFlags.FINAL,
|
||||
parameters = listOf(
|
||||
"L"
|
||||
),
|
||||
strings = listOf(
|
||||
"playback_speed"
|
||||
"onStopTrackingTouch, hasTouchMove=",
|
||||
", isCurVideoPaused: ",
|
||||
"already_shown_edge_speed_guide"
|
||||
)
|
||||
)
|
||||
@@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.tiktok.misc.settings
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
|
||||
@@ -14,17 +13,19 @@ import app.revanced.patches.tiktok.misc.settings.fingerprints.AdPersonalizationA
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.AddSettingsEntryFingerprint
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsEntryFingerprint
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsEntryInfoFingerprint
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c
|
||||
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.reference.FieldReference
|
||||
|
||||
@Patch(
|
||||
name = "Settings",
|
||||
description = "Adds ReVanced settings to TikTok.",
|
||||
dependencies = [IntegrationsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["30.8.4"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["30.8.4"])
|
||||
CompatiblePackage("com.ss.android.ugc.trill", ["32.5.3"]),
|
||||
CompatiblePackage("com.zhiliaoapp.musically", ["32.5.3"])
|
||||
]
|
||||
)
|
||||
object SettingsPatch : BytecodePatch(
|
||||
@@ -57,31 +58,31 @@ object SettingsPatch : BytecodePatch(
|
||||
?: throw SettingsEntryInfoFingerprint.exception
|
||||
|
||||
// Create a settings entry for 'revanced settings' and add it to settings fragment
|
||||
AddSettingsEntryFingerprint.result?.apply {
|
||||
scanResult.patternScanResult?.startIndex?.let {
|
||||
val settingsEntries = mutableMethod.getInstruction(it + 3)
|
||||
val addEntry = mutableMethod.getInstruction<BuilderInstruction35c>(it + 5)
|
||||
val register1 = addEntry.registerC
|
||||
val register2 = addEntry.registerD
|
||||
// Add the settings entry created to the settings fragment
|
||||
mutableMethod.addInstructions(
|
||||
it + 6,
|
||||
listOf(
|
||||
settingsEntries,
|
||||
addEntry
|
||||
)
|
||||
)
|
||||
// These instructions call a method that create a settings entry use reflection base on the class name of classes that construct settings entry
|
||||
mutableMethod.addInstructions(
|
||||
it + 6,
|
||||
"""
|
||||
const-string v$register1, "$settingsButtonClass"
|
||||
const-string v$register2, "$settingsButtonInfoClass"
|
||||
invoke-static {v$register1, v$register2}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR
|
||||
move-result-object v$register2
|
||||
"""
|
||||
)
|
||||
AddSettingsEntryFingerprint.result?.mutableMethod?.apply {
|
||||
val markIndex = implementation!!.instructions.indexOfFirst {
|
||||
it.opcode == Opcode.IGET_OBJECT && ((it as Instruction22c).reference as FieldReference).name == "headerUnit"
|
||||
}
|
||||
|
||||
val getUnitManager = getInstruction(markIndex + 2)
|
||||
val addEntry = getInstruction(markIndex + 1)
|
||||
|
||||
addInstructions(
|
||||
markIndex + 2,
|
||||
listOf(
|
||||
getUnitManager,
|
||||
addEntry
|
||||
)
|
||||
)
|
||||
|
||||
addInstructions(
|
||||
markIndex + 2,
|
||||
"""
|
||||
const-string v0, "$settingsButtonClass"
|
||||
const-string v1, "$settingsButtonInfoClass"
|
||||
invoke-static {v0, v1}, $CREATE_SETTINGS_ENTRY_METHOD_DESCRIPTOR
|
||||
move-result-object v0
|
||||
"""
|
||||
)
|
||||
} ?: throw AddSettingsEntryFingerprint.exception
|
||||
|
||||
// Initialize the settings menu once the replaced setting entry is clicked.
|
||||
@@ -98,10 +99,10 @@ object SettingsPatch : BytecodePatch(
|
||||
"""
|
||||
invoke-static {v$thisRegister}, $INITIALIZE_SETTINGS_METHOD_DESCRIPTOR
|
||||
move-result v$usableRegister
|
||||
if-eqz v$usableRegister, :notrevanced
|
||||
if-eqz v$usableRegister, :do_not_open
|
||||
return-void
|
||||
""",
|
||||
ExternalLabel("notrevanced", getInstruction(initializeSettingsIndex))
|
||||
ExternalLabel("do_not_open", getInstruction(initializeSettingsIndex))
|
||||
)
|
||||
} ?: throw AdPersonalizationActivityOnCreateFingerprint.exception
|
||||
}
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
package app.revanced.patches.tiktok.misc.settings.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
internal object AddSettingsEntryFingerprint : MethodFingerprint(
|
||||
opcodes = listOf(
|
||||
Opcode.CONST_CLASS,
|
||||
Opcode.APUT_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.IGET_OBJECT,
|
||||
Opcode.INVOKE_VIRTUAL,
|
||||
),
|
||||
customFingerprint = { methodDef, _ ->
|
||||
methodDef.definingClass.endsWith("/SettingNewVersionFragment;") &&
|
||||
methodDef.name == "onViewCreated"
|
||||
methodDef.name == "initUnitManger"
|
||||
}
|
||||
)
|
||||
@@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.tiktok.misc.spoof.sim
|
||||
|
||||
import app.revanced.util.findMutableMethodOf
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
@@ -10,8 +9,9 @@ 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.tiktok.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsStatusLoadFingerprint
|
||||
import app.revanced.patches.tiktok.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.tiktok.misc.settings.fingerprints.SettingsStatusLoadFingerprint
|
||||
import app.revanced.util.findMutableMethodOf
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
|
||||
@@ -39,7 +39,7 @@ object SpoofSimPatch : BytecodePatch() {
|
||||
)
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Find all api call to check sim information
|
||||
// Find all api call to check sim information.
|
||||
buildMap {
|
||||
context.classes.forEach { classDef ->
|
||||
classDef.methods.let { methods ->
|
||||
@@ -81,7 +81,7 @@ object SpoofSimPatch : BytecodePatch() {
|
||||
}
|
||||
}
|
||||
|
||||
// Enable patch in settings
|
||||
// Enable patch in settings.
|
||||
with(SettingsStatusLoadFingerprint.result!!.mutableMethod) {
|
||||
addInstruction(
|
||||
0,
|
||||
@@ -90,7 +90,7 @@ object SpoofSimPatch : BytecodePatch() {
|
||||
}
|
||||
}
|
||||
|
||||
// Patch Android API and return fake sim information
|
||||
// Patch Android API and return fake sim information.
|
||||
private fun MutableMethod.replaceReference(index: Int, replacement: String) {
|
||||
val resultReg = getInstruction<OneRegisterInstruction>(index + 1).registerA
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.io.Closeable
|
||||
description = "Adds settings menu to Twitch.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("tv.twitch.android.app", ["16.9.1"])
|
||||
CompatiblePackage("tv.twitch.android.app", ["15.4.1", "16.1.0", "16.9.1"])
|
||||
]
|
||||
)
|
||||
object SettingsPatch : BytecodePatch(
|
||||
|
||||
@@ -10,7 +10,7 @@ import java.nio.file.Files
|
||||
|
||||
@Patch(
|
||||
name = "Dynamic color",
|
||||
description = "Replaces the default Twitter Blue with the user's Material You palette.",
|
||||
description = "Replaces the default X (Formerly Twitter) Blue with the user's Material You palette.",
|
||||
compatiblePackages = [CompatiblePackage("com.twitter.android")]
|
||||
)
|
||||
@Suppress("unused")
|
||||
@@ -46,8 +46,7 @@ object DynamicColorPatch : ResourcePatch() {
|
||||
"twitter_blue_opacity_30" to "@android:color/system_accent1_100",
|
||||
"twitter_blue_opacity_50" to "@android:color/system_accent1_200",
|
||||
"twitter_blue_opacity_58" to "@android:color/system_accent1_300",
|
||||
"deep_transparent_twitter_blue" to "@android:color/system_accent1_200",
|
||||
"ic_launcher_background" to "#1DA1F2"
|
||||
"deep_transparent_twitter_blue" to "@android:color/system_accent1_200"
|
||||
).forEach { (k, v) ->
|
||||
val colorElement = document.createElement("color")
|
||||
|
||||
|
||||
@@ -28,30 +28,39 @@ internal object CopyVideoUrlResourcePatch : ResourcePatch() {
|
||||
SwitchPreference(
|
||||
"revanced_copy_video_url",
|
||||
StringResource("revanced_copy_video_url_title", "Show copy video URL button"),
|
||||
StringResource("revanced_copy_video_url_summary_on", "Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp"),
|
||||
StringResource(
|
||||
"revanced_copy_video_url_summary_on",
|
||||
"Button is shown. Tap to copy video URL. Tap and hold to copy video URL with timestamp"
|
||||
),
|
||||
StringResource("revanced_copy_video_url_summary_off", "Button is not shown")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_copy_video_url_timestamp",
|
||||
StringResource("revanced_copy_video_url_timestamp_title", "Show copy timestamp URL button"),
|
||||
StringResource("revanced_copy_video_url_timestamp_summary_on", "Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp"),
|
||||
StringResource(
|
||||
"revanced_copy_video_url_timestamp_summary_on",
|
||||
"Button is shown. Tap to copy video URL with timestamp. Tap and hold to copy video without timestamp"
|
||||
),
|
||||
StringResource("revanced_copy_video_url_timestamp_summary_off", "Button is not shown")
|
||||
)
|
||||
),
|
||||
StringResource("revanced_copy_video_url_preference_screen_summary", "Settings related to copy URL buttons in video player")
|
||||
StringResource(
|
||||
"revanced_copy_video_url_preference_screen_summary",
|
||||
"Settings related to copy URL buttons in video player"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
context.copyResources("copyvideourl", ResourceGroup(
|
||||
resourceDirectoryName = "drawable",
|
||||
"revanced_yt_copy.xml",
|
||||
"revanced_yt_copy_timestamp.xml"
|
||||
)
|
||||
context.copyResources(
|
||||
"copyvideourl", ResourceGroup(
|
||||
resourceDirectoryName = "drawable",
|
||||
"revanced_yt_copy.xml",
|
||||
"revanced_yt_copy_timestamp.xml"
|
||||
)
|
||||
)
|
||||
|
||||
// merge strings
|
||||
context.mergeStrings("copyvideourl/host/values/strings.xml")
|
||||
|
||||
BottomControlsResourcePatch.addControls("copyvideourl/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
|
||||
BottomControlsResourcePatch.addControls("copyvideourl")
|
||||
}
|
||||
}
|
||||
@@ -28,27 +28,35 @@ internal object ExternalDownloadsResourcePatch : ResourcePatch() {
|
||||
"revanced_external_downloader",
|
||||
StringResource("revanced_external_downloader_title", "Show external download button"),
|
||||
StringResource("revanced_external_downloader_summary_on", "Download button shown in player"),
|
||||
StringResource("revanced_external_downloader_summary_off", "Download button not shown in player")
|
||||
StringResource(
|
||||
"revanced_external_downloader_summary_off",
|
||||
"Download button not shown in player"
|
||||
)
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_external_downloader_name",
|
||||
StringResource("revanced_external_downloader_name_title", "Downloader package name"),
|
||||
StringResource("revanced_external_downloader_name_summary", "Package name of your installed external downloader app, such as NewPipe or Seal"),
|
||||
StringResource(
|
||||
"revanced_external_downloader_name_summary",
|
||||
"Package name of your installed external downloader app, such as NewPipe or Seal"
|
||||
),
|
||||
InputType.TEXT
|
||||
)
|
||||
),
|
||||
StringResource("revanced_external_downloader_preference_screen_summary", "Settings for using an external downloader")
|
||||
StringResource(
|
||||
"revanced_external_downloader_preference_screen_summary",
|
||||
"Settings for using an external downloader"
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
// Copy strings
|
||||
context.mergeStrings("downloads/host/values/strings.xml")
|
||||
|
||||
// Copy resources
|
||||
context.copyResources("downloads", ResourceGroup("drawable", "revanced_yt_download_button.xml"))
|
||||
context.copyResources(
|
||||
"downloads",
|
||||
ResourceGroup("drawable", "revanced_yt_download_button.xml")
|
||||
)
|
||||
|
||||
// Add download button node
|
||||
BottomControlsResourcePatch.addControls("downloads/host/layout/${BottomControlsResourcePatch.TARGET_RESOURCE_NAME}")
|
||||
BottomControlsResourcePatch.addControls("downloads")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Enable slide to seek",
|
||||
description = "Enable slide to seek instead of playing at 2x speed.",
|
||||
description = "Enable slide to seek instead of playing at 2x speed when pressing and holding in the video player.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.nio.file.Files
|
||||
|
||||
@Patch(
|
||||
name = "Custom branding",
|
||||
description = "Changes the app icon and name to your choice (defaults to YouTube ReVanced and the ReVanced logo).",
|
||||
description = "Changes the app name and icon to your choice (defaults to \"YouTube ReVanced\" and the ReVanced logo).",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube")
|
||||
],
|
||||
|
||||
@@ -13,7 +13,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Hide video action buttons",
|
||||
description = "Adds the options to hide action buttons under a video.",
|
||||
description = "Adds options to hide action buttons under a video.",
|
||||
dependencies = [
|
||||
ResourceMappingPatch::class,
|
||||
LithoFilterPatch::class
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.android.tools.smali.dexlib2.Opcode
|
||||
|
||||
@Patch(
|
||||
name = "Hide captions button",
|
||||
description = "Hides the captions button on video player.",
|
||||
description = "Hides the captions button in the video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction3rc
|
||||
|
||||
@Patch(
|
||||
name = "Hide player buttons",
|
||||
description = "Adds the option to hide video player previous and next buttons.",
|
||||
description = "Hides previous and next buttons in the video player.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
SettingsPatch::class
|
||||
|
||||
@@ -16,7 +16,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||
|
||||
@Patch(
|
||||
name = "Hide endscreen cards",
|
||||
description = "Hides the suggested video cards at the end of a video in fullscreen.",
|
||||
description = "Hides the suggested video cards at the end of videos.",
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
HideEndscreenCardsResourcePatch::class
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package app.revanced.patches.youtube.layout.hide.personalinformation
|
||||
|
||||
import app.revanced.util.exception
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||
@@ -9,10 +8,11 @@ import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.layout.hide.personalinformation.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Deprecated("This patch is no longer working and will be removed in a future release.")
|
||||
@Patch(
|
||||
name = "Hide email address",
|
||||
description = "Hides the email address in the account switcher.",
|
||||
dependencies = [IntegrationsPatch::class, HideEmailAddressResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Disable rolling number animations",
|
||||
description = "Disables rolling number animations of video view count, upload time, and user likes",
|
||||
description = "Disables rolling number animations of video view count, user likes, and upload time.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -14,7 +14,7 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
@Patch(
|
||||
name = "Disable player popup panels",
|
||||
description = "Disables panels from appearing automatically when going into fullscreen (playlist or live chat).",
|
||||
description = "Disables panels (such as live chat) from opening automatically.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -13,7 +13,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Custom player overlay opacity",
|
||||
description = "Change the opacity of the player background, when player controls are visible.",
|
||||
description = "Change the opacity of the player background when player controls are visible.",
|
||||
dependencies = [CustomPlayerOverlayOpacityResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage("com.google.android.youtube")
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
|
||||
@Patch(
|
||||
name = "SponsorBlock",
|
||||
description = "Integrates SponsorBlock which allows skipping video segments such as sponsored content.",
|
||||
description = "Integrates SponsorBlock, which can skip undesired video segments such as sponsored content.",
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
|
||||
@@ -18,7 +18,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||
@Patch(
|
||||
name = "Spoof app version",
|
||||
description = "Tricks YouTube into thinking you are running an older version of the app. " +
|
||||
"One of the side effects also includes restoring the old UI.",
|
||||
"This can be used to restore old UI elements and features.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
package app.revanced.patches.youtube.layout.startpage
|
||||
|
||||
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.shared.fingerprints.HomeActivityFingerprint
|
||||
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
|
||||
import app.revanced.patches.shared.settings.preference.impl.ListPreference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.youtube.layout.startpage.fingerprints.StartActivityFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
|
||||
@Patch(
|
||||
name = "Change start page",
|
||||
description = "Changes the start page of the app.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube"
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object ChangeStartPagePatch : BytecodePatch(
|
||||
setOf(HomeActivityFingerprint)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/ChangeStartPagePatch;"
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
ListPreference(
|
||||
"revanced_start_page",
|
||||
StringResource(
|
||||
"revanced_start_page_title",
|
||||
"Set start page"
|
||||
),
|
||||
ArrayResource(
|
||||
"revanced_start_page_entries",
|
||||
listOf(
|
||||
StringResource("revanced_start_page_home_entry_0", "Default"),
|
||||
StringResource("revanced_start_page_home_entry_1", "Home"),
|
||||
StringResource("revanced_start_page_search_entry_2", "Search"),
|
||||
StringResource("revanced_start_page_subscriptions_entry_3", "Subscriptions"),
|
||||
StringResource("revanced_start_page_explore_entry_4", "Explore"),
|
||||
StringResource("revanced_start_page_shorts_entry_5", "Shorts"),
|
||||
)
|
||||
),
|
||||
ArrayResource(
|
||||
"revanced_start_page_values",
|
||||
listOf(
|
||||
StringResource("revanced_start_page_home_value_0", ""),
|
||||
StringResource("revanced_start_page_home_value_1", "MAIN"),
|
||||
StringResource("revanced_start_page_search_value_2", "open.search"),
|
||||
StringResource("revanced_start_page_subscriptions_value_3", "open.subscriptions"),
|
||||
StringResource("revanced_start_page_explore_value_4", "open.explore"),
|
||||
StringResource("revanced_start_page_shorts_value_5", "open.shorts"),
|
||||
)
|
||||
),
|
||||
default = ""
|
||||
)
|
||||
)
|
||||
|
||||
StartActivityFingerprint.resolve(
|
||||
context,
|
||||
HomeActivityFingerprint.result?.classDef ?: throw HomeActivityFingerprint.exception
|
||||
)
|
||||
|
||||
StartActivityFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static { p1 }, $INTEGRATIONS_CLASS_DESCRIPTOR->changeIntent(Landroid/content/Intent;)V"
|
||||
) ?: throw StartActivityFingerprint.exception
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package app.revanced.patches.youtube.layout.startpage.fingerprints
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
object StartActivityFingerprint : MethodFingerprint(
|
||||
parameters = listOf("Landroid/content/Intent;"),
|
||||
)
|
||||
@@ -1,22 +1,36 @@
|
||||
package app.revanced.patches.youtube.layout.thumbnails
|
||||
|
||||
import app.revanced.util.exception
|
||||
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.getInstructions
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
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.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.shared.settings.preference.impl.*
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.*
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.MessageDigestImageUrlFingerprint
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.MessageDigestImageUrlParentFingerprint
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.RequestFingerprint
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnFailureFingerprint
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnResponseStartedFingerprint
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback.OnSucceededFingerprint
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.exception
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
|
||||
|
||||
@Patch(
|
||||
name = "Alternative thumbnails",
|
||||
description = "Adds options to replace video thumbnails with still image captures of the video.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class, AlternativeThumbnailsResourcePatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
@@ -34,7 +48,11 @@ import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
)
|
||||
@Suppress("unused")
|
||||
object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
setOf(MessageDigestImageUrlParentFingerprint, CronetURLRequestCallbackOnResponseStartedFingerprint)
|
||||
setOf(
|
||||
MessageDigestImageUrlParentFingerprint,
|
||||
OnResponseStartedFingerprint,
|
||||
RequestFingerprint,
|
||||
)
|
||||
) {
|
||||
private const val INTEGRATIONS_CLASS_DESCRIPTOR =
|
||||
"Lapp/revanced/integrations/patches/AlternativeThumbnailsPatch;"
|
||||
@@ -51,11 +69,13 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
/**
|
||||
* @param highPriority If the hook should be called before all other hooks.
|
||||
*/
|
||||
@Suppress("SameParameterValue")
|
||||
private fun addImageUrlHook(targetMethodClass: String, highPriority: Boolean) {
|
||||
loadImageUrlMethod.addInstructions(
|
||||
if (highPriority) 0 else loadImageUrlIndex, """
|
||||
invoke-static { p1 }, $targetMethodClass->overrideImageURL(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object p1
|
||||
if (highPriority) 0 else loadImageUrlIndex,
|
||||
"""
|
||||
invoke-static { p1 }, $targetMethodClass->overrideImageURL(Ljava/lang/String;)Ljava/lang/String;
|
||||
move-result-object p1
|
||||
"""
|
||||
)
|
||||
loadImageUrlIndex += 2
|
||||
@@ -65,103 +85,197 @@ object AlternativeThumbnailsPatch : BytecodePatch(
|
||||
* If a connection completed, which includes normal 200 responses but also includes
|
||||
* status 404 and other error like http responses.
|
||||
*/
|
||||
@Suppress("SameParameterValue")
|
||||
private fun addImageUrlSuccessCallbackHook(targetMethodClass: String) {
|
||||
loadImageSuccessCallbackMethod.addInstruction(
|
||||
loadImageSuccessCallbackIndex++,
|
||||
"invoke-static { p2 }, $targetMethodClass->handleCronetSuccess(Lorg/chromium/net/UrlResponseInfo;)V"
|
||||
"invoke-static { p1, p2 }, $targetMethodClass->handleCronetSuccess(" +
|
||||
"Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;)V"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* If a connection outright failed to complete any connection.
|
||||
*/
|
||||
fun addImageUrlErrorCallbackHook(targetMethodClass: String) {
|
||||
@Suppress("SameParameterValue")
|
||||
private fun addImageUrlErrorCallbackHook(targetMethodClass: String) {
|
||||
loadImageErrorCallbackMethod.addInstruction(
|
||||
loadImageErrorCallbackIndex++,
|
||||
"invoke-static { p2, p3 }, $targetMethodClass->handleCronetFailure(Lorg/chromium/net/UrlResponseInfo;Ljava/io/IOException;)V"
|
||||
"invoke-static { p1, p2, p3 }, $targetMethodClass->handleCronetFailure(" +
|
||||
"Lorg/chromium/net/UrlRequest;Lorg/chromium/net/UrlResponseInfo;Ljava/io/IOException;)V"
|
||||
)
|
||||
}
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
|
||||
PreferenceScreen(
|
||||
"revanced_alt_thumbnails_preference_screen",
|
||||
StringResource("revanced_alt_thumbnails_preference_screen_title", "Alternative thumbnails"),
|
||||
"revanced_alt_thumbnail_preference_screen",
|
||||
StringResource("revanced_alt_thumbnail_preference_screen_title", "Alternative thumbnails"),
|
||||
listOf(
|
||||
NonInteractivePreference(
|
||||
StringResource("revanced_alt_thumbnail_about_title", "Thumbnails in use"),
|
||||
null, // Summary is dynamically updated based on the current settings.
|
||||
tag = "app.revanced.integrations.settingsmenu.AlternativeThumbnailsStatusPreference"
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_alt_thumbnail",
|
||||
StringResource("revanced_alt_thumbnail_title", "Enable alternative thumbnails"),
|
||||
StringResource("revanced_alt_thumbnail_summary_on", "YouTube video stills shown"),
|
||||
StringResource("revanced_alt_thumbnail_summary_off", "Original YouTube thumbnails shown")
|
||||
"revanced_alt_thumbnail_dearrow",
|
||||
StringResource("revanced_alt_thumbnail_dearrow_title", "Enable DeArrow"),
|
||||
StringResource("revanced_alt_thumbnail_dearrow_summary_on", "Using DeArrow"),
|
||||
StringResource("revanced_alt_thumbnail_dearrow_summary_off", "Not using DeArrow")
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_alt_thumbnail_dearrow_connection_toast",
|
||||
StringResource("revanced_alt_thumbnail_dearrow_connection_toast_title", "Show a toast if API is not available"),
|
||||
StringResource("revanced_alt_thumbnail_dearrow_connection_toast_summary_on", "Toast is shown if DeArrow is not available"),
|
||||
StringResource("revanced_alt_thumbnail_dearrow_connection_toast_summary_off", "Toast is not shown if DeArrow is not available")
|
||||
),
|
||||
TextPreference(
|
||||
"revanced_alt_thumbnail_dearrow_api_url",
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_dearrow_api_url_title",
|
||||
"DeArrow API endpoint"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_dearrow_api_url_summary",
|
||||
"The URL of the DeArrow thumbnail cache endpoint. " +
|
||||
"Do not change this unless you know what you\\\'re doing"
|
||||
),
|
||||
),
|
||||
NonInteractivePreference(
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_dearrow_about_title",
|
||||
"About DeArrow"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_dearrow_about_summary",
|
||||
"DeArrow provides crowd-sourced thumbnails for YouTube videos. " +
|
||||
"These thumbnails are often more relevant than those provided by YouTube. " +
|
||||
"If enabled, video URLs will be sent to the API server and no other data is sent."
|
||||
+ "\\n\\nTap here to learn more about DeArrow"
|
||||
),
|
||||
// Custom about preference with link to the DeArrow website.
|
||||
tag = "app.revanced.integrations.settingsmenu.AlternativeThumbnailsAboutDeArrowPreference",
|
||||
selectable = true
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_alt_thumbnail_stills",
|
||||
StringResource("revanced_alt_thumbnail_stills_title", "Enable still video captures"),
|
||||
StringResource("revanced_alt_thumbnail_stills_summary_on", "Using YouTube still video captures"),
|
||||
StringResource("revanced_alt_thumbnail_stills_summary_off", "Not using YouTube still video captures")
|
||||
),
|
||||
ListPreference(
|
||||
"revanced_alt_thumbnail_type",
|
||||
StringResource("revanced_alt_thumbnail_type_title", "Video time to take the still from"),
|
||||
"revanced_alt_thumbnail_stills_time",
|
||||
StringResource("revanced_alt_thumbnail_stills_time_title", "Video time to take the still from"),
|
||||
ArrayResource(
|
||||
"revanced_alt_thumbnail_type_entries",
|
||||
listOf(
|
||||
StringResource("revanced_alt_thumbnail_type_entry_1", "Beginning of video"),
|
||||
StringResource("revanced_alt_thumbnail_type_entry_2", "Middle of video"),
|
||||
StringResource("revanced_alt_thumbnail_type_entry_3", "End of video"),
|
||||
StringResource("revanced_alt_thumbnail_stills_time_entry_1", "Beginning of video"),
|
||||
StringResource("revanced_alt_thumbnail_stills_time_entry_2", "Middle of video"),
|
||||
StringResource("revanced_alt_thumbnail_stills_time_entry_3", "End of video"),
|
||||
)
|
||||
),
|
||||
ArrayResource(
|
||||
"revanced_alt_thumbnail_type_entry_values",
|
||||
"revanced_alt_thumbnail_stills_time_entry_values",
|
||||
listOf(
|
||||
StringResource("revanced_alt_thumbnail_type_entry_value_1", "1"),
|
||||
StringResource("revanced_alt_thumbnail_type_entry_value_2", "2"),
|
||||
StringResource("revanced_alt_thumbnail_type_entry_value_3", "3"),
|
||||
StringResource("revanced_alt_thumbnail_stills_time_entry_value_1", "1"),
|
||||
StringResource("revanced_alt_thumbnail_stills_time_entry_value_2", "2"),
|
||||
StringResource("revanced_alt_thumbnail_stills_time_entry_value_3", "3"),
|
||||
)
|
||||
)
|
||||
),
|
||||
SwitchPreference(
|
||||
"revanced_alt_thumbnail_fast_quality",
|
||||
StringResource("revanced_alt_thumbnail_fast_quality_title", "Use fast alternative thumbnails"),
|
||||
"revanced_alt_thumbnail_stills_fast",
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_fast_quality_summary_on",
|
||||
"Using medium quality stills. Thumbnails will load faster, but live streams, unreleased, or very old videos may show blank thumbnails"
|
||||
"revanced_alt_thumbnail_stills_fast_title",
|
||||
"Use fast still captures"
|
||||
),
|
||||
StringResource("revanced_alt_thumbnail_fast_quality_summary_off", "Using high quality stills")
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_stills_fast_summary_on",
|
||||
"Using medium quality still captures. " +
|
||||
"Thumbnails will load faster, but live streams, unreleased, " +
|
||||
"or very old videos may show blank thumbnails"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_stills_fast_summary_off",
|
||||
"Using high quality still captures"
|
||||
)
|
||||
),
|
||||
NonInteractivePreference(
|
||||
StringResource("revanced_alt_thumbnail_about_title", "About"),
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_about_summary",
|
||||
"Alternative thumbnails are still images from the beginning/middle/end of each video. No external API is used, as these images are built into YouTube"
|
||||
)
|
||||
"revanced_alt_thumbnail_stills_about_title",
|
||||
"About still video captures"
|
||||
),
|
||||
StringResource(
|
||||
"revanced_alt_thumbnail_stills_about_summary",
|
||||
"Still captures are taken from the beginning/middle/end of each video. " +
|
||||
"These images are built into YouTube and no external API is used"
|
||||
),
|
||||
// Restore the preference dividers to keep it from looking weird.
|
||||
selectable = true
|
||||
)
|
||||
),
|
||||
StringResource("revanced_alt_thumbnails_preference_screen_summary", "Video thumbnail settings")
|
||||
StringResource("revanced_alt_thumbnail_preference_screen_summary", "Video thumbnail settings")
|
||||
)
|
||||
)
|
||||
|
||||
MessageDigestImageUrlParentFingerprint.result
|
||||
?: throw MessageDigestImageUrlParentFingerprint.exception
|
||||
MessageDigestImageUrlFingerprint.resolve(context, MessageDigestImageUrlParentFingerprint.result!!.classDef)
|
||||
MessageDigestImageUrlFingerprint.result?.apply {
|
||||
loadImageUrlMethod = mutableMethod
|
||||
} ?: throw MessageDigestImageUrlFingerprint.exception
|
||||
addImageUrlHook(INTEGRATIONS_CLASS_DESCRIPTOR, true)
|
||||
fun MethodFingerprint.getResultOrThrow() =
|
||||
result ?: throw exception
|
||||
|
||||
fun MethodFingerprint.alsoResolve(fingerprint: MethodFingerprint) =
|
||||
also { resolve(context, fingerprint.getResultOrThrow().classDef) }.getResultOrThrow()
|
||||
|
||||
CronetURLRequestCallbackOnResponseStartedFingerprint.result
|
||||
?: throw CronetURLRequestCallbackOnResponseStartedFingerprint.exception
|
||||
CronetURLRequestCallbackOnSucceededFingerprint.resolve(
|
||||
context,
|
||||
CronetURLRequestCallbackOnResponseStartedFingerprint.result!!.classDef
|
||||
)
|
||||
CronetURLRequestCallbackOnSucceededFingerprint.result?.apply {
|
||||
loadImageSuccessCallbackMethod = mutableMethod
|
||||
} ?: throw CronetURLRequestCallbackOnSucceededFingerprint.exception
|
||||
addImageUrlSuccessCallbackHook(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
fun MethodFingerprint.resolveAndLetMutableMethod(
|
||||
fingerprint: MethodFingerprint,
|
||||
block: (MutableMethod) -> Unit
|
||||
) = alsoResolve(fingerprint).also { block(it.mutableMethod) }
|
||||
|
||||
MessageDigestImageUrlFingerprint.resolveAndLetMutableMethod(MessageDigestImageUrlParentFingerprint) {
|
||||
loadImageUrlMethod = it
|
||||
addImageUrlHook(INTEGRATIONS_CLASS_DESCRIPTOR, true)
|
||||
}
|
||||
|
||||
CronetURLRequestCallbackOnFailureFingerprint.resolve(
|
||||
context,
|
||||
CronetURLRequestCallbackOnResponseStartedFingerprint.result!!.classDef
|
||||
)
|
||||
CronetURLRequestCallbackOnFailureFingerprint.result?.apply {
|
||||
loadImageErrorCallbackMethod = mutableMethod
|
||||
} ?: throw CronetURLRequestCallbackOnFailureFingerprint.exception
|
||||
OnSucceededFingerprint.resolveAndLetMutableMethod(OnResponseStartedFingerprint) {
|
||||
loadImageSuccessCallbackMethod = it
|
||||
addImageUrlSuccessCallbackHook(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
OnFailureFingerprint.resolveAndLetMutableMethod(OnResponseStartedFingerprint) {
|
||||
loadImageErrorCallbackMethod = it
|
||||
addImageUrlErrorCallbackHook(INTEGRATIONS_CLASS_DESCRIPTOR)
|
||||
}
|
||||
|
||||
// The URL is required for the failure callback hook, but the URL field is obfuscated.
|
||||
// Add a helper get method that returns the URL field.
|
||||
RequestFingerprint.getResultOrThrow().apply {
|
||||
// The url is the only string field that is set inside the constructor.
|
||||
val urlFieldInstruction = mutableMethod.getInstructions().first {
|
||||
if (it.opcode != Opcode.IPUT_OBJECT) return@first false
|
||||
|
||||
val reference = (it as ReferenceInstruction).reference as FieldReference
|
||||
reference.type == "Ljava/lang/String;"
|
||||
} as ReferenceInstruction
|
||||
|
||||
val urlFieldName = (urlFieldInstruction.reference as FieldReference).name
|
||||
val definingClass = RequestFingerprint.IMPLEMENTATION_CLASS_NAME
|
||||
val addedMethodName = "getHookedUrl"
|
||||
mutableClass.methods.add(
|
||||
ImmutableMethod(
|
||||
definingClass,
|
||||
addedMethodName,
|
||||
emptyList(),
|
||||
"Ljava/lang/String;",
|
||||
AccessFlags.PUBLIC.value,
|
||||
null,
|
||||
null,
|
||||
MutableMethodImplementation(2)
|
||||
).toMutable().apply {
|
||||
addInstructions(
|
||||
"""
|
||||
iget-object v0, p0, $definingClass->${urlFieldName}:Ljava/lang/String;
|
||||
return-object v0
|
||||
"""
|
||||
)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.youtube.layout.thumbnails
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.mergeStrings
|
||||
|
||||
@Patch(
|
||||
dependencies = [SettingsPatch::class]
|
||||
)
|
||||
internal object AlternativeThumbnailsResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
context.mergeStrings("alternativethumbnails/host/values/strings.xml")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.RequestFingerprint.IMPLEMENTATION_CLASS_NAME
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object RequestFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||
customFingerprint = { _, classDef ->
|
||||
classDef.type == IMPLEMENTATION_CLASS_NAME
|
||||
}
|
||||
) {
|
||||
const val IMPLEMENTATION_CLASS_NAME = "Lorg/chromium/net/impl/CronetUrlRequest;"
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object CronetURLRequestCallbackOnFailureFingerprint : MethodFingerprint(
|
||||
internal object OnFailureFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;", "Lorg/chromium/net/CronetException;"),
|
||||
@@ -1,11 +1,11 @@
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
// Acts as a parent fingerprint.
|
||||
internal object CronetURLRequestCallbackOnResponseStartedFingerprint : MethodFingerprint(
|
||||
internal object OnResponseStartedFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;"),
|
||||
@@ -1,10 +1,10 @@
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints
|
||||
package app.revanced.patches.youtube.layout.thumbnails.fingerprints.cronet.request.callback
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
|
||||
internal object CronetURLRequestCallbackOnSucceededFingerprint : MethodFingerprint(
|
||||
internal object OnSucceededFingerprint : MethodFingerprint(
|
||||
returnType = "V",
|
||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||
parameters = listOf("Lorg/chromium/net/UrlRequest;", "Lorg/chromium/net/UrlResponseInfo;"),
|
||||
@@ -112,7 +112,7 @@ object SpoofSignaturePatch : BytecodePatch(
|
||||
|
||||
// Hook the player parameters.
|
||||
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.ProtoBufferParameter(
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;)Ljava/lang/String;"
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->spoofParameter(Ljava/lang/String;Z)Ljava/lang/String;"
|
||||
)
|
||||
|
||||
// Force the seekbar time and chapters to always show up.
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
package app.revanced.patches.youtube.misc.gms
|
||||
|
||||
internal object Constants {
|
||||
const val YOUTUBE_PACKAGE_NAME = "com.google.android.youtube"
|
||||
const val REVANCED_YOUTUBE_PACKAGE_NAME = "app.revanced.android.youtube"
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package app.revanced.patches.youtube.misc.gms
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patches.shared.fingerprints.HomeActivityFingerprint
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportPatch
|
||||
import app.revanced.patches.youtube.layout.buttons.cast.HideCastButtonPatch
|
||||
import app.revanced.patches.youtube.misc.fix.playback.ClientSpoofPatch
|
||||
import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorOption
|
||||
import app.revanced.patches.youtube.misc.gms.fingerprints.*
|
||||
import app.revanced.util.exception
|
||||
|
||||
|
||||
@Suppress("unused")
|
||||
object GmsCoreSupportPatch : AbstractGmsCoreSupportPatch(
|
||||
fromPackageName = YOUTUBE_PACKAGE_NAME,
|
||||
toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME,
|
||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||
earlyReturnFingerprints = setOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint
|
||||
),
|
||||
dependencies = setOf(
|
||||
HideCastButtonPatch::class,
|
||||
ClientSpoofPatch::class
|
||||
),
|
||||
abstractGmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||
compatiblePackages = setOf(
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", setOf(
|
||||
"18.32.39",
|
||||
"18.37.36",
|
||||
"18.38.44",
|
||||
"18.43.45",
|
||||
"18.44.41",
|
||||
"18.45.41",
|
||||
"18.45.43"
|
||||
)
|
||||
)
|
||||
),
|
||||
fingerprints = setOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeMethodFingerprint,
|
||||
HomeActivityFingerprint,
|
||||
)
|
||||
) {
|
||||
override val gmsCoreVendor by gmsCoreVendorOption
|
||||
|
||||
override fun execute(context: BytecodeContext) {
|
||||
// Check the availability of GmsCore.
|
||||
HomeActivityFingerprint.result?.mutableMethod?.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/integrations/patches/GmsCoreSupport;->checkAvailability()V"
|
||||
) ?: throw HomeActivityFingerprint.exception
|
||||
|
||||
super.execute(context)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package app.revanced.patches.youtube.misc.gms
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.patches.shared.misc.gms.AbstractGmsCoreSupportResourcePatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
|
||||
|
||||
object GmsCoreSupportResourcePatch : AbstractGmsCoreSupportResourcePatch(
|
||||
fromPackageName = YOUTUBE_PACKAGE_NAME,
|
||||
toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME,
|
||||
spoofedPackageSignature = "24bb24c05e47e0aefa68a58a766179d9b613a600",
|
||||
dependencies = setOf(SettingsPatch::class)
|
||||
) {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.addPreference(
|
||||
Preference(
|
||||
StringResource("microg_settings", "GmsCore Settings"),
|
||||
StringResource("microg_settings_summary", "Settings for GmsCore"),
|
||||
Preference.Intent("$gmsCoreVendor.android.gms", "", "org.microg.gms.ui.SettingsActivity")
|
||||
)
|
||||
)
|
||||
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(REVANCED_YOUTUBE_PACKAGE_NAME)
|
||||
SettingsPatch.renameIntentsTargetPackage(packageName)
|
||||
|
||||
super.execute(context)
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.misc.microg.fingerprints
|
||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.misc.microg.fingerprints
|
||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.misc.microg.fingerprints
|
||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -1,8 +1,8 @@
|
||||
package app.revanced.patches.music.misc.microg.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object PrimeFingerprint : MethodFingerprint(
|
||||
strings = listOf("com.google.android.GoogleCamera", "com.android.vending")
|
||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object PrimeMethodFingerprint : MethodFingerprint(
|
||||
strings = listOf("com.google.android.GoogleCamera", "com.android.vending")
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
package app.revanced.patches.youtube.misc.microg.fingerprints
|
||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
||||
|
||||
import app.revanced.patcher.extensions.or
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
@@ -16,4 +16,4 @@ object IntegrationsPatch : AbstractIntegrationsPatch(
|
||||
EmbeddedPlayerFingerprint,
|
||||
APIPlayerServiceFingerprint,
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -1,79 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.microg
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.patch.BytecodePatch
|
||||
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.patches.youtube.shared.fingerprints.WatchWhileActivityFingerprint
|
||||
import app.revanced.patches.youtube.layout.buttons.cast.HideCastButtonPatch
|
||||
import app.revanced.patches.youtube.misc.fix.playback.ClientSpoofPatch
|
||||
import app.revanced.patches.youtube.misc.microg.fingerprints.*
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
|
||||
import app.revanced.util.microg.MicroGBytecodeHelper
|
||||
|
||||
@Patch(
|
||||
name = "Vanced MicroG support",
|
||||
description = "Allows YouTube to run without root and under a different package name with Vanced MicroG.",
|
||||
dependencies = [
|
||||
ChangePackageNamePatch::class,
|
||||
MicroGResourcePatch::class,
|
||||
HideCastButtonPatch::class,
|
||||
ClientSpoofPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube", [
|
||||
"18.32.39",
|
||||
"18.37.36",
|
||||
"18.38.44",
|
||||
"18.43.45",
|
||||
"18.44.41",
|
||||
"18.45.41",
|
||||
"18.45.43"
|
||||
]
|
||||
)
|
||||
]
|
||||
)
|
||||
@Suppress("unused")
|
||||
object MicroGBytecodePatch : BytecodePatch(
|
||||
setOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint,
|
||||
PrimeFingerprint,
|
||||
WatchWhileActivityFingerprint
|
||||
)
|
||||
) {
|
||||
override fun execute(context: BytecodeContext) {
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(REVANCED_PACKAGE_NAME)
|
||||
|
||||
// apply common microG patch
|
||||
MicroGBytecodeHelper.patchBytecode(
|
||||
context, arrayOf(
|
||||
MicroGBytecodeHelper.packageNameTransform(
|
||||
PACKAGE_NAME,
|
||||
packageName
|
||||
)
|
||||
),
|
||||
MicroGBytecodeHelper.PrimeMethodTransformationData(
|
||||
PrimeFingerprint,
|
||||
PACKAGE_NAME,
|
||||
packageName
|
||||
),
|
||||
listOf(
|
||||
ServiceCheckFingerprint,
|
||||
GooglePlayUtilityFingerprint,
|
||||
CastDynamiteModuleFingerprint,
|
||||
CastDynamiteModuleV2Fingerprint,
|
||||
CastContextFetchFingerprint
|
||||
)
|
||||
)
|
||||
|
||||
// inject the notice for MicroG
|
||||
MicroGBytecodeHelper.injectNotice(WatchWhileActivityFingerprint)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.microg
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.patcher.patch.ResourcePatch
|
||||
import app.revanced.patcher.patch.annotation.Patch
|
||||
import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
||||
import app.revanced.patches.shared.settings.preference.impl.Preference
|
||||
import app.revanced.patches.shared.settings.preference.impl.StringResource
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_APP_NAME
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_NAME
|
||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.SPOOFED_PACKAGE_SIGNATURE
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.util.microg.Constants.MICROG_VENDOR
|
||||
import app.revanced.util.microg.MicroGManifestHelper
|
||||
import app.revanced.util.microg.MicroGResourceHelper
|
||||
|
||||
@Patch(
|
||||
dependencies = [
|
||||
SettingsPatch::class,
|
||||
ChangePackageNamePatch::class
|
||||
]
|
||||
)
|
||||
object MicroGResourcePatch : ResourcePatch() {
|
||||
override fun execute(context: ResourceContext) {
|
||||
SettingsPatch.addPreference(
|
||||
Preference(
|
||||
StringResource("microg_settings", "MicroG Settings"),
|
||||
StringResource("microg_settings_summary", "Settings for MicroG"),
|
||||
Preference.Intent("$MICROG_VENDOR.android.gms", "", "org.microg.gms.ui.SettingsActivity")
|
||||
)
|
||||
)
|
||||
|
||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(REVANCED_PACKAGE_NAME)
|
||||
|
||||
SettingsPatch.renameIntentsTargetPackage(packageName)
|
||||
|
||||
// update manifest
|
||||
MicroGResourceHelper.patchManifest(
|
||||
context,
|
||||
PACKAGE_NAME,
|
||||
packageName,
|
||||
REVANCED_APP_NAME
|
||||
)
|
||||
|
||||
// add metadata to manifest
|
||||
MicroGManifestHelper.addSpoofingMetadata(
|
||||
context,
|
||||
SPOOFED_PACKAGE_NAME,
|
||||
SPOOFED_PACKAGE_SIGNATURE
|
||||
)
|
||||
|
||||
// add strings
|
||||
MicroGResourceHelper.addStrings(context)
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.microg.fingerprints
|
||||
|
||||
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
|
||||
internal object CastContextFetchFingerprint : MethodFingerprint(
|
||||
strings = listOf("Error fetching CastContext.")
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
package app.revanced.patches.youtube.misc.microg.shared
|
||||
|
||||
internal object Constants {
|
||||
const val REVANCED_APP_NAME = "YouTube ReVanced"
|
||||
const val REVANCED_PACKAGE_NAME = "app.revanced.android.youtube"
|
||||
const val PACKAGE_NAME = "com.google.android.youtube"
|
||||
const val SPOOFED_PACKAGE_NAME = PACKAGE_NAME
|
||||
const val SPOOFED_PACKAGE_SIGNATURE = "24bb24c05e47e0aefa68a58a766179d9b613a600"
|
||||
}
|
||||
@@ -17,13 +17,19 @@ import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.Minimize
|
||||
import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsParentFingerprint
|
||||
import app.revanced.patches.youtube.misc.playertype.PlayerTypeHookPatch
|
||||
import app.revanced.patches.youtube.misc.settings.SettingsPatch
|
||||
import app.revanced.patches.youtube.video.information.VideoInformationPatch
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||
|
||||
@Patch(
|
||||
name = "Minimized playback",
|
||||
description = "Enables minimized and background playback.",
|
||||
dependencies = [IntegrationsPatch::class, PlayerTypeHookPatch::class, SettingsPatch::class],
|
||||
dependencies = [
|
||||
IntegrationsPatch::class,
|
||||
PlayerTypeHookPatch::class,
|
||||
VideoInformationPatch::class,
|
||||
SettingsPatch::class
|
||||
],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
"com.google.android.youtube",
|
||||
@@ -65,7 +71,7 @@ object MinimizedPlaybackPatch : BytecodePatch(
|
||||
mutableMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->isPlaybackNotShort()Z
|
||||
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->playbackIsNotShort()Z
|
||||
move-result v0
|
||||
return v0
|
||||
"""
|
||||
|
||||
@@ -11,15 +11,15 @@ import java.io.Closeable
|
||||
object BottomControlsResourcePatch : ResourcePatch(), Closeable {
|
||||
internal var bottomUiContainerResourceId: Long = -1
|
||||
|
||||
internal const val TARGET_RESOURCE_NAME = "youtube_controls_bottom_ui_container.xml"
|
||||
private const val TARGET_RESOURCE_NAME = "youtube_controls_bottom_ui_container.xml"
|
||||
private const val TARGET_RESOURCE = "res/layout/$TARGET_RESOURCE_NAME"
|
||||
|
||||
// The element to the left of the element being added.
|
||||
private var lastLeftOf = "fullscreen_button"
|
||||
|
||||
private lateinit var resourceContext: ResourceContext
|
||||
private lateinit var targetXmlEditor: DomFileEditor
|
||||
|
||||
// The element to which to add the new elements to
|
||||
private var lastLeftOf = "fullscreen_button"
|
||||
|
||||
override fun execute(context: ResourceContext) {
|
||||
resourceContext = context
|
||||
targetXmlEditor = context.xmlEditor[TARGET_RESOURCE]
|
||||
@@ -30,46 +30,44 @@ object BottomControlsResourcePatch : ResourcePatch(), Closeable {
|
||||
|
||||
/**
|
||||
* Add new controls to the bottom of the YouTube player.
|
||||
* @param hostYouTubeControlsBottomUiResourceName The hosting resource name containing the elements.
|
||||
*
|
||||
* @param resourceDirectoryName The name of the directory containing the hosting resource.
|
||||
*/
|
||||
internal fun addControls(hostYouTubeControlsBottomUiResourceName: String) {
|
||||
val sourceXmlEditor =
|
||||
resourceContext.xmlEditor[this::class.java.classLoader.getResourceAsStream(
|
||||
hostYouTubeControlsBottomUiResourceName
|
||||
)!!]
|
||||
fun addControls(resourceDirectoryName: String) {
|
||||
val sourceXmlEditor = resourceContext.xmlEditor[
|
||||
this::class.java.classLoader.getResourceAsStream(
|
||||
"$resourceDirectoryName/host/layout/$TARGET_RESOURCE_NAME"
|
||||
)!!
|
||||
]
|
||||
|
||||
val targetElement =
|
||||
"android.support.constraint.ConstraintLayout"
|
||||
val targetElement = "android.support.constraint.ConstraintLayout"
|
||||
|
||||
val hostElements = sourceXmlEditor.file.getElementsByTagName(targetElement).item(0).childNodes
|
||||
|
||||
val destinationResourceFile = targetXmlEditor.file
|
||||
val destinationElement =
|
||||
destinationResourceFile.getElementsByTagName(targetElement).item(0)
|
||||
val destinationElement = destinationResourceFile.getElementsByTagName(targetElement).item(0)
|
||||
|
||||
for (index in 1 until hostElements.length) {
|
||||
val element = hostElements.item(index).cloneNode(true)
|
||||
|
||||
// if the element has no attributes theres no point to adding it to the destination
|
||||
// If the element has no attributes there's no point to adding it to the destination.
|
||||
if (!element.hasAttributes()) continue
|
||||
|
||||
// set the elements lastLeftOf attribute to the lastLeftOf value
|
||||
// Set the elements lastLeftOf attribute to the lastLeftOf value.
|
||||
val namespace = "@+id"
|
||||
element.attributes.getNamedItem("yt:layout_constraintRight_toLeftOf").nodeValue =
|
||||
"$namespace/$lastLeftOf"
|
||||
|
||||
// set lastLeftOf attribute to the current element
|
||||
// Set lastLeftOf attribute to the current element.
|
||||
val nameSpaceLength = 5
|
||||
lastLeftOf = element.attributes.getNamedItem("android:id").nodeValue.substring(nameSpaceLength)
|
||||
|
||||
// copy the element
|
||||
// Add the element.
|
||||
destinationResourceFile.adoptNode(element)
|
||||
destinationElement.appendChild(element)
|
||||
}
|
||||
sourceXmlEditor.close()
|
||||
}
|
||||
|
||||
override fun close() {
|
||||
targetXmlEditor.close()
|
||||
}
|
||||
override fun close() = targetXmlEditor.close()
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
|
||||
|
||||
@Patch(
|
||||
name = "Remove tracking query parameter",
|
||||
description = "Remove the tracking query parameter from links.",
|
||||
description = "Remove the tracking query parameter from links you share.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -12,6 +12,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
|
||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||
import app.revanced.patches.youtube.video.information.fingerprints.*
|
||||
import app.revanced.patches.youtube.video.playerresponse.PlayerResponseMethodHookPatch
|
||||
import app.revanced.patches.youtube.video.videoid.VideoIdPatch
|
||||
import com.android.tools.smali.dexlib2.AccessFlags
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
@@ -26,7 +27,7 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
|
||||
|
||||
@Patch(
|
||||
description = "Hooks YouTube to get information about the current playing video.",
|
||||
dependencies = [IntegrationsPatch::class, VideoIdPatch::class]
|
||||
dependencies = [IntegrationsPatch::class, VideoIdPatch::class, PlayerResponseMethodHookPatch::class]
|
||||
)
|
||||
object VideoInformationPatch : BytecodePatch(
|
||||
setOf(
|
||||
@@ -115,6 +116,10 @@ object VideoInformationPatch : BytecodePatch(
|
||||
VideoIdPatch.hookBackgroundPlayVideoId(videoIdMethodDescriptor)
|
||||
VideoIdPatch.hookPlayerResponseVideoId(
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->setPlayerResponseVideoId(Ljava/lang/String;Z)V")
|
||||
// Call before any other video id hooks,
|
||||
// so they can use VideoInformation and check if the video id is for a Short.
|
||||
PlayerResponseMethodHookPatch += PlayerResponseMethodHookPatch.Hook.ProtoBufferParameterBeforeVideoId(
|
||||
"$INTEGRATIONS_CLASS_DESCRIPTOR->newPlayerResponseSignature(Ljava/lang/String;Z)Ljava/lang/String;")
|
||||
|
||||
/*
|
||||
* Set the video time method
|
||||
|
||||
@@ -19,7 +19,7 @@ object PlayerResponseMethodHookPatch :
|
||||
Closeable,
|
||||
MutableSet<PlayerResponseMethodHookPatch.Hook> by mutableSetOf() {
|
||||
private const val VIDEO_ID_PARAMETER = 1
|
||||
private const val VIDEO_IS_OPENING_OR_PLAYING_PARAMETER = 11
|
||||
private const val IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER = 11
|
||||
private const val PROTO_BUFFER_PARAMETER_PARAMETER = 3
|
||||
|
||||
private lateinit var playerResponseMethod: MutableMethod
|
||||
@@ -31,13 +31,13 @@ object PlayerResponseMethodHookPatch :
|
||||
|
||||
override fun close() {
|
||||
fun hookVideoId(hook: Hook) = playerResponseMethod.addInstruction(
|
||||
0, "invoke-static {p$VIDEO_ID_PARAMETER, p$VIDEO_IS_OPENING_OR_PLAYING_PARAMETER}, $hook"
|
||||
0, "invoke-static {p$VIDEO_ID_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook"
|
||||
)
|
||||
|
||||
fun hookProtoBufferParameter(hook: Hook) = playerResponseMethod.addInstructions(
|
||||
0,
|
||||
"""
|
||||
invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER}, $hook
|
||||
invoke-static {p$PROTO_BUFFER_PARAMETER_PARAMETER, p$IS_SHORT_AND_OPENING_OR_PLAYING_PARAMETER}, $hook
|
||||
move-result-object p$PROTO_BUFFER_PARAMETER_PARAMETER
|
||||
"""
|
||||
)
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference
|
||||
|
||||
@Patch(
|
||||
name = "Remember video quality",
|
||||
description = "Adds the ability to remember the video quality you chose in the video quality flyout.",
|
||||
description = "Adds the ability to remember the last video quality selected.",
|
||||
dependencies = [IntegrationsPatch::class, VideoInformationPatch::class, SettingsPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -9,8 +9,7 @@ import app.revanced.patches.youtube.video.speed.remember.RememberPlaybackSpeedPa
|
||||
|
||||
@Patch(
|
||||
name = "Playback speed",
|
||||
description = "Adds custom playback speeds and ability " +
|
||||
"to remember the playback speed you chose in the video playback speed flyout.",
|
||||
description = "Adds custom playback speeds and ability to remember the last playback speed selected.",
|
||||
dependencies = [CustomPlaybackSpeedPatch::class, RememberPlaybackSpeedPatch::class],
|
||||
compatiblePackages = [
|
||||
CompatiblePackage(
|
||||
|
||||
@@ -19,7 +19,6 @@ import app.revanced.patches.youtube.video.speed.remember.fingerprint.InitializeP
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
|
||||
|
||||
@Patch(
|
||||
description = "Adds the ability to remember the playback speed you chose in the playback speed flyout.",
|
||||
dependencies = [IntegrationsPatch::class, SettingsPatch::class, VideoInformationPatch::class, CustomPlaybackSpeedPatch::class]
|
||||
)
|
||||
object RememberPlaybackSpeedPatch : BytecodePatch(
|
||||
|
||||
@@ -104,7 +104,7 @@ object VideoIdPatch : BytecodePatch(
|
||||
* Supports all videos and functions in all situations.
|
||||
*
|
||||
* First parameter is the video id.
|
||||
* Second parameter is if the video is being opened or is currently playing.
|
||||
* Second parameter is if the video is a Short AND it is being opened or is currently playing.
|
||||
*
|
||||
* Hook is always called off the main thread.
|
||||
*
|
||||
|
||||
@@ -8,6 +8,8 @@ import org.w3c.dom.Node
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.StandardCopyOption
|
||||
|
||||
private val classLoader = object {}.javaClass.classLoader
|
||||
|
||||
/**
|
||||
* Recursively traverse the DOM tree starting from the given root node.
|
||||
*
|
||||
@@ -45,7 +47,6 @@ fun ResourceContext.mergeStrings(host: String) {
|
||||
* @param resources The resources to copy.
|
||||
*/
|
||||
fun ResourceContext.copyResources(sourceResourceDirectory: String, vararg resources: ResourceGroup) {
|
||||
val classLoader = javaClass.classLoader
|
||||
val targetResourceDirectory = this["res"]
|
||||
|
||||
for (resourceGroup in resources) {
|
||||
@@ -77,7 +78,7 @@ fun ResourceContext.iterateXmlNodeChildren(
|
||||
targetTag: String,
|
||||
callback: (node: Node) -> Unit
|
||||
) =
|
||||
xmlEditor[javaClass.classLoader.getResourceAsStream(resource)!!].use {
|
||||
xmlEditor[classLoader.getResourceAsStream(resource)!!].use {
|
||||
val stringsNode = it.file.getElementsByTagName(targetTag).item(0).childNodes
|
||||
for (i in 1 until stringsNode.length - 1) callback(stringsNode.item(i))
|
||||
}
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
/**
|
||||
* constants for microG builds with signature spoofing
|
||||
*/
|
||||
internal object Constants {
|
||||
/**
|
||||
* microG vendor name
|
||||
* aka. package prefix / package base
|
||||
*/
|
||||
const val MICROG_VENDOR = "com.mgoogle"
|
||||
|
||||
/**
|
||||
* meta-data for microG package name spoofing on patched builds
|
||||
*/
|
||||
const val META_SPOOFED_PACKAGE_NAME = "$MICROG_VENDOR.android.gms.SPOOFED_PACKAGE_NAME"
|
||||
|
||||
/**
|
||||
* meta-data for microG package signature spoofing on patched builds
|
||||
*/
|
||||
const val META_SPOOFED_PACKAGE_SIGNATURE = "$MICROG_VENDOR.android.gms.SPOOFED_PACKAGE_SIGNATURE"
|
||||
|
||||
/**
|
||||
* meta-data for microG package detection
|
||||
*/
|
||||
const val META_GMS_PACKAGE_NAME = "app.revanced.MICROG_PACKAGE_NAME"
|
||||
|
||||
/**
|
||||
* a list of all permissions in microG
|
||||
*/
|
||||
val PERMISSIONS = listOf(
|
||||
// C2DM / GCM
|
||||
"com.google.android.c2dm.permission.RECEIVE",
|
||||
"com.google.android.c2dm.permission.SEND",
|
||||
"com.google.android.gtalkservice.permission.GTALK_SERVICE",
|
||||
|
||||
// GAuth
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.cp",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.local",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.mail",
|
||||
"com.google.android.googleapps.permission.GOOGLE_AUTH.writely",
|
||||
)
|
||||
|
||||
/**
|
||||
* a list of all (intent) actions in microG
|
||||
*/
|
||||
val ACTIONS = listOf(
|
||||
// location
|
||||
"com.google.android.gms.location.places.ui.PICK_PLACE",
|
||||
"com.google.android.gms.location.places.GeoDataApi",
|
||||
"com.google.android.gms.location.places.PlacesApi",
|
||||
"com.google.android.gms.location.places.PlaceDetectionApi",
|
||||
"com.google.android.gms.wearable.MESSAGE_RECEIVED",
|
||||
|
||||
// C2DM / GCM
|
||||
"com.google.android.c2dm.intent.REGISTER",
|
||||
"com.google.android.c2dm.intent.REGISTRATION",
|
||||
"com.google.android.c2dm.intent.UNREGISTER",
|
||||
"com.google.android.c2dm.intent.RECEIVE",
|
||||
"com.google.iid.TOKEN_REQUEST",
|
||||
"com.google.android.gcm.intent.SEND",
|
||||
|
||||
// car
|
||||
"com.google.android.gms.car.service.START",
|
||||
|
||||
// people
|
||||
"com.google.android.gms.people.service.START",
|
||||
|
||||
// wearable
|
||||
"com.google.android.gms.wearable.BIND",
|
||||
|
||||
// auth
|
||||
"com.google.android.gsf.login",
|
||||
"com.google.android.gsf.action.GET_GLS",
|
||||
"com.google.android.gms.common.account.CHOOSE_ACCOUNT",
|
||||
"com.google.android.gms.auth.login.LOGIN",
|
||||
"com.google.android.gms.auth.api.credentials.PICKER",
|
||||
"com.google.android.gms.auth.api.credentials.service.START",
|
||||
"com.google.android.gms.auth.service.START",
|
||||
"com.google.firebase.auth.api.gms.service.START",
|
||||
"com.google.android.gms.auth.be.appcert.AppCertService",
|
||||
|
||||
// fido
|
||||
"com.google.android.gms.fido.fido2.privileged.START",
|
||||
|
||||
// games
|
||||
"com.google.android.gms.games.service.START",
|
||||
"com.google.android.gms.games.PLAY_GAMES_UPGRADE",
|
||||
|
||||
// chimera
|
||||
"com.google.android.gms.chimera",
|
||||
|
||||
// fonts
|
||||
"com.google.android.gms.fonts",
|
||||
|
||||
// phenotype
|
||||
"com.google.android.gms.phenotype.service.START",
|
||||
|
||||
// location
|
||||
"com.google.android.gms.location.reporting.service.START",
|
||||
|
||||
// misc
|
||||
"com.google.android.gms.gmscompliance.service.START",
|
||||
"com.google.android.gms.oss.licenses.service.START",
|
||||
"com.google.android.gms.safetynet.service.START",
|
||||
"com.google.android.gms.tapandpay.service.BIND"
|
||||
)
|
||||
|
||||
/**
|
||||
* a list of all content provider authorities in microG
|
||||
*/
|
||||
val AUTHORITIES = listOf(
|
||||
// gsf
|
||||
"com.google.android.gsf.gservices",
|
||||
"com.google.settings",
|
||||
|
||||
// auth
|
||||
"com.google.android.gms.auth.accounts",
|
||||
|
||||
// chimera
|
||||
"com.google.android.gms.chimera",
|
||||
|
||||
// fonts
|
||||
"com.google.android.gms.fonts",
|
||||
|
||||
// phenotype
|
||||
"com.google.android.gms.phenotype"
|
||||
)
|
||||
}
|
||||
@@ -1,215 +0,0 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.BytecodeContext
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
|
||||
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
|
||||
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||
import app.revanced.util.returnEarly
|
||||
import app.revanced.util.microg.Constants.ACTIONS
|
||||
import app.revanced.util.microg.Constants.AUTHORITIES
|
||||
import app.revanced.util.microg.Constants.MICROG_VENDOR
|
||||
import app.revanced.util.microg.Constants.PERMISSIONS
|
||||
import com.android.tools.smali.dexlib2.Opcode
|
||||
import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction21c
|
||||
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction21c
|
||||
import com.android.tools.smali.dexlib2.iface.reference.StringReference
|
||||
import com.android.tools.smali.dexlib2.immutable.reference.ImmutableStringReference
|
||||
|
||||
/**
|
||||
* Helper class for applying bytecode patches needed for the microg-support patches.
|
||||
*/
|
||||
internal object MicroGBytecodeHelper {
|
||||
/**
|
||||
* Hook a method to check the availability of MicroG.
|
||||
*
|
||||
* @param fingerprint The fingerprint of the method to add the call for the notice in.
|
||||
*/
|
||||
fun injectNotice(fingerprint: MethodFingerprint) {
|
||||
fingerprint.result!!.mutableMethod.addInstruction(
|
||||
0,
|
||||
"invoke-static {}, Lapp/revanced/integrations/patches/MicroGSupport;->checkAvailability()V"
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform strings with package name out of [fromPackageName] and [toPackageName].
|
||||
*
|
||||
* @param fromPackageName Original package name.
|
||||
* @param toPackageName The package name to accept.
|
||||
**/
|
||||
fun packageNameTransform(fromPackageName: String, toPackageName: String): (String) -> String? {
|
||||
return { referencedString ->
|
||||
when (referencedString) {
|
||||
"$fromPackageName.SuggestionsProvider",
|
||||
"$fromPackageName.fileprovider" -> referencedString.replace(fromPackageName, toPackageName)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Prime method data class for the [MicroGBytecodeHelper] class.
|
||||
*
|
||||
* @param primeMethodFingerprint The prime methods [MethodFingerprint].
|
||||
* @param fromPackageName Original package name.
|
||||
* @param toPackageName The package name to accept.
|
||||
**/
|
||||
data class PrimeMethodTransformationData(
|
||||
val primeMethodFingerprint: MethodFingerprint,
|
||||
val fromPackageName: String,
|
||||
val toPackageName: String
|
||||
) {
|
||||
/**
|
||||
* Patch the prime method to accept the new package name.
|
||||
*/
|
||||
fun transformPrimeMethodPackageName() {
|
||||
val primeMethod = primeMethodFingerprint.result!!.mutableMethod
|
||||
val implementation = primeMethod.implementation!!
|
||||
|
||||
var register = 2
|
||||
val index = implementation.instructions.indexOfFirst {
|
||||
if (it.opcode != Opcode.CONST_STRING) return@indexOfFirst false
|
||||
|
||||
val instructionString = ((it as Instruction21c).reference as StringReference).string
|
||||
if (instructionString != fromPackageName) return@indexOfFirst false
|
||||
|
||||
register = it.registerA
|
||||
return@indexOfFirst true
|
||||
}
|
||||
|
||||
primeMethod.replaceInstruction(
|
||||
index, "const-string v$register, \"$toPackageName\""
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Patch the bytecode to work with MicroG.
|
||||
* Note: this only handles string constants to gms (intent actions, authorities, ...).
|
||||
* If the app employs additional checks to validate the installed gms package, you'll have to handle those in the app- specific patch
|
||||
*
|
||||
* @param context The context.
|
||||
* @param additionalStringTransforms Additional transformations applied to all const-string references.
|
||||
* @param primeMethodTransformationData Data to patch the prime method.
|
||||
* @param earlyReturns List of [MethodFingerprint] to return the resolved methods early.
|
||||
*/
|
||||
fun patchBytecode(
|
||||
context: BytecodeContext,
|
||||
additionalStringTransforms: Array<(str: String) -> String?>,
|
||||
primeMethodTransformationData: PrimeMethodTransformationData,
|
||||
earlyReturns: List<MethodFingerprint>
|
||||
) {
|
||||
earlyReturns.returnEarly()
|
||||
primeMethodTransformationData.transformPrimeMethodPackageName()
|
||||
|
||||
val allTransforms = arrayOf(
|
||||
MicroGBytecodeHelper::commonTransform,
|
||||
MicroGBytecodeHelper::contentUrisTransform,
|
||||
*additionalStringTransforms
|
||||
)
|
||||
|
||||
// transform all strings using all provided transforms, first match wins
|
||||
context.transformStringReferences transform@{
|
||||
for (transformFn in allTransforms) {
|
||||
val s = transformFn(it)
|
||||
if (s != null) return@transform s
|
||||
}
|
||||
|
||||
return@transform null
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* const-string transform function for common gms string references.
|
||||
*
|
||||
* @param referencedString The string to transform.
|
||||
*/
|
||||
private fun commonTransform(referencedString: String): String? =
|
||||
when (referencedString) {
|
||||
"com.google",
|
||||
"com.google.android.gms",
|
||||
in PERMISSIONS,
|
||||
in ACTIONS,
|
||||
in AUTHORITIES -> referencedString.replace("com.google", MICROG_VENDOR)
|
||||
|
||||
// subscribedfeeds has no vendor prefix for whatever reason...
|
||||
"subscribedfeeds" -> "${MICROG_VENDOR}.subscribedfeeds"
|
||||
else -> null
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* const-string transform function for strings containing gms content uris / authorities.
|
||||
*/
|
||||
private fun contentUrisTransform(str: String): String? {
|
||||
// only when content:// uri
|
||||
if (str.startsWith("content://")) {
|
||||
// check if matches any authority
|
||||
for (authority in AUTHORITIES) {
|
||||
val uriPrefix = "content://$authority"
|
||||
if (str.startsWith(uriPrefix)) {
|
||||
return str.replace(
|
||||
uriPrefix,
|
||||
"content://${authority.replace("com.google", MICROG_VENDOR)}"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
// gms also has a 'subscribedfeeds' authority, check for that one too
|
||||
val subFeedsUriPrefix = "content://subscribedfeeds"
|
||||
if (str.startsWith(subFeedsUriPrefix)) {
|
||||
return str.replace(subFeedsUriPrefix, "content://${MICROG_VENDOR}.subscribedfeeds")
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* Transform all constant string references using a transformation function.
|
||||
*
|
||||
* @param transformFn string transformation function. if null, string is not changed.
|
||||
*/
|
||||
private fun BytecodeContext.transformStringReferences(transformFn: (str: String) -> String?) {
|
||||
classes.forEach { classDef ->
|
||||
var mutableClass: MutableClass? = null
|
||||
|
||||
// enumerate all methods
|
||||
classDef.methods.forEach classLoop@{ methodDef ->
|
||||
var mutableMethod: MutableMethod? = null
|
||||
val implementation = methodDef.implementation ?: return@classLoop
|
||||
|
||||
// enumerate all instructions and find const-string
|
||||
implementation.instructions.forEachIndexed implLoop@{ index, instruction ->
|
||||
// skip all that are not const-string
|
||||
if (instruction.opcode != Opcode.CONST_STRING) return@implLoop
|
||||
val str = ((instruction as Instruction21c).reference as StringReference).string
|
||||
|
||||
// call transform function
|
||||
val transformedStr = transformFn(str)
|
||||
if (transformedStr != null) {
|
||||
// make class and method mutable, if not already
|
||||
mutableClass = mutableClass ?: proxy(classDef).mutableClass
|
||||
mutableMethod = mutableMethod ?: mutableClass!!.methods.first {
|
||||
it.name == methodDef.name && it.parameterTypes.containsAll(methodDef.parameterTypes)
|
||||
}
|
||||
|
||||
// replace instruction with updated string
|
||||
mutableMethod!!.implementation!!.replaceInstruction(
|
||||
index,
|
||||
BuilderInstruction21c(
|
||||
Opcode.CONST_STRING,
|
||||
instruction.registerA,
|
||||
ImmutableStringReference(
|
||||
transformedStr
|
||||
)
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,58 +0,0 @@
|
||||
package app.revanced.util.microg
|
||||
|
||||
import app.revanced.patcher.data.ResourceContext
|
||||
import app.revanced.util.microg.Constants.META_GMS_PACKAGE_NAME
|
||||
import app.revanced.util.microg.Constants.META_SPOOFED_PACKAGE_NAME
|
||||
import app.revanced.util.microg.Constants.META_SPOOFED_PACKAGE_SIGNATURE
|
||||
import app.revanced.util.microg.Constants.MICROG_VENDOR
|
||||
import org.w3c.dom.Element
|
||||
import org.w3c.dom.Node
|
||||
|
||||
/**
|
||||
* helper class for adding manifest metadata needed for microG builds with signature spoofing
|
||||
*/
|
||||
internal object MicroGManifestHelper {
|
||||
|
||||
/**
|
||||
* Add manifest entries needed for package and signature spoofing when using MicroG.
|
||||
* Note: this only adds metadata entries for signature spoofing, other changes may still be required to make a microG patch work.
|
||||
*
|
||||
* @param context Resource context.
|
||||
* @param spoofedPackage The package to spoof.
|
||||
* @param spoofedSignature The signature to spoof.
|
||||
*/
|
||||
fun addSpoofingMetadata(
|
||||
context: ResourceContext,
|
||||
spoofedPackage: String,
|
||||
spoofedSignature: String
|
||||
) {
|
||||
context.xmlEditor["AndroidManifest.xml"].use {
|
||||
val applicationNode = it
|
||||
.file
|
||||
.getElementsByTagName("application")
|
||||
.item(0)
|
||||
|
||||
// package spoofing
|
||||
applicationNode.adoptChild("meta-data") {
|
||||
setAttribute("android:name", META_SPOOFED_PACKAGE_NAME)
|
||||
setAttribute("android:value", spoofedPackage)
|
||||
}
|
||||
applicationNode.adoptChild("meta-data") {
|
||||
setAttribute("android:name", META_SPOOFED_PACKAGE_SIGNATURE)
|
||||
setAttribute("android:value", spoofedSignature)
|
||||
}
|
||||
|
||||
// microG presence detection in integrations
|
||||
applicationNode.adoptChild("meta-data") {
|
||||
setAttribute("android:name", META_GMS_PACKAGE_NAME)
|
||||
setAttribute("android:value", "${MICROG_VENDOR}.android.gms")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun Node.adoptChild(tagName: String, block: Element.() -> Unit) {
|
||||
val child = ownerDocument.createElement(tagName)
|
||||
child.block()
|
||||
appendChild(child)
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user