From e928128a947ddb4c4bb1d9ba3a1d64916b3d624d Mon Sep 17 00:00:00 2001 From: oSumAtrIX Date: Wed, 28 Jan 2026 20:10:53 +0100 Subject: [PATCH] fix error & update to latest patcher --- ...{HideAdbPatch.kt => HideAdbStatusPatch.kt} | 4 +- .../sim/spoof/SpoofSimProviderPatch.kt | 2 +- .../all/misc/transformation/MethodCall.kt | 2 +- .../TransformInstructionsPatch.kt | 2 +- .../ads/mainfeed/HideSponsoredStoriesPatch.kt | 2 +- .../facebook/ads/story/HideStoryAdsPatch.kt | 2 +- .../misc/share/EditShareLinksPatch.kt | 2 +- .../patches/messenger/metaai/Fingerprints.kt | 1 + .../infinityforreddit/api/SpoofClientPatch.kt | 2 +- .../branding/BaseCustomBrandingPatch.kt | 2 +- .../misc/audio/ForceOriginalAudioPatch.kt | 25 +++-- .../misc/checks/BaseCheckEnvironmentPatch.kt | 10 +- ...ckWatchHistoryDomainNameResolutionPatch.kt | 4 +- .../shared/misc/gms/GmsCoreSupportPatch.kt | 2 +- .../misc/spoof/SpoofVideoStreamsPatch.kt | 8 +- .../misc/lyrics/ChangeLyricsProviderPatch.kt | 2 +- .../DisableSubscriptionSuggestionsPatch.kt | 2 +- .../login/fixgoogle/FixGoogleLoginPatch.kt | 2 +- .../revanced/patches/trakt/UnlockProPatch.kt | 2 +- .../featureflags/OverrideFeatureFlagsPatch.kt | 4 +- .../twitch/misc/settings/SettingsPatch.kt | 4 +- .../swipecontrols/SwipeControlsPatch.kt | 2 +- .../layout/miniplayer/MiniplayerPatch.kt | 4 +- .../layout/seekbar/SeekbarColorPatch.kt | 4 +- .../shortsautoplay/ShortsAutoplayPatch.kt | 2 +- .../misc/imageurlhook/CronetImageUrlHook.kt | 4 +- .../misc/navigation/NavigationBarHookPatch.kt | 14 +-- .../playercontrols/PlayerControlsPatch.kt | 2 +- .../youtube/misc/settings/SettingsPatch.kt | 6 +- .../information/VideoInformationPatch.kt | 94 +++++++++---------- .../PlayerResponseMethodHookPatch.kt | 2 +- .../speed/custom/CustomPlaybackSpeedPatch.kt | 2 +- .../youtube/video/videoid/VideoIdPatch.kt | 2 +- .../kotlin/app/revanced/util/BytecodeUtils.kt | 8 +- 34 files changed, 114 insertions(+), 118 deletions(-) rename patches/src/main/kotlin/app/revanced/patches/all/misc/adb/{HideAdbPatch.kt => HideAdbStatusPatch.kt} (96%) diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/adb/HideAdbPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/adb/HideAdbStatusPatch.kt similarity index 96% rename from patches/src/main/kotlin/app/revanced/patches/all/misc/adb/HideAdbPatch.kt rename to patches/src/main/kotlin/app/revanced/patches/all/misc/adb/HideAdbStatusPatch.kt index e21d8e959..71f677785 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/adb/HideAdbPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/adb/HideAdbStatusPatch.kt @@ -13,14 +13,14 @@ import com.android.tools.smali.dexlib2.util.MethodUtil private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/all/misc/hide/adb/HideAdbPatch;" private val SETTINGS_GLOBAL_GET_INT_OR_THROW_METHOD_REFERENCE = ImmutableMethodReference( - "Landroid/provider/Settings\$Global;", + $$"Landroid/provider/Settings$Global;", "getInt", listOf("Landroid/content/ContentResolver;", "Ljava/lang/String;"), "I", ) private val SETTINGS_GLOBAL_GET_INT_OR_DEFAULT_METHOD_REFERENCE = ImmutableMethodReference( - "Landroid/provider/Settings\$Global;", + $$"Landroid/provider/Settings$Global;", "getInt", listOf("Landroid/content/ContentResolver;", "Ljava/lang/String;", "I"), "I", diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/telephony/sim/spoof/SpoofSimProviderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/telephony/sim/spoof/SpoofSimProviderPatch.kt index 4f60d88d3..a7dfdf7bf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/telephony/sim/spoof/SpoofSimProviderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/connectivity/telephony/sim/spoof/SpoofSimProviderPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.all.misc.connectivity.telephony.sim.spoof +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.extensions.replaceInstruction import app.revanced.patcher.patch.bytecodePatch @@ -10,7 +11,6 @@ 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.MethodReference import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference -import com.android.tools.smali.dexlib2.mutable.MutableMethod import com.android.tools.smali.dexlib2.util.MethodUtil import java.util.* diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt index c0b19358d..0535d6f06 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/MethodCall.kt @@ -1,7 +1,7 @@ package app.revanced.patches.all.misc.transformation +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.replaceInstruction -import com.android.tools.smali.dexlib2.mutable.MutableMethod import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.ClassDef import com.android.tools.smali.dexlib2.iface.instruction.Instruction diff --git a/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt index d17386935..17e6a9384 100644 --- a/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/all/misc/transformation/TransformInstructionsPatch.kt @@ -1,6 +1,6 @@ package app.revanced.patches.all.misc.transformation -import com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.patch.bytecodePatch import app.revanced.util.forEachInstructionAsSequence import com.android.tools.smali.dexlib2.iface.ClassDef diff --git a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt index a28ca0c47..92ab63516 100644 --- a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/mainfeed/HideSponsoredStoriesPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.facebook.ads.mainfeed +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructionsWithLabels import app.revanced.patcher.patch.bytecodePatch @@ -8,7 +9,6 @@ import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction31i import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable @Suppress("unused") val hideSponsoredStoriesPatch = bytecodePatch("Hide 'Sponsored Stories'") { diff --git a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt index 2f9af038c..88e44efc7 100644 --- a/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/facebook/ads/story/HideStoryAdsPatch.kt @@ -1,8 +1,8 @@ package app.revanced.patches.facebook.ads.story +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.patch.bytecodePatch import app.revanced.util.returnEarly -import com.android.tools.smali.dexlib2.mutable.MutableMethod @Suppress("unused") val hideStoryAdsPatch = bytecodePatch( diff --git a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/EditShareLinksPatch.kt b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/EditShareLinksPatch.kt index 298f7fa02..812bae23c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/EditShareLinksPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/instagram/misc/share/EditShareLinksPatch.kt @@ -1,11 +1,11 @@ package app.revanced.patches.instagram.misc.share +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.util.indexOfFirstInstruction import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction -import com.android.tools.smali.dexlib2.mutable.MutableMethod internal fun BytecodePatchContext.editShareLinksPatch(block: MutableMethod.(index: Int, register: Int) -> Unit) { val methodsToPatch = arrayOf( diff --git a/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/Fingerprints.kt index 4149549d9..96753309a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/messenger/metaai/Fingerprints.kt @@ -4,6 +4,7 @@ import app.revanced.patcher.* import com.android.tools.smali.dexlib2.Opcode internal val getMobileConfigBoolMethodMatch = firstMethodComposite { + parameterTypes("J") returnType("Z") opcodes(Opcode.RETURN) custom { "Lcom/facebook/mobileconfig/factory/MobileConfigUnsafeContext;" in immutableClassDef.interfaces } diff --git a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt index 3ec6a11d1..7b8b2a6d9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/reddit/customclients/infinityforreddit/api/SpoofClientPatch.kt @@ -1,12 +1,12 @@ package app.revanced.patches.reddit.customclients.infinityforreddit.api +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.toInstructions import app.revanced.patches.reddit.customclients.spoofClientPatch import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable val spoofClientPatch = spoofClientPatch(redirectUri = "infinity://localhost") { clientIdOption -> compatibleWith( diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt index 854957efc..750dee5fd 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/layout/branding/BaseCustomBrandingPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.shared.layout.branding +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.patch.* @@ -15,7 +16,6 @@ import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.TypeReference -import com.android.tools.smali.dexlib2.mutable.MutableMethod import org.w3c.dom.Element import org.w3c.dom.NodeList import java.io.File diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt index adcab55e1..702cfc22f 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/audio/ForceOriginalAudioPatch.kt @@ -1,5 +1,8 @@ package app.revanced.patches.shared.misc.audio +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructionsWithLabels @@ -21,9 +24,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.immutable.ImmutableField import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/shared/patches/ForceOriginalAudioPatch;" @@ -37,12 +37,11 @@ internal fun forceOriginalAudioPatch( fixUseLocalizedAudioTrackFlag: BytecodePatchContext.() -> Boolean, getMainActivityOnCreateMethod: BytecodePatchContext.() -> MutableMethod, subclassExtensionClassDescriptor: String, - preferenceScreen: BasePreferenceScreen.Screen + preferenceScreen: BasePreferenceScreen.Screen, ) = bytecodePatch( name = "Force original audio", // TODO description = "Adds an option to always use the original audio track.", ) { - block() dependsOn(addResourcesPatch) @@ -53,13 +52,13 @@ internal fun forceOriginalAudioPatch( preferenceScreen.addPreferences( SwitchPreference( key = "revanced_force_original_audio", - tag = "app.revanced.extension.shared.settings.preference.ForceOriginalAudioSwitchPreference" - ) + tag = "app.revanced.extension.shared.settings.preference.ForceOriginalAudioSwitchPreference", + ), ) getMainActivityOnCreateMethod().addInstruction( 0, - "invoke-static { }, $subclassExtensionClassDescriptor->setEnabled()V" + "invoke-static { }, $subclassExtensionClassDescriptor->setEnabled()V", ) // Disable feature flag that ignores the default track flag @@ -67,7 +66,7 @@ internal fun forceOriginalAudioPatch( if (fixUseLocalizedAudioTrackFlag()) { selectAudioStreamMethodMatch.method.insertLiteralOverride( selectAudioStreamMethodMatch.indices.first(), - "$EXTENSION_CLASS_DESCRIPTOR->ignoreDefaultAudioStream(Z)Z" + "$EXTENSION_CLASS_DESCRIPTOR->ignoreDefaultAudioStream(Z)Z", ) } @@ -93,8 +92,8 @@ internal fun forceOriginalAudioPatch( AccessFlags.PRIVATE.value or AccessFlags.VOLATILE.value, null, null, - null - ).toMutable() + null, + ).toMutable(), ) // Add a helper method because the isDefaultAudioTrack() has only 2 registers and 3 are needed. @@ -133,7 +132,7 @@ internal fun forceOriginalAudioPatch( move-result-object v0 iput-object v0, p0, $helperMethodClass->$helperFieldName:Ljava/lang/Boolean; return v3 - """ + """, ) } methods.add(helperMethod) @@ -148,7 +147,7 @@ internal fun forceOriginalAudioPatch( """ invoke-direct { p0, v$register }, $helperMethodClass->$helperMethodName(Z)Z move-result v$register - """ + """, ) } } diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt index 29aa14946..dafda23bd 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/checks/BaseCheckEnvironmentPatch.kt @@ -1,19 +1,19 @@ package app.revanced.patches.shared.misc.checks import android.os.Build.* +import app.revanced.com.android.tools.smali.dexlib2.iface.value.MutableEncodedValue +import app.revanced.com.android.tools.smali.dexlib2.iface.value.MutableLongEncodedValue +import app.revanced.com.android.tools.smali.dexlib2.iface.value.MutableStringEncodedValue +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableClassDef +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.patcher.patch.Patch import app.revanced.patcher.patch.bytecodePatch import app.revanced.patches.all.misc.resources.addResources import app.revanced.patches.all.misc.resources.addResourcesPatch -import com.android.tools.smali.dexlib2.iface.value.MutableEncodedValue -import com.android.tools.smali.dexlib2.iface.value.MutableLongEncodedValue -import com.android.tools.smali.dexlib2.iface.value.MutableStringEncodedValue import com.android.tools.smali.dexlib2.immutable.value.ImmutableLongEncodedValue import com.android.tools.smali.dexlib2.immutable.value.ImmutableStringEncodedValue -import com.android.tools.smali.dexlib2.mutable.MutableClassDef -import com.android.tools.smali.dexlib2.mutable.MutableMethod import java.nio.charset.StandardCharsets import java.security.MessageDigest import kotlin.io.encoding.Base64 diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt index 5e78e40a5..afec7080c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/dns/CheckWatchHistoryDomainNameResolutionPatch.kt @@ -1,11 +1,11 @@ package app.revanced.patches.shared.misc.dns +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.patch.BytecodePatchBuilder import app.revanced.patcher.patch.BytecodePatchContext import app.revanced.patcher.patch.bytecodePatch import app.revanced.patches.all.misc.resources.addResources -import com.android.tools.smali.dexlib2.mutable.MutableMethod private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/shared/patches/CheckWatchHistoryDomainNameResolutionPatch;" @@ -16,7 +16,7 @@ private const val EXTENSION_CLASS_DESCRIPTOR = internal fun checkWatchHistoryDomainNameResolutionPatch( block: BytecodePatchBuilder.() -> Unit = {}, executeBlock: BytecodePatchContext.() -> Unit = {}, - getMainActivityMethod: BytecodePatchContext.() -> MutableMethod + getMainActivityMethod: BytecodePatchContext.() -> MutableMethod, ) = bytecodePatch( name = "Check watch history domain name resolution", // TODO description = "Checks if the device DNS server is preventing user watch history from being saved.", diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt index a7c677e1d..91586cf4e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/gms/GmsCoreSupportPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.shared.misc.gms +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.instructions import app.revanced.patcher.extensions.replaceInstruction @@ -19,7 +20,6 @@ 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.mutable.MutableMethod import com.android.tools.smali.dexlib2.util.MethodUtil import org.w3c.dom.Element import org.w3c.dom.Node diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt index fde3bfc62..33944f0d9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/spoof/SpoofVideoStreamsPatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.shared.misc.spoof +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.custom import app.revanced.patcher.extensions.* import app.revanced.patcher.firstMutableMethodDeclaratively @@ -21,8 +23,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/shared/spoof/SpoofVideoStreamsPatch;" @@ -128,7 +128,7 @@ internal fun spoofVideoStreamsPatch( addInstruction( videoDetailsIndex + 1, "invoke-direct { p0, v$videoDetailsRegister }, " + - "$resultMethodType->$setStreamDataMethodName($videoDetailsClass)V", + "$resultMethodType->$setStreamDataMethodName($videoDetailsClass)V", ) val protobufClass = protobufClassParseByteBufferMethod.definingClass @@ -275,7 +275,7 @@ internal fun spoofVideoStreamsPatch( val mediaFetchEnumClass = definingClass val sabrFieldIndex = indexOfFirstInstructionOrThrow(disabledBySABRStreamingUrlString) { opcode == Opcode.SPUT_OBJECT && - getReference()?.type == mediaFetchEnumClass + getReference()?.type == mediaFetchEnumClass } Pair( diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt index e2c4e636a..040bf0719 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/lyrics/ChangeLyricsProviderPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.spotify.misc.lyrics +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.getInstruction @@ -19,7 +20,6 @@ import com.android.tools.smali.dexlib2.builder.instruction.BuilderInstruction35c import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.immutable.reference.ImmutableMethodReference -import com.android.tools.smali.dexlib2.mutable.MutableMethod import java.net.InetAddress import java.net.URI import java.net.URISyntaxException diff --git a/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt index 8de2faa36..ff22086f0 100644 --- a/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/strava/upselling/DisableSubscriptionSuggestionsPatch.kt @@ -1,12 +1,12 @@ package app.revanced.patches.strava.upselling +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.removeInstruction import app.revanced.patcher.patch.bytecodePatch import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.immutable.ImmutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable @Suppress("unused") val disableSubscriptionSuggestionsPatch = bytecodePatch("Disable subscription suggestions") { diff --git a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt index 4469b8df6..4c562eb9c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tiktok/misc/login/fixgoogle/FixGoogleLoginPatch.kt @@ -1,8 +1,8 @@ package app.revanced.patches.tiktok.misc.login.fixgoogle +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.patch.bytecodePatch import app.revanced.util.returnEarly -import com.android.tools.smali.dexlib2.mutable.MutableMethod @Suppress("unused") val fixGoogleLoginPatch = bytecodePatch( diff --git a/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt b/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt index 101502a92..294ea61c1 100644 --- a/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/trakt/UnlockProPatch.kt @@ -1,8 +1,8 @@ package app.revanced.patches.trakt +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.bytecodePatch -import com.android.tools.smali.dexlib2.mutable.MutableMethod @Suppress("unused") val unlockProPatch = bytecodePatch("Unlock pro") { diff --git a/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt index c8b042a3e..79bcafd3c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/tumblr/featureflags/OverrideFeatureFlagsPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.tumblr.featureflags +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.addInstructionsWithLabels import app.revanced.patcher.patch.bytecodePatch @@ -7,7 +8,6 @@ import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable /** * Override a feature flag with a value. @@ -73,7 +73,7 @@ val overrideFeatureFlagsPatch = bytecodePatch( val getFeatureIndex = match.indices.first() match.method.addInstructionsWithLabels( getFeatureIndex, - """ + """ # Call the Helper Method with the Feature invoke-virtual {p0, p1}, $configurationClass->getValueOverride($featureClass)Ljava/lang/String; move-result-object v0 diff --git a/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt index ed35b087d..26d82f42e 100644 --- a/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/twitch/misc/settings/SettingsPatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.twitch.misc.settings +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.classDef import app.revanced.patcher.extensions.ExternalLabel import app.revanced.patcher.extensions.addInstructions @@ -14,8 +16,6 @@ import app.revanced.patches.shared.misc.settings.settingsPatch import app.revanced.patches.twitch.misc.extension.sharedExtensionPatch import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.immutable.ImmutableField -import com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable -import com.android.tools.smali.dexlib2.mutable.MutableMethod private const val REVANCED_SETTINGS_MENU_ITEM_NAME = "RevancedSettings" private const val REVANCED_SETTINGS_MENU_ITEM_ID = 0x7 diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt index 6f1fbcfeb..cd86a260d 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/interaction/swipecontrols/SwipeControlsPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.interaction.swipecontrols +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.patch.bytecodePatch import app.revanced.patcher.patch.resourcePatch @@ -21,7 +22,6 @@ import app.revanced.patches.youtube.shared.mainActivityConstructorMethod import app.revanced.util.* import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.immutable.ImmutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable internal const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/swipecontrols/SwipeControlsHostActivity;" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt index abba11b3c..d1fa8a77a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/miniplayer/MiniplayerPatch.kt @@ -2,6 +2,8 @@ package app.revanced.patches.youtube.layout.miniplayer +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions @@ -30,8 +32,6 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable // Only available in 19.15 and upwards. internal var ytOutlineXWhite24 = -1L diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt index 5d0f75c3e..5136d43e8 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.layout.seekbar +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.* import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.getInstruction @@ -25,8 +27,6 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/theme/SeekbarColorPatch;" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt index 04941ff53..310b2064a 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/layout/shortsautoplay/ShortsAutoplayPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.layout.shortsautoplay +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions @@ -30,7 +31,6 @@ import com.android.tools.smali.dexlib2.iface.reference.FieldReference import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/ShortsAutoplayPatch;" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt index 03c0e94b4..796ea8239 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/imageurlhook/CronetImageUrlHook.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.misc.imageurlhook +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions @@ -14,8 +16,6 @@ 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 -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable private lateinit var loadImageUrlMethod: MutableMethod private var loadImageUrlIndex = 0 diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt index 27c8c856e..48dd9f9c3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt @@ -1,5 +1,7 @@ package app.revanced.patches.youtube.misc.navigation +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions @@ -28,8 +30,6 @@ 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.MethodReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import com.android.tools.smali.dexlib2.util.MethodUtil import java.util.logging.Logger @@ -73,7 +73,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig addInstruction( insertIndex, "invoke-static { v$register }, " + - "$EXTENSION_CLASS_DESCRIPTOR->${hook.methodName}(${hook.parameters})V", + "$EXTENSION_CLASS_DESCRIPTOR->${hook.methodName}(${hook.parameters})V", ) } } @@ -83,7 +83,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig val navigationEnumClassName = navigationEnumMethod.classDef.type addHook(NavigationHook.SET_LAST_APP_NAVIGATION_ENUM) { opcode == Opcode.INVOKE_STATIC && - getReference()?.definingClass == navigationEnumClassName + getReference()?.definingClass == navigationEnumClassName } // Hook the creation of navigation tab views. @@ -121,7 +121,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig addInstruction( index + 1, "invoke-static { v$viewRegister, v$isSelectedRegister }, " + - "$EXTENSION_CLASS_DESCRIPTOR->navigationTabSelected(Landroid/view/View;Z)V", + "$EXTENSION_CLASS_DESCRIPTOR->navigationTabSelected(Landroid/view/View;Z)V", ) } @@ -145,7 +145,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig addInstruction( instructionIndex, "invoke-static { v$viewRegister }, " + - "$EXTENSION_CLASS_DESCRIPTOR->searchBarResultsViewLoaded(Landroid/view/View;)V", + "$EXTENSION_CLASS_DESCRIPTOR->searchBarResultsViewLoaded(Landroid/view/View;)V", ) } } @@ -199,7 +199,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig navigationBarHookCallbackMethod.addInstruction( 0, "invoke-static { p0, p1 }, $extensionClassDescriptor->navigationTabCreated" + - "(${EXTENSION_NAVIGATION_BUTTON_DESCRIPTOR}Landroid/view/View;)V", + "(${EXTENSION_NAVIGATION_BUTTON_DESCRIPTOR}Landroid/view/View;)V", ) } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt index 68538e434..b3233d512 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.misc.playercontrols +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.immutableClassDef @@ -13,7 +14,6 @@ import app.revanced.patches.youtube.misc.playservice.* import app.revanced.util.* import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction -import com.android.tools.smali.dexlib2.mutable.MutableMethod import org.w3c.dom.Node /** diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt index c7e321b6e..920025857 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/settings/SettingsPatch.kt @@ -1,5 +1,8 @@ package app.revanced.patches.youtube.misc.settings +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableClassDef +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.extensions.getInstruction @@ -27,9 +30,6 @@ import com.android.tools.smali.dexlib2.builder.MutableMethodImplementation import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableClassDef -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import com.android.tools.smali.dexlib2.util.MethodUtil private const val BASE_ACTIVITY_HOOK_CLASS_DESCRIPTOR = diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt index fb7868337..d7a8f2d4c 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/information/VideoInformationPatch.kt @@ -1,5 +1,8 @@ package app.revanced.patches.youtube.video.information +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableClassDef +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.* import app.revanced.patcher.firstMutableClassDef @@ -34,9 +37,6 @@ import com.android.tools.smali.dexlib2.iface.reference.MethodReference import com.android.tools.smali.dexlib2.immutable.ImmutableMethod import com.android.tools.smali.dexlib2.immutable.ImmutableMethodImplementation import com.android.tools.smali.dexlib2.immutable.ImmutableMethodParameter -import com.android.tools.smali.dexlib2.mutable.MutableClassDef -import com.android.tools.smali.dexlib2.mutable.MutableMethod -import com.android.tools.smali.dexlib2.mutable.MutableMethod.Companion.toMutable import com.android.tools.smali.dexlib2.util.MethodUtil private const val EXTENSION_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/VideoInformation;" @@ -106,7 +106,7 @@ val videoInformationPatch = bytecodePatch( addSeekInterfaceMethods( playVideoCheckVideoStreamingDataResponseMethod.classDef, classDef.getSeekMethod(), - classDef.getSeekRelativeMethod() + classDef.getSeekRelativeMethod(), ) } @@ -125,7 +125,7 @@ val videoInformationPatch = bytecodePatch( addSeekInterfaceMethods( classDef, classDef.getMdxSeekMethod(), - classDef.getMdxSeekRelativeMethod() + classDef.getMdxSeekRelativeMethod(), ) } @@ -140,7 +140,7 @@ val videoInformationPatch = bytecodePatch( addInstruction( videoLengthMethodMatch.indices.last(), "invoke-static {v$videoLengthRegister, v$dummyRegisterForLong}, " + - "$EXTENSION_CLASS_DESCRIPTOR->setVideoLength(J)V", + "$EXTENSION_CLASS_DESCRIPTOR->setVideoLength(J)V", ) } } @@ -162,7 +162,7 @@ val videoInformationPatch = bytecodePatch( addPlayerResponseMethodHook( Hook.ProtoBufferParameterBeforeVideoId( "$EXTENSION_CLASS_DESCRIPTOR->" + - "newPlayerResponseSignature(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;", + "newPlayerResponseSignature(Ljava/lang/String;Ljava/lang/String;Z)Ljava/lang/String;", ), ) @@ -232,9 +232,11 @@ val videoInformationPatch = bytecodePatch( :ignore return-void - """.toInstructions(), null, null - ) - ).toMutable() + """.toInstructions(), + null, + null, + ), + ).toMutable(), ) } @@ -246,7 +248,7 @@ val videoInformationPatch = bytecodePatch( // Set playback speed class. addInstructionsAtControlFlowLabel( index, - "sput-object v$register, $EXTENSION_CLASS_DESCRIPTOR->playbackSpeedClass:$playbackSpeedClass" + "sput-object v$register, $EXTENSION_CLASS_DESCRIPTOR->playbackSpeedClass:$playbackSpeedClass", ) val smaliInstructions = @@ -263,7 +265,7 @@ val videoInformationPatch = bytecodePatch( "overridePlaybackSpeed", "playbackSpeedClass", playbackSpeedClass, - smaliInstructions + smaliInstructions, ) } @@ -286,7 +288,7 @@ val videoInformationPatch = bytecodePatch( """ invoke-static { $nameRegister, p1 }, $EXTENSION_CLASS_DESCRIPTOR->fixVideoQualityResolution(Ljava/lang/String;I)I move-result p1 - """ + """, ) // Add methods to access obfuscated quality fields. @@ -312,9 +314,9 @@ val videoInformationPatch = bytecodePatch( """ iget-object v0, p0, $qualityNameField return-object v0 - """ + """, ) - } + }, ) methods.add( @@ -337,9 +339,9 @@ val videoInformationPatch = bytecodePatch( """ iget v0, p0, $resolutionField return v0 - """ + """, ) - } + }, ) } } @@ -360,7 +362,7 @@ val videoInformationPatch = bytecodePatch( type, "patch_setQuality", listOf( - ImmutableMethodParameter(YOUTUBE_VIDEO_QUALITY_CLASS_TYPE, null, null) + ImmutableMethodParameter(YOUTUBE_VIDEO_QUALITY_CLASS_TYPE, null, null), ), "V", AccessFlags.PUBLIC.value or AccessFlags.FINAL.value, @@ -377,9 +379,9 @@ val videoInformationPatch = bytecodePatch( """ invoke-virtual { p0, p1 }, $setQualityMenuIndexMethod return-void - """ + """, ) - } + }, ) } @@ -392,7 +394,7 @@ val videoInformationPatch = bytecodePatch( invoke-static { p1, v0, p2 }, $EXTENSION_CLASS_DESCRIPTOR->setVideoQuality([$YOUTUBE_VIDEO_QUALITY_CLASS_TYPE${EXTENSION_VIDEO_QUALITY_MENU_INTERFACE}I)I move-result p2 - """ + """, ) } @@ -450,11 +452,9 @@ private fun addSeekInterfaceMethods(targetClass: MutableClassDef, seekToMethod: } } -private fun MutableMethod.insert(insertIndex: Int, register: String, descriptor: String) = - addInstruction(insertIndex, "invoke-static { $register }, $descriptor") +private fun MutableMethod.insert(insertIndex: Int, register: String, descriptor: String) = addInstruction(insertIndex, "invoke-static { $register }, $descriptor") -private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) = - insert(insertIndex, "p1, p2", descriptor) +private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) = insert(insertIndex, "p1, p2", descriptor) /** * Hook the player controller. Called when a video is opened or the current video is changed. @@ -465,12 +465,11 @@ private fun MutableMethod.insertTimeHook(insertIndex: Int, descriptor: String) = * @param targetMethodClass The descriptor for the class to invoke when the player controller is created. * @param targetMethodName The name of the static method to invoke when the player controller is created. */ -internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) = - playerInitMethod.insert( - playerInitInsertIndex++, - "v$playerInitInsertRegister", - "$targetMethodClass->$targetMethodName($EXTENSION_PLAYER_INTERFACE)V", - ) +internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) = playerInitMethod.insert( + playerInitInsertIndex++, + "v$playerInitInsertRegister", + "$targetMethodClass->$targetMethodName($EXTENSION_PLAYER_INTERFACE)V", +) /** * Hook the MDX player director. Called when playing videos while casting to a big screen device. @@ -478,12 +477,11 @@ internal fun onCreateHook(targetMethodClass: String, targetMethodName: String) = * @param targetMethodClass The descriptor for the class to invoke when the player controller is created. * @param targetMethodName The name of the static method to invoke when the player controller is created. */ -internal fun onCreateHookMdx(targetMethodClass: String, targetMethodName: String) = - mdxInitMethod.insert( - mdxInitInsertIndex++, - "v$mdxInitInsertRegister", - "$targetMethodClass->$targetMethodName($EXTENSION_PLAYER_INTERFACE)V", - ) +internal fun onCreateHookMdx(targetMethodClass: String, targetMethodName: String) = mdxInitMethod.insert( + mdxInitInsertIndex++, + "v$mdxInitInsertRegister", + "$targetMethodClass->$targetMethodName($EXTENSION_PLAYER_INTERFACE)V", +) /** * Hook the video time. @@ -492,20 +490,18 @@ internal fun onCreateHookMdx(targetMethodClass: String, targetMethodName: String * @param targetMethodClass The descriptor for the static method to invoke when the player controller is created. * @param targetMethodName The name of the static method to invoke when the player controller is created. */ -fun videoTimeHook(targetMethodClass: String, targetMethodName: String) = - timeMethod.insertTimeHook( - timeInitInsertIndex++, - "$targetMethodClass->$targetMethodName(J)V", - ) +fun videoTimeHook(targetMethodClass: String, targetMethodName: String) = timeMethod.insertTimeHook( + timeInitInsertIndex++, + "$targetMethodClass->$targetMethodName(J)V", +) /** * Hook when the video speed is changed for any reason _except when the user manually selects a new speed_. */ -fun videoSpeedChangedHook(targetMethodClass: String, targetMethodName: String) = - setPlaybackSpeedMethod.addInstruction( - setPlaybackSpeedMethodIndex++, - "invoke-static { p1 }, $targetMethodClass->$targetMethodName(F)V" - ) +fun videoSpeedChangedHook(targetMethodClass: String, targetMethodName: String) = setPlaybackSpeedMethod.addInstruction( + setPlaybackSpeedMethodIndex++, + "invoke-static { p1 }, $targetMethodClass->$targetMethodName(F)V", +) /** * Hook the video speed selected by the user. @@ -513,11 +509,11 @@ fun videoSpeedChangedHook(targetMethodClass: String, targetMethodName: String) = fun userSelectedPlaybackSpeedHook(targetMethodClass: String, targetMethodName: String) { legacySpeedSelectionInsertMethod.addInstruction( legacySpeedSelectionInsertIndex++, - "invoke-static { v$legacySpeedSelectionValueRegister }, $targetMethodClass->$targetMethodName(F)V" + "invoke-static { v$legacySpeedSelectionValueRegister }, $targetMethodClass->$targetMethodName(F)V", ) speedSelectionInsertMethod.addInstruction( speedSelectionInsertIndex++, "invoke-static { v$speedSelectionValueRegister }, $targetMethodClass->$targetMethodName(F)V", ) -} \ No newline at end of file +} diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt index 5d9bbddb6..e9b4503b4 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/playerresponse/PlayerResponseMethodHookPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.video.playerresponse +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions import app.revanced.patcher.patch.bytecodePatch @@ -11,7 +12,6 @@ import app.revanced.patches.youtube.misc.playservice.is_20_15_or_greater import app.revanced.patches.youtube.misc.playservice.is_20_26_or_greater import app.revanced.patches.youtube.misc.playservice.is_20_46_or_greater import app.revanced.patches.youtube.misc.playservice.versionCheckPatch -import com.android.tools.smali.dexlib2.mutable.MutableMethod private val hooks = mutableSetOf() diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt index a70ad87b3..88b557bdf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/speed/custom/CustomPlaybackSpeedPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.video.speed.custom +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable import app.revanced.patcher.classDef import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.addInstructions @@ -31,7 +32,6 @@ import app.revanced.util.returnEarly import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction import com.android.tools.smali.dexlib2.immutable.ImmutableField -import com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable private const val FILTER_CLASS_DESCRIPTOR = "Lapp/revanced/extension/youtube/patches/components/PlaybackSpeedMenuFilter;" diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt index 1b342cf25..6fc87aa3b 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/video/videoid/VideoIdPatch.kt @@ -1,5 +1,6 @@ package app.revanced.patches.youtube.video.videoid +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.extensions.addInstruction import app.revanced.patcher.extensions.getInstruction import app.revanced.patcher.patch.bytecodePatch @@ -9,7 +10,6 @@ import app.revanced.patches.youtube.video.playerresponse.Hook import app.revanced.patches.youtube.video.playerresponse.addPlayerResponseMethodHook import app.revanced.patches.youtube.video.playerresponse.playerResponseMethodHookPatch import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction -import com.android.tools.smali.dexlib2.mutable.MutableMethod /** * Hooks the new video id when the video changes. diff --git a/patches/src/main/kotlin/app/revanced/util/BytecodeUtils.kt b/patches/src/main/kotlin/app/revanced/util/BytecodeUtils.kt index 343d16bdb..9e18d21c2 100644 --- a/patches/src/main/kotlin/app/revanced/util/BytecodeUtils.kt +++ b/patches/src/main/kotlin/app/revanced/util/BytecodeUtils.kt @@ -1,5 +1,9 @@ package app.revanced.util +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableClassDef +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableField +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable +import app.revanced.com.android.tools.smali.dexlib2.mutable.MutableMethod import app.revanced.patcher.* import app.revanced.patcher.extensions.* import app.revanced.patcher.patch.BytecodePatchContext @@ -23,10 +27,6 @@ import com.android.tools.smali.dexlib2.iface.reference.StringReference import com.android.tools.smali.dexlib2.iface.value.* import com.android.tools.smali.dexlib2.immutable.ImmutableField import com.android.tools.smali.dexlib2.immutable.value.* -import com.android.tools.smali.dexlib2.mutable.MutableClassDef -import com.android.tools.smali.dexlib2.mutable.MutableField -import com.android.tools.smali.dexlib2.mutable.MutableField.Companion.toMutable -import com.android.tools.smali.dexlib2.mutable.MutableMethod import com.android.tools.smali.dexlib2.util.MethodUtil import java.util.*