chore: merge branch dev to main (#2000)

This commit is contained in:
oSumAtrIX 2023-05-01 19:03:35 +02:00 committed by GitHub
commit a9bb284297
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
23 changed files with 822 additions and 388 deletions

View file

@ -1,3 +1,66 @@
# [2.172.0-dev.9](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.8...v2.172.0-dev.9) (2023-05-01)
### Features
* **youtube/general-ads:** hide multiple audio track button on video player overlay ([#2021](https://github.com/revanced/revanced-patches/issues/2021)) ([8d7f305](https://github.com/revanced/revanced-patches/commit/8d7f305aa2d8f86a9232a6a9577a87f58b53d51c))
# [2.172.0-dev.8](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.7...v2.172.0-dev.8) (2023-05-01)
### Bug Fixes
* **change-package-name:** use `null` as default value for option `packageName` ([#1998](https://github.com/revanced/revanced-patches/issues/1998)) ([8128e6b](https://github.com/revanced/revanced-patches/commit/8128e6ba57ec4e4e01a0923a0d353cc934b93899))
# [2.172.0-dev.7](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.6...v2.172.0-dev.7) (2023-04-30)
### Bug Fixes
* **youtube/return-youtube-dislike:** support older UI layouts ([#2031](https://github.com/revanced/revanced-patches/issues/2031)) ([c82ccb5](https://github.com/revanced/revanced-patches/commit/c82ccb59955d7663a5be20338b4b5c9b7601195c))
# [2.172.0-dev.6](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.5...v2.172.0-dev.6) (2023-04-30)
### Features
* **youtube/hide-get-premium:** hide get premium advertisements under video player ([#2020](https://github.com/revanced/revanced-patches/issues/2020)) ([05904a2](https://github.com/revanced/revanced-patches/commit/05904a2569cf9b82e3731692b93bc3a6bb005b03))
# [2.172.0-dev.5](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.4...v2.172.0-dev.5) (2023-04-30)
### Bug Fixes
* **youtube/spoof-app-version:** adjust available app targets ([#2030](https://github.com/revanced/revanced-patches/issues/2030)) ([a16cb0d](https://github.com/revanced/revanced-patches/commit/a16cb0d32f40694f237cb1820b965cee26663fdd))
# [2.172.0-dev.4](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.3...v2.172.0-dev.4) (2023-04-30)
### Features
* **youtube/hide-player-overlay:** exclude by default ([1c6fb94](https://github.com/revanced/revanced-patches/commit/1c6fb941f59599e2fe4a7d6f96babb6b0edac054))
# [2.172.0-dev.3](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.2...v2.172.0-dev.3) (2023-04-29)
### Features
* **youtube/spoof-signature-verification:** list known spoofing side effects in revanced settings ([#2011](https://github.com/revanced/revanced-patches/issues/2011)) ([dc6e9b2](https://github.com/revanced/revanced-patches/commit/dc6e9b2268efe8a1bb72b80e5285d7002f448f4d))
# [2.172.0-dev.2](https://github.com/revanced/revanced-patches/compare/v2.172.0-dev.1...v2.172.0-dev.2) (2023-04-29)
### Bug Fixes
* **youtube/minimized-playback:** fix background play of kids videos ([#2016](https://github.com/revanced/revanced-patches/issues/2016)) ([89b1484](https://github.com/revanced/revanced-patches/commit/89b1484d1d8c1419ba8020d0571b25071d43e926))
# [2.172.0-dev.1](https://github.com/revanced/revanced-patches/compare/v2.171.0...v2.172.0-dev.1) (2023-04-28)
### Features
* **youtube/spoof-app-version:** user selectable version to spoof ([#2013](https://github.com/revanced/revanced-patches/issues/2013)) ([fd66417](https://github.com/revanced/revanced-patches/commit/fd6641747bd60bdd8b967db7cceaed454fb891a1))
# [2.171.0](https://github.com/revanced/revanced-patches/compare/v2.170.0...v2.171.0) (2023-04-27)

View file

@ -36,6 +36,7 @@ The official Patch bundle provided by ReVanced and the community.
| `hide-email-address` | Hides the email address in the account switcher. | 18.15.40 |
| `hide-endscreen-cards` | Hides the suggested video cards at the end of a video in fullscreen. | 18.15.40 |
| `hide-floating-microphone-button` | Hides the floating microphone button which appears in search. | 18.15.40 |
| `hide-get-premium` | Hides advertisement for YouTube Premium under the video player. | 18.15.40 |
| `hide-info-cards` | Hides info cards in videos. | 18.15.40 |
| `hide-player-buttons` | Adds the option to hide video player previous and next buttons. | all |
| `hide-player-overlay` | Hides the dark player overlay when player controls are visible. | all |

View file

@ -1,2 +1,2 @@
kotlin.code.style = official
version = 2.171.0
version = 2.172.0-dev.9

Binary file not shown.

View file

@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.2-bin.zip
distributionSha256Sum=e111cb9948407e26351227dabce49822fb88c37ee72f1d1582a69c68af2e702f
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

7
gradlew vendored
View file

@ -85,9 +85,6 @@ done
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
@ -197,6 +194,10 @@ if "$cygwin" || "$msys" ; then
done
fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in

870
package-lock.json generated

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

View file

@ -5,7 +5,7 @@ import app.revanced.patcher.patch.Patch
import app.revanced.patcher.util.patch.PatchBundle
import java.io.File
typealias PatchBundlePatches = List<Class<out Patch<Context>>>
internal typealias PatchBundlePatches = List<Class<out Patch<Context>>>
internal interface PatchesFileGenerator {
fun generate(bundle: PatchBundlePatches)

View file

@ -41,7 +41,7 @@ class ChangePackageNamePatch : ResourcePatch {
var packageName: String? by option(
PatchOption.StringOption(
key = "packageName",
default = "",
default = null,
title = "Package name",
description = "The name of the package to rename of the app.",
)

View file

@ -212,6 +212,13 @@ class GeneralAdsResourcePatch : ResourcePatch {
true,
StringResource("revanced_hide_image_shelf_summary_on", "Image shelf is hidden"),
StringResource("revanced_hide_image_shelf_summary_off", "Image shelf is shown")
),
SwitchPreference(
"revanced_hide_audio_track_button",
StringResource("revanced_hide_audio_track_button_title", "Hide audio track button"),
false,
StringResource("revanced_hide_audio_track_button_on", "Audio track button is hidden"),
StringResource("revanced_hide_audio_track_button_off", "Audio track button is shown")
)
)

View file

@ -0,0 +1,8 @@
package app.revanced.patches.youtube.layout.hide.getpremium.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility([Package("com.google.android.youtube", arrayOf("18.15.40"))])
@Target(AnnotationTarget.CLASS)
internal annotation class HideGetPremiumCompatibility

View file

@ -0,0 +1,17 @@
package app.revanced.patches.youtube.layout.hide.getpremium.bytecode.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.Opcode
object GetPremiumViewFingerprint : MethodFingerprint(
opcodes = listOf(
Opcode.ADD_INT_2ADDR,
Opcode.ADD_INT_2ADDR,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
),
customFingerprint = { methodDef ->
methodDef.definingClass == "Lcom/google/android/apps/youtube/app/red/presenter/CompactYpcOfferModuleView;"
&& methodDef.name == "onMeasure"
}
)

View file

@ -0,0 +1,77 @@
package app.revanced.patches.youtube.layout.hide.getpremium.bytecode.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.hide.getpremium.annotations.HideGetPremiumCompatibility
import app.revanced.patches.youtube.layout.hide.getpremium.bytecode.fingerprints.GetPremiumViewFingerprint
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.settings.bytecode.patch.SettingsPatch
import org.jf.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@DependsOn([IntegrationsPatch::class, SettingsPatch::class])
@Name("hide-get-premium")
@Description("Hides advertisement for YouTube Premium under the video player.")
@HideGetPremiumCompatibility
@Version("0.0.1")
class HideGetPremiumPatch : BytecodePatch(
listOf(
GetPremiumViewFingerprint,
)
) {
override fun execute(context: BytecodeContext): PatchResult {
SettingsPatch.PreferenceScreen.LAYOUT.addPreferences(
SwitchPreference(
"revanced_hide_get_premium",
StringResource("revanced_hide_get_premium_title", "Hide YouTube Premium advertisement"),
true,
StringResource("revanced_hide_get_premium_summary_on", "YouTube Premium advertisement are hidden"),
StringResource("revanced_hide_get_premium_summary_off", "YouTube Premium advertisement are shown")
)
)
GetPremiumViewFingerprint.result?.let {
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
val measuredWidthRegister = (instruction(startIndex) as TwoRegisterInstruction).registerA
val measuredHeightInstruction = instruction(startIndex + 1) as TwoRegisterInstruction
val measuredHeightRegister = measuredHeightInstruction.registerA
val tempRegister = measuredHeightInstruction.registerB
addInstructions(
startIndex + 2,
"""
# Override the internal measurement of the layout with zero values.
invoke-static {}, $INTEGRATIONS_CLASS_DESCRIPTOR->hideGetPremiumView()Z
move-result v$tempRegister
if-eqz v$tempRegister, :allow
const/4 v$measuredWidthRegister, 0x0
const/4 v$measuredHeightRegister, 0x0
:allow
nop
# Layout width/height is then passed to a protected class method.
"""
)
}
} ?: return GetPremiumViewFingerprint.toErrorResult()
return PatchResultSuccess()
}
private companion object {
const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/HideGetPremiumPatch;"
}
}

View file

@ -10,7 +10,7 @@ import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.youtube.layout.hide.player.overlay.annotations.HidePlayerOverlayPatchCompatibility
@Patch
@Patch(false)
@Name("hide-player-overlay")
@Description("Hides the dark player overlay when player controls are visible.")
@HidePlayerOverlayPatchCompatibility

View file

@ -0,0 +1,28 @@
package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.youtube.layout.returnyoutubedislike.resource.patch.ReturnYouTubeDislikeResourcePatch
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
import org.jf.dexlib2.iface.instruction.WideLiteralInstruction
object DislikesOldLayoutTextViewFingerprint : MethodFingerprint(
returnType = "V",
parameters = listOf("L"),
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
opcodes = listOf(
Opcode.CONST, // resource identifier register
Opcode.INVOKE_VIRTUAL,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_OBJECT,
Opcode.IF_NEZ, // textview register
Opcode.GOTO,
),
customFingerprint = { methodDef ->
methodDef.implementation?.instructions?.any { instruction ->
instruction.opcode.ordinal == Opcode.CONST.ordinal &&
(instruction as? WideLiteralInstruction)?.wideLiteral == ReturnYouTubeDislikeResourcePatch.oldUIDislikeId
} == true
}
)

View file

@ -1,11 +1,8 @@
package app.revanced.patches.youtube.layout.returnyoutubedislike.fingerprints
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
@FuzzyPatternScanMethod(2)
object LikeFingerprint : MethodFingerprint(
"V",
strings = listOf("like/like")
strings = listOf("like/like")
)

View file

@ -7,6 +7,7 @@ import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.extensions.instruction
import app.revanced.patcher.extensions.replaceInstruction
@ -48,6 +49,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
listOf(
TextComponentConstructorFingerprint,
ShortsTextComponentParentFingerprint,
DislikesOldLayoutTextViewFingerprint,
LikeFingerprint,
DislikeFingerprint,
RemoveLikeFingerprint,
@ -56,7 +58,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
override fun execute(context: BytecodeContext): PatchResult {
// region Inject newVideoLoaded event handler to update dislikes when a new video is loaded.
VideoIdPatch.injectCall("$INTEGRATIONS_PATCH_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
VideoIdPatch.injectCall("$INTEGRATIONS_CLASS_DESCRIPTOR->newVideoLoaded(Ljava/lang/String;)V")
// endregion
@ -72,7 +74,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
0,
"""
const/4 v0, ${vote.value}
invoke-static {v0}, $INTEGRATIONS_PATCH_CLASS_DESCRIPTOR->sendVote(I)V
invoke-static {v0}, $INTEGRATIONS_CLASS_DESCRIPTOR->sendVote(I)V
"""
)
} ?: return PatchResultError("Failed to find ${fingerprint.name} method.")
@ -120,7 +122,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
addInstructions(
insertIndex + 1, """
iget-object v$contextRegister, v$contextRegister, $conversionContextFieldReference # copy obfuscated context field into free register
invoke-static {v$contextRegister, v$atomicReferenceRegister, v$charSequenceRegister}, $INTEGRATIONS_PATCH_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
invoke-static {v$contextRegister, v$atomicReferenceRegister, v$charSequenceRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->onLithoTextLoaded(Ljava/lang/Object;Ljava/util/concurrent/atomic/AtomicReference;Ljava/lang/CharSequence;)Ljava/lang/CharSequence;
move-result-object v$charSequenceRegister
move-object v${moveCharSequenceInstruction.registerA}, v${charSequenceRegister} # original instruction at the insertion point
"""
@ -164,11 +166,26 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
// endregion
// region Hook old UI layout dislikes, for the older app spoofs used with spoof-app-version.
DislikesOldLayoutTextViewFingerprint.result?.let {
it.mutableMethod.apply {
val startIndex = it.scanResult.patternScanResult!!.startIndex
val resourceIdentifierRegister = (instruction(startIndex) as OneRegisterInstruction).registerA
val textViewRegister = (instruction(startIndex + 4) as OneRegisterInstruction).registerA
addInstruction(startIndex + 4,
"invoke-static {v$resourceIdentifierRegister, v$textViewRegister}, $INTEGRATIONS_CLASS_DESCRIPTOR->setOldUILayoutDislikes(ILandroid/widget/TextView;)V"
)
}
} ?: return DislikesOldLayoutTextViewFingerprint.toErrorResult()
// endregion
return PatchResultSuccess()
}
private companion object {
const val INTEGRATIONS_PATCH_CLASS_DESCRIPTOR =
const val INTEGRATIONS_CLASS_DESCRIPTOR =
"Lapp/revanced/integrations/patches/ReturnYouTubeDislikePatch;"
private fun MethodFingerprint.toPatch(voteKind: Vote) = VotePatch(this, voteKind)
@ -182,7 +199,7 @@ class ReturnYouTubeDislikePatch : BytecodePatch(
private fun MutableMethod.insertShorts(index: Int, register: Int) {
addInstructions(
index, """
invoke-static {v$register}, $INTEGRATIONS_PATCH_CLASS_DESCRIPTOR->onShortsComponentCreated(Landroid/text/Spanned;)Landroid/text/Spanned;
invoke-static {v$register}, $INTEGRATIONS_CLASS_DESCRIPTOR->onShortsComponentCreated(Landroid/text/Spanned;)Landroid/text/Spanned;
move-result-object v$register
"""
)

View file

@ -8,6 +8,7 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patches.shared.mapping.misc.patch.ResourceMappingPatch
import app.revanced.patches.shared.settings.preference.impl.Preference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.youtube.layout.returnyoutubedislike.annotations.ReturnYouTubeDislikeCompatibility
@ -20,6 +21,10 @@ import app.revanced.util.resources.ResourceUtils.mergeStrings
@ReturnYouTubeDislikeCompatibility
@Version("0.0.1")
class ReturnYouTubeDislikeResourcePatch : ResourcePatch {
companion object {
internal var oldUIDislikeId: Long = -1
}
override fun execute(context: ResourceContext): PatchResult {
val youtubePackage = "com.google.android.youtube"
SettingsPatch.addPreference(
@ -36,6 +41,10 @@ class ReturnYouTubeDislikeResourcePatch : ResourcePatch {
// merge strings
context.mergeStrings("returnyoutubedislike/host/values/strings.xml")
oldUIDislikeId = ResourceMappingPatch.resourceMappings.single {
it.type == "id" && it.name == "dislike_button"
}.id
return PatchResultSuccess()
}
}

View file

@ -11,6 +11,8 @@ import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.shared.settings.preference.impl.ArrayResource
import app.revanced.patches.shared.settings.preference.impl.ListPreference
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.shared.settings.preference.impl.SwitchPreference
import app.revanced.patches.youtube.layout.spoofappversion.annotations.SpoofAppVersionCompatibility
@ -36,11 +38,36 @@ class SpoofAppVersionPatch : BytecodePatch(
"revanced_spoof_app_version",
StringResource("revanced_spoof_app_version_title", "Spoof app version"),
false,
StringResource("revanced_spoof_app_version_summary_on", "Version spoofed to 17.30.34"),
StringResource("revanced_spoof_app_version_summary_on", "Version spoofed"),
StringResource("revanced_spoof_app_version_summary_off", "Version not spoofed"),
StringResource("revanced_spoof_app_version_user_dialog_message",
"App version will be spoofed to 17.30.34. This will give the old UI layout, but unknown side effects may occur."
+ " If later turned off, the old UI layout may remain until you log out or clear the app data.")
"App version will be spoofed to an older version of YouTube. This will change the appearance of the app, but unknown side effects may occur."
+ " If later turned off, the old UI may remain until you log out or clear the app data.")
),
ListPreference(
"revanced_spoof_app_version_target",
StringResource(
"revanced_spoof_app_version_target_title",
"Spoof app version target"
),
ArrayResource(
"revanced_spoof_app_version_target_entries",
listOf(
StringResource("revanced_spoof_app_version_target_entry_1", "17.30.35 - Restore old UI layout"),
StringResource("revanced_spoof_app_version_target_entry_2", "17.01.35 - Enable sorting videos by oldest"),
StringResource("revanced_spoof_app_version_target_entry_3", "16.08.35 - Restore explore tab"),
StringResource("revanced_spoof_app_version_target_entry_4", "16.01.35 - Restore old shorts player"),
)
),
ArrayResource(
"revanced_spoof_app_version_target_entry_values",
listOf(
StringResource("revanced_spoof_app_version_target_entry_value_1", "17.30.35"),
StringResource("revanced_spoof_app_version_target_entry_value_2", "17.01.35"),
StringResource("revanced_spoof_app_version_target_entry_value_3", "16.08.35"),
StringResource("revanced_spoof_app_version_target_entry_value_4", "16.01.35"),
)
)
)
)

View file

@ -52,10 +52,14 @@ class SpoofSignatureVerificationPatch : BytecodePatch(
"revanced_spoof_signature_verification",
StringResource("revanced_spoof_signature_verification_title", "Spoof app signature"),
true,
StringResource("revanced_spoof_signature_verification_summary_on", "App signature spoofed"),
StringResource("revanced_spoof_signature_verification_summary_on",
"App signature spoofed\\n\\n"
+ "Side effects include:\\n"
+ "• End screen cards are always hidden\\n"
+ "• Download button may be hidden"),
StringResource("revanced_spoof_signature_verification_summary_off", "App signature not spoofed"),
StringResource("revanced_spoof_signature_verification_user_dialog_message",
"Signature spoofing can fix playback issues, but may causes side effects.")
"Turning off this setting may cause playback issues.")
)
)

View file

@ -0,0 +1,23 @@
package app.revanced.patches.youtube.misc.minimizedplayback.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
returnType = "V",
access = AccessFlags.PUBLIC or AccessFlags.FINAL,
parameters = listOf("I", "L", "L"),
opcodes = listOf(
Opcode.IF_EQZ,
Opcode.SGET_OBJECT,
Opcode.IF_NE,
Opcode.CONST_4,
Opcode.IPUT_BOOLEAN,
Opcode.IF_EQZ,
Opcode.IGET,
Opcode.INVOKE_STATIC
),
customFingerprint = { it.definingClass.endsWith("MinimizedPlaybackPolicyController;") }
)

View file

@ -6,6 +6,7 @@ import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.data.toMethodWalker
import app.revanced.patcher.extensions.addInstruction
import app.revanced.patcher.extensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
@ -17,6 +18,7 @@ import app.revanced.patches.shared.settings.preference.impl.NonInteractivePrefer
import app.revanced.patches.shared.settings.preference.impl.StringResource
import app.revanced.patches.youtube.misc.integrations.patch.IntegrationsPatch
import app.revanced.patches.youtube.misc.minimizedplayback.annotations.MinimizedPlaybackCompatibility
import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint
import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
import app.revanced.patches.youtube.misc.minimizedplayback.fingerprints.MinimizedPlaybackSettingsFingerprint
import app.revanced.patches.youtube.misc.playertype.patch.PlayerTypeHookPatch
@ -33,7 +35,8 @@ import org.jf.dexlib2.iface.reference.MethodReference
class MinimizedPlaybackPatch : BytecodePatch(
listOf(
MinimizedPlaybackManagerFingerprint,
MinimizedPlaybackSettingsFingerprint
MinimizedPlaybackSettingsFingerprint,
KidsMinimizedPlaybackPolicyControllerFingerprint
)
) {
override fun execute(context: BytecodeContext): PatchResult {
@ -73,6 +76,15 @@ class MinimizedPlaybackPatch : BytecodePatch(
)
} ?: return MinimizedPlaybackSettingsFingerprint.toErrorResult()
// Force allowing background play for videos labeled for kids.
// Some regions and YouTube accounts do not require this patch.
KidsMinimizedPlaybackPolicyControllerFingerprint.result?.apply {
mutableMethod.addInstruction(
0,
"return-void"
)
} ?: return KidsMinimizedPlaybackPolicyControllerFingerprint.toErrorResult()
return PatchResultSuccess()
}