mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 01:01:56 +01:00
feat(Google Photos): Add GmsCore support
patch (#3414)
Co-authored-by: benjy3gg <benjy3gg@gmail.com> Co-authored-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
cece0fefb3
commit
24528e0a6e
19 changed files with 143 additions and 77 deletions
|
@ -235,6 +235,18 @@ public final class app/revanced/patches/googlenews/misc/integrations/Integration
|
||||||
public static final field INSTANCE Lapp/revanced/patches/googlenews/misc/integrations/IntegrationsPatch;
|
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
|
||||||
|
|
|
@ -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 ->
|
||||||
|
|
|
@ -4,7 +4,6 @@ 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.Constants.REVANCED_MAGAZINES_PACKAGE_NAME
|
||||||
import app.revanced.patches.googlenews.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
import app.revanced.patches.googlenews.misc.gms.GmsCoreSupportResourcePatch.gmsCoreVendorGroupIdOption
|
||||||
import app.revanced.patches.googlenews.misc.gms.fingerprints.MagazinesActivityOnCreateFingerprint
|
import app.revanced.patches.googlenews.misc.gms.fingerprints.MagazinesActivityOnCreateFingerprint
|
||||||
import app.revanced.patches.googlenews.misc.gms.fingerprints.ServiceCheckFingerprint
|
|
||||||
import app.revanced.patches.googlenews.misc.integrations.IntegrationsPatch
|
import app.revanced.patches.googlenews.misc.integrations.IntegrationsPatch
|
||||||
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
import app.revanced.patches.shared.misc.gms.BaseGmsCoreSupportPatch
|
||||||
|
|
||||||
|
@ -13,14 +12,12 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
fromPackageName = MAGAZINES_PACKAGE_NAME,
|
fromPackageName = MAGAZINES_PACKAGE_NAME,
|
||||||
toPackageName = REVANCED_MAGAZINES_PACKAGE_NAME,
|
toPackageName = REVANCED_MAGAZINES_PACKAGE_NAME,
|
||||||
primeMethodFingerprint = null,
|
primeMethodFingerprint = null,
|
||||||
earlyReturnFingerprints = setOf(ServiceCheckFingerprint),
|
|
||||||
mainActivityOnCreateFingerprint = MagazinesActivityOnCreateFingerprint,
|
mainActivityOnCreateFingerprint = MagazinesActivityOnCreateFingerprint,
|
||||||
integrationsPatchDependency = IntegrationsPatch::class,
|
integrationsPatchDependency = IntegrationsPatch::class,
|
||||||
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
gmsCoreSupportResourcePatch = GmsCoreSupportResourcePatch,
|
||||||
// Remove version constraint,
|
// Remove version constraint,
|
||||||
// once https://github.com/ReVanced/revanced-patches/pull/3111#issuecomment-2240877277 is resolved.
|
// once https://github.com/ReVanced/revanced-patches/pull/3111#issuecomment-2240877277 is resolved.
|
||||||
compatiblePackages = setOf(CompatiblePackage(MAGAZINES_PACKAGE_NAME, setOf("5.108.0.644447823"))),
|
compatiblePackages = setOf(CompatiblePackage(MAGAZINES_PACKAGE_NAME, setOf("5.108.0.644447823"))),
|
||||||
fingerprints = setOf(ServiceCheckFingerprint),
|
|
||||||
) {
|
) {
|
||||||
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
|
override val gmsCoreVendorGroupId by gmsCoreVendorGroupIdOption
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
package app.revanced.patches.googlenews.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(
|
|
||||||
returnType = "V",
|
|
||||||
accessFlags = AccessFlags.PUBLIC or AccessFlags.STATIC,
|
|
||||||
parameters = listOf("L", "I"),
|
|
||||||
strings = listOf("Google Play Services not available", "GooglePlayServices not available due to error "),
|
|
||||||
)
|
|
|
@ -26,7 +26,7 @@ internal object StartActivityInitFingerprint : IntegrationsFingerprint(
|
||||||
getReference<MethodReference>()?.name == "getApplicationContext"
|
getReference<MethodReference>()?.name == "getApplicationContext"
|
||||||
}
|
}
|
||||||
|
|
||||||
getApplicationContextIndex + 2 // Below the move-result-object instruction
|
getApplicationContextIndex + 2 // Below the move-result-object instruction.
|
||||||
},
|
},
|
||||||
contextRegisterResolver = { method ->
|
contextRegisterResolver = { method ->
|
||||||
val moveResultInstruction = method.implementation!!.instructions.elementAt(getApplicationContextIndex + 1)
|
val moveResultInstruction = method.implementation!!.instructions.elementAt(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
|
||||||
|
}
|
|
@ -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,8 +16,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
toPackageName = REVANCED_MUSIC_PACKAGE_NAME,
|
||||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||||
earlyReturnFingerprints = setOf(
|
earlyReturnFingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
),
|
),
|
||||||
|
@ -35,8 +35,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
PrimeMethodFingerprint,
|
PrimeMethodFingerprint,
|
||||||
|
|
|
@ -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"),
|
|
||||||
)
|
|
|
@ -11,9 +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.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
|
||||||
|
@ -44,7 +46,7 @@ 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,
|
||||||
|
@ -54,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,
|
||||||
|
@ -64,6 +66,8 @@ abstract class BaseGmsCoreSupportPatch(
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
GmsCoreSupportFingerprint,
|
GmsCoreSupportFingerprint,
|
||||||
GooglePlayUtilityFingerprint,
|
GooglePlayUtilityFingerprint,
|
||||||
|
ServiceCheckFingerprint,
|
||||||
|
CastDynamiteModuleFingerprint,
|
||||||
mainActivityOnCreateFingerprint,
|
mainActivityOnCreateFingerprint,
|
||||||
) + fingerprints,
|
) + fingerprints,
|
||||||
requiresIntegrations = true,
|
requiresIntegrations = true,
|
||||||
|
@ -96,7 +100,7 @@ abstract class BaseGmsCoreSupportPatch(
|
||||||
primeMethodFingerprint?.let { 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.returnEarly()
|
(earlyReturnFingerprints + ServiceCheckFingerprint + CastDynamiteModuleFingerprint).returnEarly()
|
||||||
if (GooglePlayUtilityFingerprint.result != null) {
|
if (GooglePlayUtilityFingerprint.result != null) {
|
||||||
GooglePlayUtilityFingerprint.returnEarly()
|
GooglePlayUtilityFingerprint.returnEarly()
|
||||||
}
|
}
|
||||||
|
@ -105,7 +109,7 @@ abstract class BaseGmsCoreSupportPatch(
|
||||||
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.
|
||||||
|
|
|
@ -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 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,10 +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.CastDynamiteModuleFingerprint
|
|
||||||
import app.revanced.patches.youtube.misc.gms.fingerprints.CastDynamiteModuleV2Fingerprint
|
import app.revanced.patches.youtube.misc.gms.fingerprints.CastDynamiteModuleV2Fingerprint
|
||||||
import app.revanced.patches.youtube.misc.gms.fingerprints.PrimeMethodFingerprint
|
import app.revanced.patches.youtube.misc.gms.fingerprints.PrimeMethodFingerprint
|
||||||
import app.revanced.patches.youtube.misc.gms.fingerprints.ServiceCheckFingerprint
|
|
||||||
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
|
||||||
|
|
||||||
|
@ -20,8 +18,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME,
|
toPackageName = REVANCED_YOUTUBE_PACKAGE_NAME,
|
||||||
primeMethodFingerprint = PrimeMethodFingerprint,
|
primeMethodFingerprint = PrimeMethodFingerprint,
|
||||||
earlyReturnFingerprints = setOf(
|
earlyReturnFingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
CastDynamiteModuleFingerprint,
|
|
||||||
CastDynamiteModuleV2Fingerprint,
|
CastDynamiteModuleV2Fingerprint,
|
||||||
CastContextFetchFingerprint,
|
CastContextFetchFingerprint,
|
||||||
),
|
),
|
||||||
|
@ -63,8 +59,6 @@ object GmsCoreSupportPatch : BaseGmsCoreSupportPatch(
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
fingerprints = setOf(
|
fingerprints = setOf(
|
||||||
ServiceCheckFingerprint,
|
|
||||||
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")
|
|
||||||
)
|
|
Loading…
Reference in a new issue