forked from ReVanced/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(YouTube Music): Rename
Minimized playback
to `Remove background…
… playback restrictions` (ReVanced#3315)
- Loading branch information
1 parent
37d415b
commit 3c31e55
Showing
6 changed files
with
67 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 4 additions & 41 deletions
45
...main/kotlin/app/revanced/patches/music/layout/minimizedplayback/MinimizedPlaybackPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
...main/kotlin/app/revanced/patches/music/misc/backgroundplayback/BackgroundPlaybackPatch.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
""", | ||
) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...s/BackgroundPlaybackDisableFingerprint.kt → ...s/BackgroundPlaybackDisableFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...zedPlaybackPolicyControllerFingerprint.kt → ...undPlaybackPolicyControllerFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters