fix(YouTube Music/Intent hook): apply fingerprints compatible with the wider version

This commit is contained in:
inotia00 2024-03-20 02:47:27 +09:00
parent 1afc292dd8
commit 82c4d367b8
4 changed files with 17 additions and 18 deletions

View File

@ -7,17 +7,17 @@ import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.Patch import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.utils.integrations.Constants.INTEGRATIONS_PATH 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.patches.music.utils.settings.SettingsPatch
import app.revanced.util.exception import app.revanced.util.exception
@Patch(dependencies = [SettingsPatch::class]) @Patch(dependencies = [SettingsPatch::class])
object IntentHookPatch : BytecodePatch( object IntentHookPatch : BytecodePatch(
setOf(FullStackTraceActivityFingerprint) setOf(GoogleApiActivityFingerprint)
) { ) {
override fun execute(context: BytecodeContext) { override fun execute(context: BytecodeContext) {
FullStackTraceActivityFingerprint.result?.let { GoogleApiActivityFingerprint.result?.let {
it.mutableMethod.apply { it.mutableMethod.apply {
addInstructionsWithLabels( addInstructionsWithLabels(
1, """ 1, """
@ -28,7 +28,7 @@ object IntentHookPatch : BytecodePatch(
""", ExternalLabel("show", getInstruction(1)) """, ExternalLabel("show", getInstruction(1))
) )
} }
} ?: throw FullStackTraceActivityFingerprint.exception } ?: throw GoogleApiActivityFingerprint.exception
} }
} }

View File

@ -2,10 +2,11 @@ package app.revanced.patches.music.utils.intenthook.fingerprints
import app.revanced.patcher.fingerprint.MethodFingerprint import app.revanced.patcher.fingerprint.MethodFingerprint
object FullStackTraceActivityFingerprint : MethodFingerprint( object GoogleApiActivityFingerprint : MethodFingerprint(
returnType = "V", returnType = "V",
parameters = listOf("Landroid/os/Bundle;"), parameters = listOf("Landroid/os/Bundle;"),
customFingerprint = { methodDef, _ -> customFingerprint = { methodDef, _ ->
methodDef.definingClass.endsWith("/FullStackTraceActivity;") && methodDef.name == "onCreate" methodDef.definingClass.endsWith("/GoogleApiActivity;")
&& methodDef.name == "onCreate"
} }
) )

View File

@ -23,7 +23,7 @@ object ResourceUtils {
"com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference" "com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference"
const val YOUTUBE_MUSIC_PREFERENCE_TARGET_CLASS = 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" var targetPackage = "com.google.android.apps.youtube.music"
@ -209,7 +209,6 @@ object ResourceUtils {
) )
setAttribute("android:key", key) setAttribute("android:key", key)
setAttribute("app:allowDividerAbove", "false") setAttribute("app:allowDividerAbove", "false")
setAttribute("app:allowDividerAbove", "false")
} }
it.getAttributeNode("app:allowDividerBelow").textContent = "true" it.getAttributeNode("app:allowDividerBelow").textContent = "true"
return@loop return@loop
@ -252,7 +251,6 @@ object ResourceUtils {
setAttribute("android:key", key) setAttribute("android:key", key)
setAttribute("android:fragment", fragment) setAttribute("android:fragment", fragment)
setAttribute("app:allowDividerAbove", "false") setAttribute("app:allowDividerAbove", "false")
setAttribute("app:allowDividerAbove", "false")
} }
it.getAttributeNode("app:allowDividerBelow").textContent = "true" it.getAttributeNode("app:allowDividerBelow").textContent = "true"
return@loop return@loop

View File

