mirror of
https://github.com/ReVanced/revanced-patches.git
synced 2024-11-10 09:07:46 +01:00
chore: update matching method names for microg
patch
Signed-off-by: oSumAtrIX <johan.melkonyan1@web.de>
This commit is contained in:
parent
32b8ac5fca
commit
159f7f3c3d
7 changed files with 19 additions and 19 deletions
|
@ -21,7 +21,7 @@ import app.revanced.patcher.util.smali.toInstructions
|
||||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||||
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
|
import app.revanced.patches.youtube.misc.microg.patch.resource.enum.StringReplaceMode
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_REVANCED_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.microg.signatures.GooglePlayUtilitySignature
|
import app.revanced.patches.youtube.misc.microg.signatures.GooglePlayUtilitySignature
|
||||||
import app.revanced.patches.youtube.misc.microg.signatures.IntegrityCheckSignature
|
import app.revanced.patches.youtube.misc.microg.signatures.IntegrityCheckSignature
|
||||||
import app.revanced.patches.youtube.misc.microg.signatures.PrimeSignature
|
import app.revanced.patches.youtube.misc.microg.signatures.PrimeSignature
|
||||||
|
@ -98,7 +98,7 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||||
|
|
||||||
val newString =
|
val newString =
|
||||||
if (replaceMode == StringReplaceMode.REPLACE_WITH_REVANCED) stringValue.replace(
|
if (replaceMode == StringReplaceMode.REPLACE_WITH_REVANCED) stringValue.replace(
|
||||||
"com.google.android.youtube", BASE_REVANCED_PACKAGE_NAME
|
"com.google.android.youtube", REVANCED_PACKAGE_NAME
|
||||||
)
|
)
|
||||||
else stringValue.replace("com.google", BASE_MICROG_PACKAGE_NAME)
|
else stringValue.replace("com.google", BASE_MICROG_PACKAGE_NAME)
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ class MicroGBytecodePatch : BytecodePatch(
|
||||||
}
|
}
|
||||||
|
|
||||||
implementation.replaceInstruction(
|
implementation.replaceInstruction(
|
||||||
index, "const-string v$register, \"$BASE_REVANCED_PACKAGE_NAME\"".toInstruction()
|
index, "const-string v$register, \"$REVANCED_PACKAGE_NAME\"".toInstruction()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,34 +10,34 @@ import app.revanced.patcher.patch.implementation.misc.PatchResult
|
||||||
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
import app.revanced.patcher.patch.implementation.misc.PatchResultSuccess
|
||||||
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibility
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_MICROG_PACKAGE_NAME
|
||||||
import app.revanced.patches.youtube.misc.microg.shared.Constants.BASE_REVANCED_PACKAGE_NAME
|
import app.revanced.patches.youtube.misc.microg.shared.Constants.REVANCED_PACKAGE_NAME
|
||||||
|
|
||||||
@Patch
|
@Patch
|
||||||
@Name("microg-bytecode-patch")
|
@Name("microg-resource-patch")
|
||||||
@Description("Bytecode patch to allow YouTube ReVanced to run without root and under a different package name.")
|
@Description("Resource patch to allow YouTube ReVanced to run without root and under a different package name.")
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
@Version("0.0.1")
|
@Version("0.0.1")
|
||||||
class MicroGResourcePatch : ResourcePatch() {
|
class MicroGResourcePatch : ResourcePatch() {
|
||||||
override fun execute(data: ResourceData): PatchResult {
|
override fun execute(data: ResourceData): PatchResult {
|
||||||
data.writer("AndroidManifest.xml").write(
|
data.writer("AndroidManifest.xml").write(
|
||||||
data.reader("AndroidManifest.xml").readText().replace(
|
data.reader("AndroidManifest.xml").readText().replace(
|
||||||
"package=\"com.google.android.youtube\"", "package=\"$BASE_REVANCED_PACKAGE_NAME\""
|
"package=\"com.google.android.youtube\"", "package=\"$REVANCED_PACKAGE_NAME\""
|
||||||
).replace(
|
).replace(
|
||||||
" android:label=\"@string/application_name\" ", " android:label=\"{APP_NAME}\" "
|
" android:label=\"@string/application_name\" ", " android:label=\"{APP_NAME}\" "
|
||||||
).replace(
|
).replace(
|
||||||
"<uses-permission android:name=\"com.google.android.youtube.permission.C2D_MESSAGE\"",
|
"<uses-permission android:name=\"com.google.android.youtube.permission.C2D_MESSAGE\"",
|
||||||
"<uses-permission android:name=\"$BASE_REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE\""
|
"<uses-permission android:name=\"$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE\""
|
||||||
).replace(
|
).replace(
|
||||||
"<permission android:name=\"com.google.android.youtube.permission.C2D_MESSAGE\"",
|
"<permission android:name=\"com.google.android.youtube.permission.C2D_MESSAGE\"",
|
||||||
"<permission android:name=\"$BASE_REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE\""
|
"<permission android:name=\"$REVANCED_PACKAGE_NAME.permission.C2D_MESSAGE\""
|
||||||
).replace(
|
).replace(
|
||||||
"<provider android:authorities=\"com.google.android.youtube.lifecycle-trojan\"",
|
"<provider android:authorities=\"com.google.android.youtube.lifecycle-trojan\"",
|
||||||
"<provider android:authorities=\"$BASE_REVANCED_PACKAGE_NAME.lifecycle-trojan\""
|
"<provider android:authorities=\"$REVANCED_PACKAGE_NAME.lifecycle-trojan\""
|
||||||
).replace(
|
).replace(
|
||||||
"\"com.google.android.youtube.fileprovider\"", "\"$BASE_REVANCED_PACKAGE_NAME.fileprovider\""
|
"\"com.google.android.youtube.fileprovider\"", "\"$REVANCED_PACKAGE_NAME.fileprovider\""
|
||||||
).replace(
|
).replace(
|
||||||
"<provider android:authorities=\"com.google.android.youtube.photopicker_images\"",
|
"<provider android:authorities=\"com.google.android.youtube.photopicker_images\"",
|
||||||
"<provider android:authorities=\"$BASE_REVANCED_PACKAGE_NAME.photopicker_images\""
|
"<provider android:authorities=\"$REVANCED_PACKAGE_NAME.photopicker_images\""
|
||||||
).replace("com.google.android.c2dm", "$BASE_MICROG_PACKAGE_NAME.android.c2dm").replace(
|
).replace("com.google.android.c2dm", "$BASE_MICROG_PACKAGE_NAME.android.c2dm").replace(
|
||||||
" </queries>",
|
" </queries>",
|
||||||
" <package android:name=\"$BASE_MICROG_PACKAGE_NAME.android.gms\"/>\n </queries>"
|
" <package android:name=\"$BASE_MICROG_PACKAGE_NAME.android.gms\"/>\n </queries>"
|
||||||
|
@ -46,10 +46,10 @@ class MicroGResourcePatch : ResourcePatch() {
|
||||||
|
|
||||||
val replacement = arrayOf(
|
val replacement = arrayOf(
|
||||||
Pair(
|
Pair(
|
||||||
"com.google.android.youtube.SuggestionProvider", "$BASE_REVANCED_PACKAGE_NAME.SuggestionProvider"
|
"com.google.android.youtube.SuggestionProvider", "$REVANCED_PACKAGE_NAME.SuggestionProvider"
|
||||||
),
|
),
|
||||||
Pair(
|
Pair(
|
||||||
"com.google.android.youtube.fileprovider", "$BASE_REVANCED_PACKAGE_NAME.fileprovider"
|
"com.google.android.youtube.fileprovider", "$REVANCED_PACKAGE_NAME.fileprovider"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -2,5 +2,5 @@ package app.revanced.patches.youtube.misc.microg.shared
|
||||||
|
|
||||||
object Constants {
|
object Constants {
|
||||||
internal const val BASE_MICROG_PACKAGE_NAME = "com.mgoogle"
|
internal const val BASE_MICROG_PACKAGE_NAME = "com.mgoogle"
|
||||||
internal const val BASE_REVANCED_PACKAGE_NAME = "app.revanced.android.youtube"
|
internal const val REVANCED_PACKAGE_NAME = "app.revanced.android.youtube"
|
||||||
}
|
}
|
|
@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("google-play-utility-signature")
|
@Name("google-play-utility-signature")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Llpe;", "b"
|
"Llss;", "b"
|
||||||
)
|
)
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("google-play-sig-check-signature")
|
@Name("google-play-sig-check-signature")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Ldsf;", "d"
|
"Ldwn;", "d"
|
||||||
)
|
)
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
|
|
|
@ -9,7 +9,7 @@ import app.revanced.patches.youtube.misc.microg.annotations.MicroGPatchCompatibi
|
||||||
|
|
||||||
@Name("google-play-prime-signature")
|
@Name("google-play-prime-signature")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Louy;", "e"
|
"Lpag;", "d"
|
||||||
)
|
)
|
||||||
@DirectPatternScanMethod
|
@DirectPatternScanMethod
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
|
|
|
@ -12,7 +12,7 @@ import org.jf.dexlib2.Opcode
|
||||||
|
|
||||||
@Name("google-play-service-checker-signature")
|
@Name("google-play-service-checker-signature")
|
||||||
@MatchingMethod(
|
@MatchingMethod(
|
||||||
"Llpe;", "d"
|
"Llss;", "d"
|
||||||
)
|
)
|
||||||
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
@FuzzyPatternScanMethod(2) // FIXME: Test this threshold and find the best value.
|
||||||
@MicroGPatchCompatibility
|
@MicroGPatchCompatibility
|
||||||
|
|
Loading…
Reference in a new issue