mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2026-01-23 10:41:03 +00:00
Compare commits
5 Commits
v4.12.0-de
...
v4.12.0-de
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b0d8ee9f4 | ||
|
|
250cc7cbde | ||
|
|
1af65de1f6 | ||
|
|
6e87e3044c | ||
|
|
273af26274 |
15
CHANGELOG.md
15
CHANGELOG.md
@@ -1,3 +1,18 @@
|
|||||||
|
# [4.12.0-dev.5](https://github.com/ReVanced/revanced-patches/compare/v4.12.0-dev.4...v4.12.0-dev.5) (2024-07-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add `Hide mock location` patch ([#3417](https://github.com/ReVanced/revanced-patches/issues/3417)) ([5f81b40](https://github.com/ReVanced/revanced-patches/commit/5f81b40e7d5567fb5689d08ccc9caeaa267c3143))
|
||||||
|
* **Google Photos:** Add `GmsCore support` patch ([#3414](https://github.com/ReVanced/revanced-patches/issues/3414)) ([24528e0](https://github.com/ReVanced/revanced-patches/commit/24528e0a6eec17ce0a3c52f8862585933615ad28))
|
||||||
|
|
||||||
|
# [4.12.0-dev.4](https://github.com/ReVanced/revanced-patches/compare/v4.12.0-dev.3...v4.12.0-dev.4) (2024-07-20)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **Google News:** Add `Enable CustomTabs` and `GmsCore support` patch ([#3111](https://github.com/ReVanced/revanced-patches/issues/3111)) ([ad59096](https://github.com/ReVanced/revanced-patches/commit/ad590962275f888b335252ad5bed0f34e959d3c7))
|
||||||
|
|
||||||
# [4.12.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.12.0-dev.2...v4.12.0-dev.3) (2024-07-18)
|
# [4.12.0-dev.3](https://github.com/ReVanced/revanced-patches/compare/v4.12.0-dev.2...v4.12.0-dev.3) (2024-07-18)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,14 @@ public final class app/revanced/patches/all/interaction/gestures/PredictiveBackG
|
|||||||
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
public fun execute (Lapp/revanced/patcher/data/ResourceContext;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/all/location/hide/HideMockLocationPatch : app/revanced/patches/all/misc/transformation/BaseTransformInstructionsPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/all/location/hide/HideMockLocationPatch;
|
||||||
|
public synthetic fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Ljava/lang/Object;
|
||||||
|
public fun filterMap (Lcom/android/tools/smali/dexlib2/iface/ClassDef;Lcom/android/tools/smali/dexlib2/iface/Method;Lcom/android/tools/smali/dexlib2/iface/instruction/Instruction;I)Lkotlin/Pair;
|
||||||
|
public synthetic fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Ljava/lang/Object;)V
|
||||||
|
public fun transform (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;Lkotlin/Pair;)V
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch : app/revanced/patcher/patch/ResourcePatch {
|
public final class app/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch : app/revanced/patcher/patch/ResourcePatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch;
|
public static final field INSTANCE Lapp/revanced/patches/all/misc/debugging/EnableAndroidDebuggingPatch;
|
||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
@@ -217,6 +225,36 @@ public final class app/revanced/patches/finanzonline/detection/root/RootDetectio
|
|||||||
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlenews/customtabs/EnableCustomTabs : app/revanced/patcher/patch/BytecodePatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlenews/customtabs/EnableCustomTabs;
|
||||||
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
|
public synthetic fun execute (Lapp/revanced/patcher/data/Context;)V
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlenews/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlenews/misc/gms/GmsCoreSupportPatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlenews/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlenews/misc/gms/GmsCoreSupportResourcePatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlenews/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlenews/misc/integrations/IntegrationsPatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlephotos/misc/gms/GmsCoreSupportPatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlephotos/misc/gms/GmsCoreSupportPatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlephotos/misc/gms/GmsCoreSupportResourcePatch : app/revanced/patches/shared/misc/gms/BaseGmsCoreSupportResourcePatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlephotos/misc/gms/GmsCoreSupportResourcePatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
public final class app/revanced/patches/googlephotos/misc/integrations/IntegrationsPatch : app/revanced/patches/shared/misc/integrations/BaseIntegrationsPatch {
|
||||||
|
public static final field INSTANCE Lapp/revanced/patches/googlephotos/misc/integrations/IntegrationsPatch;
|
||||||
|
}
|
||||||
|
|
||||||
public final class app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions : app/revanced/patcher/patch/BytecodePatch {
|
public final class app/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions : app/revanced/patcher/patch/BytecodePatch {
|
||||||
public static final field INSTANCE Lapp/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions;
|
public static final field INSTANCE Lapp/revanced/patches/googlerecorder/restrictions/RemoveDeviceRestrictions;
|
||||||
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
public fun execute (Lapp/revanced/patcher/data/BytecodeContext;)V
|
||||||
@@ -2033,7 +2071,11 @@ public final class app/revanced/util/BytecodeUtilsKt {
|
|||||||
public static final fun indexOfIdResourceOrThrow (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I
|
public static final fun indexOfIdResourceOrThrow (Lcom/android/tools/smali/dexlib2/iface/Method;Ljava/lang/String;)I
|
||||||
public static final fun injectHideViewCall (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;IILjava/lang/String;Ljava/lang/String;)V
|
public static final fun injectHideViewCall (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableMethod;IILjava/lang/String;Ljava/lang/String;)V
|
||||||
public static final fun resultOrThrow (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;
|
public static final fun resultOrThrow (Lapp/revanced/patcher/fingerprint/MethodFingerprint;)Lapp/revanced/patcher/fingerprint/MethodFingerprintResult;
|
||||||
|
public static final fun returnEarly (Lapp/revanced/patcher/fingerprint/MethodFingerprint;Z)V
|
||||||
|
public static final fun returnEarly (Ljava/lang/Iterable;Z)V
|
||||||
public static final fun returnEarly (Ljava/util/List;Z)V
|
public static final fun returnEarly (Ljava/util/List;Z)V
|
||||||
|
public static synthetic fun returnEarly$default (Lapp/revanced/patcher/fingerprint/MethodFingerprint;ZILjava/lang/Object;)V
|
||||||
|
public static synthetic fun returnEarly$default (Ljava/lang/Iterable;ZILjava/lang/Object;)V
|
||||||
public static synthetic fun returnEarly$default (Ljava/util/List;ZILjava/lang/Object;)V
|
public static synthetic fun returnEarly$default (Ljava/util/List;ZILjava/lang/Object;)V
|
||||||
public static final fun transformMethods (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
|
public static final fun transformMethods (Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
|
||||||
public static final fun traverseClassHierarchy (Lapp/revanced/patcher/data/BytecodeContext;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
|
public static final fun traverseClassHierarchy (Lapp/revanced/patcher/data/BytecodeContext;Lapp/revanced/patcher/util/proxy/mutableTypes/MutableClass;Lkotlin/jvm/functions/Function1;)V
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
org.gradle.parallel = true
|
org.gradle.parallel = true
|
||||||
org.gradle.caching = true
|
org.gradle.caching = true
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
version = 4.12.0-dev.3
|
version = 4.12.0-dev.5
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
@file:Suppress("unused")
|
||||||
|
|
||||||
|
package app.revanced.patches.all.location.hide
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patcher.util.proxy.mutableTypes.MutableMethod
|
||||||
|
import app.revanced.patches.all.misc.transformation.BaseTransformInstructionsPatch
|
||||||
|
import app.revanced.patches.all.misc.transformation.IMethodCall
|
||||||
|
import app.revanced.patches.all.misc.transformation.fromMethodReference
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import com.android.tools.smali.dexlib2.iface.ClassDef
|
||||||
|
import com.android.tools.smali.dexlib2.iface.Method
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.FiveRegisterInstruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.Instruction
|
||||||
|
import com.android.tools.smali.dexlib2.iface.reference.MethodReference
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Hide mock location",
|
||||||
|
description = "Prevents the app from knowing the device location is being mocked by a third party app.",
|
||||||
|
use = false
|
||||||
|
)
|
||||||
|
object HideMockLocationPatch : BaseTransformInstructionsPatch<Pair<Instruction, Int>>() {
|
||||||
|
override fun filterMap(
|
||||||
|
classDef: ClassDef,
|
||||||
|
method: Method,
|
||||||
|
instruction: Instruction,
|
||||||
|
instructionIndex: Int
|
||||||
|
): Pair<Instruction, Int>? {
|
||||||
|
val reference = instruction.getReference<MethodReference>() ?: return null
|
||||||
|
if (fromMethodReference<MethodCall>(reference) == null) return null
|
||||||
|
|
||||||
|
return instruction to instructionIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun transform(mutableMethod: MutableMethod, entry: Pair<Instruction, Int>) {
|
||||||
|
val (instruction, index) = entry
|
||||||
|
instruction as FiveRegisterInstruction
|
||||||
|
|
||||||
|
// Replace return value with a constant `false` boolean.
|
||||||
|
mutableMethod.replaceInstruction(
|
||||||
|
index + 1,
|
||||||
|
"const/4 v${instruction.registerC}, 0x0"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private enum class MethodCall(
|
||||||
|
override val definedClassName: String,
|
||||||
|
override val methodName: String,
|
||||||
|
override val methodParams: Array<String>,
|
||||||
|
override val returnType: String
|
||||||
|
) : IMethodCall {
|
||||||
|
IsMock("Landroid/location/Location;", "isMock", emptyArray(), "Z"),
|
||||||
|
IsFromMockProvider("Landroid/location/Location;", "isFromMockProvider", emptyArray(), "Z")
|
||||||
|
}
|
||||||
@@ -347,7 +347,10 @@ object AddResourcesPatch : ResourcePatch(), MutableMap<Value, MutableSet<BaseRes
|
|||||||
val targetFile =
|
val targetFile =
|
||||||
context.get("res/$value/$resourceFileName.xml").also {
|
context.get("res/$value/$resourceFileName.xml").also {
|
||||||
it.parentFile?.mkdirs()
|
it.parentFile?.mkdirs()
|
||||||
it.createNewFile()
|
|
||||||
|
if(it.createNewFile()) {
|
||||||
|
it.writeText("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<resources>\n</resources>")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.xmlEditor[targetFile.path].let { editor ->
|
context.xmlEditor[targetFile.path].let { editor ->
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package app.revanced.patches.googlenews.customtabs
|
||||||
|
|
||||||
|
import app.revanced.patcher.data.BytecodeContext
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.getInstruction
|
||||||
|
import app.revanced.patcher.extensions.InstructionExtensions.replaceInstruction
|
||||||
|
import app.revanced.patcher.patch.BytecodePatch
|
||||||
|
import app.revanced.patcher.patch.annotation.CompatiblePackage
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.googlenews.customtabs.fingerprints.LaunchCustomTabFingerprint
|
||||||
|
import app.revanced.util.resultOrThrow
|
||||||
|
import com.android.tools.smali.dexlib2.iface.instruction.OneRegisterInstruction
|
||||||
|
|
||||||
|
@Patch(
|
||||||
|
name = "Enable CustomTabs",
|
||||||
|
description = "Enables CustomTabs to open articles in your default browser.",
|
||||||
|
compatiblePackages = [CompatiblePackage("com.google.android.apps.magazines")],
|
||||||
|
)
|
||||||
|
@Suppress("unused")
|
||||||
|
object EnableCustomTabs : BytecodePatch(
|
||||||
|
setOf(LaunchCustomTabFingerprint)
|
||||||
|
) {
|
||||||
|
override fun execute(context: BytecodeContext) {
|
||||||
|
LaunchCustomTabFingerprint.resultOrThrow().let { result ->
|
||||||
|
result.mutableMethod.apply {
|
||||||
|
val checkIndex = result.scanResult.patternScanResult!!.endIndex + 1
|
||||||
|
val register = getInstruction<OneRegisterInstruction>(checkIndex).registerA
|
||||||
|
|
||||||
|
replaceInstruction(checkIndex, "const/4 v$register, 0x1")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package app.revanced.patches.googlenews.customtabs.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.extensions.or
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
import com.android.tools.smali.dexlib2.AccessFlags
|
||||||
|
import com.android.tools.smali.dexlib2.Opcode
|
||||||
|
|
||||||
|
internal object LaunchCustomTabFingerprint : MethodFingerprint(
|
||||||
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.CONSTRUCTOR,
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IPUT,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
),
|
||||||
|
customFingerprint = { _, classDef -> classDef.endsWith("CustomTabsArticleLauncher;") },
|
||||||
|
)
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.gms
|
||||||
|
|
||||||
|
internal object Constants {
|
||||||
|
const val MAGAZINES_PACKAGE_NAME = "com.google.android.apps.magazines"
|
||||||
|
const val REVANCED_MAGAZINES_PACKAGE_NAME = "app.revanced.android.magazines"
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.gms
|
||||||
|
|
||||||
|
import app.revanced.patches.googlenews.misc.gms.Constants.MAGAZINES_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.googlenews.misc.gms.Constants.REVANCED_MAGAZINES_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.googlenews.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
|
import app.revanced.patches.googlenews.misc.gms.fingerprints.MagazinesActivityOnCreateFingerprint
|
||||||
|
import app.revanced.patches.googlenews.misc.integrations.IntegrationsPatch
|
||||||
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
|
fromPackageName = MAGAZINES_PACKAGE_NAME,
|
||||||
|
toPackageName = REVANCED_MAGAZINES_PACKAGE_NAME,
|
||||||
|
primeMethodFingerprint = null,
|
||||||
|
mainActivityOnCreateFingerprint = MagazinesActivityOnCreateFingerprint,
|
||||||
|
integrationsPatchDependency = IntegrationsPatch::class,
|
||||||
|
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||||
|
// Remove version constraint,
|
||||||
|
// once https://github.com/ReVanced/revanced-patches/pull/3111#issuecomment-2240877277 is resolved.
|
||||||
|
compatiblePackages = setOf(CompatiblePackage(MAGAZINES_PACKAGE_NAME, setOf("5.108.0.644447823"))),
|
||||||
|
) {
|
||||||
|
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.gms
|
||||||
|
|
||||||
|
import app.revanced.patches.googlenews.misc.gms.Constants.MAGAZINES_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.googlenews.misc.gms.Constants.REVANCED_MAGAZINES_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportResourcePatch
|
||||||
|
|
||||||
|
object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch(
|
||||||
|
fromPackageName = MAGAZINES_PACKAGE_NAME,
|
||||||
|
toPackageName = REVANCED_MAGAZINES_PACKAGE_NAME,
|
||||||
|
spoofedPackageSignature = "24bb24c05e47e0aefa68a58a766179d9b613a666",
|
||||||
|
)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.gms.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object MagazinesActivityOnCreateFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "onCreate" && classDef.endsWith("/StartActivity;")
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.gms.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object PrimeMethodFingerprint : MethodFingerprint(
|
||||||
|
strings = listOf("com.google.android.GoogleCamera", "com.android.vending"),
|
||||||
|
)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.integrations
|
||||||
|
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.googlenews.misc.integrations.fingerprints.StartActivityInitFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch
|
||||||
|
|
||||||
|
@Patch(requiresIntegrations = true)
|
||||||
|
object IntegrationsPatch : BaseIntegrationsPatch(
|
||||||
|
setOf(StartActivityInitFingerprint),
|
||||||
|
)
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package app.revanced.patches.googlenews.misc.integrations.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.googlenews.misc.integrations.fingerprints.StartActivityInitFingerprint.getApplicationContextIndex
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
|
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
|
||||||
|
|
||||||
|
internal object StartActivityInitFingerprint : IntegrationsFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT,
|
||||||
|
Opcode.CONST_4,
|
||||||
|
Opcode.IF_EQZ,
|
||||||
|
Opcode.CONST,
|
||||||
|
Opcode.INVOKE_VIRTUAL,
|
||||||
|
Opcode.IPUT_OBJECT,
|
||||||
|
Opcode.IPUT_BOOLEAN,
|
||||||
|
Opcode.INVOKE_VIRTUAL, // Calls startActivity.getApplicationContext().
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
),
|
||||||
|
insertIndexResolver = { method ->
|
||||||
|
getApplicationContextIndex = method.indexOfFirstInstructionOrThrow {
|
||||||
|
getReference<MethodReference>()?.name == "getApplicationContext"
|
||||||
|
}
|
||||||
|
|
||||||
|
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
||||||
|
},
|
||||||
|
contextRegisterResolver = { method ->
|
||||||
|
val moveResultInstruction = method.implementation!!.instructions.elementAt(getApplicationContextIndex + 1)
|
||||||
|
as OneRegisterInstruction
|
||||||
|
moveResultInstruction.registerA
|
||||||
|
},
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "onCreate" && classDef.endsWith("/StartActivity;")
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
private var getApplicationContextIndex = -1
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package app.revanced.patches.googlephotos.misc.gms
|
||||||
|
|
||||||
|
internal object Constants {
|
||||||
|
const val PHOTOS_PACKAGE_NAME = "com.google.android.apps.photos"
|
||||||
|
const val REVANCED_PHOTOS_PACKAGE_NAME = "app.revanced.android.photos"
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.revanced.patches.googlephotos.misc.gms
|
||||||
|
|
||||||
|
import app.revanced.patches.googlephotos.misc.gms.Constants.PHOTOS_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.googlephotos.misc.gms.Constants.REVANCED_PHOTOS_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.googlephotos.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
|
import app.revanced.patches.googlephotos.misc.gms.fingerprints.PhotosActivityOnCreateFingerprint
|
||||||
|
import app.revanced.patches.googlephotos.misc.integrations.IntegrationsPatch
|
||||||
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
|
|
||||||
|
@Suppress("unused")
|
||||||
|
object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
|
fromPackageName = PHOTOS_PACKAGE_NAME,
|
||||||
|
toPackageName = REVANCED_PHOTOS_PACKAGE_NAME,
|
||||||
|
primeMethodFingerprint = null,
|
||||||
|
mainActivityOnCreateFingerprint = PhotosActivityOnCreateFingerprint,
|
||||||
|
integrationsPatchDependency = IntegrationsPatch::class,
|
||||||
|
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||||
|
compatiblePackages = setOf(CompatiblePackage(PHOTOS_PACKAGE_NAME)),
|
||||||
|
) {
|
||||||
|
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.revanced.patches.googlephotos.misc.gms
|
||||||
|
|
||||||
|
import app.revanced.patches.googlephotos.misc.gms.Constants.PHOTOS_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.googlephotos.misc.gms.Constants.REVANCED_PHOTOS_PACKAGE_NAME
|
||||||
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportResourcePatch
|
||||||
|
|
||||||
|
object GmsCoreSupportResourcePatch : BaseGmsCoreSupportResourcePatch(
|
||||||
|
fromPackageName = PHOTOS_PACKAGE_NAME,
|
||||||
|
toPackageName = REVANCED_PHOTOS_PACKAGE_NAME,
|
||||||
|
spoofedPackageSignature = "24bb24c05e47e0aefa68a58a766179d9b613a600",
|
||||||
|
)
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.revanced.patches.googlephotos.misc.gms.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
|
|
||||||
|
internal object PhotosActivityOnCreateFingerprint : MethodFingerprint(
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "onCreate" && classDef.endsWith("/HomeActivity;")
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.revanced.patches.googlephotos.misc.integrations
|
||||||
|
|
||||||
|
import app.revanced.patcher.patch.annotation.Patch
|
||||||
|
import app.revanced.patches.googlephotos.misc.integrations.fingerprints.HomeActivityInitFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch
|
||||||
|
|
||||||
|
@Patch(requiresIntegrations = true)
|
||||||
|
object IntegrationsPatch : BaseIntegrationsPatch(
|
||||||
|
setOf(HomeActivityInitFingerprint),
|
||||||
|
)
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package app.revanced.patches.googlephotos.misc.integrations.fingerprints
|
||||||
|
|
||||||
|
import app.revanced.patches.googlephotos.misc.integrations.fingerprints.HomeActivityInitFingerprint.getApplicationContextIndex
|
||||||
|
import app.revanced.patches.shared.misc.integrations.BaseIntegrationsPatch.IntegrationsFingerprint
|
||||||
|
import app.revanced.util.getReference
|
||||||
|
import app.revanced.util.indexOfFirstInstructionOrThrow
|
||||||
|
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
|
||||||
|
|
||||||
|
internal object HomeActivityInitFingerprint : IntegrationsFingerprint(
|
||||||
|
opcodes = listOf(
|
||||||
|
Opcode.CONST_STRING,
|
||||||
|
Opcode.INVOKE_STATIC,
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
Opcode.IF_NEZ,
|
||||||
|
Opcode.INVOKE_VIRTUAL, // Calls getApplicationContext().
|
||||||
|
Opcode.MOVE_RESULT_OBJECT,
|
||||||
|
),
|
||||||
|
insertIndexResolver = { method ->
|
||||||
|
getApplicationContextIndex = method.indexOfFirstInstructionOrThrow {
|
||||||
|
getReference<MethodReference>()?.name == "getApplicationContext"
|
||||||
|
}
|
||||||
|
|
||||||
|
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
||||||
|
},
|
||||||
|
contextRegisterResolver = { method ->
|
||||||
|
val moveResultInstruction = method.implementation!!.instructions.elementAt(getApplicationContextIndex + 1)
|
||||||
|
as OneRegisterInstruction
|
||||||
|
moveResultInstruction.registerA
|
||||||
|
},
|
||||||
|
customFingerprint = { methodDef, classDef ->
|
||||||
|
methodDef.name == "onCreate" && classDef.endsWith("/HomeActivity;")
|
||||||
|
},
|
||||||
|
) {
|
||||||
|
private var getApplicationContextIndex = -1
|
||||||
|
}
|
||||||
@@ -12,15 +12,15 @@ import app.revanced.util.returnEarly
|
|||||||
@Patch(
|
@Patch(
|
||||||
name = "Remove root detection",
|
name = "Remove root detection",
|
||||||
description = "Removes the check for root permissions and unlocked bootloader.",
|
description = "Removes the check for root permissions and unlocked bootloader.",
|
||||||
compatiblePackages = [CompatiblePackage("at.gv.oe.app")]
|
compatiblePackages = [CompatiblePackage("at.gv.oe.app")],
|
||||||
)
|
)
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
object RootDetectionPatch : BytecodePatch(
|
object RootDetectionPatch : BytecodePatch(
|
||||||
setOf(AttestationSupportedCheckFingerprint, BootloaderCheckFingerprint, RootCheckFingerprint)
|
setOf(AttestationSupportedCheckFingerprint, BootloaderCheckFingerprint, RootCheckFingerprint),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) = listOf(
|
override fun execute(context: BytecodeContext) = setOf(
|
||||||
AttestationSupportedCheckFingerprint,
|
AttestationSupportedCheckFingerprint,
|
||||||
BootloaderCheckFingerprint,
|
BootloaderCheckFingerprint,
|
||||||
RootCheckFingerprint
|
RootCheckFingerprint,
|
||||||
).returnEarly(true)
|
).returnEarly(true)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ package app.revanced.patches.music.misc.gms
|
|||||||
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
import app.revanced.patches.music.misc.gms.Constants.REVANCED_MUSIC_PACKAGE_NAME
|
||||||
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
import app.revanced.patches.music.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
import app.revanced.patches.music.misc.gms.fingerprints.*
|
import app.revanced.patches.music.misc.gms.fingerprints.CastDynamiteModuleV2Fingerprint
|
||||||
|
import app.revanced.patches.music.misc.gms.fingerprints.MusicActivityOnCreateFingerprint
|
||||||
|
import app.revanced.patches.music.misc.gms.fingerprints.PrimeMethodFingerprint
|
||||||
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.music.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
import app.revanced.patches.shared.fingerprints.CastContextFetchFingerprint
|
||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
@@ -14,9 +16,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
|||||||
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
||||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||||
earlyReturnFingerprints = setOf(
|
earlyReturnFingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
GooglePlayUtilityFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
),
|
),
|
||||||
@@ -32,13 +31,10 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
|||||||
"7.01.53",
|
"7.01.53",
|
||||||
"7.02.52",
|
"7.02.52",
|
||||||
"7.03.52",
|
"7.03.52",
|
||||||
)
|
),
|
||||||
)
|
),
|
||||||
),
|
),
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
GooglePlayUtilityFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
PrimeMethodFingerprint,
|
PrimeMethodFingerprint,
|
||||||
|
|||||||
@@ -1,18 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.gms.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
internal object GooglePlayUtilityFingerprint : MethodFingerprint(
|
|
||||||
"I",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
|
||||||
listOf("L", "I"),
|
|
||||||
strings = listOf(
|
|
||||||
"This should never happen.",
|
|
||||||
"MetadataValueReader",
|
|
||||||
"GooglePlayServicesUtil",
|
|
||||||
"com.android.vending",
|
|
||||||
"android.hardware.type.embedded"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
package app.revanced.patches.music.misc.gms.fingerprints
|
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
import com.android.tools.smali.dexlib2.AccessFlags
|
|
||||||
|
|
||||||
internal object ServiceCheckFingerprint : MethodFingerprint(
|
|
||||||
"V",
|
|
||||||
AccessFlags.PUBLIC or AccessFlags.STATIC,
|
|
||||||
listOf("L", "I"),
|
|
||||||
strings = listOf("Google Play Services not available"),
|
|
||||||
)
|
|
||||||
@@ -15,5 +15,5 @@ abstract class BaseDisableAdsPatch(
|
|||||||
compatiblePackages = compatiblePackages,
|
compatiblePackages = compatiblePackages,
|
||||||
fingerprints = setOf(IsAdsEnabledFingerprint),
|
fingerprints = setOf(IsAdsEnabledFingerprint),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) = listOf(IsAdsEnabledFingerprint).returnEarly()
|
override fun execute(context: BytecodeContext) = IsAdsEnabledFingerprint.returnEarly()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,5 +22,5 @@ object UnlockSubscriptionPatch : BytecodePatch(
|
|||||||
setOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected),
|
setOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected),
|
||||||
) {
|
) {
|
||||||
override fun execute(context: BytecodeContext) =
|
override fun execute(context: BytecodeContext) =
|
||||||
listOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected).returnEarly()
|
setOf(StartSubscriptionActivityFingerprint, BillingClientOnServiceConnected).returnEarly()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,11 @@ import app.revanced.patches.all.misc.packagename.ChangePackageNamePatch
|
|||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.ACTIONS
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.ACTIONS
|
||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AUTHORITIES
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.AUTHORITIES
|
||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.PERMISSIONS
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch.Constants.PERMISSIONS
|
||||||
|
import app.revanced.patches.shared.misc.gms.fingerprints.CastDynamiteModuleFingerprint
|
||||||
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint
|
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint
|
||||||
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME
|
import app.revanced.patches.shared.misc.gms.fingerprints.GmsCoreSupportFingerprint.GET_GMS_CORE_VENDOR_GROUP_ID_METHOD_NAME
|
||||||
|
import app.revanced.patches.shared.misc.gms.fingerprints.GooglePlayUtilityFingerprint
|
||||||
|
import app.revanced.patches.shared.misc.gms.fingerprints.ServiceCheckFingerprint
|
||||||
import app.revanced.util.exception
|
import app.revanced.util.exception
|
||||||
import app.revanced.util.getReference
|
import app.revanced.util.getReference
|
||||||
import app.revanced.util.returnEarly
|
import app.revanced.util.returnEarly
|
||||||
@@ -42,8 +45,8 @@ import com.android.tools.smali.dexlib2.util.MethodUtil
|
|||||||
abstract class BaseGmsCoreSupportPatch(
|
abstract class BaseGmsCoreSupportPatch(
|
||||||
private val fromPackageName: String,
|
private val fromPackageName: String,
|
||||||
private val toPackageName: String,
|
private val toPackageName: String,
|
||||||
private val primeMethodFingerprint: MethodFingerprint,
|
private val primeMethodFingerprint: MethodFingerprint?,
|
||||||
private val earlyReturnFingerprints: Set<MethodFingerprint>,
|
private val earlyReturnFingerprints: Set<MethodFingerprint> = setOf(),
|
||||||
private val mainActivityOnCreateFingerprint: MethodFingerprint,
|
private val mainActivityOnCreateFingerprint: MethodFingerprint,
|
||||||
private val integrationsPatchDependency: PatchClass,
|
private val integrationsPatchDependency: PatchClass,
|
||||||
gmsCoreSupportResourcePatch: BaseGmsCoreSupportResourcePatch,
|
gmsCoreSupportResourcePatch: BaseGmsCoreSupportResourcePatch,
|
||||||
@@ -53,7 +56,7 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
) : BytecodePatch(
|
) : BytecodePatch(
|
||||||
name = "GmsCore support",
|
name = "GmsCore support",
|
||||||
description = "Allows patched Google apps to run without root and under a different package name " +
|
description = "Allows patched Google apps to run without root and under a different package name " +
|
||||||
"by using GmsCore instead of Google Play Services.",
|
"by using GmsCore instead of Google Play Services.",
|
||||||
dependencies = setOf(
|
dependencies = setOf(
|
||||||
ChangePackageNamePatch::class,
|
ChangePackageNamePatch::class,
|
||||||
gmsCoreSupportResourcePatch::class,
|
gmsCoreSupportResourcePatch::class,
|
||||||
@@ -62,6 +65,9 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
compatiblePackages = compatiblePackages,
|
compatiblePackages = compatiblePackages,
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
GmsCoreSupportFingerprint,
|
GmsCoreSupportFingerprint,
|
||||||
|
GooglePlayUtilityFingerprint,
|
||||||
|
ServiceCheckFingerprint,
|
||||||
|
CastDynamiteModuleFingerprint,
|
||||||
mainActivityOnCreateFingerprint,
|
mainActivityOnCreateFingerprint,
|
||||||
) + fingerprints,
|
) + fingerprints,
|
||||||
requiresIntegrations = true,
|
requiresIntegrations = true,
|
||||||
@@ -91,16 +97,19 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Specific method that needs to be patched.
|
// Specific method that needs to be patched.
|
||||||
transformPrimeMethod(packageName)
|
primeMethodFingerprint?.let { transformPrimeMethod(packageName) }
|
||||||
|
|
||||||
// Return these methods early to prevent the app from crashing.
|
// Return these methods early to prevent the app from crashing.
|
||||||
earlyReturnFingerprints.toList().returnEarly()
|
(earlyReturnFingerprints + ServiceCheckFingerprint + CastDynamiteModuleFingerprint).returnEarly()
|
||||||
|
if (GooglePlayUtilityFingerprint.result != null) {
|
||||||
|
GooglePlayUtilityFingerprint.returnEarly()
|
||||||
|
}
|
||||||
|
|
||||||
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
// Verify GmsCore is installed and whitelisted for power optimizations and background usage.
|
||||||
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
mainActivityOnCreateFingerprint.result?.mutableMethod?.addInstructions(
|
||||||
0,
|
0,
|
||||||
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
|
"invoke-static/range { p0 .. p0 }, Lapp/revanced/integrations/shared/GmsCoreSupport;->" +
|
||||||
"checkGmsCore(Landroid/app/Activity;)V",
|
"checkGmsCore(Landroid/app/Activity;)V",
|
||||||
) ?: throw mainActivityOnCreateFingerprint.exception
|
) ?: throw mainActivityOnCreateFingerprint.exception
|
||||||
|
|
||||||
// Change the vendor of GmsCore in ReVanced Integrations.
|
// Change the vendor of GmsCore in ReVanced Integrations.
|
||||||
@@ -192,7 +201,7 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun transformPrimeMethod(packageName: String) {
|
private fun transformPrimeMethod(packageName: String) {
|
||||||
primeMethodFingerprint.result?.mutableMethod?.apply {
|
primeMethodFingerprint!!.result?.mutableMethod?.apply {
|
||||||
var register = 2
|
var register = 2
|
||||||
|
|
||||||
val index = getInstructions().indexOfFirst {
|
val index = getInstructions().indexOfFirst {
|
||||||
@@ -305,6 +314,7 @@ abstract class BaseGmsCoreSupportPatch(
|
|||||||
"com.google.android.gms.languageprofile.service.START",
|
"com.google.android.gms.languageprofile.service.START",
|
||||||
"com.google.android.gms.clearcut.service.START",
|
"com.google.android.gms.clearcut.service.START",
|
||||||
"com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE",
|
"com.google.android.gms.icing.LIGHTWEIGHT_INDEX_SERVICE",
|
||||||
|
"com.google.android.gms.accountsettings.action.VIEW_SETTINGS",
|
||||||
|
|
||||||
// potoken
|
// potoken
|
||||||
"com.google.android.gms.potokens.service.START",
|
"com.google.android.gms.potokens.service.START",
|
||||||
|
|||||||
@@ -96,27 +96,23 @@ abstract class BaseGmsCoreSupportResourcePatch(
|
|||||||
private fun ResourceContext.patchManifest() {
|
private fun ResourceContext.patchManifest() {
|
||||||
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(toPackageName)
|
val packageName = ChangePackageNamePatch.setOrGetFallbackPackageName(toPackageName)
|
||||||
|
|
||||||
val manifest = this.get("AndroidManifest.xml").readText()
|
val transformations = mapOf(
|
||||||
this.get("AndroidManifest.xml").writeText(
|
"package=\"$fromPackageName" to "package=\"$packageName",
|
||||||
manifest.replace(
|
"android:authorities=\"$fromPackageName" to "android:authorities=\"$packageName",
|
||||||
"package=\"$fromPackageName",
|
"$fromPackageName.permission.C2D_MESSAGE" to "$packageName.permission.C2D_MESSAGE",
|
||||||
"package=\"$packageName",
|
"$fromPackageName.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION" to "$packageName.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION",
|
||||||
).replace(
|
"com.google.android.c2dm" to "$packageName.android.c2dm",
|
||||||
"android:authorities=\"$fromPackageName",
|
"com.google.android.libraries.photos.api.mars" to "$packageName.android.apps.photos.api.mars",
|
||||||
"android:authorities=\"$packageName",
|
"</queries>" to "<package android:name=\"$gmsCoreVendorGroupId.android.gms\"/></queries>",
|
||||||
).replace(
|
)
|
||||||
"$fromPackageName.permission.C2D_MESSAGE",
|
|
||||||
"$packageName.permission.C2D_MESSAGE",
|
get("AndroidManifest.xml", false).writeText(
|
||||||
).replace(
|
transformations.entries.fold(get("AndroidManifest.xml", false).readText()) { acc, (from, to) ->
|
||||||
"$fromPackageName.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION",
|
acc.replace(
|
||||||
"$packageName.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION",
|
from,
|
||||||
).replace(
|
to
|
||||||
"com.google.android.c2dm",
|
)
|
||||||
"$gmsCoreVendorGroupId.android.c2dm",
|
}
|
||||||
).replace(
|
|
||||||
"</queries>",
|
|
||||||
"<package android:name=\"$gmsCoreVendorGroupId.android.gms\"/></queries>",
|
|
||||||
),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.music.misc.gms.fingerprints
|
package app.revanced.patches.shared.misc.gms.fingerprints
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
package app.revanced.patches.shared.misc.gms.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
@@ -8,5 +8,5 @@ internal object GooglePlayUtilityFingerprint : MethodFingerprint(
|
|||||||
returnType = "I",
|
returnType = "I",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
parameters = listOf("L", "I"),
|
parameters = listOf("L", "I"),
|
||||||
strings = listOf("This should never happen.", "MetadataValueReader", "com.google.android.gms")
|
strings = listOf("This should never happen.", "MetadataValueReader", "com.google.android.gms"),
|
||||||
)
|
)
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
package app.revanced.patches.shared.misc.gms.fingerprints
|
||||||
|
|
||||||
import app.revanced.patcher.extensions.or
|
import app.revanced.patcher.extensions.or
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
import app.revanced.patcher.fingerprint.MethodFingerprint
|
||||||
@@ -8,5 +8,5 @@ internal object ServiceCheckFingerprint : MethodFingerprint(
|
|||||||
returnType = "V",
|
returnType = "V",
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
||||||
parameters = listOf("L", "I"),
|
parameters = listOf("L", "I"),
|
||||||
strings = listOf("Google Play Services not available", "GooglePlayServices not available due to error ")
|
strings = listOf("Google Play Services not available")
|
||||||
)
|
)
|
||||||
@@ -7,7 +7,8 @@ import app.revanced.patches.youtube.misc.fix.playback.SpoofClientPatch
|
|||||||
import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.gms.Constants.REVANCED_YOUTUBE_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.gms.Constants.YOUTUBE_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
import app.revanced.patches.youtube.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
import app.revanced.patches.youtube.misc.gms.fingerprints.*
|
import app.revanced.patches.youtube.misc.gms.fingerprints.CastDynamiteModuleV2Fingerprint
|
||||||
|
import app.revanced.patches.youtube.misc.gms.fingerprints.PrimeMethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.youtube.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint
|
import app.revanced.patches.youtube.shared.fingerprints.MainActivityOnCreateFingerprint
|
||||||
|
|
||||||
@@ -17,9 +18,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
|||||||
toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME,
|
toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME,
|
||||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||||
earlyReturnFingerprints = setOf(
|
earlyReturnFingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
GooglePlayUtilityFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
),
|
),
|
||||||
@@ -61,9 +59,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
GooglePlayUtilityFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
PrimeMethodFingerprint,
|
PrimeMethodFingerprint,
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
package app.revanced.patches.youtube.misc.gms.fingerprints
|
|
||||||
|
|
||||||
|
|
||||||
import app.revanced.patcher.fingerprint.MethodFingerprint
|
|
||||||
|
|
||||||
internal object CastDynamiteModuleFingerprint : MethodFingerprint(
|
|
||||||
strings = listOf("com.google.android.gms.cast.framework.internal.CastDynamiteModuleImpl")
|
|
||||||
)
|
|
||||||
@@ -114,7 +114,7 @@ fun Method.indexOfFirstWideLiteralInstructionValue(literal: Long) = implementati
|
|||||||
*
|
*
|
||||||
* @return the first literal instruction with the value, or throws [PatchException] if not found.
|
* @return the first literal instruction with the value, or throws [PatchException] if not found.
|
||||||
*/
|
*/
|
||||||
fun Method.indexOfFirstWideLiteralInstructionValueOrThrow(literal: Long) : Int {
|
fun Method.indexOfFirstWideLiteralInstructionValueOrThrow(literal: Long): Int {
|
||||||
val index = indexOfFirstWideLiteralInstructionValue(literal)
|
val index = indexOfFirstWideLiteralInstructionValue(literal)
|
||||||
if (index < 0) throw PatchException("Could not find literal value: $literal")
|
if (index < 0) throw PatchException("Could not find literal value: $literal")
|
||||||
return index
|
return index
|
||||||
@@ -160,7 +160,7 @@ inline fun <reified T : Reference> Instruction.getReference() = (this as? Refere
|
|||||||
// TODO: delete this on next major release, the overloaded method with an optional start index serves the same purposes.
|
// TODO: delete this on next major release, the overloaded method with an optional start index serves the same purposes.
|
||||||
// Method is deprecated, but annotation is commented out otherwise during compilation usage of the replacement is
|
// Method is deprecated, but annotation is commented out otherwise during compilation usage of the replacement is
|
||||||
// incorrectly flagged as deprecated.
|
// incorrectly flagged as deprecated.
|
||||||
//@Deprecated("Use the overloaded method with an optional start index.", ReplaceWith("indexOfFirstInstruction(predicate)"))
|
// @Deprecated("Use the overloaded method with an optional start index.", ReplaceWith("indexOfFirstInstruction(predicate)"))
|
||||||
fun Method.indexOfFirstInstruction(predicate: Instruction.() -> Boolean) = indexOfFirstInstruction(0, predicate)
|
fun Method.indexOfFirstInstruction(predicate: Instruction.() -> Boolean) = indexOfFirstInstruction(0, predicate)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -211,28 +211,41 @@ fun Method.findOpcodeIndicesReversed(opcode: Opcode): List<Int> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the resolved methods of [MethodFingerprint]s early.
|
* Return the resolved method early.
|
||||||
*/
|
*/
|
||||||
fun List<MethodFingerprint>.returnEarly(bool: Boolean = false) {
|
fun MethodFingerprint.returnEarly(bool: Boolean = false) {
|
||||||
val const = if (bool) "0x1" else "0x0"
|
val const = if (bool) "0x1" else "0x0"
|
||||||
this.forEach { fingerprint ->
|
result?.let { result ->
|
||||||
fingerprint.result?.let { result ->
|
val stringInstructions = when (result.method.returnType.first()) {
|
||||||
val stringInstructions = when (result.method.returnType.first()) {
|
'L' ->
|
||||||
'L' ->
|
"""
|
||||||
"""
|
|
||||||
const/4 v0, $const
|
const/4 v0, $const
|
||||||
return-object v0
|
return-object v0
|
||||||
"""
|
"""
|
||||||
'V' -> "return-void"
|
'V' -> "return-void"
|
||||||
'I', 'Z' ->
|
'I', 'Z' ->
|
||||||
"""
|
"""
|
||||||
const/4 v0, $const
|
const/4 v0, $const
|
||||||
return v0
|
return v0
|
||||||
"""
|
"""
|
||||||
else -> throw Exception("This case should never happen.")
|
else -> throw Exception("This case should never happen.")
|
||||||
}
|
}
|
||||||
|
|
||||||
result.mutableMethod.addInstructions(0, stringInstructions)
|
result.mutableMethod.addInstructions(0, stringInstructions)
|
||||||
} ?: throw fingerprint.exception
|
} ?: throw exception
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the resolved methods early.
|
||||||
|
*/
|
||||||
|
fun Iterable<MethodFingerprint>.returnEarly(bool: Boolean = false) = forEach { fingerprint ->
|
||||||
|
fingerprint.returnEarly(bool)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the resolved methods early.
|
||||||
|
*/
|
||||||
|
@Deprecated("Use the Iterable version")
|
||||||
|
fun List<MethodFingerprint>.returnEarly(bool: Boolean = false) = forEach { fingerprint ->
|
||||||
|
fingerprint.returnEarly(bool)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user