feat(songpal): add remove-notification-badge patch

This commit is contained in:
oSumAtrIX 2023-06-10 18:39:50 +02:00
parent bde9053f04
commit 1b77f9633c
2 changed files with 62 additions and 0 deletions

View File

@ -0,0 +1,31 @@
package app.revanced.patches.songpal.badge.fingerprints
import app.revanced.patcher.fingerprint.method.annotation.FuzzyPatternScanMethod
import app.revanced.patcher.fingerprint.method.impl.MethodFingerprint
import org.jf.dexlib2.AccessFlags
import org.jf.dexlib2.Opcode
// Located @ com.sony.songpal.mdr.vim.activity.MdrRemoteBaseActivity.e#run (9.5.0)
@FuzzyPatternScanMethod(2)
object ShowNotificationFingerprint : MethodFingerprint(
"V",
accessFlags = AccessFlags.PUBLIC.value,
opcodes = listOf(
Opcode.IGET_OBJECT,
Opcode.IGET,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.IGET_OBJECT,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT_OBJECT,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.MOVE_RESULT,
Opcode.INVOKE_VIRTUAL,
Opcode.IGET_BOOLEAN,
Opcode.INVOKE_VIRTUAL,
Opcode.CONST,
Opcode.INVOKE_VIRTUAL,
Opcode.RETURN_VOID
)
)

View File

@ -0,0 +1,31 @@
package app.revanced.patches.songpal.badge.patch
import app.revanced.extensions.toErrorResult
import app.revanced.patcher.annotation.Description
import app.revanced.patcher.annotation.Name
import app.revanced.patcher.annotation.Version
import app.revanced.patcher.data.BytecodeContext
import app.revanced.patcher.extensions.InstructionExtensions.addInstructions
import app.revanced.patcher.patch.BytecodePatch
import app.revanced.patcher.patch.PatchResult
import app.revanced.patcher.patch.PatchResultSuccess
import app.revanced.patcher.patch.annotations.Patch
import app.revanced.patches.songpal.badge.annotations.BadgeCompatibility
import app.revanced.patches.songpal.badge.fingerprints.ShowNotificationFingerprint
@Patch
@Name("remove-notification-badge")
@Description("Removes the red notification badge from the activity tab.")
@BadgeCompatibility
@Version("0.0.1")
class RemoveNotificationBadgePatch : BytecodePatch(
listOf(ShowNotificationFingerprint)
) {
override fun execute(context: BytecodeContext): PatchResult {
ShowNotificationFingerprint.result?.mutableMethod?.apply {
addInstructions(0, "return-void")
} ?: return ShowNotificationFingerprint.toErrorResult()
return PatchResultSuccess()
}
}