Skip to content

Commit

Permalink
fix(YouTube/Litho filter): disable obfuscation
Browse files Browse the repository at this point in the history
  • Loading branch information
inotia00 committed Nov 8, 2024
1 parent f0cf292 commit 2864fb1
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,17 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.shared.integrations.Constants.COMPONENTS_PATH
import app.revanced.patches.shared.litho.fingerprints.BufferUpbFeatureFlagFingerprint
import app.revanced.patches.shared.litho.fingerprints.ByteBufferFingerprint
import app.revanced.patches.shared.litho.fingerprints.EmptyComponentsFingerprint
import app.revanced.patches.shared.litho.fingerprints.PathBuilderFingerprint
import app.revanced.patches.shared.litho.fingerprints.PathUpbFeatureFlagFingerprint
import app.revanced.util.findMethodsOrThrow
import app.revanced.util.getReference
import app.revanced.util.indexOfFirstInstructionOrThrow
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
import app.revanced.util.indexOfFirstStringInstructionOrThrow
import app.revanced.util.injectLiteralInstructionBooleanCall
import app.revanced.util.resultOrThrow
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
Expand All @@ -38,6 +41,8 @@ object LithoFilterPatch : BytecodePatch(
setOf(
ByteBufferFingerprint,
EmptyComponentsFingerprint,
BufferUpbFeatureFlagFingerprint,
PathUpbFeatureFlagFingerprint,
)
), Closeable {
private const val INTEGRATIONS_LITHO_FILER_CLASS_DESCRIPTOR =
Expand Down Expand Up @@ -156,6 +161,28 @@ object LithoFilterPatch : BytecodePatch(
}
}

// region A/B test of new Litho native code.

// Turn off native code that handles litho component names. If this feature is on then nearly
// all litho components have a null name and identifier/path filtering is completely broken.

if (BufferUpbFeatureFlagFingerprint.result != null &&
PathUpbFeatureFlagFingerprint.result != null) {
mapOf(
BufferUpbFeatureFlagFingerprint to 45419603,
PathUpbFeatureFlagFingerprint to 45631264,
).forEach { (fingerprint, literalValue) ->
fingerprint.result?.let {
fingerprint.injectLiteralInstructionBooleanCall(
literalValue,
"0x0"
)
}
}
}

// endregion

// Create a new method to get the filter array to avoid register conflicts.
// This fixes an issue with Integrations compiled with Android Gradle Plugin 8.3.0+.
// https://github.com/ReVanced/revanced-patches/issues/2818
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.shared.litho.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal object BufferUpbFeatureFlagFingerprint : LiteralValueFingerprint(
returnType = "L",
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
parameters = listOf("L"),
literalSupplier = { 45419603 },
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package app.revanced.patches.shared.litho.fingerprints

import app.revanced.patcher.extensions.or
import app.revanced.util.fingerprint.LiteralValueFingerprint
import com.android.tools.smali.dexlib2.AccessFlags

internal object PathUpbFeatureFlagFingerprint : LiteralValueFingerprint(
returnType = "Z",
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = emptyList(),
literalSupplier = { 45631264 },
)

0 comments on commit 2864fb1

Please sign in to comment.