mirror of
https://github.com/inotia00/revanced-patches.git
synced 2025-05-29 13:20:19 +02:00
fix(YouTube Music/Custom header for YouTube Music): patch not applied to some users (due to A/B testing)
This commit is contained in:
parent
587513cb44
commit
4c3f0ff30c
@ -3,6 +3,7 @@ package app.revanced.patches.music.layout.header
|
|||||||
import app.revanced.patcher.data.ResourceContext
|
import app.revanced.patcher.data.ResourceContext
|
||||||
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
import app.revanced.patcher.patch.options.PatchOption.PatchExtensions.stringPatchOption
|
||||||
import app.revanced.patches.music.utils.compatibility.Constants
|
import app.revanced.patches.music.utils.compatibility.Constants
|
||||||
|
import app.revanced.patches.music.utils.fix.header.RestoreOldHeaderPatch
|
||||||
import app.revanced.patches.music.utils.settings.ResourceUtils
|
import app.revanced.patches.music.utils.settings.ResourceUtils
|
||||||
import app.revanced.util.ResourceGroup
|
import app.revanced.util.ResourceGroup
|
||||||
import app.revanced.util.Utils.trimIndentMultiline
|
import app.revanced.util.Utils.trimIndentMultiline
|
||||||
@ -15,6 +16,7 @@ import app.revanced.util.underBarOrThrow
|
|||||||
object ChangeHeaderPatch : BaseResourcePatch(
|
object ChangeHeaderPatch : BaseResourcePatch(
|
||||||
name = "Custom header for YouTube Music",
|
name = "Custom header for YouTube Music",
|
||||||
description = "Applies a custom header in the top left corner within the app.",
|
description = "Applies a custom header in the top left corner within the app.",
|
||||||
|
dependencies = setOf(RestoreOldHeaderPatch::class),
|
||||||
compatiblePackages = Constants.COMPATIBLE_PACKAGE,
|
compatiblePackages = Constants.COMPATIBLE_PACKAGE,
|
||||||
use = false,
|
use = false,
|
||||||
) {
|
) {
|
||||||
|
@ -0,0 +1,47 @@
|
|||||||
|
package app.revanced.patches.music.utils.fix.header
|
||||||
|
|
||||||
|
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.annotation.Patch
|
||||||
|
import app.revanced.patches.music.layout.header.ChangeHeaderPatch
|
||||||
|
import app.revanced.patches.music.utils.fix.header.fingerprints.HeaderSwitchConfigFingerprint
|
||||||
|
import app.revanced.util.getTargetIndex
|
||||||
|
import app.revanced.util.getWideLiteralInstructionIndex
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
description = "Fix the issues where new headers are used."
|
||||||
|
)
|
||||||
|
object RestoreOldHeaderPatch : BytecodePatch(
|
||||||
|
setOf(HeaderSwitchConfigFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* New Header has been added from YouTube Music v7.04.51.
|
||||||
|
*
|
||||||
|
* The new header's file names are 'action_bar_logo_ringo2.png' and 'ytm_logo_ringo2.png'.
|
||||||
|
* The only difference between the existing header and the new header is the dimensions of the image.
|
||||||
|
*
|
||||||
|
* The affected patch is [ChangeHeaderPatch].
|
||||||
|
*
|
||||||
|
* TODO: Add a new header image file to [ChangeHeaderPatch] later.
|
||||||
|
*/
|
||||||
|
HeaderSwitchConfigFingerprint.result?.let {
|
||||||
|
it.mutableMethod.apply {
|
||||||
|
val targetIndex =
|
||||||
|
getTargetIndex(getWideLiteralInstructionIndex(45617851), Opcode.MOVE_RESULT)
|
||||||
|
val targetRegister = getInstruction<OneRegisterInstruction>(targetIndex).registerA
|
||||||
|
|
||||||
|
addInstruction(
|
||||||
|
targetIndex + 1,
|
||||||
|
"const/4 v$targetRegister, 0x0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
package app.revanced.patches.music.utils.fix.header.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.util.fingerprint.LiteralValueFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This fingerprint is compatible with YouTube Music v7.04.51+
|
||||||
|
*/
|
||||||
|
internal object HeaderSwitchConfigFingerprint : LiteralValueFingerprint(
|
||||||
|
returnType = "Z",
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL,
|
||||||
|
literalSupplier = { 45617851 }
|
||||||
|
)
|
Loading…
x
Reference in New Issue
Block a user