From 297dd62a1f059ce59360b696b9ba4fd7d4fbc2df Mon Sep 17 00:00:00 2001 From: inotia00 <108592928+inotia00@users.noreply.github.com> Date: Sat, 18 Jan 2025 20:14:42 +0900 Subject: [PATCH] fix(GmsCore support): Patched apps are not added to Cloud Messaging https://github.com/inotia00/ReVanced_Extended/issues/2691 --- .../spoof/SpoofStreamingDataPatch.java | 10 ------ .../BaseSpoofStreamingDataPatch.kt | 34 ------------------- .../spoof/streamingdata/Fingerprints.kt | 16 --------- 3 files changed, 60 deletions(-) diff --git a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java index fbebfe515..124790b88 100644 --- a/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java +++ b/extensions/shared/src/main/java/app/revanced/extension/shared/patches/spoof/SpoofStreamingDataPatch.java @@ -109,16 +109,6 @@ public class SpoofStreamingDataPatch { return SPOOF_STREAMING_DATA; } - /** - * Injection point. - */ - public static Object isSpoofingEnabled(Object original) { - if (!SPOOF_STREAMING_DATA) { - return original; - } - return null; - } - /** * Injection point. * This method is only invoked when playing a livestream on an iOS client. diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt index 5ba50bab4..451a17c12 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/BaseSpoofStreamingDataPatch.kt @@ -14,14 +14,11 @@ import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod.Companion.toMu import app.revanced.patches.shared.extension.Constants.SPOOF_PATH import app.revanced.patches.shared.formatStreamModelConstructorFingerprint import app.revanced.util.findInstructionIndicesReversedOrThrow -import app.revanced.util.findMethodOrThrow import app.revanced.util.fingerprint.definingClassOrThrow import app.revanced.util.fingerprint.injectLiteralInstructionBooleanCall import app.revanced.util.fingerprint.matchOrThrow import app.revanced.util.fingerprint.methodOrThrow -import app.revanced.util.fingerprint.mutableClassOrThrow import app.revanced.util.getReference -import app.revanced.util.getWalkerMethod import app.revanced.util.indexOfFirstInstructionOrThrow import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.Opcode @@ -370,35 +367,4 @@ fun baseSpoofStreamingDataPatch( executeBlock() } - - finalize { - gmsServiceBrokerFingerprint.methodOrThrow() - .addInstructionsWithLabels( - 0, """ - invoke-static {}, $EXTENSION_CLASS_DESCRIPTOR->isSpoofingEnabled()Z - move-result v0 - if-eqz v0, :ignore - return-void - :ignore - nop - """ - ) - - gmsServiceBrokerExceptionFingerprint.matchOrThrow().let { - val walkerIndex = it.patternMatch!!.startIndex - val walkerMethod = it.getWalkerMethod(walkerIndex) - - walkerMethod.apply { - val insertIndex = indexOfFirstInstructionOrThrow(Opcode.CHECK_CAST) - val insertRegister = getInstruction(insertIndex).registerA - - addInstructions( - insertIndex + 1, """ - invoke-static {v$insertRegister}, $EXTENSION_CLASS_DESCRIPTOR->isSpoofingEnabled(Ljava/lang/Object;)Ljava/lang/Object; - move-result-object v$insertRegister - """ - ) - } - } - } } diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/Fingerprints.kt b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/Fingerprints.kt index 8be26a661..79e334099 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/Fingerprints.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/spoof/streamingdata/Fingerprints.kt @@ -198,20 +198,4 @@ internal val hlsCurrentTimeFingerprint = legacyFingerprint( literals = listOf(HLS_CURRENT_TIME_FEATURE_FLAG), ) -internal val gmsServiceBrokerFingerprint = legacyFingerprint( - name = "gmsServiceBrokerFingerprint", - returnType = "V", - strings = listOf("mServiceBroker is null, client disconnected") -) - -internal val gmsServiceBrokerExceptionFingerprint = legacyFingerprint( - name = "gmsServiceBrokerExceptionFingerprint", - returnType = "V", - parameters = listOf("Ljava/lang/Exception;"), - opcodes = listOf( - Opcode.INVOKE_VIRTUAL, - Opcode.RETURN_VOID - ), - strings = listOf("Exception must not be null") -)