mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-28 21:21:02 +00:00
fix(YouTube): Always use single threaded layout to resolve layout bugs in unpatched YouTube (#5226)
This commit is contained in:
committed by
GitHub
parent
dcfbd8bf93
commit
ccd169121a
@@ -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")
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user