diff --git a/patches/api/patches.api b/patches/api/patches.api index 4782cf765a..49739e3bb8 100644 --- a/patches/api/patches.api +++ b/patches/api/patches.api @@ -1348,6 +1348,7 @@ public final class app/revanced/patches/youtube/misc/playservice/VersionCheckPat public static final fun is_19_32_or_greater ()Z public static final fun is_19_33_or_greater ()Z public static final fun is_19_34_or_greater ()Z + public static final fun is_19_35_or_greater ()Z public static final fun is_19_36_or_greater ()Z public static final fun is_19_41_or_greater ()Z public static final fun is_19_43_or_greater ()Z diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/Fingerprints.kt index edd505cb48..9fca4d89cf 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/Fingerprints.kt @@ -46,3 +46,11 @@ internal val controlsOverlayVisibilityFingerprint = fingerprint { returns("V") parameters("Z", "Z") } + +internal val playerControlsExploderFeatureFlagFingerprint = fingerprint { + accessFlags(AccessFlags.PUBLIC, AccessFlags.FINAL) + returns("Z") + parameters() + literal { 45643739L } +} + diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt index e22aef1819..a198e75ea9 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playercontrols/PlayerControlsPatch.kt @@ -10,6 +10,7 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod import app.revanced.patches.shared.misc.mapping.get import app.revanced.patches.shared.misc.mapping.resourceMappingPatch import app.revanced.patches.shared.misc.mapping.resourceMappings +import app.revanced.patches.youtube.misc.playservice.is_19_35_or_greater import app.revanced.util.* import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction @@ -217,6 +218,7 @@ val playerControlsPatch = bytecodePatch( val playerTopControlsInflateMatch by playerTopControlsInflateFingerprint() val overlayViewInflateMatch by overlayViewInflateFingerprint() val playerControlsExtensionHookMatch by playerControlsExtensionHookFingerprint() + val playerControlsExploderFeatureFlagMatch by playerControlsExploderFeatureFlagFingerprint() execute { context -> fun MutableMethod.indexOfFirstViewInflateOrThrow() = @@ -269,5 +271,13 @@ val playerControlsPatch = bytecodePatch( } visibilityImmediateMethod = playerControlsExtensionHookMatch.mutableMethod + + // A/B test for a slightly different overlay controls, + // that uses layout file youtube_video_exploder_controls_bottom_ui_container.xml + // The change to support this is simple and only requires adding buttons to both layout files, + // but for now force this different layout off since it's still an experimental test. + if (is_19_35_or_greater) { + playerControlsExploderFeatureFlagMatch.mutableMethod.returnEarly() + } } } diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt index 1ff14ea40b..780ad310a3 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/playservice/VersionCheckPatch.kt @@ -29,6 +29,8 @@ var is_19_33_or_greater = false private set var is_19_34_or_greater = false private set +var is_19_35_or_greater = false + private set var is_19_36_or_greater = false private set var is_19_41_or_greater = false @@ -62,6 +64,7 @@ val versionCheckPatch = resourcePatch( is_19_32_or_greater = 243199000 <= playStoreServicesVersion is_19_33_or_greater = 243405000 <= playStoreServicesVersion is_19_34_or_greater = 243499000 <= playStoreServicesVersion + is_19_35_or_greater = 243605000 <= playStoreServicesVersion is_19_36_or_greater = 243705000 <= playStoreServicesVersion is_19_41_or_greater = 244305000 <= playStoreServicesVersion is_19_43_or_greater = 244405000 <= playStoreServicesVersion