Skip to content

Commit

Permalink
feat(songpal): add remove-notification-badge patch
Browse files Browse the repository at this point in the history
  • Loading branch information
oSumAtrIX committed Jun 10, 2023
1 parent bde9053 commit 1b77f96
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
)
)
Original file line number Diff line number Diff line change
@@ -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()
}
}

0 comments on commit 1b77f96

Please sign in to comment.