fix(YouTube): Always use single threaded layout to resolve layout bugs in unpatched YouTube (#5226)

This commit is contained in:
LisoUseInAIKyrios
2025-06-23 12:19:07 +04:00
committed by GitHub
parent dcfbd8bf93
commit ccd169121a
3 changed files with 73 additions and 7 deletions

View File

@@ -1,6 +1,7 @@
package app.revanced.patches.youtube.misc.litho.filter
import app.revanced.patcher.fingerprint
import app.revanced.util.containsLiteralInstruction
import app.revanced.util.literal
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
@@ -52,6 +53,15 @@ internal val emptyComponentFingerprint = fingerprint {
}
}
internal val lithoThreadExecutorFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.CONSTRUCTOR)
parameters("I", "I", "I")
custom { method, classDef ->
classDef.superclass == "Ljava/util/concurrent/ThreadPoolExecutor;" &&
method.containsLiteralInstruction(1L) // 1L = default thread timeout.
}
}
internal val lithoComponentNameUpbFeatureFlagFingerprint = fingerprint {
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
returns("Z")

View File

@@ -209,6 +209,22 @@ val lithoFilterPatch = bytecodePatch(
// endregion
// region Change Litho thread executor to 1 thread to fix layout issue in unpatched YouTube.
lithoThreadExecutorFingerprint.method.addInstructions(
0,
"""
invoke-static { p1 }, $EXTENSION_CLASS_DESCRIPTOR->getExecutorCorePoolSize(I)I
move-result p1
invoke-static { p2 }, $EXTENSION_CLASS_DESCRIPTOR->getExecutorMaxThreads(I)I
move-result p2
"""
)
// endregion
// 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