From 0ece1b9aead52c9416b09eadf9662ce16407332c Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Mon, 10 Feb 2025 17:51:39 +0900 Subject: [PATCH] fix(YouTube - Remove background playback restriction): Play/Pause button not working in PiP mode (Unpatched YouTube bug) https://github.com/inotia00/ReVanced_Extended/issues/2764 --- .../backgroundplayback/BackgroundPlaybackPatch.kt | 5 +++++ .../youtube/misc/backgroundplayback/Fingerprints.kt | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt index fdee59c81..c6380be34 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/BackgroundPlaybackPatch.kt @@ -97,6 +97,11 @@ val backgroundPlaybackPatch = bytecodePatch( } } } + + pipInputConsumerFeatureFlagFingerprint.injectLiteralInstructionBooleanCall( + PIP_INPUT_CONSUMER_FEATURE_FLAG, + "0x0" + ) } // Force allowing background play for videos labeled for kids. diff --git a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/Fingerprints.kt index 7c89ea6a5..fca3d72da 100644 --- a/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/youtube/misc/backgroundplayback/Fingerprints.kt @@ -125,6 +125,17 @@ internal val backgroundPlaybackManagerCairoFragmentSecondaryFingerprint = legacy ), ) +internal const val PIP_INPUT_CONSUMER_FEATURE_FLAG = 45638483L + +/** + * Fix 'E/InputDispatcher: Window handle pip_input_consumer has no registered input channel' + * Related with [ReVanced_Extended#2764](https://github.com/inotia00/ReVanced_Extended/issues/2764). + */ +internal val pipInputConsumerFeatureFlagFingerprint = legacyFingerprint( + name = "pipInputConsumerFeatureFlagFingerprint", + literals = listOf(PIP_INPUT_CONSUMER_FEATURE_FLAG), +) + internal const val SHORTS_BACKGROUND_PLAYBACK_FEATURE_FLAG = 45415425L internal val shortsBackgroundPlaybackFeatureFlagFingerprint = legacyFingerprint(