fix(YouTube Music): Rename Minimized playback to Remove background playback restrictions (#3315)

This commit is contained in:
LisoUseInAIKyrios 2024-06-08 11:35:44 +03:00 committed by GitHub
parent 37d415b53a
commit 3c31e55b13
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 67 additions and 47 deletions

View file

@ -403,6 +403,12 @@ public final class app/revanced/patches/music/misc/androidauto/BypassCertificate
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch : app/revanced/patcher/patch/BytecodePatch {
public static final field INSTANCE Lapp/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch;
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
}
public final class app/revanced/patches/music/misc/gms/Constants {
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/Constants;
}

View file

@ -1,50 +1,13 @@
package app.revanced.patches.music.layout.minimizedplayback
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.BackgroundPlaybackDisableFingerprint
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint
import app.revanced.util.exception
import app.revanced.patches.music.misc.backgroundplayback.BackgroundPlaybackPatch
@Patch(
name = "Minimized playback",
description = "Unlocks options for picture-in-picture and background playback.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.45.54",
"6.51.53",
"7.01.53",
"7.02.52",
"7.03.52",
]
)
]
)
@Suppress("unused")
@Deprecated("This patch has been merged into BackgroundPlaybackPatch.")
object MinimizedPlaybackPatch : BytecodePatch(
setOf(
KidsMinimizedPlaybackPolicyControllerFingerprint,
BackgroundPlaybackDisableFingerprint,
),
dependencies = setOf(BackgroundPlaybackPatch::class),
) {
override fun execute(context: BytecodeContext) {
KidsMinimizedPlaybackPolicyControllerFingerprint.result?.mutableMethod?.addInstruction(
0,
"return-void",
) ?: throw KidsMinimizedPlaybackPolicyControllerFingerprint.exception
BackgroundPlaybackDisableFingerprint.result?.mutableMethod?.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
""",
) ?: throw BackgroundPlaybackDisableFingerprint.exception
}
}
}

View file

@ -0,0 +1,50 @@
package app.revanced.patches.music.misc.backgroundplayback
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.misc.backgroundplayback.fingerprints.BackgroundPlaybackDisableFingerprint
import app.revanced.patches.music.misc.backgroundplayback.fingerprints.KidsBackgroundPlaybackPolicyControllerFingerprint
import app.revanced.util.resultOrThrow
@Patch(
name = "Remove background playback restrictions",
description = "Removes restrictions on background playback.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.45.54",
"6.51.53",
"7.01.53",
"7.02.52",
"7.03.52",
]
)
]
)
@Suppress("unused")
object BackgroundPlaybackPatch : BytecodePatch(
setOf(
KidsBackgroundPlaybackPolicyControllerFingerprint,
BackgroundPlaybackDisableFingerprint,
),
) {
override fun execute(context: BytecodeContext) {
KidsBackgroundPlaybackPolicyControllerFingerprint.resultOrThrow().mutableMethod.addInstruction(
0,
"return-void",
)
BackgroundPlaybackDisableFingerprint.resultOrThrow().mutableMethod.addInstructions(
0,
"""
const/4 v0, 0x1
return v0
""",
)
}
}

View file

@ -1,4 +1,4 @@
package app.revanced.patches.music.layout.minimizedplayback.fingerprints
package app.revanced.patches.music.misc.backgroundplayback.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint

View file

@ -1,11 +1,11 @@
package app.revanced.patches.music.layout.minimizedplayback.fingerprints
package app.revanced.patches.music.misc.backgroundplayback.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.MethodFingerprint
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode
internal object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
internal object KidsBackgroundPlaybackPolicyControllerFingerprint : MethodFingerprint(
"V",
AccessFlags.PUBLIC or AccessFlags.FINAL,
listOf("I", "L", "Z"),

View file

@ -2,10 +2,11 @@ package app.revanced.patches.music.premium.backgroundplay
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.music.layout.minimizedplayback.MinimizedPlaybackPatch
@Deprecated("This patch has been merged into MinimizedPlaybackPatch.")
import app.revanced.patches.music.misc.backgroundplayback.BackgroundPlaybackPatch
@Deprecated("This patch has been merged into BackgroundPlaybackPatch.")
object BackgroundPlayPatch : BytecodePatch(
dependencies = setOf(MinimizedPlaybackPatch::class),
dependencies = setOf(BackgroundPlaybackPatch::class),
) {
override fun execute(context: BytecodeContext) {
}