From 581369077f648f0420911244258bdfd92dd0abfe Mon Sep 17 00:00:00 2001 From: drobotk Date: Mon, 23 Feb 2026 23:08:38 +0100 Subject: [PATCH] simplify `activityOnCreateExtensionHook` --- .../misc/extension/SharedExtensionPatch.kt | 29 +++++++------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt b/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt index 79c3a60f14..6df4833213 100644 --- a/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt +++ b/patches/src/main/kotlin/app/revanced/patches/shared/misc/extension/SharedExtensionPatch.kt @@ -111,25 +111,18 @@ fun extensionHook( * defined in the app manifest.xml file. * * @param activityClassType Either the full activity class type such as `Lcom/company/MainActivity;` - * or the 'ends with' string for the activity such as `/MainActivity;` + * or the 'starts with' or 'ends with' string for the activity such as `/MainActivity;` */ -fun activityOnCreateExtensionHook(activityClassType: String): ExtensionHook { - if (!activityClassType.endsWith(';')) { - throw IllegalArgumentException("Activity class type does not end with semicolon: $activityClassType") - } - - val fullClassType = activityClassType.startsWith('L') - - return extensionHook { +fun activityOnCreateExtensionHook(activityClassType: String) = extensionHook { name("onCreate") - - if (fullClassType) { - definingClass(activityClassType) - } else { - definingClass { endsWith(activityClassType) } - } - + definingClass(activityClassType) returnType("V") - parameterTypes("Landroid/os/Bundle;") + + /* + * Leaving this out (for now?), because before the refactor many apps + * which used a simpler fingerprint checking only method name and classDef name + * were refactored to use this instead, which caused their hooks to fail. + */ + // parameterTypes("Landroid/os/Bundle;") } -} +