Skip to content

Commit 2864fb1

Browse files
committed
fix(YouTube/Litho filter): disable obfuscation
1 parent f0cf292 commit 2864fb1

File tree

3 files changed

+51
-0
lines changed

3 files changed

+51
-0
lines changed

src/main/kotlin/app/revanced/patches/shared/litho/LithoFilterPatch.kt

+27
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,17 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
1111
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
1212
import app.revanced.patcher.util.smali.ExternalLabel
1313
import app.revanced.patches.shared.integrations.Constants.COMPONENTS_PATH
14+
import app.revanced.patches.shared.litho.fingerprints.BufferUpbFeatureFlagFingerprint
1415
import app.revanced.patches.shared.litho.fingerprints.ByteBufferFingerprint
1516
import app.revanced.patches.shared.litho.fingerprints.EmptyComponentsFingerprint
1617
import app.revanced.patches.shared.litho.fingerprints.PathBuilderFingerprint
18+
import app.revanced.patches.shared.litho.fingerprints.PathUpbFeatureFlagFingerprint
1719
import app.revanced.util.findMethodsOrThrow
1820
import app.revanced.util.getReference
1921
import app.revanced.util.indexOfFirstInstructionOrThrow
2022
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
2123
import app.revanced.util.indexOfFirstStringInstructionOrThrow
24+
import app.revanced.util.injectLiteralInstructionBooleanCall
2225
import app.revanced.util.resultOrThrow
2326
import com.android.tools.smali.dexlib2.AccessFlags
2427
import com.android.tools.smali.dexlib2.Opcode
@@ -38,6 +41,8 @@ object LithoFilterPatch : BytecodePatch(
3841
setOf(
3942
ByteBufferFingerprint,
4043
EmptyComponentsFingerprint,
44+
BufferUpbFeatureFlagFingerprint,
45+
PathUpbFeatureFlagFingerprint,
4146
)
4247
), Closeable {
4348
private const val INTEGRATIONS_LITHO_FILER_CLASS_DESCRIPTOR =
@@ -156,6 +161,28 @@ object LithoFilterPatch : BytecodePatch(
156161
}
157162
}
158163

164+
// region A/B test of new Litho native code.
165+
166+
// Turn off native code that handles litho component names. If this feature is on then nearly
167+
// all litho components have a null name and identifier/path filtering is completely broken.
168+
169+
if (BufferUpbFeatureFlagFingerprint.result != null &&
170+
PathUpbFeatureFlagFingerprint.result != null) {
171+
mapOf(
172+
BufferUpbFeatureFlagFingerprint to 45419603,
173+
PathUpbFeatureFlagFingerprint to 45631264,
174+
).forEach { (fingerprint, literalValue) ->
175+
fingerprint.result?.let {
176+
fingerprint.injectLiteralInstructionBooleanCall(
177+
literalValue,
178+
"0x0"
179+
)
180+
}
181+
}
182+
}
183+
184+
// endregion
185+
159186
// Create a new method to get the filter array to avoid register conflicts.
160187
// This fixes an issue with Integrations compiled with Android Gradle Plugin 8.3.0+.
161188
// https://github.com/ReVanced/revanced-patches/issues/2818
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package app.revanced.patches.shared.litho.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.util.fingerprint.LiteralValueFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object BufferUpbFeatureFlagFingerprint : LiteralValueFingerprint(
8+
returnType = "L",
9+
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
10+
parameters = listOf("L"),
11+
literalSupplier = { 45419603 },
12+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package app.revanced.patches.shared.litho.fingerprints
2+
3+
import app.revanced.patcher.extensions.or
4+
import app.revanced.util.fingerprint.LiteralValueFingerprint
5+
import com.android.tools.smali.dexlib2.AccessFlags
6+
7+
internal object PathUpbFeatureFlagFingerprint : LiteralValueFingerprint(
8+
returnType = "Z",
9+
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
10+
parameters = emptyList(),
11+
literalSupplier = { 45631264 },
12+
)

0 commit comments

Comments
 (0)