forked from inotia00/revanced-patches
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(YouTube Music): replace with a fingerprint that supports a wide…
…r range of versions
- Loading branch information
Showing
7 changed files
with
175 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...revanced/patches/music/player/components/fingerprints/EngagementPanelHeightFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package app.revanced.patches.music.player.components.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.util.getReference | ||
import app.revanced.util.indexOfFirstInstruction | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference | ||
|
||
internal object EngagementPanelHeightFingerprint : MethodFingerprint( | ||
returnType = "L", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
opcodes = listOf( | ||
Opcode.IGET_OBJECT, | ||
Opcode.INVOKE_VIRTUAL, | ||
Opcode.MOVE_RESULT, | ||
), | ||
parameters = emptyList(), | ||
customFingerprint = custom@{ methodDef, _ -> | ||
methodDef.indexOfFirstInstruction { | ||
opcode == Opcode.INVOKE_VIRTUAL && | ||
getReference<MethodReference>()?.name == "booleanValue" | ||
} >= 0 | ||
} | ||
) |
28 changes: 28 additions & 0 deletions
28
...ed/patches/music/player/components/fingerprints/EngagementPanelHeightParentFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package app.revanced.patches.music.player.components.fingerprints | ||
|
||
import app.revanced.patcher.extensions.or | ||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.util.indexOfFirstInstruction | ||
import com.android.tools.smali.dexlib2.AccessFlags | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.instruction.ReferenceInstruction | ||
|
||
internal object EngagementPanelHeightParentFingerprint : MethodFingerprint( | ||
returnType = "L", | ||
accessFlags = AccessFlags.PUBLIC or AccessFlags.FINAL, | ||
opcodes = listOf(Opcode.NEW_ARRAY), | ||
parameters = emptyList(), | ||
customFingerprint = custom@{ methodDef, _ -> | ||
if (methodDef.definingClass.startsWith("Lcom/")) { | ||
return@custom false | ||
} | ||
if (methodDef.returnType == "Ljava/lang/Object;") { | ||
return@custom false | ||
} | ||
|
||
methodDef.indexOfFirstInstruction { | ||
opcode == Opcode.CHECK_CAST && | ||
(this as? ReferenceInstruction)?.reference?.toString() == "Lcom/google/android/libraries/youtube/engagementpanel/size/EngagementPanelSizeBehavior;" | ||
} >= 0 | ||
} | ||
) |
30 changes: 25 additions & 5 deletions
30
...p/revanced/patches/music/player/components/fingerprints/MppWatchWhileLayoutFingerprint.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,36 @@ | ||
package app.revanced.patches.music.player.components.fingerprints | ||
|
||
import app.revanced.patcher.fingerprint.MethodFingerprint | ||
import app.revanced.patches.music.player.components.fingerprints.MppWatchWhileLayoutFingerprint.indexOfCallableInstruction | ||
import app.revanced.patches.music.utils.resourceid.SharedResourceIdPatch.MiniPlayerPlayPauseReplayButton | ||
import app.revanced.util.containsWideLiteralInstructionValue | ||
import app.revanced.util.getReference | ||
import app.revanced.util.indexOfFirstInstruction | ||
import com.android.tools.smali.dexlib2.Opcode | ||
import com.android.tools.smali.dexlib2.iface.Method | ||
import com.android.tools.smali.dexlib2.iface.reference.MethodReference | ||
|
||
internal object MppWatchWhileLayoutFingerprint : MethodFingerprint( | ||
returnType = "V", | ||
opcodes = listOf(Opcode.NEW_ARRAY), | ||
customFingerprint = { methodDef, _ -> | ||
methodDef.definingClass.endsWith("/MppWatchWhileLayout;") | ||
&& methodDef.name == "onFinishInflate" | ||
&& methodDef.containsWideLiteralInstructionValue(MiniPlayerPlayPauseReplayButton) | ||
customFingerprint = custom@{ methodDef, _ -> | ||
if (!methodDef.definingClass.endsWith("/MppWatchWhileLayout;")) { | ||
return@custom false | ||
} | ||
if (methodDef.name != "onFinishInflate") { | ||
return@custom false | ||
} | ||
|
||
methodDef.containsWideLiteralInstructionValue(MiniPlayerPlayPauseReplayButton) && | ||
indexOfCallableInstruction(methodDef) >= 0 | ||
} | ||
) | ||
) { | ||
fun indexOfCallableInstruction(methodDef: Method) = | ||
methodDef.indexOfFirstInstruction { | ||
val reference = getReference<MethodReference>() | ||
opcode == Opcode.INVOKE_VIRTUAL && | ||
reference?.returnType == "V" && | ||
reference.parameterTypes.size == 1 && | ||
reference.parameterTypes.firstOrNull() == "Ljava/util/concurrent/Callable;" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters