From 82c4d367b83d3162cbb7b1f7036b40bb6f15e480 Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Wed, 20 Mar 2024 02:47:27 +0900 Subject: [PATCH] fix(YouTube Music/Intent hook): apply fingerprints compatible with the wider version --- .../music/utils/intenthook/IntentHookPatch.kt | 8 ++++---- ...rint.kt => GoogleApiActivityFingerprint.kt} | 5 +++-- .../music/utils/settings/ResourceUtils.kt | 4 +--- .../sponsorblock/xml/sponsorblock_prefs.xml | 18 +++++++++--------- 4 files changed, 17 insertions(+), 18 deletions(-) rename src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/{FullStackTraceActivityFingerprint.kt => GoogleApiActivityFingerprint.kt} (59%) diff --git a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt index 8d6f75476..0ff85da41 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/IntentHookPatch.kt @@ -7,17 +7,17 @@ import app.revanced.patcher.patch.BytecodePatch import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patches.music.utils.integrations.Constants.INTEGRATIONS_PATH -import app.revanced.patches.music.utils.intenthook.fingerprints.FullStackTraceActivityFingerprint +import app.revanced.patches.music.utils.intenthook.fingerprints.GoogleApiActivityFingerprint import app.revanced.patches.music.utils.settings.SettingsPatch import app.revanced.util.exception @Patch(dependencies = [SettingsPatch::class]) object IntentHookPatch : BytecodePatch( - setOf(FullStackTraceActivityFingerprint) + setOf(GoogleApiActivityFingerprint) ) { override fun execute(context: BytecodeContext) { - FullStackTraceActivityFingerprint.result?.let { + GoogleApiActivityFingerprint.result?.let { it.mutableMethod.apply { addInstructionsWithLabels( 1, """ @@ -28,7 +28,7 @@ object IntentHookPatch : BytecodePatch( """, ExternalLabel("show", getInstruction(1)) ) } - } ?: throw FullStackTraceActivityFingerprint.exception + } ?: throw GoogleApiActivityFingerprint.exception } } \ No newline at end of file diff --git a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/GoogleApiActivityFingerprint.kt similarity index 59% rename from src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt rename to src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/GoogleApiActivityFingerprint.kt index a5f809c25..98a223694 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/FullStackTraceActivityFingerprint.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/intenthook/fingerprints/GoogleApiActivityFingerprint.kt @@ -2,10 +2,11 @@ package app.revanced.patches.music.utils.intenthook.fingerprints import app.revanced.patcher.fingerprint.MethodFingerprint -object FullStackTraceActivityFingerprint : MethodFingerprint( +object GoogleApiActivityFingerprint : MethodFingerprint( returnType = "V", parameters = listOf("Landroid/os/Bundle;"), customFingerprint = { methodDef, _ -> - methodDef.definingClass.endsWith("/FullStackTraceActivity;") && methodDef.name == "onCreate" + methodDef.definingClass.endsWith("/GoogleApiActivity;") + && methodDef.name == "onCreate" } ) diff --git a/src/main/kotlin/app/revanced/patches/music/utils/settings/ResourceUtils.kt b/src/main/kotlin/app/revanced/patches/music/utils/settings/ResourceUtils.kt index 38961ac92..0cb7718ba 100644 --- a/src/main/kotlin/app/revanced/patches/music/utils/settings/ResourceUtils.kt +++ b/src/main/kotlin/app/revanced/patches/music/utils/settings/ResourceUtils.kt @@ -23,7 +23,7 @@ object ResourceUtils { "com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference" const val YOUTUBE_MUSIC_PREFERENCE_TARGET_CLASS = - "com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" + "com.google.android.gms.common.api.GoogleApiActivity" var targetPackage = "com.google.android.apps.youtube.music" @@ -209,7 +209,6 @@ object ResourceUtils { ) setAttribute("android:key", key) setAttribute("app:allowDividerAbove", "false") - setAttribute("app:allowDividerAbove", "false") } it.getAttributeNode("app:allowDividerBelow").textContent = "true" return@loop @@ -252,7 +251,6 @@ object ResourceUtils { setAttribute("android:key", key) setAttribute("android:fragment", fragment) setAttribute("app:allowDividerAbove", "false") - setAttribute("app:allowDividerAbove", "false") } it.getAttributeNode("app:allowDividerBelow").textContent = "true" return@loop diff --git a/src/main/resources/music/sponsorblock/xml/sponsorblock_prefs.xml b/src/main/resources/music/sponsorblock/xml/sponsorblock_prefs.xml index 30ab62437..dfdceb521 100644 --- a/src/main/resources/music/sponsorblock/xml/sponsorblock_prefs.xml +++ b/src/main/resources/music/sponsorblock/xml/sponsorblock_prefs.xml @@ -5,32 +5,32 @@ - + - + - + - + - + - + - + - + - +