fix(TikTok): Resolve startup app crash

This commit is contained in:
LisoUseInAIKyrios 2025-02-22 08:20:19 +02:00
parent 4b61b99217
commit 64663983b8
2 changed files with 14 additions and 6 deletions

View File

@ -2,4 +2,4 @@ package app.revanced.patches.tiktok.misc.extension
import app.revanced.patches.shared.misc.extension.sharedExtensionPatch import app.revanced.patches.shared.misc.extension.sharedExtensionPatch
val sharedExtensionPatch = sharedExtensionPatch("tiktok", initHook, jatoInitHook) val sharedExtensionPatch = sharedExtensionPatch("tiktok", initHook, jatoInitHook, storeRegionInitHook)

View File

@ -3,9 +3,7 @@ package app.revanced.patches.tiktok.misc.extension
import app.revanced.patches.shared.misc.extension.extensionHook import app.revanced.patches.shared.misc.extension.extensionHook
import com.android.tools.smali.dexlib2.AccessFlags import com.android.tools.smali.dexlib2.AccessFlags
internal val initHook = extensionHook( internal val initHook = extensionHook {
insertIndexResolver = { 0 }
) {
custom { method, classDef -> custom { method, classDef ->
classDef.type == "Lcom/ss/android/ugc/aweme/main/MainActivity;" && classDef.type == "Lcom/ss/android/ugc/aweme/main/MainActivity;" &&
method.name == "onCreate" method.name == "onCreate"
@ -16,14 +14,24 @@ internal val initHook = extensionHook(
* In some cases the extension code can be called before * In some cases the extension code can be called before
* the app main activity onCreate is called. * the app main activity onCreate is called.
* *
* This class is called from startup code titled "BPEA RunnableGuardLancet" * This class is called from startup code titled "BPEA RunnableGuardLancet".
*/ */
internal val jatoInitHook = extensionHook( internal val jatoInitHook = extensionHook(
insertIndexResolver = { 0 },
contextRegisterResolver = { "p1" } contextRegisterResolver = { "p1" }
) { ) {
parameters("Landroid/content/Context;")
custom { method, classDef -> custom { method, classDef ->
classDef.type == "Lcom/ss/android/ugc/aweme/legoImp/task/JatoInitTask;" && classDef.type == "Lcom/ss/android/ugc/aweme/legoImp/task/JatoInitTask;" &&
method.name == "run" method.name == "run"
} }
} }
internal val storeRegionInitHook = extensionHook(
contextRegisterResolver = { "p1" }
) {
parameters("Landroid/content/Context;")
custom { method, classDef ->
classDef.type == "Lcom/ss/android/ugc/aweme/legoImp/task/StoreRegionInitTask;" &&
method.name == "run"
}
}