Skip to content

Commit b78b7cf

Browse files
author
LisoUseInAIKyrios
authored
fix(YouTube Music): Rename Minimized playback to Remove background playback restrictions (#3315)
1 parent 4919cba commit b78b7cf

File tree

6 files changed

+67
-47
lines changed

6 files changed

+67
-47
lines changed

api/revanced-patches.api

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,12 @@ public final class app/revanced/patches/music/misc/androidauto/BypassCertificate
403403
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
404404
}
405405

406+
public final class app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch : app/revanced/patcher/patch/BytecodePatch {
407+
public static final field INSTANCE Lapp/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch;
408+
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
409+
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
410+
}
411+
406412
public final class app/revanced/patches/music/misc/gms/Constants {
407413
public static final field INSTANCE Lapp/revanced/patches/music/misc/gms/Constants;
408414
}
Lines changed: 4 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,13 @@
11
package app.revanced.patches.music.layout.minimizedplayback
22

33
import app.revanced.patcher.data.BytecodeContext
4-
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
5-
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
64
import app.revanced.patcher.patch.BytecodePatch
7-
import app.revanced.patcher.patch.annotation.CompatiblePackage
8-
import app.revanced.patcher.patch.annotation.Patch
9-
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.BackgroundPlaybackDisableFingerprint
10-
import app.revanced.patches.music.layout.minimizedplayback.fingerprints.KidsMinimizedPlaybackPolicyControllerFingerprint
11-
import app.revanced.util.exception
5+
import app.revanced.patches.music.misc.backgroundplayback.BackgroundPlaybackPatch
126

13-
@Patch(
14-
name = "Minimized playback",
15-
description = "Unlocks options for picture-in-picture and background playback.",
16-
compatiblePackages = [
17-
CompatiblePackage(
18-
"com.google.android.apps.youtube.music",
19-
[
20-
"6.45.54",
21-
"6.51.53",
22-
"7.01.53",
23-
"7.02.52",
24-
"7.03.52",
25-
]
26-
)
27-
]
28-
)
29-
@Suppress("unused")
7+
@Deprecated("This patch has been merged into BackgroundPlaybackPatch.")
308
object MinimizedPlaybackPatch : BytecodePatch(
31-
setOf(
32-
KidsMinimizedPlaybackPolicyControllerFingerprint,
33-
BackgroundPlaybackDisableFingerprint,
34-
),
9+
dependencies = setOf(BackgroundPlaybackPatch::class),
3510
) {
3611
override fun execute(context: BytecodeContext) {
37-
KidsMinimizedPlaybackPolicyControllerFingerprint.result?.mutableMethod?.addInstruction(
38-
0,
39-
"return-void",
40-
) ?: throw KidsMinimizedPlaybackPolicyControllerFingerprint.exception
41-
42-
BackgroundPlaybackDisableFingerprint.result?.mutableMethod?.addInstructions(
43-
0,
44-
"""
45-
const/4 v0, 0x1
46-
return v0
47-
""",
48-
) ?: throw BackgroundPlaybackDisableFingerprint.exception
4912
}
50-
}
13+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package app.revanced.patches.music.misc.backgroundplayback
2+
3+
import app.revanced.patcher.data.BytecodeContext
4+
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
5+
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
6+
import app.revanced.patcher.patch.BytecodePatch
7+
import app.revanced.patcher.patch.annotation.CompatiblePackage
8+
import app.revanced.patcher.patch.annotation.Patch
9+
import app.revanced.patches.music.misc.backgroundplayback.fingerprints.BackgroundPlaybackDisableFingerprint
10+
import app.revanced.patches.music.misc.backgroundplayback.fingerprints.KidsBackgroundPlaybackPolicyControllerFingerprint
11+
import app.revanced.util.resultOrThrow
12+
13+
@Patch(
14+
name = "Remove background playback restrictions",
15+
description = "Removes restrictions on background playback.",
16+
compatiblePackages = [
17+
CompatiblePackage(
18+
"com.google.android.apps.youtube.music",
19+
[
20+
"6.45.54",
21+
"6.51.53",
22+
"7.01.53",
23+
"7.02.52",
24+
"7.03.52",
25+
]
26+
)
27+
]
28+
)
29+
@Suppress("unused")
30+
object BackgroundPlaybackPatch : BytecodePatch(
31+
setOf(
32+
KidsBackgroundPlaybackPolicyControllerFingerprint,
33+
BackgroundPlaybackDisableFingerprint,
34+
),
35+
) {
36+
override fun execute(context: BytecodeContext) {
37+
KidsBackgroundPlaybackPolicyControllerFingerprint.resultOrThrow().mutableMethod.addInstruction(
38+
0,
39+
"return-void",
40+
)
41+
42+
BackgroundPlaybackDisableFingerprint.resultOrThrow().mutableMethod.addInstructions(
43+
0,
44+
"""
45+
const/4 v0, 0x1
46+
return v0
47+
""",
48+
)
49+
}
50+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package app.revanced.patches.music.layout.minimizedplayback.fingerprints
1+
package app.revanced.patches.music.misc.backgroundplayback.fingerprints
22

33
import app.revanced.patcher.extensions.or
44
import app.revanced.patcher.fingerprint.MethodFingerprint
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
package app.revanced.patches.music.layout.minimizedplayback.fingerprints
1+
package app.revanced.patches.music.misc.backgroundplayback.fingerprints
22

33
import app.revanced.patcher.extensions.or
44
import app.revanced.patcher.fingerprint.MethodFingerprint
55
import com.android.tools.smali.dexlib2.AccessFlags
66
import com.android.tools.smali.dexlib2.Opcode
77

8-
internal object KidsMinimizedPlaybackPolicyControllerFingerprint : MethodFingerprint(
8+
internal object KidsBackgroundPlaybackPolicyControllerFingerprint : MethodFingerprint(
99
"V",
1010
AccessFlags.PUBLIC or AccessFlags.FINAL,
1111
listOf("I", "L", "Z"),

src/main/kotlin/app/revanced/patches/music/premium/backgroundplay/BackgroundPlayPatch.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ package app.revanced.patches.music.premium.backgroundplay
22

33
import app.revanced.patcher.data.BytecodeContext
44
import app.revanced.patcher.patch.BytecodePatch
5-
import app.revanced.patches.music.layout.minimizedplayback.MinimizedPlaybackPatch
6-
@Deprecated("This patch has been merged into MinimizedPlaybackPatch.")
5+
import app.revanced.patches.music.misc.backgroundplayback.BackgroundPlaybackPatch
6+
7+
@Deprecated("This patch has been merged into BackgroundPlaybackPatch.")
78
object BackgroundPlayPatch : BytecodePatch(
8-
dependencies = setOf(MinimizedPlaybackPatch::class),
9+
dependencies = setOf(BackgroundPlaybackPatch::class),
910
) {
1011
override fun execute(context: BytecodeContext) {
1112
}

0 commit comments

Comments
 (0)