From b31fed98901fcda1bce6f05eb0de63280c689fa0 Mon Sep 17 00:00:00 2001 From: Alberto Ponces Date: Tue, 11 Feb 2025 18:37:58 +0000 Subject: [PATCH] feat(YouTube Music): Support version `8.05.50` (#4439) --- .../patches/music/ad/video/HideVideoAds.kt | 7 ++++++- .../EnableExclusiveAudioPlayback.kt | 19 ++++++++----------- .../audio/exclusiveaudio/Fingerprints.kt | 9 ++++----- .../permanentrepeat/PermanentRepeatPatch.kt | 8 ++++++-- .../layout/compactheader/HideCategoryBar.kt | 7 ++++++- .../layout/premium/HideGetPremiumPatch.kt | 7 ++++++- .../upgradebutton/RemoveUpgradeButtonPatch.kt | 7 ++++++- .../BypassCertificateChecksPatch.kt | 7 ++++++- .../music/misc/androidauto/Fingerprints.kt | 6 ++++-- .../BackgroundPlaybackPatch.kt | 7 ++++++- .../music/misc/spoof/SpoofClientPatch.kt | 7 ++++++- 11 files changed, 64 insertions(+), 27 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt b/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt index 27c981256..5e8a4376d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/ad/video/HideVideoAds.kt @@ -8,7 +8,12 @@ val hideVideoAdsPatch = bytecodePatch( name = "Hide music video ads", description = "Hides ads that appear while listening to or streaming music videos, podcasts, or songs.", ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { navigate(showVideoAdsParentFingerprint.originalMethod) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt b/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt index 466e81aeb..f79c1a45e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/EnableExclusiveAudioPlayback.kt @@ -1,24 +1,21 @@ package app.revanced.patches.music.audio.exclusiveaudio -import app.revanced.patcher.extensions.InstructionExtensions.addInstructions import app.revanced.patcher.patch.bytecodePatch +import app.revanced.util.returnEarly @Suppress("unused") val enableExclusiveAudioPlaybackPatch = bytecodePatch( name = "Enable exclusive audio playback", description = "Enables the option to play audio without video.", ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { - allowExclusiveAudioPlaybackFingerprint.method.apply { - addInstructions( - 0, - """ - const/4 v0, 0x1 - return v0 - """, - ) - } + allowExclusiveAudioPlaybackFingerprint.method.returnEarly(true) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/Fingerprints.kt index 02a978f0f..4ac10dd9b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/audio/exclusiveaudio/Fingerprints.kt @@ -9,16 +9,15 @@ internal val allowExclusiveAudioPlaybackFingerprint = fingerprint { returns("Z") parameters() opcodes( + Opcode.INVOKE_INTERFACE, + Opcode.MOVE_RESULT_OBJECT, + Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, Opcode.MOVE_RESULT_OBJECT, Opcode.CHECK_CAST, Opcode.IF_NEZ, Opcode.IGET_OBJECT, Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT, - Opcode.GOTO, - Opcode.INVOKE_VIRTUAL, - Opcode.MOVE_RESULT, - Opcode.RETURN + Opcode.MOVE_RESULT ) } \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt index c6617664f..969acb7d1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/interaction/permanentrepeat/PermanentRepeatPatch.kt @@ -11,10 +11,14 @@ val permanentRepeatPatch = bytecodePatch( description = "Permanently remember your repeating preference even if the playlist ends or another track is played.", use = false, ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { - val startIndex = repeatTrackFingerprint.patternMatch!!.endIndex val repeatIndex = startIndex + 1 diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt index b0021b966..31e04d66f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/compactheader/HideCategoryBar.kt @@ -11,7 +11,12 @@ val hideCategoryBar = bytecodePatch( description = "Hides the category bar at the top of the homepage.", use = false, ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { constructCategoryBarFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt index 23965cea4..2ad41c47e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/premium/HideGetPremiumPatch.kt @@ -11,7 +11,12 @@ val hideGetPremiumPatch = bytecodePatch( name = "Hide 'Get Music Premium' label", description = "Hides the \"Get Music Premium\" label from the account menu and settings.", ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { hideGetPremiumFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt index 22878b05f..7409bb57e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/layout/upgradebutton/RemoveUpgradeButtonPatch.kt @@ -18,7 +18,12 @@ val removeUpgradeButtonPatch = bytecodePatch( name = "Remove upgrade button", description = "Removes the upgrade tab from the pivot bar.", ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { pivotBarConstructorFingerprint.method.apply { diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt index cf3ada07b..0b627a588 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/BypassCertificateChecksPatch.kt @@ -8,7 +8,12 @@ val bypassCertificateChecksPatch = bytecodePatch( name = "Bypass certificate checks", description = "Bypasses certificate checks which prevent YouTube Music from working on Android Auto.", ) { - compatibleWith("com.google.android.apps.youtube.music"("7.29.52")) + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { checkCertificateFingerprint.method.returnEarly(true) diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/Fingerprints.kt index 957f055b6..97dea5650 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/androidauto/Fingerprints.kt @@ -4,8 +4,10 @@ import com.android.tools.smali.dexlib2.AccessFlags import app.revanced.patcher.fingerprint internal val checkCertificateFingerprint = fingerprint { - accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) returns("Z") parameters("Ljava/lang/String;") - strings("X509", "Failed to get certificate.") + strings( + "X509", + "Failed to get certificate" // Partial String match. + ) } \ No newline at end of file diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt index 90ddf6644..2ddcd2dcc 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt @@ -8,7 +8,12 @@ val backgroundPlaybackPatch = bytecodePatch( name = "Remove background playback restrictions", description = "Removes restrictions on background playback, including playing kids videos in the background.", ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) execute { kidsBackgroundPlaybackPolicyControllerFingerprint.method.addInstruction( diff --git a/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofClientPatch.kt index a8f8933ac..d184d2c56 100644 --- a/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/music/misc/spoof/SpoofClientPatch.kt @@ -25,7 +25,12 @@ val spoofClientPatch = bytecodePatch( name = "Spoof client", description = "Spoofs the client to fix playback.", ) { - compatibleWith("com.google.android.apps.youtube.music") + compatibleWith( + "com.google.android.apps.youtube.music"( + "7.16.53", + "8.05.50" + ) + ) dependsOn( sharedExtensionPatch,