@ -5,32 +5,32 @@
<com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference android:title="@string/sb_toast_on_skip" android:key="sb_toast_on_skip" android:summary="@string/sb_toast_on_skip_sum" android:dependency="sb_enabled" android:defaultValue="true" /> <com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference android:title="@string/sb_toast_on_skip" android:key="sb_toast_on_skip" android:summary="@string/sb_toast_on_skip_sum" android:dependency="sb_enabled" android:defaultValue="true" />
<com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference android:title="@string/sb_toast_on_connection_error" android:key="sb_toast_on_connection_error" android:summary="@string/sb_toast_on_connection_error_sum" android:dependency="sb_enabled" android:defaultValue="false" /> <com.google.android.apps.youtube.music.ui.preference.SwitchCompatPreference android:title="@string/sb_toast_on_connection_error" android:key="sb_toast_on_connection_error" android:summary="@string/sb_toast_on_connection_error_sum" android:dependency="sb_enabled" android:defaultValue="false" />
<Preference android:title="@string/sb_api_url" android:key="sb_api_url" android:summary="@string/sb_api_url_sum" android:dependency="sb_enabled"> <Preference android:title="@string/sb_api_url" android:key="sb_api_url" android:summary="@string/sb_api_url_sum" android:dependency="sb_enabled">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_api_url" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_api_url" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat android:title="@string/sb_diff_segments" android:key="segments"> <com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat android:title="@string/sb_diff_segments" android:key="segments">
<Preference android:title="@string/sb_segments_sponsor" android:key="sb_segments_sponsor" android:summary="@string/sb_segments_sponsor_sum"> <Preference android:title="@string/sb_segments_sponsor" android:key="sb_segments_sponsor" android:summary="@string/sb_segments_sponsor_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_sponsor" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_sponsor" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_selfpromo" android:key="sb_segments_selfpromo" android:summary="@string/sb_segments_selfpromo_sum"> <Preference android:title="@string/sb_segments_selfpromo" android:key="sb_segments_selfpromo" android:summary="@string/sb_segments_selfpromo_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_selfpromo" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_selfpromo" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_interaction" android:key="sb_segments_interaction" android:summary="@string/sb_segments_interaction_sum"> <Preference android:title="@string/sb_segments_interaction" android:key="sb_segments_interaction" android:summary="@string/sb_segments_interaction_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_interaction" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_interaction" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_intro" android:key="sb_segments_intro" android:summary="@string/sb_segments_intro_sum"> <Preference android:title="@string/sb_segments_intro" android:key="sb_segments_intro" android:summary="@string/sb_segments_intro_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_intro" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_intro" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_outro" android:key="sb_segments_outro" android:summary="@string/sb_segments_outro_sum"> <Preference android:title="@string/sb_segments_outro" android:key="sb_segments_outro" android:summary="@string/sb_segments_outro_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_outro" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_outro" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_preview" android:key="sb_segments_preview" android:summary="@string/sb_segments_preview_sum"> <Preference android:title="@string/sb_segments_preview" android:key="sb_segments_preview" android:summary="@string/sb_segments_preview_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_preview" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_preview" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_filler" android:key="sb_segments_filler" android:summary="@string/sb_segments_filler_sum"> <Preference android:title="@string/sb_segments_filler" android:key="sb_segments_filler" android:summary="@string/sb_segments_filler_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_filler" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_filler" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
<Preference android:title="@string/sb_segments_nomusic" android:key="sb_segments_music_offtopic" android:summary="@string/sb_segments_nomusic_sum"> <Preference android:title="@string/sb_segments_nomusic" android:key="sb_segments_music_offtopic" android:summary="@string/sb_segments_nomusic_sum">
<intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_music_offtopic" android:targetClass="com.google.android.libraries.strictmode.penalties.notification.FullStackTraceActivity" /> <intent android:targetPackage="com.google.android.apps.youtube.music" android:data="sb_segments_music_offtopic" android:targetClass="com.google.android.gms.common.api.GoogleApiActivity" />
</Preference> </Preference>
</com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat> </com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat>
<com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat android:title="@string/sb_about" android:key="about"> <com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat android:title="@string/sb_about" android:key="about">