From 4d5d896790e124aa5af8cf370103891c26ffd715 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Sat, 25 Dec 2021 23:42:20 +0800 Subject: [PATCH] Reduce binary size by disabling tons of kt null check (#1202) --- app/build.gradle.kts | 12 ++++++++++++ .../me/singleneuron/hook/MessageStyleNotification.kt | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/app/build.gradle.kts b/app/build.gradle.kts index e55dbf0d..b736beca 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -352,3 +352,15 @@ tasks.whenTaskAdded { this.dependsOn(tasks.getByName("checkTargetNativeLibsRelease")) } } + +tasks.withType().all { + if (name.contains("release", true)) { + kotlinOptions { + freeCompilerArgs = freeCompilerArgs + listOf( + "-Xno-call-assertions", + "-Xno-receiver-assertions", + "-Xno-param-assertions", + ) + } + } +} diff --git a/app/src/main/java/me/singleneuron/hook/MessageStyleNotification.kt b/app/src/main/java/me/singleneuron/hook/MessageStyleNotification.kt index 639639de..62872a6e 100644 --- a/app/src/main/java/me/singleneuron/hook/MessageStyleNotification.kt +++ b/app/src/main/java/me/singleneuron/hook/MessageStyleNotification.kt @@ -242,7 +242,7 @@ object MessageStyleNotification : CommonDelayAbleHookBridge(SyncUtils.PROC_ANY) Activity::class.java, Boolean::class.javaPrimitiveType, object : XC_MethodReplacement() { - override fun replaceHookedMethod(param: MethodHookParam): Any { + override fun replaceHookedMethod(param: MethodHookParam): Any? { val id = Thread.currentThread().id val unhook = if (param.args[1] as Boolean && (param.args[0] as Activity).isLaunchedFromBubble