Skip to content

Commit 4f87180

Browse files
committed
use string for finding index
1 parent d53118f commit 4f87180

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/Fingerprints.kt

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,9 @@ package app.revanced.patches.spotify.misc.fix
22

33
import app.revanced.patcher.fingerprint
44

5-
internal val getPackageInfoFingerprint = fingerprint { strings("Failed to get the application signatures") }
5+
internal val getPackageInfoFingerprint = fingerprint {
6+
strings(
7+
"Failed to get the application signatures",
8+
"Failed to get installer package"
9+
)
10+
}

patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofPackageInfoPatch.kt

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import app.revanced.patcher.extensions.InstructionExtensions.instructions
55
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
66
import app.revanced.patcher.patch.bytecodePatch
77
import app.revanced.util.addInstructionsAtControlFlowLabel
8+
import app.revanced.util.indexOfFirstInstructionOrThrow
89
import app.revanced.util.indexOfFirstInstructionReversedOrThrow
910
import com.android.tools.smali.dexlib2.Opcode
1011
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
@@ -20,10 +21,10 @@ val spoofPackageInfoPatch = bytecodePatch(
2021
getPackageInfoFingerprint.method.apply {
2122
// region Spoof signature.
2223

23-
val failedToGetSignaturesStringMatch = getPackageInfoFingerprint.stringMatches!!.first()
24+
val failedToGetSignaturesStringIndex = getPackageInfoFingerprint.stringMatches!!.first().index
2425

2526
val concatSignaturesIndex = indexOfFirstInstructionReversedOrThrow(
26-
failedToGetSignaturesStringMatch.index,
27+
failedToGetSignaturesStringIndex,
2728
Opcode.MOVE_RESULT_OBJECT,
2829
)
2930

@@ -36,8 +37,10 @@ val spoofPackageInfoPatch = bytecodePatch(
3637

3738
// region Spoof installer name.
3839

39-
val returnInstallerNameIndex = indexOfFirstInstructionReversedOrThrow(
40-
instructions.lastIndex,
40+
val failedToGetInstallerPackageStringIndex = getPackageInfoFingerprint.stringMatches!!.last().index
41+
42+
val returnInstallerNameIndex = indexOfFirstInstructionOrThrow(
43+
failedToGetInstallerPackageStringIndex,
4144
Opcode.RETURN_OBJECT
4245
)
4346

0 commit comments

Comments
 (0)