From 2e1758462ba6d4fc1f008c1b1bc95d27f83d7b03 Mon Sep 17 00:00:00 2001 From: Parallelc Date: Wed, 30 Oct 2024 00:48:40 +0800 Subject: [PATCH] feat: long press home button --- README.md | 10 +- README_en.md | 10 +- app/src/main/java/com/parallelc/micts/Main.kt | 180 ------------------ .../java/com/parallelc/micts/ModuleMain.kt | 89 +++++++++ .../hooker/ContextualSearchIntentHooker.kt | 18 ++ .../micts/hooker/LongPressHomeHooker.kt | 62 ++++++ .../micts/hooker/NavStubViewHooker.kt | 39 ++++ .../parallelc/micts/hooker/ResourcesHooker.kt | 41 ++++ .../micts/hooker/ReturnFalseHooker.kt | 17 ++ .../micts/hooker/ReturnTrueHooker.kt | 17 ++ 10 files changed, 295 insertions(+), 188 deletions(-) delete mode 100644 app/src/main/java/com/parallelc/micts/Main.kt create mode 100644 app/src/main/java/com/parallelc/micts/ModuleMain.kt create mode 100644 app/src/main/java/com/parallelc/micts/hooker/ContextualSearchIntentHooker.kt create mode 100644 app/src/main/java/com/parallelc/micts/hooker/LongPressHomeHooker.kt create mode 100644 app/src/main/java/com/parallelc/micts/hooker/NavStubViewHooker.kt create mode 100644 app/src/main/java/com/parallelc/micts/hooker/ResourcesHooker.kt create mode 100644 app/src/main/java/com/parallelc/micts/hooker/ReturnFalseHooker.kt create mode 100644 app/src/main/java/com/parallelc/micts/hooker/ReturnTrueHooker.kt diff --git a/README.md b/README.md index f6114d4..473b1e3 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,15 @@ ## 操作步骤 -1. 在`桌面设置-系统导航方式`里,选择`全面屏手势`,关闭`隐藏手势提示线` +1. 安装最新版[Google](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox)应用,开启`自启动`权限,`省电策略`选择`无限制` -2. 安装最新版[Google](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox)应用,开启`自启动`权限,`省电策略`选择`无限制` +2. 安装并启用模块,重启手机 -3. 安装并启用模块,重启手机 +3. 执行相应的动作触发 + - 如果是全面屏手势,需要在`桌面设置-系统导航方式`里,关闭`隐藏手势提示线`,之后长按底部小白条触发 + - 如果是经典导航键(三按钮),需要在`桌面设置-系统导航方式-按键快捷方式-长按Home键`里,选择`语音助手`,之后长按Home键触发 -4. 长按底部小白条,如果没有反应,尝试在`设置-应用设置-右上角其他设置-默认应用设置-助手和语音输入-数字助理应用`里选择Google \ No newline at end of file +4. 如果没有反应,尝试在`设置-应用设置-右上角其他设置-默认应用设置-助手和语音输入-数字助理应用`里选择Google \ No newline at end of file diff --git a/README_en.md b/README_en.md index 3987bcf..012b165 100644 --- a/README_en.md +++ b/README_en.md @@ -6,13 +6,15 @@ Enable Circle to Search for Xiaomi System Launcher ## Usage -1. In `Home Screen Settings - System Navigation`, select `Gestures` and turn off `Hide full screen indicator` +1. Install the latest version of [Google](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox). In Google's `App info`, turn on `Autostart` if it exists and select `No restrictions` in `Battery saver` -2. Install the latest version of [Google](https://play.google.com/store/apps/details?id=com.google.android.googlequicksearchbox). In Google's `App info`, turn on `Autostart` if it exists and select `No restrictions` in `Battery saver` +2. Install and enable the module, restart your phone -3. Install and enable the module, restart your phone +3. Perform the action to trigger + - For `Gesture`, turn off `Hide full screen indicator` in `Home Screen Settings - System Navigation`, and then long press the navigation handle at the bottom to trigger + - For `Buttons`, select `Launch Google Assistant` in `Home Screen Settings - System Navigation - Button shortcuts - Long press the Home button`, and then long press the home button to trigger -4. Long press the navigation handle at the bottom to trigger. If it doesn't work, try to select Google in `Settings - Apps - Manage apps - Other Settings in the upper right corner - Default apps - Assist & voice input - Digital Assistant App` \ No newline at end of file +4. If it doesn't work, try to select Google in `Settings - Apps - Manage apps - Other Settings in the upper right corner - Default apps - Assist & voice input - Digital Assistant App` \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/Main.kt b/app/src/main/java/com/parallelc/micts/Main.kt deleted file mode 100644 index d46e760..0000000 --- a/app/src/main/java/com/parallelc/micts/Main.kt +++ /dev/null @@ -1,180 +0,0 @@ -package com.parallelc.micts - -import android.annotation.SuppressLint -import android.content.Context -import android.content.Intent -import android.content.res.Resources -import android.os.Build -import android.os.Bundle -import android.os.IBinder -import android.os.SystemClock -import android.view.MotionEvent -import android.view.View -import android.view.ViewConfiguration -import io.github.libxposed.api.XposedInterface -import io.github.libxposed.api.XposedInterface.AfterHookCallback -import io.github.libxposed.api.XposedInterface.BeforeHookCallback -import io.github.libxposed.api.XposedInterface.Hooker -import io.github.libxposed.api.XposedModule -import io.github.libxposed.api.XposedModuleInterface.ModuleLoadedParam -import io.github.libxposed.api.XposedModuleInterface.PackageLoadedParam -import io.github.libxposed.api.XposedModuleInterface.SystemServerLoadedParam -import io.github.libxposed.api.annotations.AfterInvocation -import io.github.libxposed.api.annotations.BeforeInvocation -import io.github.libxposed.api.annotations.XposedHooker - -private lateinit var module: ModuleMain - -class ModuleMain(base: XposedInterface, param: ModuleLoadedParam) : XposedModule(base, param) { - - init { - module = this - } - - @XposedHooker - class ContextualSearchIntentHooker : Hooker { - companion object { - @JvmStatic - @AfterInvocation - fun after(callback: AfterHookCallback) { - (callback.result as Intent).putExtra("com.android.contextualsearch.flag_secure_found", false) - } - } - } - - class ResourcesHooker { - companion object { - private var R: Class<*>? = null - - @SuppressLint("PrivateApi") - fun hook(param: SystemServerLoadedParam) { - R = param.classLoader.loadClass("com.android.internal.R\$string") - module.hook(Resources::class.java.getDeclaredMethod("getString", Int::class.java), GetStringHooker::class.java) - } - - @XposedHooker - class GetStringHooker : Hooker { - companion object { - @JvmStatic - @BeforeInvocation - fun before(callback: BeforeHookCallback) { - when (callback.args[0]) { - R!!.getField("config_defaultContextualSearchKey").getInt(null) -> { - callback.returnAndSkip("omni.entry_point") - } - - R!!.getField("config_defaultContextualSearchPackageName").getInt(null) -> { - callback.returnAndSkip("com.google.android.googlequicksearchbox") - } - } - } - } - } - } - } - - @SuppressLint("PrivateApi") - override fun onSystemServerLoaded(param: SystemServerLoadedParam) { - super.onSystemServerLoaded(param) - - runCatching { - ResourcesHooker.hook(param) - val vims = param.classLoader.loadClass("com.android.server.voiceinteraction.VoiceInteractionManagerService\$VoiceInteractionManagerServiceStub") - hook(vims.getDeclaredMethod("getContextualSearchIntent", Bundle::class.java), ContextualSearchIntentHooker::class.java) - }.onFailure { e -> - log("hook system fail", e) - } - } - - @XposedHooker - class ReturnTrueHooker : Hooker { - companion object { - @JvmStatic - @BeforeInvocation - fun before(callback: BeforeHookCallback) { - callback.returnAndSkip(true) - } - } - } - - @XposedHooker - class ReturnFalseHooker : Hooker { - companion object { - @JvmStatic - @BeforeInvocation - fun before(callback: BeforeHookCallback) { - callback.returnAndSkip(false) - } - } - } - - @XposedHooker - class NavStubViewHooker : Hooker { - companion object { - @SuppressLint("PrivateApi") - private val mCheckLongPress = Runnable { - runCatching { - val bundle = Bundle() - bundle.putLong("invocation_time_ms", SystemClock.elapsedRealtime()) - bundle.putInt("omni.entry_point", 1) - val iVims = Class.forName("com.android.internal.app.IVoiceInteractionManagerService\$Stub") - val asInterfaceMethod = iVims.getMethod("asInterface", IBinder::class.java) - val getServiceMethod = Class.forName("android.os.ServiceManager").getMethod("getService", String::class.java) - val vimsInstance = asInterfaceMethod.invoke(null, getServiceMethod.invoke(null, "voiceinteraction")) ?: return@Runnable - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { - val showSessionFromSession = vimsInstance.javaClass.getDeclaredMethod("showSessionFromSession", IBinder::class.java, Bundle::class.java, Integer.TYPE, String::class.java) - showSessionFromSession.invoke(vimsInstance, null, bundle, 7, "hyperOS_home") - } else { - val showSessionFromSession = vimsInstance.javaClass.getDeclaredMethod("showSessionFromSession", IBinder::class.java, Bundle::class.java, Integer.TYPE) - showSessionFromSession.invoke(vimsInstance, null, bundle, 7) - } - }.onFailure { e -> - module.log("NavStubViewHooker mCheckLongPress fail", e) - } - } - - @JvmStatic - @AfterInvocation - fun after(callback: AfterHookCallback) { - val view = callback.thisObject as View - view.removeCallbacks(this.mCheckLongPress) - runCatching { - val mCurrAction = callback.thisObject!!.javaClass.getDeclaredField("mCurrAction") - mCurrAction.isAccessible = true - if (mCurrAction.getInt(callback.thisObject) == 0) { - view.postDelayed(this.mCheckLongPress, ViewConfiguration.getLongPressTimeout().toLong()) - } - }.onFailure { e -> - module.log("NavStubViewHooker onTouchEvent fail", e) - } - } - } - } - - override fun onPackageLoaded(param: PackageLoadedParam) { - super.onPackageLoaded(param) - if (param.packageName != "com.miui.home" || !param.isFirstPackage) return - - runCatching { - val circleToSearchHelper = param.classLoader.loadClass("com.miui.home.recents.cts.CircleToSearchHelper") - hook(circleToSearchHelper.getDeclaredMethod("isSceneForbid", Context::class.java, Int::class.java), ReturnFalseHooker::class.java) - hook(circleToSearchHelper.getDeclaredMethod("hasCtsFeature", Context::class.java), ReturnTrueHooker::class.java) - hook(circleToSearchHelper.getDeclaredMethod("isSettingsLongPressHomeAssistantEnabled", Context::class.java), ReturnTrueHooker::class.java) - hook(circleToSearchHelper.getDeclaredMethod("isThirdHome", Context::class.java), ReturnFalseHooker::class.java) - return - }.onFailure { e -> - log("hook CircleToSearchHelper fail", e) - } - - runCatching { - val navStubView = param.classLoader.loadClass("com.miui.home.recents.NavStubView") - runCatching { navStubView.getDeclaredField("mCheckLongPress") } - .onSuccess { throw Exception("mCheckLongPress exists") } - .onFailure { - hook(navStubView.getDeclaredMethod("onTouchEvent", MotionEvent::class.java), NavStubViewHooker::class.java) - } - }.onFailure { e -> - log("hook NavStubView fail", e) - } - } -} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/ModuleMain.kt b/app/src/main/java/com/parallelc/micts/ModuleMain.kt new file mode 100644 index 0000000..363dae3 --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/ModuleMain.kt @@ -0,0 +1,89 @@ +package com.parallelc.micts + +import android.annotation.SuppressLint +import android.content.Context +import android.os.Build +import android.os.Bundle +import android.os.IBinder +import android.os.SystemClock +import android.view.MotionEvent +import com.parallelc.micts.hooker.ContextualSearchIntentHooker +import com.parallelc.micts.hooker.LongPressHomeHooker +import com.parallelc.micts.hooker.NavStubViewHooker +import com.parallelc.micts.hooker.ResourcesHooker +import com.parallelc.micts.hooker.ReturnFalseHooker +import com.parallelc.micts.hooker.ReturnTrueHooker +import io.github.libxposed.api.XposedInterface +import io.github.libxposed.api.XposedModule +import io.github.libxposed.api.XposedModuleInterface.ModuleLoadedParam +import io.github.libxposed.api.XposedModuleInterface.PackageLoadedParam +import io.github.libxposed.api.XposedModuleInterface.SystemServerLoadedParam + +@SuppressLint("PrivateApi") +fun triggerCircleToSearch() { + val bundle = Bundle() + bundle.putLong("invocation_time_ms", SystemClock.elapsedRealtime()) + bundle.putInt("omni.entry_point", 1) + val iVims = Class.forName("com.android.internal.app.IVoiceInteractionManagerService\$Stub") + val asInterfaceMethod = iVims.getMethod("asInterface", IBinder::class.java) + val getServiceMethod = Class.forName("android.os.ServiceManager").getMethod("getService", String::class.java) + val vimsInstance = asInterfaceMethod.invoke(null, getServiceMethod.invoke(null, "voiceinteraction")) ?: return + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE) { + val showSessionFromSession = vimsInstance.javaClass.getDeclaredMethod("showSessionFromSession", IBinder::class.java, Bundle::class.java, Integer.TYPE, String::class.java) + showSessionFromSession.invoke(vimsInstance, null, bundle, 7, "hyperOS_home") + } else { + val showSessionFromSession = vimsInstance.javaClass.getDeclaredMethod("showSessionFromSession", IBinder::class.java, Bundle::class.java, Integer.TYPE) + showSessionFromSession.invoke(vimsInstance, null, bundle, 7) + } +} + +lateinit var module: ModuleMain + +class ModuleMain(base: XposedInterface, param: ModuleLoadedParam) : XposedModule(base, param) { + + init { + module = this + } + + @SuppressLint("PrivateApi") + override fun onSystemServerLoaded(param: SystemServerLoadedParam) { + super.onSystemServerLoaded(param) + + runCatching { + LongPressHomeHooker.hook(param) + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.UPSIDE_DOWN_CAKE) return + ResourcesHooker.hook(param) + val vims = param.classLoader.loadClass("com.android.server.voiceinteraction.VoiceInteractionManagerService\$VoiceInteractionManagerServiceStub") + hook(vims.getDeclaredMethod("getContextualSearchIntent", Bundle::class.java), ContextualSearchIntentHooker::class.java) + }.onFailure { e -> + log("hook system fail", e) + } + } + + override fun onPackageLoaded(param: PackageLoadedParam) { + super.onPackageLoaded(param) + if (param.packageName != "com.miui.home" || !param.isFirstPackage) return + + runCatching { + val circleToSearchHelper = param.classLoader.loadClass("com.miui.home.recents.cts.CircleToSearchHelper") + hook(circleToSearchHelper.getDeclaredMethod("isSceneForbid", Context::class.java, Int::class.java), ReturnFalseHooker::class.java) + hook(circleToSearchHelper.getDeclaredMethod("hasCtsFeature", Context::class.java), ReturnTrueHooker::class.java) + hook(circleToSearchHelper.getDeclaredMethod("isSettingsLongPressHomeAssistantEnabled", Context::class.java), ReturnTrueHooker::class.java) + hook(circleToSearchHelper.getDeclaredMethod("isThirdHome", Context::class.java), ReturnFalseHooker::class.java) + return + }.onFailure { e -> + log("hook CircleToSearchHelper fail", e) + } + + runCatching { + val navStubView = param.classLoader.loadClass("com.miui.home.recents.NavStubView") + runCatching { navStubView.getDeclaredField("mCheckLongPress") } + .onSuccess { throw Exception("mCheckLongPress exists") } + .onFailure { + hook(navStubView.getDeclaredMethod("onTouchEvent", MotionEvent::class.java), NavStubViewHooker::class.java) + } + }.onFailure { e -> + log("hook NavStubView fail", e) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/hooker/ContextualSearchIntentHooker.kt b/app/src/main/java/com/parallelc/micts/hooker/ContextualSearchIntentHooker.kt new file mode 100644 index 0000000..24a2dea --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/hooker/ContextualSearchIntentHooker.kt @@ -0,0 +1,18 @@ +package com.parallelc.micts.hooker + +import android.content.Intent +import io.github.libxposed.api.XposedInterface.AfterHookCallback +import io.github.libxposed.api.XposedInterface.Hooker +import io.github.libxposed.api.annotations.AfterInvocation +import io.github.libxposed.api.annotations.XposedHooker + +@XposedHooker +class ContextualSearchIntentHooker : Hooker { + companion object { + @JvmStatic + @AfterInvocation + fun after(callback: AfterHookCallback) { + (callback.result as Intent).putExtra("com.android.contextualsearch.flag_secure_found", false) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/hooker/LongPressHomeHooker.kt b/app/src/main/java/com/parallelc/micts/hooker/LongPressHomeHooker.kt new file mode 100644 index 0000000..9f5f9a4 --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/hooker/LongPressHomeHooker.kt @@ -0,0 +1,62 @@ +package com.parallelc.micts.hooker + +import android.os.Bundle +import com.parallelc.micts.module +import com.parallelc.micts.triggerCircleToSearch +import io.github.libxposed.api.XposedInterface.AfterHookCallback +import io.github.libxposed.api.XposedInterface.BeforeHookCallback +import io.github.libxposed.api.XposedInterface.Hooker +import io.github.libxposed.api.XposedInterface.MethodUnhooker +import io.github.libxposed.api.XposedModuleInterface.SystemServerLoadedParam +import io.github.libxposed.api.annotations.AfterInvocation +import io.github.libxposed.api.annotations.BeforeInvocation +import io.github.libxposed.api.annotations.XposedHooker +import java.lang.reflect.Method + +class LongPressHomeHooker { + companion object { + private var hookFunction = mutableMapOf() + + fun hook(param: SystemServerLoadedParam) { + val shortCutActionsUtils = param.classLoader.loadClass("com.miui.server.input.util.ShortCutActionsUtils") + hookFunction["launch_voice_assistant"] = shortCutActionsUtils.declaredMethods.firstOrNull { method: Method -> method.name == "launchVoiceAssistant" } + hookFunction["launch_google_search"] = shortCutActionsUtils.declaredMethods.firstOrNull { method: Method -> method.name == "launchGoogleSearch" } + module.hook( + shortCutActionsUtils.getDeclaredMethod("triggerFunction", String::class.java, String::class.java, Bundle::class.java, Boolean::class.java, String::class.java), + TriggerFunctionHooker::class.java + ) + } + + @XposedHooker + class LaunchFunctionHooker : Hooker { + companion object { + @JvmStatic + @BeforeInvocation + fun before(callback: BeforeHookCallback) { + triggerCircleToSearch() + callback.returnAndSkip(true) + } + } + } + + @XposedHooker + class TriggerFunctionHooker : Hooker { + companion object { + @JvmStatic + @BeforeInvocation + fun before(callback: BeforeHookCallback) : MethodUnhooker? { + if (callback.args[1] == "long_press_home_key" || callback.args[1] == "long_press_home_key_no_ui") { + hookFunction[callback.args[0]]?.let { return module.hook(it, LaunchFunctionHooker::class.java) } + } + return null + } + + @JvmStatic + @AfterInvocation + fun after(callback: AfterHookCallback, unhook: MethodUnhooker?) { + unhook?.unhook() + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/hooker/NavStubViewHooker.kt b/app/src/main/java/com/parallelc/micts/hooker/NavStubViewHooker.kt new file mode 100644 index 0000000..c69fc07 --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/hooker/NavStubViewHooker.kt @@ -0,0 +1,39 @@ +package com.parallelc.micts.hooker + +import android.view.View +import android.view.ViewConfiguration +import com.parallelc.micts.module +import com.parallelc.micts.triggerCircleToSearch +import io.github.libxposed.api.XposedInterface.AfterHookCallback +import io.github.libxposed.api.XposedInterface.Hooker +import io.github.libxposed.api.annotations.AfterInvocation +import io.github.libxposed.api.annotations.XposedHooker + +@XposedHooker +class NavStubViewHooker : Hooker { + companion object { + private val mCheckLongPress = Runnable { + runCatching { + triggerCircleToSearch() + }.onFailure { e -> + module.log("NavStubViewHooker mCheckLongPress fail", e) + } + } + + @JvmStatic + @AfterInvocation + fun after(callback: AfterHookCallback) { + val view = callback.thisObject as View + view.removeCallbacks(this.mCheckLongPress) + runCatching { + val mCurrAction = callback.thisObject!!.javaClass.getDeclaredField("mCurrAction") + mCurrAction.isAccessible = true + if (mCurrAction.getInt(callback.thisObject) == 0) { + view.postDelayed(this.mCheckLongPress, ViewConfiguration.getLongPressTimeout().toLong()) + } + }.onFailure { e -> + module.log("NavStubViewHooker onTouchEvent fail", e) + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/hooker/ResourcesHooker.kt b/app/src/main/java/com/parallelc/micts/hooker/ResourcesHooker.kt new file mode 100644 index 0000000..f328227 --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/hooker/ResourcesHooker.kt @@ -0,0 +1,41 @@ +package com.parallelc.micts.hooker + +import android.annotation.SuppressLint +import android.content.res.Resources +import com.parallelc.micts.module +import io.github.libxposed.api.XposedInterface.BeforeHookCallback +import io.github.libxposed.api.XposedInterface.Hooker +import io.github.libxposed.api.XposedModuleInterface.SystemServerLoadedParam +import io.github.libxposed.api.annotations.BeforeInvocation +import io.github.libxposed.api.annotations.XposedHooker + +class ResourcesHooker { + companion object { + private var R: Class<*>? = null + + @SuppressLint("PrivateApi") + fun hook(param: SystemServerLoadedParam) { + R = param.classLoader.loadClass("com.android.internal.R\$string") + module.hook(Resources::class.java.getDeclaredMethod("getString", Int::class.java), GetStringHooker::class.java) + } + + @XposedHooker + class GetStringHooker : Hooker { + companion object { + @JvmStatic + @BeforeInvocation + fun before(callback: BeforeHookCallback) { + when (callback.args[0]) { + R!!.getField("config_defaultContextualSearchKey").getInt(null) -> { + callback.returnAndSkip("omni.entry_point") + } + + R!!.getField("config_defaultContextualSearchPackageName").getInt(null) -> { + callback.returnAndSkip("com.google.android.googlequicksearchbox") + } + } + } + } + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/hooker/ReturnFalseHooker.kt b/app/src/main/java/com/parallelc/micts/hooker/ReturnFalseHooker.kt new file mode 100644 index 0000000..1df752a --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/hooker/ReturnFalseHooker.kt @@ -0,0 +1,17 @@ +package com.parallelc.micts.hooker + +import io.github.libxposed.api.XposedInterface.BeforeHookCallback +import io.github.libxposed.api.XposedInterface.Hooker +import io.github.libxposed.api.annotations.BeforeInvocation +import io.github.libxposed.api.annotations.XposedHooker + +@XposedHooker +class ReturnFalseHooker : Hooker { + companion object { + @JvmStatic + @BeforeInvocation + fun before(callback: BeforeHookCallback) { + callback.returnAndSkip(false) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/com/parallelc/micts/hooker/ReturnTrueHooker.kt b/app/src/main/java/com/parallelc/micts/hooker/ReturnTrueHooker.kt new file mode 100644 index 0000000..4d8155d --- /dev/null +++ b/app/src/main/java/com/parallelc/micts/hooker/ReturnTrueHooker.kt @@ -0,0 +1,17 @@ +package com.parallelc.micts.hooker + +import io.github.libxposed.api.XposedInterface.BeforeHookCallback +import io.github.libxposed.api.XposedInterface.Hooker +import io.github.libxposed.api.annotations.BeforeInvocation +import io.github.libxposed.api.annotations.XposedHooker + +@XposedHooker +class ReturnTrueHooker : Hooker { + companion object { + @JvmStatic + @BeforeInvocation + fun before(callback: BeforeHookCallback) { + callback.returnAndSkip(true) + } + } +} \ No newline at end of file