diff --git a/CHANGELOG.md b/CHANGELOG.md index af299f05c..f94da2715 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +## [5.20.1-dev.1](https://github.com/ReVanced/revanced-patches/compare/v5.20.0...v5.20.1-dev.1) (2025-04-15) + + +### Bug Fixes + +* **Spotify - Custom theme:** Support latest app target ([#4800](https://github.com/ReVanced/revanced-patches/issues/4800)) ([03d0eb2](https://github.com/ReVanced/revanced-patches/commit/03d0eb2f8c0f3e48d53bdab38d34057f2020bb65)) + # [5.20.0](https://github.com/ReVanced/revanced-patches/compare/v5.19.1...v5.20.0) (2025-04-15) diff --git a/gradle.properties b/gradle.properties index 94dfff809..2c104f301 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,4 +3,4 @@ org.gradle.jvmargs = -Xms512M -Xmx2048M org.gradle.parallel = true android.useAndroidX = true kotlin.code.style = official -version = 5.20.0 +version = 5.20.1-dev.1 diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/Fingerprints.kt index ce4840283..355422477 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/layout/theme/Fingerprints.kt @@ -5,7 +5,10 @@ import app.revanced.util.containsLiteralInstruction import com.android.tools.smali.dexlib2.AccessFlags internal val encoreThemeFingerprint = fingerprint { - strings("No EncoreLayoutTheme provided") + strings("Encore theme was not provided.") // Partial string match. + custom { method, _ -> + method.name == "invoke" + } } internal const val PLAYLIST_BACKGROUND_COLOR_LITERAL = 0xFF121212 diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/Fingerprints.kt index f8959ae64..6b25bc630 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/Fingerprints.kt @@ -3,15 +3,7 @@ package app.revanced.patches.spotify.misc.fix import app.revanced.patcher.fingerprint internal val getPackageInfoFingerprint = fingerprint { - strings( - "Failed to get the application signatures", - "Failed to get installer package" - ) -} - -internal val getPackageInfoLegacyFingerprint = fingerprint { strings( "Failed to get the application signatures" ) } - diff --git a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofPackageInfoPatch.kt b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofPackageInfoPatch.kt index c06f2a04c..2836a4872 100644 --- a/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofPackageInfoPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/spotify/misc/fix/SpoofPackageInfoPatch.kt @@ -1,14 +1,15 @@ package app.revanced.patches.spotify.misc.fix +import app.revanced.patcher.extensions.InstructionExtensions.addInstruction import app.revanced.patcher.extensions.InstructionExtensions.getInstruction import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction import app.revanced.patcher.patch.bytecodePatch -import app.revanced.patches.spotify.misc.extension.IS_SPOTIFY_LEGACY_APP_TARGET -import app.revanced.util.addInstructionsAtControlFlowLabel -import app.revanced.util.indexOfFirstInstructionOrThrow +import app.revanced.util.findInstructionIndicesReversedOrThrow +import app.revanced.util.getReference import app.revanced.util.indexOfFirstInstructionReversedOrThrow import com.android.tools.smali.dexlib2.Opcode import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction +import com.android.tools.smali.dexlib2.iface.reference.MethodReference @Suppress("unused") val spoofPackageInfoPatch = bytecodePatch( @@ -18,18 +19,11 @@ val spoofPackageInfoPatch = bytecodePatch( compatibleWith("com.spotify.music") execute { - val getPackageInfoFingerprint = if (IS_SPOTIFY_LEGACY_APP_TARGET) { - getPackageInfoLegacyFingerprint - } else { - getPackageInfoFingerprint - } - getPackageInfoFingerprint.method.apply { - val stringMatches = getPackageInfoFingerprint.stringMatches!! - // region Spoof signature. - val failedToGetSignaturesStringIndex = stringMatches.first().index + val failedToGetSignaturesStringIndex = + getPackageInfoFingerprint.stringMatches!!.first().index val concatSignaturesIndex = indexOfFirstInstructionReversedOrThrow( failedToGetSignaturesStringIndex, @@ -45,26 +39,23 @@ val spoofPackageInfoPatch = bytecodePatch( // region Spoof installer name. - if (IS_SPOTIFY_LEGACY_APP_TARGET) { - // Installer name is not used in the legacy app target. - return@execute - } - val expectedInstallerName = "com.android.vending" - val returnInstallerNameIndex = indexOfFirstInstructionOrThrow( - stringMatches.last().index, - Opcode.RETURN_OBJECT - ) + findInstructionIndicesReversedOrThrow { + val reference = getReference() + reference?.name == "getInstallerPackageName" || reference?.name == "getInstallingPackageName" + }.forEach { index -> + val returnObjectIndex = index + 1 - val installerNameRegister = getInstruction( - returnInstallerNameIndex - ).registerA + val installerPackageNameRegister = getInstruction( + returnObjectIndex + ).registerA - addInstructionsAtControlFlowLabel( - returnInstallerNameIndex, - "const-string v$installerNameRegister, \"$expectedInstallerName\"" - ) + addInstruction( + returnObjectIndex + 1, + "const-string v$installerPackageNameRegister, \"$expectedInstallerName\"" + ) + } // endregion }