Skip to content

Commit b4a6bd6

Browse files
20.28 work in progress (litho filtering is still partially broken)
1 parent 699bd86 commit b4a6bd6

File tree

12 files changed

+52
-69
lines changed

12 files changed

+52
-69
lines changed

patches/api/patches.api

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,7 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat
14641464
public static final fun is_20_21_or_greater ()Z
14651465
public static final fun is_20_22_or_greater ()Z
14661466
public static final fun is_20_26_or_greater ()Z
1467+
public static final fun is_20_28_or_greater ()Z
14671468
}
14681469

14691470
public final class app/revanced/patches/youtube/misc/privacy/RemoveTrackingQueryParameterPatchKt {

patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/EnableSlideToSeekPatch.kt

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,9 @@ val enableSlideToSeekPatch = bytecodePatch(
7373

7474
// Disable the double speed seek gesture.
7575
if (is_19_17_or_greater) {
76-
arrayOf(
77-
disableFastForwardGestureFingerprint,
78-
disableFastForwardNoticeFingerprint,
79-
).forEach { fingerprint ->
80-
fingerprint.method.apply {
81-
val targetIndex = fingerprint.instructionMatches.last().index
76+
disableFastForwardGestureFingerprint.let {
77+
it.method.apply {
78+
val targetIndex = it.instructionMatches.last().index
8279
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
8380

8481
addInstructions(

patches/src/main/kotlin/app/revanced/patches/youtube/interaction/seekbar/Fingerprints.kt

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -69,29 +69,6 @@ internal val disableFastForwardGestureFingerprint by fingerprint {
6969
}
7070
}
7171

72-
internal val disableFastForwardNoticeFingerprint by fingerprint {
73-
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
74-
returns("V")
75-
parameters()
76-
instructions(
77-
opcode(Opcode.CHECK_CAST),
78-
// opcode(Opcode.IGET_OBJECT), // 20.25+
79-
methodCall(opcode = Opcode.INVOKE_VIRTUAL, returnType = "Z", maxAfter = 1),
80-
opcode(Opcode.MOVE_RESULT, maxAfter = 0),
81-
)
82-
custom { method, _ ->
83-
// Code is found in different methods with different strings.
84-
val findSearchLandingKey = (is_19_34_or_greater && !is_19_47_or_greater)
85-
|| is_20_19_or_greater
86-
87-
method.name == "run" && method.indexOfFirstInstruction {
88-
val string = getReference<StringReference>()?.string
89-
string == "Failed to easy seek haptics vibrate."
90-
|| (findSearchLandingKey && string == "search_landing_cache_key")
91-
} >= 0
92-
}
93-
}
94-
9572
/**
9673
* For 20.19 and below, this matches the same method as [disableFastForwardNoticeFingerprint].
9774
* For 20.20+, this matches a different method.

patches/src/main/kotlin/app/revanced/patches/youtube/layout/buttons/overlay/HidePlayerOverlayButtonsPatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ val hidePlayerOverlayButtonsPatch = bytecodePatch(
3636
sharedExtensionPatch,
3737
settingsPatch,
3838
addResourcesPatch,
39-
resourceMappingPatch // Used by fingerprints
39+
resourceMappingPatch // Used by fingerprints.
4040
)
4141

4242
compatibleWith(

patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/Fingerprints.kt

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,26 +145,13 @@ internal val lottieAnimationViewSetAnimationIntFingerprint by fingerprint {
145145
}
146146
}
147147

148-
internal val lottieAnimationViewSetAnimationStreamFingerprint by fingerprint {
149-
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
150-
parameters("L")
151-
returns("V")
152-
instructions(
153-
methodCall("Ljava/util/Set;", "add"),
154-
literal(0)
155-
)
156-
custom { _, classDef ->
157-
classDef.type == LOTTIE_ANIMATION_VIEW_CLASS_TYPE
158-
}
159-
}
160-
161148
internal val lottieCompositionFactoryZipFingerprint by fingerprint {
162149
accessFlags(AccessFlags.PUBLIC, AccessFlags.STATIC)
163-
parameters("Landroid/content/Context;", "Ljava/lang/String;", "Ljava/lang/String;")
150+
parameters("Landroid/content/Context;", "Ljava/util/zip/ZipInputStream;", "Ljava/lang/String;")
164151
returns("L")
165152
instructions(
166-
string(".zip"),
167-
string(".lottie")
153+
string("Unable to parse composition"),
154+
string(" however it was not found in the animation.")
168155
)
169156
}
170157

patches/src/main/kotlin/app/revanced/patches/youtube/layout/seekbar/SeekbarColorPatch.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
55
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
66
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
77
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
8+
import app.revanced.patcher.fingerprint
89
import app.revanced.patcher.patch.PatchException
910
import app.revanced.patcher.patch.bytecodePatch
1011
import app.revanced.patcher.patch.resourcePatch
@@ -372,6 +373,14 @@ val seekbarColorPatch = bytecodePatch(
372373
factoryStreamReturnType = returnType
373374
}
374375

376+
val lottieAnimationViewSetAnimationStreamFingerprint by fingerprint {
377+
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
378+
parameters(factoryStreamReturnType.toString())
379+
returns("V")
380+
custom { _, classDef ->
381+
classDef.type == lottieAnimationViewSetAnimationIntFingerprint.originalClassDef.type
382+
}
383+
}
375384
val setAnimationStreamName = lottieAnimationViewSetAnimationStreamFingerprint
376385
.originalMethod.name
377386

patches/src/main/kotlin/app/revanced/patches/youtube/layout/theme/ThemePatch.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ val themePatch = bytecodePatch(
173173
// Fix the splash screen dark mode background color.
174174
// In 19.32+ the dark mode splash screen is white and fades to black.
175175
// Maybe it's a bug in YT, or maybe it intentionally. Who knows.
176-
document("res/values-night-v27/styles.xml").use { document ->
176+
document("res/values-night/styles.xml").use { document ->
177177
// Create a night mode specific override for the splash screen background.
178178
val style = document.createElement("style")
179179
style.setAttribute("name", "Theme.YouTube.Home")

patches/src/main/kotlin/app/revanced/patches/youtube/misc/navigation/NavigationBarHookPatch.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import app.revanced.patches.youtube.misc.extension.sharedExtensionPatch
1313
import app.revanced.patches.youtube.misc.playertype.playerTypeHookPatch
1414
import app.revanced.patches.youtube.misc.playservice.is_19_35_or_greater
1515
import app.revanced.patches.youtube.misc.playservice.is_20_21_or_greater
16+
import app.revanced.patches.youtube.misc.playservice.is_20_28_or_greater
1617
import app.revanced.patches.youtube.misc.playservice.versionCheckPatch
1718
import app.revanced.patches.youtube.shared.mainActivityOnBackPressedFingerprint
1819
import app.revanced.util.getReference
@@ -78,7 +79,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
7879
)
7980
}
8081

81-
if (is_20_21_or_greater) {
82+
if (is_20_21_or_greater && !is_20_28_or_greater) {
8283
val imageResourceIntTabMethod = pivotBarButtonsCreateResourceIntViewFingerprint.originalMethod
8384
addHook(NavigationHook.NAVIGATION_TAB_LOADED) predicate@{
8485
MethodUtil.methodSignaturesMatch(
@@ -194,7 +195,7 @@ val navigationBarHookPatch = bytecodePatch(description = "Hooks the active navig
194195
}
195196

196197
// Fix YT bug of notification tab missing the filled icon.
197-
if (is_19_35_or_greater) {
198+
if (is_19_35_or_greater && !is_20_28_or_greater) {
198199
val cairoNotificationEnumReference = imageEnumConstructorFingerprint
199200
.instructionMatches.last().getInstruction<ReferenceInstruction>().reference
200201

patches/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/Fingerprints.kt

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,21 @@ import app.revanced.patches.shared.misc.mapping.resourceLiteral
66
import com.android.tools.smali.dexlib2.AccessFlags
77
import com.android.tools.smali.dexlib2.Opcode
88

9-
internal val playerTypeFingerprint by fingerprint {
10-
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
11-
returns("V")
12-
parameters("L")
13-
opcodes(
14-
Opcode.IF_NE,
15-
Opcode.RETURN_VOID,
9+
internal val playerTypeEnumFingerprint by fingerprint {
10+
accessFlags(AccessFlags.STATIC, AccessFlags.CONSTRUCTOR)
11+
strings(
12+
"NONE",
13+
"HIDDEN",
14+
"WATCH_WHILE_MINIMIZED",
15+
"WATCH_WHILE_MAXIMIZED",
16+
"WATCH_WHILE_FULLSCREEN",
17+
"WATCH_WHILE_SLIDING_MAXIMIZED_FULLSCREEN",
18+
"WATCH_WHILE_SLIDING_MINIMIZED_MAXIMIZED",
19+
"WATCH_WHILE_SLIDING_MINIMIZED_DISMISSED",
20+
"INLINE_MINIMAL",
21+
"VIRTUAL_REALITY_FULLSCREEN",
22+
"WATCH_WHILE_PICTURE_IN_PICTURE",
1623
)
17-
custom { _, classDef -> classDef.endsWith("/YouTubePlayerOverlaysLayout;") }
1824
}
1925

2026
internal val reelWatchPagerFingerprint by fingerprint {

patches/src/main/kotlin/app/revanced/patches/youtube/misc/playertype/PlayerTypeHookPatch.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,18 @@ val playerTypeHookPatch = bytecodePatch(
2121
dependsOn(sharedExtensionPatch, resourceMappingPatch)
2222

2323
execute {
24-
playerTypeFingerprint.method.addInstruction(
24+
val playerOverlaysSetPlayerTypeFingerprint by fingerprint {
25+
accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL)
26+
returns("V")
27+
parameters(playerTypeEnumFingerprint.originalClassDef.type)
28+
custom { _, classDef ->
29+
classDef.endsWith("/YouTubePlayerOverlaysLayout;")
30+
}
31+
}
32+
33+
playerOverlaysSetPlayerTypeFingerprint.method.addInstruction(
2534
0,
26-
"invoke-static {p1}, $EXTENSION_CLASS_DESCRIPTOR->setPlayerType(Ljava/lang/Enum;)V",
35+
"invoke-static { p1 }, $EXTENSION_CLASS_DESCRIPTOR->setPlayerType(Ljava/lang/Enum;)V",
2736
)
2837

2938
reelWatchPagerFingerprint.let {

0 commit comments

Comments
 (0)