build: bump patcher to 16.0.2

This commit is contained in:
inotia00
2023-10-09 20:33:22 +09:00
parent b35510e13c
commit 83bebf0113
436 changed files with 10568 additions and 6598 deletions

View File

@ -1,7 +1,6 @@
package app.revanced.extensions
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.MethodFingerprintExtensions.name
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.util.proxy.mutableTypes.MutableClass
@ -32,7 +31,7 @@ internal fun MutableMethodImplementation.injectHideCall(
* @return The [PatchException] for the [MethodFingerprint].
*/
val MethodFingerprint.exception
get() = PatchException("Failed to resolve $name")
get() = PatchException("Failed to resolve ${this.javaClass.simpleName}")
/**
* Find the [MutableMethod] from a given [Method] in a [MutableClass].

View File

@ -1,67 +1,41 @@
package app.revanced.meta
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.dependencies
import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.include
import app.revanced.patcher.extensions.PatchExtensions.options
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.PatchOption
import app.revanced.patcher.PatchSet
import app.revanced.patcher.patch.Patch
import com.google.gson.GsonBuilder
import java.io.File
internal class JsonGenerator : PatchesFileGenerator {
override fun generate(bundle: PatchBundlePatches) {
val patches = bundle.map {
JsonPatch(
it.patchName,
it.description ?: "This patch has no description.",
!it.include,
it.options?.map { option ->
JsonPatch.Option(
option.key,
option.title,
option.description,
option.required,
option.let { listOption ->
if (listOption is PatchOption.ListOption<*>) {
listOption.options.toMutableList().toTypedArray()
} else null
}
)
}?.toTypedArray() ?: emptyArray(),
it.dependencies?.map { dep ->
dep.java.patchName
}?.toTypedArray() ?: emptyArray(),
it.compatiblePackages?.map { pkg ->
JsonPatch.CompatiblePackage(pkg.name, pkg.versions)
}?.toTypedArray() ?: emptyArray()
)
}
val json = File("patches.json")
json.writeText(GsonBuilder().serializeNulls().create().toJson(patches))
override fun generate(patches: PatchSet) = patches.map {
JsonPatch(
it.name!!,
it.description,
it.compatiblePackages,
it.use,
it.requiresIntegrations,
it.options.values.map { option ->
JsonPatch.Option(option.key, option.value, option.title, option.description, option.required)
}
)
}.let {
File("patches.json").writeText(GsonBuilder().serializeNulls().create().toJson(it))
}
@Suppress("unused")
private class JsonPatch(
val name: String,
val description: String,
val excluded: Boolean,
val options: Array<Option>,
val dependencies: Array<String>,
val compatiblePackages: Array<CompatiblePackage>,
val name: String? = null,
val description: String? = null,
val compatiblePackages: Set<Patch.CompatiblePackage>? = null,
val use: Boolean = true,
val requiresIntegrations: Boolean = false,
val options: List<Option>
) {
class CompatiblePackage(
val name: String,
val versions: Array<String>,
)
class Option(
val key: String,
val title: String,
val description: String,
val default: Any?,
val title: String?,
val description: String?,
val required: Boolean,
val choices: Array<*>?,
)
}
}

View File

@ -1,13 +1,11 @@
package app.revanced.meta
import app.revanced.patcher.PatchBundleLoader
import app.revanced.patcher.patch.PatchClass
import app.revanced.patcher.PatchSet
import java.io.File
internal typealias PatchBundlePatches = List<PatchClass>
internal interface PatchesFileGenerator {
fun generate(bundle: PatchBundlePatches)
fun generate(patches: PatchSet)
private companion object {
@JvmStatic
@ -16,11 +14,7 @@ internal interface PatchesFileGenerator {
).also { loader ->
if (loader.isEmpty()) throw IllegalStateException("No patches found")
}.let { bundle ->
arrayOf(JsonGenerator(), ReadmeGenerator()).forEach { generator ->
generator.generate(
bundle
)
}
arrayOf(JsonGenerator()).forEach { generator -> generator.generate(bundle) }
}
}
}

View File

@ -1,84 +0,0 @@
package app.revanced.meta
import app.revanced.patcher.data.Context
import app.revanced.patcher.extensions.PatchExtensions.compatiblePackages
import app.revanced.patcher.extensions.PatchExtensions.description
import app.revanced.patcher.extensions.PatchExtensions.patchName
import app.revanced.patcher.patch.Patch
import com.unascribed.flexver.FlexVerComparator
import java.io.File
internal class ReadmeGenerator : PatchesFileGenerator {
private companion object {
private const val TABLE_HEADER =
"| \uD83D\uDC8A Patch | \uD83D\uDCDC Description | \uD83C\uDFF9 Target Version |\n" +
"|:--------:|:--------------:|:-----------------:|"
}
override fun generate(bundle: PatchBundlePatches) {
val output = StringBuilder()
mutableMapOf<String, MutableList<Class<out Patch<Context<*>>>>>()
.apply {
for (patch in bundle) {
patch.compatiblePackages?.forEach { pkg ->
if (!contains(pkg.name)) put(pkg.name, mutableListOf())
this[pkg.name]!!.add(patch)
}
}
}
.entries
.sortedByDescending { it.value.size }
.forEach { (`package`, patches) ->
val supportVersions = buildMap {
patches.forEach { patch ->
patch.compatiblePackages?.single { compatiblePackage -> compatiblePackage.name == `package` }?.versions?.let {
it.forEach { version -> merge(version, 1, Integer::sum) }
}
}
}
val minVersion = supportVersions.let { commonMap ->
commonMap.maxByOrNull { it.value }?.value?.let {
commonMap.entries.filter { supported -> supported.value == it }
.minOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
} ?: "all"
}
val maxVersion = supportVersions.let { commonMap ->
commonMap.maxByOrNull { it.value }?.value?.let {
commonMap.entries.filter { supported -> supported.value == it }
.maxOfWith(FlexVerComparator::compare, Map.Entry<String, Int>::key)
} ?: "all"
}
output.apply {
appendLine("### [\uD83D\uDCE6 `${`package`}`](https://play.google.com/store/apps/details?id=${`package`})")
appendLine("<details>\n")
appendLine(TABLE_HEADER)
patches.forEach { patch ->
val supportedVersion =
if (
patch.compatiblePackages?.single { it.name == `package` }?.versions?.isNotEmpty() == true
) {
if (minVersion == maxVersion)
maxVersion
else
"$minVersion ~ $maxVersion"
} else
"all"
appendLine(
"| `${patch.patchName.lowercase().replace(" ", "-")}` " +
"| ${patch.description} " +
"| $supportedVersion |"
)
}
appendLine("</details>\n")
}
}
StringBuilder(File("README-template.md").readText())
.replace(Regex("\\{\\{\\s?table\\s?}}"), output.toString())
.let(File("README.md")::writeText)
}
}

View File

@ -1,38 +1,45 @@
package app.revanced.patches.music.account.component.patch
package app.revanced.patches.music.account.component
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.account.component.fingerprints.MenuEntryFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ACCOUNT
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch
@Name("Hide account menu")
@Description("Hide account menu elements.")
@DependsOn(
[
@Patch(
name = "Hide account menu",
description = "Hide account menu elements.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class MenuComponentPatch : BytecodePatch(
listOf(MenuEntryFingerprint)
@Suppress("unused")
object MenuComponentPatch : BytecodePatch(
setOf(MenuEntryFingerprint)
) {
override fun execute(context: BytecodeContext) {
@ -69,13 +76,11 @@ class MenuComponentPatch : BytecodePatch(
)
}
private companion object {
fun MutableMethod.targetIndex(descriptor: String): Int {
return implementation?.let {
it.instructions.indexOfFirst { instruction ->
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == descriptor
}
} ?: throw PatchException("No Method Implementation found!")
}
private fun MutableMethod.targetIndex(descriptor: String): Int {
return implementation?.let {
it.instructions.indexOfFirst { instruction ->
((instruction as? ReferenceInstruction)?.reference as? MethodReference)?.name == descriptor
}
} ?: throw PatchException("No Method Implementation found!")
}
}

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.account.component.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.MenuEntry
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MenuEntry
import app.revanced.util.bytecode.isWideLiteralExists
object MenuEntryFingerprint : MethodFingerprint(

View File

@ -1,20 +1,17 @@
package app.revanced.patches.music.account.handle.patch
package app.revanced.patches.music.account.handle
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.account.handle.fingerprints.AccountSwitcherAccessibilityLabelFingerprint
import app.revanced.patches.music.account.handle.fingerprints.NamesInactiveAccountThumbnailSizeFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ACCOUNT
import com.android.tools.smali.dexlib2.Opcode
@ -23,18 +20,28 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch
@Name("Hide handle")
@Description("Hides the handle in the account switcher.")
@DependsOn(
[
@Patch(
name = "Hide handle",
description = "Hides the handle in the account switcher.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class HideHandlePatch : BytecodePatch(
listOf(
@Suppress("unused")
object HideHandlePatch : BytecodePatch(
setOf(
AccountSwitcherAccessibilityLabelFingerprint,
NamesInactiveAccountThumbnailSizeFingerprint
)

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.account.handle.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.AccountSwitcherAccessibility
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.AccountSwitcherAccessibility
import app.revanced.util.bytecode.isWideLiteralExists
object AccountSwitcherAccessibilityLabelFingerprint : MethodFingerprint(

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.account.handle.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.NamesInactiveAccountThumbnailSize
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.NamesInactiveAccountThumbnailSize
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.Opcode

View File

@ -1,21 +1,18 @@
package app.revanced.patches.music.account.tos.patch
package app.revanced.patches.music.account.tos
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.account.tos.fingerprints.TermsOfServiceFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.TosFooter
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TosFooter
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ACCOUNT
@ -23,18 +20,28 @@ import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
@Patch
@Name("Hide terms container")
@Description("Hides terms of service container at the account menu.")
@DependsOn(
[
@Patch(
name = "Hide terms container",
description = "Hides terms of service container at the account menu.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class TermsContainerPatch : BytecodePatch(
listOf(TermsOfServiceFingerprint)
@Suppress("unused")
object TermsContainerPatch : BytecodePatch(
setOf(TermsOfServiceFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.account.tos.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.TosFooter
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.TosFooter
import app.revanced.util.bytecode.isWideLiteralExists
object TermsOfServiceFingerprint : MethodFingerprint(

View File

@ -0,0 +1,50 @@
package app.revanced.patches.music.actionbar.downloadbuttonhook
import app.revanced.patcher.data.BytecodeContext
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.utils.actionbarhook.ActionBarHookPatch
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.music.video.information.VideoInformationPatch
import app.revanced.util.enum.CategoryType
@Patch(
name = "Hook download button",
description = "Replaces the offline download button with an external download button.",
dependencies = [
ActionBarHookPatch::class,
IntentHookPatch::class,
SettingsPatch::class,
VideoInformationPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object DownloadButtonHookPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.ACTION_BAR,
"revanced_hook_action_bar_download",
"false"
)
SettingsPatch.addMusicPreferenceWithIntent(
CategoryType.ACTION_BAR,
"revanced_external_downloader_package_name",
"revanced_hook_action_bar_download"
)
}
}

View File

@ -1,43 +0,0 @@
package app.revanced.patches.music.actionbar.downloadbuttonhook.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.actionbarhook.patch.ActionBarHookPatch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.intenthook.patch.IntentHookPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.video.information.patch.VideoInformationPatch
import app.revanced.util.enum.CategoryType
@Patch
@Name("Hook download button")
@Description("Replaces the offline download button with an external download button.")
@DependsOn(
[
ActionBarHookPatch::class,
IntentHookPatch::class,
SettingsPatch::class,
VideoInformationPatch::class
]
)
@MusicCompatibility
class DownloadButtonHookPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.ACTION_BAR,
"revanced_hook_action_bar_download",
"false"
)
SettingsPatch.addMusicPreferenceWithIntent(
CategoryType.ACTION_BAR,
"revanced_external_downloader_package_name",
"revanced_hook_action_bar_download"
)
}
}

View File

@ -1,36 +1,43 @@
package app.revanced.patches.music.actionbar.label.patch
package app.revanced.patches.music.actionbar.label
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.actionbar.label.fingerprints.ActionBarLabelFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.ActionsBarParentFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ACTIONBAR
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Hide action bar label")
@Description("Hide labels in action bar.")
@DependsOn(
[
@Patch(
name = "Hide action bar label",
description = "Hide labels in action bar.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class ActionBarLabelPatch : BytecodePatch(
listOf(ActionsBarParentFingerprint)
@Suppress("unused")
object ActionBarLabelPatch : BytecodePatch(
setOf(ActionsBarParentFingerprint)
) {
override fun execute(context: BytecodeContext) {
ActionsBarParentFingerprint.result?.let { parentResult ->

View File

@ -0,0 +1,41 @@
package app.revanced.patches.music.actionbar.radio
import app.revanced.patcher.data.BytecodeContext
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.utils.actionbarhook.ActionBarHookPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
@Patch(
name = "Hide radio button",
description = "Hides start radio button.",
dependencies = [
ActionBarHookPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HideRadioButtonPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.ACTION_BAR,
"revanced_hide_action_bar_radio",
"false"
)
}
}

View File

@ -1,34 +0,0 @@
package app.revanced.patches.music.actionbar.radio.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.actionbarhook.patch.ActionBarHookPatch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
@Patch
@Name("Hide radio button")
@Description("Hides start radio button.")
@DependsOn(
[
ActionBarHookPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class HideRadioButtonPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.ACTION_BAR,
"revanced_hide_action_bar_radio",
"false"
)
}
}

View File

@ -0,0 +1,46 @@
package app.revanced.patches.music.ads.music
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.shared.patch.ads.AbstractAdsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Hide music ads",
description = "Hides ads before playing a music.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object MusicAdsPatch : AbstractAdsPatch(
"$MUSIC_ADS_PATH/HideMusicAdsPatch;->hideMusicAds()Z"
) {
override fun execute(context: BytecodeContext) {
super.execute(context)
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_music_ads", "true")
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/AdsFilter;"
}

View File

@ -1,41 +0,0 @@
package app.revanced.patches.music.ads.music.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.shared.patch.ads.AbstractAdsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide music ads")
@Description("Hides ads before playing a music.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class MusicAdsPatch : AbstractAdsPatch(
"$MUSIC_ADS_PATH/HideMusicAdsPatch;->hideMusicAds()Z"
) {
override fun execute(context: BytecodeContext) {
super.execute(context)
SettingsPatch.addMusicPreference(CategoryType.ADS, "revanced_hide_music_ads", "true")
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/AdsFilter;"
}
}

View File

@ -1,33 +1,40 @@
package app.revanced.patches.music.flyoutpanel.compactdialog.patch
package app.revanced.patches.music.flyoutpanel.compactdialog
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints.DialogSolidFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
@Patch
@Name("Enable compact dialog")
@Description("Enable compact dialog on phone.")
@DependsOn(
[
@Patch(
name = "Enable compact dialog",
description = "Enable compact dialog on phone.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class CompactDialogPatch : BytecodePatch(
listOf(DialogSolidFingerprint)
@Suppress("unused")
object CompactDialogPatch : BytecodePatch(
setOf(DialogSolidFingerprint)
) {
override fun execute(context: BytecodeContext) {
DialogSolidFingerprint.result?.let {

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.flyoutpanel.compactdialog.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.DialogSolid
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.DialogSolid
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

View File

@ -1,20 +1,17 @@
package app.revanced.patches.music.flyoutpanel.hide.patch
package app.revanced.patches.music.flyoutpanel.component
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.flyoutbutton.FlyoutButtonContainerPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
import com.android.tools.smali.dexlib2.Opcode
@ -22,18 +19,28 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@Name("Hide flyout panel")
@Description("Hides flyout panel components.")
@DependsOn(
[
@Patch(
name = "Hide flyout panel",
description = "Hides flyout panel components.",
dependencies = [
FlyoutButtonContainerPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class FlyoutPanelPatch : BytecodePatch(
listOf(MenuItemFingerprint)
@Suppress("unused")
object FlyoutPanelPatch : BytecodePatch(
setOf(MenuItemFingerprint)
) {
override fun execute(context: BytecodeContext) {
MenuItemFingerprint.result?.let {

View File

@ -0,0 +1,43 @@
package app.revanced.patches.music.flyoutpanel.playbackspeed
import app.revanced.patcher.data.BytecodeContext
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.utils.flyoutbutton.FlyoutButtonContainerPatch
import app.revanced.patches.music.utils.overridespeed.OverrideSpeedHookPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
@Patch(
name = "Enable playback speed",
description = "Add playback speed button to the flyout panel.",
dependencies = [
FlyoutButtonContainerPatch::class,
OverrideSpeedHookPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object PlaybackSpeedPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.FLYOUT,
"revanced_enable_flyout_panel_playback_speed",
"false"
)
}
}

View File

@ -1,36 +0,0 @@
package app.revanced.patches.music.flyoutpanel.playbackspeed.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonContainerPatch
import app.revanced.patches.music.utils.overridespeed.patch.OverrideSpeedHookPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
@Patch
@Name("Enable playback speed")
@Description("Add playback speed button to the flyout panel.")
@DependsOn(
[
FlyoutButtonContainerPatch::class,
OverrideSpeedHookPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class PlaybackSpeedPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.FLYOUT,
"revanced_enable_flyout_panel_playback_speed",
"false"
)
}
}

View File

@ -1,37 +1,44 @@
package app.revanced.patches.music.flyoutpanel.replace.patch
package app.revanced.patches.music.flyoutpanel.replace
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.flyoutpanel.utils.EnumUtils.getEnumIndex
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.MenuItemFingerprint
import app.revanced.patches.music.utils.flyoutbutton.patch.FlyoutButtonItemResourcePatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.video.information.patch.VideoInformationPatch
import app.revanced.patches.music.utils.flyoutbutton.FlyoutButtonItemResourcePatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.music.video.information.VideoInformationPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Replace dismiss queue")
@Description("Replace dismiss queue menu to watch on YouTube.")
@DependsOn(
[
@Patch(
name = "Replace dismiss queue",
description = "Replace dismiss queue menu to watch on YouTube.",
dependencies = [
FlyoutButtonItemResourcePatch::class,
SettingsPatch::class,
VideoInformationPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class ReplaceDismissQueuePatch : BytecodePatch(
listOf(MenuItemFingerprint)
@Suppress("unused")
object ReplaceDismissQueuePatch : BytecodePatch(
setOf(MenuItemFingerprint)
) {
override fun execute(context: BytecodeContext) {
MenuItemFingerprint.result?.let {

View File

@ -1,28 +1,37 @@
package app.revanced.patches.music.flyoutpanel.sleeptimer.patch
package app.revanced.patches.music.flyoutpanel.sleeptimer
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.flyoutpanel.sleeptimer.fingerprints.SleepTimerFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Enable sleep timer")
@Description("Add sleep timer to flyout menu.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class SleepTimerPatch : BytecodePatch(
listOf(SleepTimerFingerprint)
@Patch(
name = "Enable sleep timer",
description = "Add sleep timer to flyout menu.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object SleepTimerPatch : BytecodePatch(
setOf(SleepTimerFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,22 +1,31 @@
package app.revanced.patches.music.general.amoled.patch
package app.revanced.patches.music.general.amoled
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.shared.patch.litho.LithoThemePatch
import app.revanced.util.integrations.Constants.MUSIC_UTILS_PATH
import org.w3c.dom.Element
@Patch
@Name("Amoled")
@Description("Applies pure black theme on some components.")
@DependsOn([LithoThemePatch::class])
@MusicCompatibility
class AmoledPatch : ResourcePatch {
@Patch(
name = "Amoled",
description = "Applies pure black theme on some components.",
dependencies = [LithoThemePatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
],
)
@Suppress("unused")
object AmoledPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
LithoThemePatch.injectCall("$MUSIC_UTILS_PATH/LithoThemePatch;->applyLithoTheme(I)I")

View File

@ -1,28 +1,37 @@
package app.revanced.patches.music.general.autocaptions.patch
package app.revanced.patches.music.general.autocaptions
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.shared.fingerprints.captions.SubtitleTrackFingerprint
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Disable auto captions")
@Description("Disables forced auto captions.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class DisableAutoCaptionsPatch : BytecodePatch(
listOf(SubtitleTrackFingerprint)
@Patch(
name = "Disable auto captions",
description = "Disables forced auto captions.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
],
)
@Suppress("unused")
object DisableAutoCaptionsPatch : BytecodePatch(
setOf(SubtitleTrackFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -0,0 +1,35 @@
package app.revanced.patches.music.general.branding.icon
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.util.resources.IconHelper.customIconMusic
import app.revanced.util.resources.IconHelper.customIconMusicAdditional
@Patch(
name = "Custom branding icon MMT",
description = "Changes the YouTube Music launcher icon to MMT.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
],
use = false
)
@Suppress("unused")
object CustomBrandingIconMMTPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
context.customIconMusic("mmt")
context.customIconMusicAdditional("mmt")
}
}

View File

@ -0,0 +1,32 @@
package app.revanced.patches.music.general.branding.icon
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.util.resources.IconHelper.customIconMusic
@Patch(
name = "Custom branding icon Revancify blue",
description = "Changes the YouTube Music launcher icon to Revancify Blue.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object CustomBrandingIconRevancifyBluePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
context.customIconMusic("revancify-blue")
}
}

View File

@ -0,0 +1,33 @@
package app.revanced.patches.music.general.branding.icon
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.util.resources.IconHelper.customIconMusic
@Patch(
name = "Custom branding icon Revancify red",
description = "Changes the YouTube Music launcher icon to Revancify Red.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
],
use = false
)
@Suppress("unused")
object CustomBrandingIconRevancifyRedPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
context.customIconMusic("revancify-red")
}
}

View File

@ -1,24 +0,0 @@
package app.revanced.patches.music.general.branding.icon.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.util.resources.IconHelper.customIconMusic
import app.revanced.util.resources.IconHelper.customIconMusicAdditional
@Patch(false)
@Name("Custom branding icon MMT")
@Description("Changes the YouTube Music launcher icon to MMT.")
@MusicCompatibility
class CustomBrandingIconMMTPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
context.customIconMusic("mmt")
context.customIconMusicAdditional("mmt")
}
}

View File

@ -1,22 +0,0 @@
package app.revanced.patches.music.general.branding.icon.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.util.resources.IconHelper.customIconMusic
@Patch
@Name("Custom branding icon Revancify blue")
@Description("Changes the YouTube Music launcher icon to Revancify Blue.")
@MusicCompatibility
class CustomBrandingIconRevancifyBluePatch : ResourcePatch {
override fun execute(context: ResourceContext) {
context.customIconMusic("revancify-blue")
}
}

View File

@ -1,22 +0,0 @@
package app.revanced.patches.music.general.branding.icon.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.util.resources.IconHelper.customIconMusic
@Patch(false)
@Name("Custom branding icon Revancify red")
@Description("Changes the YouTube Music launcher icon to Revancify Red.")
@MusicCompatibility
class CustomBrandingIconRevancifyRedPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
context.customIconMusic("revancify-red")
}
}

View File

@ -0,0 +1,67 @@
package app.revanced.patches.music.general.branding.name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.patch.options.types.StringPatchOption.Companion.stringPatchOption
@Patch(
name = "Custom branding Music name",
description = "Rename the YouTube Music app to the name specified in options.json.",
dependencies = [RemoveElementsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object CustomBrandingNamePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
val longName = MusicLongName
?: throw PatchException("Invalid app name.")
val shortName = MusicShortName
?: throw PatchException("Invalid app name.")
context.xmlEditor["res/values/strings.xml"].use { editor ->
val document = editor.file
mapOf(
"app_name" to longName,
"app_launcher_name" to shortName
).forEach { (k, v) ->
val stringElement = document.createElement("string")
stringElement.setAttribute("name", k)
stringElement.textContent = v
document.getElementsByTagName("resources").item(0).appendChild(stringElement)
}
}
}
internal var MusicLongName by stringPatchOption(
key = "MusicLongName",
default = "ReVanced Extended Music",
title = "Application Name of YouTube Music",
description = "The name of the YouTube Music it will show on your notification panel."
)
internal var MusicShortName by stringPatchOption(
key = "MusicShortName",
default = "RVX Music",
title = "Application Name of YouTube Music",
description = "The name of the YouTube Music it will show on your home screen."
)
}

View File

@ -0,0 +1,121 @@
package app.revanced.patches.music.general.branding.name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import kotlin.io.path.exists
object RemoveElementsPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
LANGUAGE_LIST.forEach { path ->
val resDirectory = context["res"]
val targetXmlPath = resDirectory.resolve(path).resolve("strings.xml").toPath()
if (targetXmlPath.exists()) {
val targetXml = context["res/$path/strings.xml"]
targetXml.writeText(
targetXml.readText()
.replace(""".+"app_launcher_name".+""".toRegex(), "")
.replace(""".+"app_name".+""".toRegex(), "")
)
}
}
}
private val LANGUAGE_LIST = arrayOf(
"values",
"values-af",
"values-am",
"values-ar",
"values-ar-rXB",
"values-as",
"values-az",
"values-b+es+419",
"values-b+sr+Latn",
"values-be",
"values-bg",
"values-bn",
"values-bs",
"values-ca",
"values-cs",
"values-da",
"values-de",
"values-el",
"values-en-rAU",
"values-en-rCA",
"values-en-rGB",
"values-en-rIN",
"values-en-rXA",
"values-en-rXC",
"values-es",
"values-es-rUS",
"values-et",
"values-eu",
"values-fa",
"values-fi",
"values-fr",
"values-fr-rCA",
"values-gl",
"values-gu",
"values-hi",
"values-hr",
"values-hu",
"values-hy",
"values-id",
"values-in",
"values-is",
"values-it",
"values-iw",
"values-ja",
"values-ka",
"values-kk",
"values-km",
"values-kn",
"values-ko",
"values-ky",
"values-lo",
"values-lt",
"values-lv",
"values-mk",
"values-ml",
"values-mn",
"values-mr",
"values-ms",
"values-my",
"values-nb",
"values-ne",
"values-nl",
"values-no",
"values-or",
"values-pa",
"values-pl",
"values-pt",
"values-pt-rBR",
"values-pt-rPT",
"values-ro",
"values-ru",
"values-si",
"values-sk",
"values-sl",
"values-sq",
"values-sr",
"values-sv",
"values-sw",
"values-ta",
"values-te",
"values-th",
"values-tl",
"values-tr",
"values-uk",
"values-ur",
"values-uz",
"values-vi",
"values-zh",
"values-zh-rCN",
"values-zh-rHK",
"values-zh-rTW",
"values-zu"
)
}

View File

@ -1,64 +0,0 @@
package app.revanced.patches.music.layout.branding.name.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.OptionsContainer
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.PatchOption
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
@Patch
@Name("Custom branding Music name")
@Description("Rename the YouTube Music app to the name specified in options.json.")
@DependsOn([RemoveElementsPatch::class])
@MusicCompatibility
class CustomBrandingNamePatch : ResourcePatch {
override fun execute(context: ResourceContext) {
val longName = MusicLongName
?: throw PatchException("Invalid app name.")
val shortName = MusicShortName
?: throw PatchException("Invalid app name.")
context.xmlEditor["res/values/strings.xml"].use { editor ->
val document = editor.file
mapOf(
"app_name" to longName,
"app_launcher_name" to shortName
).forEach { (k, v) ->
val stringElement = document.createElement("string")
stringElement.setAttribute("name", k)
stringElement.textContent = v
document.getElementsByTagName("resources").item(0).appendChild(stringElement)
}
}
}
companion object : OptionsContainer() {
var MusicLongName: String? by option(
PatchOption.StringOption(
key = "MusicLongName",
default = "ReVanced Extended Music",
title = "Application Name of YouTube Music",
description = "The name of the YouTube Music it will show on your notification panel."
)
)
var MusicShortName: String? by option(
PatchOption.StringOption(
key = "MusicShortName",
default = "RVX Music",
title = "Application Name of YouTube Music",
description = "The name of the YouTube Music it will show on your home screen."
)
)
}
}

View File

@ -1,123 +0,0 @@
package app.revanced.patches.music.layout.branding.name.patch
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import kotlin.io.path.exists
class RemoveElementsPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
LANGUAGE_LIST.forEach { path ->
val resDirectory = context["res"]
val targetXmlPath = resDirectory.resolve(path).resolve("strings.xml").toPath()
if (targetXmlPath.exists()) {
val targetXml = context["res/$path/strings.xml"]
targetXml.writeText(
targetXml.readText()
.replace(""".+"app_launcher_name".+""".toRegex(), "")
.replace(""".+"app_name".+""".toRegex(), "")
)
}
}
}
companion object {
val LANGUAGE_LIST = arrayOf(
"values",
"values-af",
"values-am",
"values-ar",
"values-ar-rXB",
"values-as",
"values-az",
"values-b+es+419",
"values-b+sr+Latn",
"values-be",
"values-bg",
"values-bn",
"values-bs",
"values-ca",
"values-cs",
"values-da",
"values-de",
"values-el",
"values-en-rAU",
"values-en-rCA",
"values-en-rGB",
"values-en-rIN",
"values-en-rXA",
"values-en-rXC",
"values-es",
"values-es-rUS",
"values-et",
"values-eu",
"values-fa",
"values-fi",
"values-fr",
"values-fr-rCA",
"values-gl",
"values-gu",
"values-hi",
"values-hr",
"values-hu",
"values-hy",
"values-id",
"values-in",
"values-is",
"values-it",
"values-iw",
"values-ja",
"values-ka",
"values-kk",
"values-km",
"values-kn",
"values-ko",
"values-ky",
"values-lo",
"values-lt",
"values-lv",
"values-mk",
"values-ml",
"values-mn",
"values-mr",
"values-ms",
"values-my",
"values-nb",
"values-ne",
"values-nl",
"values-no",
"values-or",
"values-pa",
"values-pl",
"values-pt",
"values-pt-rBR",
"values-pt-rPT",
"values-ro",
"values-ru",
"values-si",
"values-sk",
"values-sl",
"values-sq",
"values-sr",
"values-sv",
"values-sw",
"values-ta",
"values-te",
"values-th",
"values-tl",
"values-tr",
"values-uk",
"values-ur",
"values-uz",
"values-vi",
"values-zh",
"values-zh-rCN",
"values-zh-rHK",
"values-zh-rTW",
"values-zu"
)
}
}

View File

@ -0,0 +1,47 @@
package app.revanced.patches.music.general.buttonshelf
import app.revanced.patcher.data.BytecodeContext
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.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Hide button shelf",
description = "Hides the button shelf from homepage and explorer.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HideButtonShelfPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_button_shelf",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/ButtonShelfFilter;"
}

View File

@ -1,42 +0,0 @@
package app.revanced.patches.music.general.buttonshelf.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide button shelf")
@Description("Hides the button shelf from homepage and explorer.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class HideButtonShelfPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_button_shelf",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/ButtonShelfFilter;"
}
}

View File

@ -0,0 +1,47 @@
package app.revanced.patches.music.general.carouselshelf
import app.revanced.patcher.data.BytecodeContext
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.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Hide carousel shelf",
description = "Hides the carousel shelf from homepage and explorer.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HideCarouselShelfPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_carousel_shelf",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/CarouselShelfFilter;"
}

View File

@ -1,42 +0,0 @@
package app.revanced.patches.music.general.carouselshelf.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide carousel shelf")
@Description("Hides the carousel shelf from homepage and explorer.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class HideCarouselShelfPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_carousel_shelf",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/CarouselShelfFilter;"
}
}

View File

@ -1,39 +1,46 @@
package app.revanced.patches.music.general.castbutton.patch
package app.revanced.patches.music.general.castbutton
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.general.castbutton.fingerprints.MediaRouteButtonFingerprint
import app.revanced.patches.music.general.castbutton.fingerprints.PlayerOverlayChipFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PlayerOverlayChip
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerOverlayChip
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Hide cast button")
@Description("Hides the cast button.")
@DependsOn(
[
@Patch(
name = "Hide cast button",
description = "Hides the cast button.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class HideCastButtonPatch : BytecodePatch(
listOf(
@Suppress("unused")
object HideCastButtonPatch : BytecodePatch(
setOf(
MediaRouteButtonFingerprint,
PlayerOverlayChipFingerprint
)

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.general.castbutton.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PlayerOverlayChip
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerOverlayChip
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags

View File

@ -1,34 +1,41 @@
package app.revanced.patches.music.general.categorybar.patch
package app.revanced.patches.music.general.categorybar
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.general.categorybar.fingerprints.ChipCloudFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Hide category bar")
@Description("Hides the music category bar at the top of the homepage.")
@DependsOn(
[
@Patch(
name = "Hide category bar",
description = "Hides the music category bar at the top of the homepage.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class CategoryBarPatch : BytecodePatch(
listOf(ChipCloudFingerprint)
@Suppress("unused")
object CategoryBarPatch : BytecodePatch(
setOf(ChipCloudFingerprint)
) {
override fun execute(context: BytecodeContext) {
ChipCloudFingerprint.result?.let {

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.general.categorybar.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ChipCloud
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ChipCloud
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.Opcode

View File

@ -0,0 +1,47 @@
package app.revanced.patches.music.general.channelguidelines
import app.revanced.patcher.data.BytecodeContext
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.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Hide channel guidelines",
description = "Hides channel guidelines at the top of comments.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HideChannelGuidelinesPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_channel_guidelines",
"true"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/ChannelGuidelinesFilter;"
}

View File

@ -1,42 +0,0 @@
package app.revanced.patches.music.general.channelguidelines.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide channel guidelines")
@Description("Hides channel guidelines at the top of comments.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class HideChannelGuidelinesPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_channel_guidelines",
"true"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/ChannelGuidelinesFilter;"
}
}

View File

@ -0,0 +1,52 @@
package app.revanced.patches.music.general.customfilter
import app.revanced.patcher.data.BytecodeContext
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.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Enable custom filter",
description = "Enables custom filter to hide layout components.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object CustomFilterPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_custom_filter",
"false"
)
SettingsPatch.addMusicPreferenceWithIntent(
CategoryType.GENERAL,
"revanced_custom_filter_strings",
"revanced_custom_filter"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/CustomFilter;"
}

View File

@ -1,47 +0,0 @@
package app.revanced.patches.music.general.customfilter.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Enable custom filter")
@Description("Enables custom filter to hide layout components.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class CustomFilterPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_custom_filter",
"false"
)
SettingsPatch.addMusicPreferenceWithIntent(
CategoryType.GENERAL,
"revanced_custom_filter_strings",
"revanced_custom_filter"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/CustomFilter;"
}
}

View File

@ -0,0 +1,47 @@
package app.revanced.patches.music.general.emojipicker
import app.revanced.patcher.data.BytecodeContext
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.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Hide emoji picker",
description = "Hides emoji picker at the comments box.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HideEmojiPickerPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_emoji_picker",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/EmojiPickerFilter;"
}

View File

@ -1,42 +0,0 @@
package app.revanced.patches.music.general.emojipicker.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide emoji picker")
@Description("Hides emoji picker at the comments box.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class HideEmojiPickerPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_emoji_picker",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/EmojiPickerFilter;"
}
}

View File

@ -1,36 +1,43 @@
package app.revanced.patches.music.general.floatingbutton.patch
package app.revanced.patches.music.general.floatingbutton
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonFingerprint
import app.revanced.patches.music.general.floatingbutton.fingerprints.FloatingButtonParentFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
@Patch
@Name("Hide new playlist button")
@Description("Hides the \"New playlist\" button in the library.")
@DependsOn(
[
@Patch(
name = "Hide new playlist button",
description = "Hides the \"New playlist\" button in the library.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class NewPlaylistButtonPatch : BytecodePatch(
listOf(FloatingButtonParentFingerprint)
@Suppress("unused")
object NewPlaylistButtonPatch : BytecodePatch(
setOf(FloatingButtonParentFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,32 +1,39 @@
package app.revanced.patches.music.general.landscapemode.patch
package app.revanced.patches.music.general.landscapemode
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.general.landscapemode.fingerprints.TabletIdentifierFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
@Patch
@Name("Enable landscape mode")
@Description("Enables entry into landscape mode by screen rotation on the phone.")
@DependsOn(
[
@Patch(
name = "Enable landscape mode",
description = "Enables entry into landscape mode by screen rotation on the phone.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class LandScapeModePatch : BytecodePatch(
listOf(TabletIdentifierFingerprint)
@Suppress("unused")
object LandScapeModePatch : BytecodePatch(
setOf(TabletIdentifierFingerprint)
) {
override fun execute(context: BytecodeContext) {
TabletIdentifierFingerprint.result?.let {

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.general.landscapemode.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.IsTablet
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.IsTablet
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

View File

@ -1,29 +1,38 @@
package app.revanced.patches.music.general.oldstylelibraryshelf.patch
package app.revanced.patches.music.general.oldstylelibraryshelf
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.general.oldstylelibraryshelf.fingerprints.BrowseIdFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.bytecode.getStringIndex
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@Name("Enable old style library shelf")
@Description("Return the library shelf to old style.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class OldStyleLibraryShelfPatch : BytecodePatch(
listOf(BrowseIdFingerprint)
@Patch(
name = "Enable old style library shelf",
description = "Return the library shelf to old style.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object OldStyleLibraryShelfPatch : BytecodePatch(
setOf(BrowseIdFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -0,0 +1,47 @@
package app.revanced.patches.music.general.playlistcard
import app.revanced.patcher.data.BytecodeContext
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.utils.litho.LithoFilterPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch(
name = "Hide playlist card",
description = "Hides the playlist card from homepage.",
dependencies = [
LithoFilterPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HidePlaylistCardPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_playlist_card",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/PlaylistCardFilter;"
}

View File

@ -1,42 +0,0 @@
package app.revanced.patches.music.general.playlistcard.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.litho.patch.LithoFilterPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_ADS_PATH
@Patch
@Name("Hide playlist card")
@Description("Hides the playlist card from homepage.")
@DependsOn(
[
LithoFilterPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class HidePlaylistCardPatch : BytecodePatch() {
override fun execute(context: BytecodeContext) {
SettingsPatch.addMusicPreference(
CategoryType.GENERAL,
"revanced_hide_playlist_card",
"false"
)
LithoFilterPatch.addFilter(FILTER_CLASS_DESCRIPTOR)
}
private companion object {
private const val FILTER_CLASS_DESCRIPTOR =
"$MUSIC_ADS_PATH/PlaylistCardFilter;"
}
}

View File

@ -1,37 +1,44 @@
package app.revanced.patches.music.general.startpage.patch
package app.revanced.patches.music.general.startpage
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.general.startpage.fingerprints.ColdStartUpFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.intenthook.patch.IntentHookPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch.Companion.contexts
import app.revanced.patches.music.utils.intenthook.IntentHookPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch.contexts
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_GENERAL
import app.revanced.util.resources.ResourceUtils.copyXmlNode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Start page")
@Description("Set the default start page.")
@DependsOn(
[
@Patch(
name = "Start page",
description = "Set the default start page.",
dependencies = [
IntentHookPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class StartPagePatch : BytecodePatch(
listOf(ColdStartUpFingerprint)
@Suppress("unused")
object StartPagePatch : BytecodePatch(
setOf(ColdStartUpFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -0,0 +1,40 @@
package app.revanced.patches.music.general.tooltip
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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.general.tooltip.fingerprints.TooltipContentViewFingerprint
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
@Patch(
name = "Hide tooltip content",
description = "Hides the tooltip box that appears on first install.",
dependencies = [SharedResourceIdPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object TooltipContentViewPatch : BytecodePatch(
setOf(TooltipContentViewFingerprint)
) {
override fun execute(context: BytecodeContext) {
TooltipContentViewFingerprint.result?.mutableMethod?.addInstruction(
0,
"return-void"
) ?: throw TooltipContentViewFingerprint.exception
}
}

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.general.tooltip.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ToolTipContentView
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ToolTipContentView
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags

View File

@ -1,31 +0,0 @@
package app.revanced.patches.music.general.tooltip.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.general.tooltip.fingerprints.TooltipContentViewFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
@Patch
@Name("Hide tooltip content")
@Description("Hides the tooltip box that appears on first install.")
@DependsOn([SharedResourceIdPatch::class])
@MusicCompatibility
class TooltipContentViewPatch : BytecodePatch(
listOf(TooltipContentViewFingerprint)
) {
override fun execute(context: BytecodeContext) {
TooltipContentViewFingerprint.result?.mutableMethod?.addInstruction(
0,
"return-void"
) ?: throw TooltipContentViewFingerprint.exception
}
}

View File

@ -1,22 +1,32 @@
package app.revanced.patches.music.misc.backgroundplay.patch
package app.revanced.patches.music.misc.backgroundplay
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.misc.backgroundplay.fingerprints.BackgroundPlaybackParentFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
@Patch
@Name("Background play")
@Description("Enables playing music in the background.")
@MusicCompatibility
class BackgroundPlayPatch : BytecodePatch(
listOf(BackgroundPlaybackParentFingerprint)
@Patch(
name = "Background play",
description = "Enables playing music in the background.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object BackgroundPlayPatch : BytecodePatch(
setOf(BackgroundPlaybackParentFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,17 +1,27 @@
package app.revanced.patches.music.misc.bitrate.patch
package app.revanced.patches.music.misc.bitrate
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
@Patch
@Name("Bitrate default value")
@Description("Set the audio quality to \"Always High\" when you first install the app.")
@MusicCompatibility
class BitrateDefaultValuePatch : ResourcePatch {
@Patch(
name = "Bitrate default value",
description = "Set the audio quality to \"Always High\" when you first install the app.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object BitrateDefaultValuePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
context.xmlEditor[RESOURCE_FILE_PATH].use { editor ->
editor.file.getElementsByTagName("com.google.android.apps.youtube.music.ui.preference.PreferenceCategoryCompat")
@ -34,7 +44,5 @@ class BitrateDefaultValuePatch : ResourcePatch {
}
private companion object {
const val RESOURCE_FILE_PATH = "res/xml/data_saving_settings.xml"
}
private const val RESOURCE_FILE_PATH = "res/xml/data_saving_settings.xml"
}

View File

@ -0,0 +1,41 @@
package app.revanced.patches.music.misc.codecs
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.shared.patch.opus.AbstractOpusCodecsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
@Patch(
name = "Enable opus codec",
description = "Enable opus codec when playing audio.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object CodecsUnlockPatch : AbstractOpusCodecsPatch(
"$MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
) {
override fun execute(context: BytecodeContext) {
super.execute(context)
SettingsPatch.addMusicPreference(
CategoryType.MISC,
"revanced_enable_opus_codec",
"true"
)
}
}

View File

@ -1,32 +0,0 @@
package app.revanced.patches.music.misc.codecs.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.shared.patch.opus.AbstractOpusCodecsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
@Patch
@Name("Enable opus codec")
@Description("Enable opus codec when playing audio.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class CodecsUnlockPatch : AbstractOpusCodecsPatch(
"$MUSIC_MISC_PATH/OpusCodecPatch;->enableOpusCodec()Z"
) {
override fun execute(context: BytecodeContext) {
super.execute(context)
SettingsPatch.addMusicPreference(
CategoryType.MISC,
"revanced_enable_opus_codec",
"true"
)
}
}

View File

@ -0,0 +1,38 @@
package app.revanced.patches.music.misc.debugging
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
@Patch(
name = "Enable debug logging",
description = "Adds debugging options.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
],
use = false
)
@Suppress("unused")
object DebuggingPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
SettingsPatch.addMusicPreference(
CategoryType.MISC,
"revanced_enable_debug_logging",
"false"
)
}
}

View File

@ -1,28 +0,0 @@
package app.revanced.patches.music.misc.debugging.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.enum.CategoryType
@Patch(false)
@Name("Enable debug logging")
@Description("Adds debugging options.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class DebuggingPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
SettingsPatch.addMusicPreference(
CategoryType.MISC,
"revanced_enable_debug_logging",
"false"
)
}
}

View File

@ -1,31 +1,41 @@
package app.revanced.patches.music.misc.exclusiveaudio.patch
package app.revanced.patches.music.misc.exclusiveaudio
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.DataSavingSettingsFragmentFingerprint
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.MusicBrowserServiceFingerprint
import app.revanced.patches.music.misc.exclusiveaudio.fingerprints.PodCastConfigFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.util.bytecode.getStringIndex
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@Patch
@Name("Exclusive audio playback")
@Description("Enables the option to play music without video.")
@MusicCompatibility
class ExclusiveAudioPatch : BytecodePatch(
listOf(
@Patch(
name = "Exclusive audio playback",
description = "Enables the option to play music without video.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object ExclusiveAudioPatch : BytecodePatch(
setOf(
DataSavingSettingsFragmentFingerprint,
MusicBrowserServiceFingerprint,
PodCastConfigFingerprint

View File

@ -0,0 +1,37 @@
package app.revanced.patches.music.misc.minimizedplayback
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
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.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
@Patch(
name = "Enable minimized playback",
description = "Enables minimized playback on Kids music.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object MinimizedPlaybackPatch : BytecodePatch(
setOf(MinimizedPlaybackManagerFingerprint)
) {
override fun execute(context: BytecodeContext) {
MinimizedPlaybackManagerFingerprint.result?.mutableMethod?.addInstruction(
0, "return-void"
) ?: throw MinimizedPlaybackManagerFingerprint.exception
}
}

View File

@ -1,27 +0,0 @@
package app.revanced.patches.music.misc.minimizedplayback.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.misc.minimizedplayback.fingerprints.MinimizedPlaybackManagerFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
@Patch
@Name("Enable minimized playback")
@Description("Enables minimized playback on Kids music.")
@MusicCompatibility
class MinimizedPlaybackPatch : BytecodePatch(
listOf(MinimizedPlaybackManagerFingerprint)
) {
override fun execute(context: BytecodeContext) {
MinimizedPlaybackManagerFingerprint.result?.mutableMethod?.addInstruction(
0, "return-void"
) ?: throw MinimizedPlaybackManagerFingerprint.exception
}
}

View File

@ -1,24 +1,21 @@
package app.revanced.patches.music.misc.premium.patch
package app.revanced.patches.music.misc.premium
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patches.music.misc.premium.fingerprints.AccountMenuFooterFingerprint
import app.revanced.patches.music.misc.premium.fingerprints.HideGetPremiumFingerprint
import app.revanced.patches.music.misc.premium.fingerprints.MembershipSettingsFingerprint
import app.revanced.patches.music.misc.premium.fingerprints.MembershipSettingsParentFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PrivacyTosFooter
import app.revanced.util.bytecode.getWideLiteralIndex
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@ -26,13 +23,25 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.reference.Reference
@Patch
@Name("Hide get premium")
@Description("Hides \"Get Premium\" label from the account menu or settings.")
@DependsOn([SharedResourceIdPatch::class])
@MusicCompatibility
class HideGetPremiumPatch : BytecodePatch(
listOf(
@Patch(
name = "Hide get premium",
description = "Hides \"Get Premium\" label from the account menu or settings.",
dependencies = [SharedResourceIdPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object HideGetPremiumPatch : BytecodePatch(
setOf(
AccountMenuFooterFingerprint,
HideGetPremiumFingerprint,
MembershipSettingsParentFingerprint
@ -105,7 +114,5 @@ class HideGetPremiumPatch : BytecodePatch(
}
private companion object {
lateinit var targetReference: Reference
}
private lateinit var targetReference: Reference
}

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.misc.premium.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PrivacyTosFooter
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PrivacyTosFooter
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

View File

@ -0,0 +1,45 @@
package app.revanced.patches.music.misc.spoofappversion
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.general.oldstylelibraryshelf.OldStyleLibraryShelfPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.shared.patch.versionspoof.AbstractVersionSpoofPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
@Patch(
name = "Spoof app version",
description = "Spoof the YouTube Music client version.",
dependencies = [
OldStyleLibraryShelfPatch::class,
SettingsPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object SpoofAppVersionPatch : AbstractVersionSpoofPatch(
"$MUSIC_MISC_PATH/SpoofAppVersionPatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
) {
override fun execute(context: BytecodeContext) {
super.execute(context)
SettingsPatch.addMusicPreference(
CategoryType.MISC,
"revanced_spoof_app_version",
"false"
)
}
}

View File

@ -1,23 +1,33 @@
package app.revanced.patches.music.misc.tastebuilder.patch
package app.revanced.patches.music.misc.tastebuilder
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.misc.tastebuilder.fingerprints.TasteBuilderConstructorFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@Patch
@Name("Hide taste builder")
@Description("Hides the \"Tell us which artists you like\" card from homepage.")
@MusicCompatibility
class TasteBuilderPatch : BytecodePatch(
listOf(TasteBuilderConstructorFingerprint)
@Patch(
name = "Hide taste builder",
description = "Hides the \"Tell us which artists you like\" card from homepage.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object TasteBuilderPatch : BytecodePatch(
setOf(TasteBuilderConstructorFingerprint)
) {
override fun execute(context: BytecodeContext) {
TasteBuilderConstructorFingerprint.result?.let {

View File

@ -0,0 +1,61 @@
package app.revanced.patches.music.misc.translations
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.resources.ResourceHelper.addTranslations
@Patch(
name = "Translations",
description = "Add Crowdin translations for YouTube Music.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object TranslationsPatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
context.addTranslations("music", LANGUAGE_LIST)
}
private val LANGUAGE_LIST = arrayOf(
"az-rAZ",
"be-rBY",
"bn",
"cs-rCZ",
"de-rDE",
"el-rGR",
"es-rES",
"fr-rFR",
"hi-rIN",
"hu-rHU",
"id-rID",
"in",
"it-rIT",
"ja-rJP",
"ko-rKR",
"nl-rNL",
"pl-rPL",
"pt-rBR",
"ru-rRU",
"th-rTH",
"tr-rTR",
"uk-rUA",
"vi-rVN",
"zh-rCN",
"zh-rTW"
)
}

View File

@ -1,54 +0,0 @@
package app.revanced.patches.music.misc.translations.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.util.resources.ResourceHelper.addTranslations
@Patch
@Name("Translations")
@Description("Add Crowdin translations for YouTube Music.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class TranslationsPatch : ResourcePatch {
override fun execute(context: ResourceContext) {
context.addTranslations("music", LANGUAGE_LIST)
}
private companion object {
val LANGUAGE_LIST = arrayOf(
"az-rAZ",
"be-rBY",
"bn",
"cs-rCZ",
"de-rDE",
"el-rGR",
"es-rES",
"fr-rFR",
"hi-rIN",
"hu-rHU",
"id-rID",
"in",
"it-rIT",
"ja-rJP",
"ko-rKR",
"nl-rNL",
"pl-rPL",
"pt-rBR",
"ru-rRU",
"th-rTH",
"tr-rTR",
"uk-rUA",
"vi-rVN",
"zh-rCN",
"zh-rTW"
)
}
}

View File

@ -1,38 +0,0 @@
package app.revanced.patches.music.misc.versionspoof.patch
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.general.oldstylelibraryshelf.patch.OldStyleLibraryShelfPatch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.shared.patch.versionspoof.AbstractVersionSpoofPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_MISC_PATH
@Patch
@Name("Spoof app version")
@Description("Spoof the YouTube Music client version.")
@DependsOn(
[
OldStyleLibraryShelfPatch::class,
SettingsPatch::class
]
)
@MusicCompatibility
class SpoofAppVersionPatch : AbstractVersionSpoofPatch(
"$MUSIC_MISC_PATH/SpoofAppVersionPatch;->getVersionOverride(Ljava/lang/String;)Ljava/lang/String;"
) {
override fun execute(context: BytecodeContext) {
super.execute(context)
SettingsPatch.addMusicPreference(
CategoryType.MISC,
"revanced_spoof_app_version",
"false"
)
}
}

View File

@ -1,34 +1,41 @@
package app.revanced.patches.music.navigation.black.patch
package app.revanced.patches.music.navigation.black
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.navigation.black.fingerprints.TabLayoutFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Enable black navigation bar")
@Description("Sets the navigation bar color to black.")
@DependsOn(
[
@Patch(
name = "Enable black navigation bar",
description = "Sets the navigation bar color to black.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class BlackNavigationBarPatch : BytecodePatch(
listOf(TabLayoutFingerprint)
@Suppress("unused")
object BlackNavigationBarPatch : BytecodePatch(
setOf(TabLayoutFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.navigation.black.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ColorGrey
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ColorGrey
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

View File

@ -1,19 +1,16 @@
package app.revanced.patches.music.navigation.component.patch
package app.revanced.patches.music.navigation.component
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.navigation.component.fingerprints.TabLayoutTextFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_NAVIGATION
@ -23,18 +20,28 @@ import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch
@Name("Hide navigation bar component")
@Description("Hides navigation bar components.")
@DependsOn(
[
@Patch(
name = "Hide navigation bar component",
description = "Hides navigation bar components.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@MusicCompatibility
class NavigationBarComponentPatch : BytecodePatch(
listOf(TabLayoutTextFingerprint)
@Suppress("unused")
object NavigationBarComponentPatch : BytecodePatch(
setOf(TabLayoutTextFingerprint)
) {
override fun execute(context: BytecodeContext) {
/**
@ -135,8 +142,6 @@ class NavigationBarComponentPatch : BytecodePatch(
)
}
private companion object {
const val FLAG = "android:layout_weight"
const val RESOURCE_FILE_PATH = "res/layout/image_with_text_tab.xml"
}
private const val FLAG = "android:layout_weight"
private const val RESOURCE_FILE_PATH = "res/layout/image_with_text_tab.xml"
}

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.navigation.component.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.Text1
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.Text1
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags
import com.android.tools.smali.dexlib2.Opcode

View File

@ -1,20 +1,17 @@
package app.revanced.patches.music.player.colormatchplayer.patch
package app.revanced.patches.music.player.colormatchplayer
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.smali.ExternalLabel
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.PlayerColorFingerprint
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.Opcode
@ -22,13 +19,25 @@ import com.android.tools.smali.dexlib2.iface.instruction.Instruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
import kotlin.properties.Delegates
@Patch
@Name("Enable color match player")
@Description("Matches the color of the mini player and the fullscreen player.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class ColorMatchPlayerPatch : BytecodePatch(
listOf(PlayerColorFingerprint)
@Patch(
name = "Enable color match player",
description = "Matches the color of the mini player and the fullscreen player.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object ColorMatchPlayerPatch : BytecodePatch(
setOf(PlayerColorFingerprint)
) {
override fun execute(context: BytecodeContext) {
@ -75,11 +84,9 @@ class ColorMatchPlayerPatch : BytecodePatch(
}
private companion object {
var relativeIndex by Delegates.notNull<Int>()
private var relativeIndex by Delegates.notNull<Int>()
fun MutableMethod.descriptor(index: Int): String {
return getInstruction<ReferenceInstruction>(relativeIndex + index).reference.toString()
}
private fun MutableMethod.descriptor(index: Int): String {
return getInstruction<ReferenceInstruction>(relativeIndex + index).reference.toString()
}
}

View File

@ -1,27 +1,36 @@
package app.revanced.patches.music.player.minimizedplayer.patch
package app.revanced.patches.music.player.minimizedplayer
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.player.minimizedplayer.fingerprints.MinimizedPlayerFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Enable force minimized player")
@Description("Keep player permanently minimized even if another track is played.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class MinimizedPlayerPatch : BytecodePatch(
listOf(MinimizedPlayerFingerprint)
@Patch(
name = "Enable force minimized player",
description = "Keep player permanently minimized even if another track is played.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object MinimizedPlayerPatch : BytecodePatch(
setOf(MinimizedPlayerFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,28 +1,37 @@
package app.revanced.patches.music.player.newlayout.patch
package app.revanced.patches.music.player.newlayout
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.player.newlayout.fingerprints.NewLayoutFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Enable new layout")
@Description("Enable new player layouts.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class NewLayoutPatch : BytecodePatch(
listOf(NewLayoutFingerprint)
@Patch(
name = "Enable new layout",
description = "Enable new player layouts.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object NewLayoutPatch : BytecodePatch(
setOf(NewLayoutFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,31 +1,40 @@
package app.revanced.patches.music.player.oldstyleminiplayer.patch
package app.revanced.patches.music.player.oldstyleminiplayer
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.NextButtonVisibilityFingerprint
import app.revanced.patches.music.player.oldstyleminiplayer.fingerprints.SwipeToCloseFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.PlayerColorFingerprint
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Enable old style miniplayer")
@Description("Return the miniplayers to old style.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class OldStyleMiniPlayerPatch : BytecodePatch(
listOf(
@Patch(
name = "Enable old style miniplayer",
description = "Return the miniplayers to old style.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object OldStyleMiniPlayerPatch : BytecodePatch(
setOf(
PlayerColorFingerprint,
SwipeToCloseFingerprint
)

View File

@ -1,28 +1,37 @@
package app.revanced.patches.music.player.repeat.patch
package app.revanced.patches.music.player.repeat
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.player.repeat.fingerprints.RepeatTrackFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@Patch
@Name("Remember repeat state")
@Description("Remembers the state of the repeat.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class RememberRepeatPatch : BytecodePatch(
listOf(RepeatTrackFingerprint)
@Patch(
name = "Remember repeat state",
description = "Remembers the state of the repeat.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object RememberRepeatPatch : BytecodePatch(
setOf(RepeatTrackFingerprint)
) {
override fun execute(context: BytecodeContext) {
RepeatTrackFingerprint.result?.let {

View File

@ -1,23 +1,20 @@
package app.revanced.patches.music.player.replace.patch
package app.revanced.patches.music.player.replace
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.player.replace.fingerprints.CastButtonContainerFingerprint
import app.revanced.patches.music.player.replace.fingerprints.PlaybackStartDescriptorFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PlayerCastMediaRouteButton
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch.Companion.contexts
import app.revanced.patches.music.utils.videotype.patch.VideoTypeHookPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerCastMediaRouteButton
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch.contexts
import app.revanced.patches.music.utils.videotype.VideoTypeHookPatch
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
@ -31,19 +28,30 @@ import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.formats.Instruction35c
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
@Patch(false)
@Name("Replace cast button")
@Description("Replace the cast button in the player with the open music button.")
@DependsOn(
[
@Patch(
name = "Replace cast button",
description = "Replace the cast button in the player with the open music button.",
dependencies = [
SettingsPatch::class,
SharedResourceIdPatch::class,
VideoTypeHookPatch::class
]
],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
],
use = false
)
@MusicCompatibility
class ReplaceCastButtonPatch : BytecodePatch(
listOf(
@Suppress("unused")
object ReplaceCastButtonPatch : BytecodePatch(
setOf(
CastButtonContainerFingerprint,
PlaybackStartDescriptorFingerprint
)

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.player.replace.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.PlayerCastMediaRouteButton
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.PlayerCastMediaRouteButton
import app.revanced.util.bytecode.isWideLiteralExists
object CastButtonContainerFingerprint : MethodFingerprint(

View File

@ -1,10 +1,8 @@
package app.revanced.patches.music.player.shuffle.patch
package app.revanced.patches.music.player.shuffle
import app.revanced.extensions.exception
import app.revanced.extensions.transformFields
import app.revanced.extensions.traverseClassHierarchy
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
@ -12,15 +10,14 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWith
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.or
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patcher.util.proxy.mutableTypes.MutableField.Companion.toMutable
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMutable
import app.revanced.patches.music.player.shuffle.fingerprints.MusicPlaybackControlsFingerprint
import app.revanced.patches.music.player.shuffle.fingerprints.ShuffleClassReferenceFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.AccessFlags
@ -32,13 +29,25 @@ import com.android.tools.smali.dexlib2.immutable.ImmutableField
import com.android.tools.smali.dexlib2.immutable.ImmutableMethod
import com.android.tools.smali.dexlib2.util.MethodUtil
@Patch
@Name("Remember shuffle state")
@Description("Remembers the state of the shuffle.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class RememberShufflePatch : BytecodePatch(
listOf(
@Patch(
name = "Remember shuffle state",
description = "Remembers the state of the shuffle.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object RememberShufflePatch : BytecodePatch(
setOf(
MusicPlaybackControlsFingerprint,
ShuffleClassReferenceFingerprint
)
@ -165,16 +174,14 @@ class RememberShufflePatch : BytecodePatch(
}
private companion object {
const val MUSIC_PLAYBACK_CONTROLS_CLASS_DESCRIPTOR =
"Lcom/google/android/apps/youtube/music/watchpage/MusicPlaybackControls;"
private const val MUSIC_PLAYBACK_CONTROLS_CLASS_DESCRIPTOR =
"Lcom/google/android/apps/youtube/music/watchpage/MusicPlaybackControls;"
lateinit var SHUFFLE_CLASS: String
lateinit var imageViewReference: Reference
lateinit var shuffleStateLabel: String
private lateinit var SHUFFLE_CLASS: String
private lateinit var imageViewReference: Reference
private lateinit var shuffleStateLabel: String
fun MutableMethod.descriptor(index: Int): Reference {
return getInstruction<ReferenceInstruction>(index).reference
}
private fun MutableMethod.descriptor(index: Int): Reference {
return getInstruction<ReferenceInstruction>(index).reference
}
}

View File

@ -1,32 +1,41 @@
package app.revanced.patches.music.player.zenmode.patch
package app.revanced.patches.music.player.zenmode
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructionsWithLabels
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.extensions.InstructionExtensions.removeInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patcher.patch.annotation.CompatiblePackage
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.player.zenmode.fingerprints.ZenModeFingerprint
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fingerprints.PlayerColorFingerprint
import app.revanced.patches.music.utils.settings.resource.patch.SettingsPatch
import app.revanced.patches.music.utils.settings.SettingsPatch
import app.revanced.util.enum.CategoryType
import app.revanced.util.integrations.Constants.MUSIC_PLAYER
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction
@Patch
@Name("Enable zen mode")
@Description("Adds a grey tint to the video player to reduce eye strain.")
@DependsOn([SettingsPatch::class])
@MusicCompatibility
class ZenModePatch : BytecodePatch(
listOf(PlayerColorFingerprint)
@Patch(
name = "Enable zen mode",
description = "Adds a grey tint to the video player to reduce eye strain.",
dependencies = [SettingsPatch::class],
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object ZenModePatch : BytecodePatch(
setOf(PlayerColorFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.utils.actionbarhook.patch
package app.revanced.patches.music.utils.actionbarhook
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
@ -6,16 +6,16 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint.Companion.resolve
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.actionbarhook.fingerprints.ActionBarHookFingerprint
import app.revanced.patches.music.utils.fingerprints.ActionsBarParentFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.util.integrations.Constants.MUSIC_ACTIONBAR
import com.android.tools.smali.dexlib2.iface.instruction.TwoRegisterInstruction
@DependsOn([SharedResourceIdPatch::class])
class ActionBarHookPatch : BytecodePatch(
listOf(ActionsBarParentFingerprint)
@Patch(dependencies = [SharedResourceIdPatch::class])
object ActionBarHookPatch : BytecodePatch(
setOf(ActionsBarParentFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,20 +0,0 @@
package app.revanced.patches.music.utils.annotations
import app.revanced.patcher.annotation.Compatibility
import app.revanced.patcher.annotation.Package
@Compatibility(
[
Package(
"com.google.android.apps.youtube.music",
arrayOf(
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
)
)
]
)
@Target(AnnotationTarget.CLASS)
internal annotation class MusicCompatibility

View File

@ -2,7 +2,7 @@ package app.revanced.patches.music.utils.fingerprints
import app.revanced.patcher.extensions.or
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.ActionsContainer
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.ActionsContainer
import app.revanced.util.bytecode.isWideLiteralExists
import com.android.tools.smali.dexlib2.AccessFlags

View File

@ -1,7 +1,7 @@
package app.revanced.patches.music.utils.fingerprints
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.InlineTimeBarAdBreakMarkerColor
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.InlineTimeBarAdBreakMarkerColor
import app.revanced.util.bytecode.isWideLiteralExists
object SeekBarConstructorFingerprint : MethodFingerprint(

View File

@ -0,0 +1,44 @@
package app.revanced.patches.music.utils.fix.androidauto
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
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.utils.fix.androidauto.fingerprints.CertificateCheckFingerprint
@Patch(
name = "Certificate spoof",
description = "Spoofs the YouTube Music certificate for Android Auto.",
compatiblePackages = [
CompatiblePackage(
"com.google.android.apps.youtube.music",
[
"6.15.52",
"6.20.51",
"6.21.51",
"6.22.51"
]
)
]
)
@Suppress("unused")
object AndroidAutoCertificatePatch : BytecodePatch(
setOf(CertificateCheckFingerprint)
) {
override fun execute(context: BytecodeContext) {
CertificateCheckFingerprint.result?.let {
it.mutableMethod.apply {
addInstructions(
0, """
const/4 v0, 0x1
return v0
"""
)
}
} ?: throw CertificateCheckFingerprint.exception
}
}

View File

@ -1,30 +0,0 @@
package app.revanced.patches.music.utils.fix.androidauto.patch
import app.revanced.extensions.exception
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.music.utils.annotations.MusicCompatibility
import app.revanced.patches.music.utils.fix.androidauto.fingerprints.CertificateCheckFingerprint
@Patch
@Name("Certificate spoof")
@Description("Spoofs the YouTube Music certificate for Android Auto.")
@MusicCompatibility
class AndroidAutoCertificatePatch : BytecodePatch(
listOf(CertificateCheckFingerprint)
) {
override fun execute(context: BytecodeContext) {
CertificateCheckFingerprint.result?.mutableMethod?.addInstructions(
0, """
const/4 v0, 0x1
return v0
"""
) ?: throw CertificateCheckFingerprint.exception
}
}

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.utils.fix.clientspoof.patch
package app.revanced.patches.music.utils.fix.clientspoof
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
@ -6,11 +6,11 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patches.music.utils.fix.clientspoof.fingerprints.UserAgentHeaderBuilderFingerprint
import app.revanced.patches.music.utils.microg.shared.Constants.MUSIC_PACKAGE_NAME
import app.revanced.patches.music.utils.microg.Constants.MUSIC_PACKAGE_NAME
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
class ClientSpoofMusicPatch : BytecodePatch(
listOf(UserAgentHeaderBuilderFingerprint)
object ClientSpoofPatch : BytecodePatch(
setOf(UserAgentHeaderBuilderFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,4 +1,4 @@
package app.revanced.patches.music.utils.flyoutbutton.patch
package app.revanced.patches.music.utils.flyoutbutton
import app.revanced.extensions.exception
import app.revanced.patcher.data.BytecodeContext
@ -6,23 +6,23 @@ import app.revanced.patcher.extensions.InstructionExtensions.addInstruction
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchException
import app.revanced.patcher.patch.annotations.DependsOn
import app.revanced.patcher.patch.annotation.Patch
import app.revanced.patches.music.utils.flyoutbutton.fingerprints.FlyoutPanelLikeButtonFingerprint
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.patch.SharedResourceIdPatch.Companion.MusicMenuLikeButtons
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MusicMenuLikeButtons
import app.revanced.util.bytecode.getWideLiteralIndex
import app.revanced.util.integrations.Constants.MUSIC_FLYOUT
import com.android.tools.smali.dexlib2.Opcode
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@DependsOn(
[
@Patch(
dependencies = [
FlyoutButtonContainerResourcePatch::class,
SharedResourceIdPatch::class
]
)
class FlyoutButtonContainerPatch : BytecodePatch(
listOf(FlyoutPanelLikeButtonFingerprint)
object FlyoutButtonContainerPatch : BytecodePatch(
setOf(FlyoutPanelLikeButtonFingerprint)
) {
override fun execute(context: BytecodeContext) {

View File

@ -1,11 +1,11 @@
package app.revanced.patches.music.utils.flyoutbutton.patch
package app.revanced.patches.music.utils.flyoutbutton
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
class FlyoutButtonContainerResourcePatch : ResourcePatch {
object FlyoutButtonContainerResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
/**

View File

@ -1,11 +1,11 @@
package app.revanced.patches.music.utils.flyoutbutton.patch
package app.revanced.patches.music.utils.flyoutbutton
import app.revanced.patcher.data.ResourceContext
import app.revanced.patcher.patch.ResourcePatch
import app.revanced.util.resources.ResourceUtils
import app.revanced.util.resources.ResourceUtils.copyResources
class FlyoutButtonItemResourcePatch : ResourcePatch {
object FlyoutButtonItemResourcePatch : ResourcePatch() {
override fun execute(context: ResourceContext) {
fun copyResources(resourceGroups: List<ResourceUtils.ResourceGroup>) {

Some files were not shown because too many files have changed in this diff Show More