From 8ba166dab9f34ad5cd9ab0d9a7937ca81e7d5d10 Mon Sep 17 00:00:00 2001 From: fankesyooni Date: Thu, 21 Sep 2023 03:19:13 +0800 Subject: [PATCH] style: lots of changes - move demo-app, demo-module to samples - rename yukihookapi to yukihookapi-core - optimize code - other small changes --- .../yukihookapi/demo_app/test/Main.java | 36 -- .../yukihookapi/demo_app/test/SuperMain.java | 22 - img-src/wechat_code.jpg | Bin 13706 -> 0 bytes {demo-app => samples}/.gitignore | 0 {yukihookapi => samples/demo-app}/.gitignore | 0 .../demo-app}/proguard-rules.pro | 0 .../demo-app}/src/main/AndroidManifest.xml | 0 .../src/main/ic_launcher-playstore.png | Bin .../yukihookapi/demo_app/test/Main.java | 63 ++ .../yukihookapi/demo_app/test/SuperMain.java | 49 ++ .../yukihookapi/demo_app/ui/MainActivity.kt | 0 .../src/main/res/layout/activity_main.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../mipmap-hdpi/ic_launcher_foreground.png | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../mipmap-mdpi/ic_launcher_foreground.png | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../mipmap-xhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin .../res/mipmap-xxhdpi/ic_face_unhappy.png | Bin .../src/main/res/mipmap-xxhdpi/ic_icon.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin .../src/main/res/values-night/themes.xml | 0 .../demo-app}/src/main/res/values/colors.xml | 0 .../res/values/ic_launcher_background.xml | 0 .../demo-app}/src/main/res/values/strings.xml | 0 .../demo-app}/src/main/res/values/themes.xml | 0 .../demo-module}/.gitignore | 0 .../demo-module}/proguard-rules.pro | 0 .../demo-module}/src/main/AndroidManifest.xml | 0 .../src/main/ic_launcher-playstore.png | Bin .../application/DemoApplication.kt | 0 .../yukihookapi/demo_module/data/DataConst.kt | 0 .../yukihookapi/demo_module/hook/HookEntry.kt | 10 +- .../hook/factory/ComponentCompatFactory.kt | 0 .../demo_module/hook/java/HookEntry.java | 2 - .../demo_module/ui/MainActivity.kt | 2 +- .../demo_module/ui/PreferenceActivity.kt | 0 .../res/drawable/ic_launcher_foreground.xml | 0 .../src/main/res/layout/activity_main.xml | 0 .../res/mipmap-anydpi-v26/ic_launcher.xml | 0 .../mipmap-anydpi-v26/ic_launcher_round.xml | 0 .../src/main/res/mipmap-hdpi/ic_launcher.png | Bin .../mipmap-hdpi/ic_launcher_foreground.png | Bin .../res/mipmap-hdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-mdpi/ic_launcher.png | Bin .../mipmap-mdpi/ic_launcher_foreground.png | Bin .../res/mipmap-mdpi/ic_launcher_round.png | Bin .../src/main/res/mipmap-xhdpi/ic_launcher.png | Bin .../mipmap-xhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xhdpi/ic_launcher_round.png | Bin .../main/res/mipmap-xxhdpi/ic_face_happy.png | Bin .../src/main/res/mipmap-xxhdpi/ic_icon.png | Bin .../main/res/mipmap-xxhdpi/ic_launcher.png | Bin .../mipmap-xxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxhdpi/ic_launcher_round.png | Bin .../main/res/mipmap-xxxhdpi/ic_launcher.png | Bin .../mipmap-xxxhdpi/ic_launcher_foreground.png | Bin .../res/mipmap-xxxhdpi/ic_launcher_round.png | Bin .../src/main/res/values-night/themes.xml | 0 .../src/main/res/values/array.xml | 0 .../src/main/res/values/colors.xml | 0 .../res/values/ic_launcher_background.xml | 0 .../src/main/res/values/strings.xml | 0 .../src/main/res/values/themes.xml | 0 .../src/main/res/xml/settings_preferences.xml | 0 yukihookapi-core/.gitignore | 1 + .../consumer-rules.pro | 0 .../proguard-rules.pro | 0 .../src/main/AndroidManifest.xml | 0 .../highcapable/yukihookapi/YukiHookAPI.kt | 5 +- .../annotation/CauseProblemsApi.kt | 2 +- .../yukihookapi/annotation/YukiGenerateApi.kt | 2 +- .../yukihookapi/annotation/YukiPrivateApi.kt | 2 +- .../xposed/InjectYukiHookWithXposed.kt | 0 .../yukihookapi/hook/bean/CurrentClass.kt | 2 +- .../yukihookapi/hook/bean/GenericClass.kt | 0 .../yukihookapi/hook/bean/HookClass.kt | 0 .../yukihookapi/hook/bean/HookResources.kt | 0 .../yukihookapi/hook/bean/VariousClass.kt | 0 .../hook/core/YukiMemberHookCreator.kt | 23 +- .../hook/core/YukiResourcesHookCreator.kt | 20 +- .../hook/core/api/compat/HookApiCategory.kt | 0 .../core/api/compat/HookApiCategoryHelper.kt | 0 .../hook/core/api/compat/HookApiProperty.kt | 0 .../hook/core/api/compat/HookCompatHelper.kt | 0 .../hook/core/api/compat/type/ExecutorType.kt | 0 .../api/factory/YukiHookDelegateFactory.kt | 0 .../hook/core/api/helper/YukiHookHelper.kt | 0 .../core/api/priority/YukiHookPriority.kt | 0 .../hook/core/api/proxy/YukiHookCallback.kt | 0 .../hook/core/api/proxy/YukiMemberHook.kt | 0 .../core/api/proxy/YukiMemberReplacement.kt | 0 .../hook/core/api/result/YukiHookResult.kt | 0 .../hook/core/api/store/YukiHookCacheStore.kt | 0 .../hook/core/finder/base/BaseFinder.kt | 0 .../hook/core/finder/base/ClassBaseFinder.kt | 0 .../hook/core/finder/base/MemberBaseFinder.kt | 0 .../core/finder/base/data/BaseRulesData.kt | 0 .../hook/core/finder/base/rules/CountRules.kt | 0 .../core/finder/base/rules/ModifierRules.kt | 0 .../hook/core/finder/base/rules/NameRules.kt | 0 .../core/finder/base/rules/ObjectRules.kt | 0 .../core/finder/classes/DexClassFinder.kt | 2 +- .../finder/classes/data/ClassRulesData.kt | 10 +- .../finder/classes/rules/ConstructorRules.kt | 0 .../core/finder/classes/rules/FieldRules.kt | 0 .../core/finder/classes/rules/MemberRules.kt | 0 .../core/finder/classes/rules/MethodRules.kt | 0 .../finder/classes/rules/base/BaseRules.kt | 0 .../classes/rules/result/MemberRulesResult.kt | 0 .../core/finder/members/ConstructorFinder.kt | 0 .../hook/core/finder/members/FieldFinder.kt | 0 .../hook/core/finder/members/MethodFinder.kt | 9 +- .../members/data/ConstructorRulesData.kt | 2 +- .../finder/members/data/FieldRulesData.kt | 0 .../finder/members/data/MemberRulesData.kt | 0 .../finder/members/data/MethodRulesData.kt | 6 +- .../hook/core/finder/tools/ReflectionTool.kt | 6 +- .../finder/type/factory/TypeAliasFactory.kt | 0 .../yukihookapi/hook/entity/YukiBaseHooker.kt | 0 .../hook/factory/ReflectionFactory.kt | 34 +- .../hook/factory/YukiHookFactory.kt | 2 +- .../yukihookapi/hook/log/LoggerFactory.kt | 3 +- .../yukihookapi/hook/param/HookParam.kt | 0 .../yukihookapi/hook/param/PackageParam.kt | 8 +- .../hook/param/wrapper/PackageParamWrapper.kt | 0 .../hook/type/android/ComponentTypeFactory.kt | 2 +- .../hook/type/android/GraphicsTypeFactory.kt | 29 +- .../hook/type/android/ViewTypeFactory.kt | 40 +- .../hook/type/defined/DefinedTypeFactory.kt | 0 .../hook/type/java/VariableTypeFactory.kt | 2 +- .../yukihookapi/hook/utils/UtilsFactory.kt | 2 +- .../xposed/application/ModuleApplication.kt | 0 .../hook/xposed/bridge/YukiXposedModule.kt | 0 .../bridge/caller/YukiXposedModuleCaller.kt | 0 .../delegate/XSharedPreferencesDelegate.kt | 0 .../xposed/bridge/event/YukiXposedEvent.kt | 0 .../event/caller/YukiXposedEventCaller.kt | 0 .../proxy/IYukiXposedModuleLifecycle.kt | 0 .../bridge/resources/YukiModuleResources.kt | 0 .../bridge/resources/YukiResForwarder.kt | 0 .../xposed/bridge/resources/YukiResources.kt | 0 .../caller/YukiXposedResourcesCaller.kt | 0 .../bridge/status/YukiXposedModuleStatus.kt | 0 .../hook/xposed/bridge/type/HookEntryType.kt | 0 .../xposed/channel/YukiHookDataChannel.kt | 33 +- .../hook/xposed/channel/data/ChannelData.kt | 0 .../data/wrapper/ChannelDataWrapper.kt | 0 .../channel/priority/ChannelPriority.kt | 0 .../hook/xposed/parasitic/AppParasitics.kt | 47 +- .../activity/base/ModuleAppActivity.kt | 0 .../activity/base/ModuleAppCompatActivity.kt | 0 .../activity/config/ActivityProxyConfig.kt | 0 .../delegate/InstrumentationDelegate.kt | 13 +- .../delegate/caller/HandlerDelegateCaller.kt | 0 .../caller/IActivityManagerProxyCaller.kt | 6 +- .../delegate/impl/HandlerDelegateImpl.kt | 0 .../impl/IActivityManagerProxyImpl.kt | 0 .../wrapper/ModuleContextThemeWrapper.kt | 0 .../parasitic/reference/ModuleClassLoader.kt | 0 .../hook/xposed/prefs/YukiHookPrefsBridge.kt | 2 +- .../hook/xposed/prefs/data/PrefsData.kt | 0 .../prefs/ui/ModulePreferenceFragment.kt | 0 .../hook/xposed/proxy/IYukiHookXposedInit.kt | 0 .../xposed/proxy/YukiHookXposedInitProxy.kt | 0 .../YukiHookXposedProcessor.kt | 35 +- .../bean/GenerateData.kt | 2 +- .../factory/CodeSourceFileFactory.kt | 540 ++++++++++++++++++ .../factory/CodeSourceFileFactory.kt | 525 ----------------- 179 files changed, 919 insertions(+), 682 deletions(-) delete mode 100644 demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/Main.java delete mode 100644 demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/SuperMain.java delete mode 100644 img-src/wechat_code.jpg rename {demo-app => samples}/.gitignore (100%) rename {yukihookapi => samples/demo-app}/.gitignore (100%) rename {demo-app => samples/demo-app}/proguard-rules.pro (100%) rename {demo-app => samples/demo-app}/src/main/AndroidManifest.xml (100%) rename {demo-app => samples/demo-app}/src/main/ic_launcher-playstore.png (100%) create mode 100644 samples/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/Main.java create mode 100644 samples/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/SuperMain.java rename {demo-app => samples/demo-app}/src/main/java/com/highcapable/yukihookapi/demo_app/ui/MainActivity.kt (100%) rename {demo-app => samples/demo-app}/src/main/res/layout/activity_main.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-hdpi/ic_launcher_foreground.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-hdpi/ic_launcher_round.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-mdpi/ic_launcher_foreground.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-mdpi/ic_launcher_round.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxhdpi/ic_face_unhappy.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxhdpi/ic_icon.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png (100%) rename {demo-app => samples/demo-app}/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) rename {demo-app => samples/demo-app}/src/main/res/values-night/themes.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/values/colors.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/values/ic_launcher_background.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/values/strings.xml (100%) rename {demo-app => samples/demo-app}/src/main/res/values/themes.xml (100%) rename {demo-module => samples/demo-module}/.gitignore (100%) rename {demo-module => samples/demo-module}/proguard-rules.pro (100%) rename {demo-module => samples/demo-module}/src/main/AndroidManifest.xml (100%) rename {demo-module => samples/demo-module}/src/main/ic_launcher-playstore.png (100%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/application/DemoApplication.kt (100%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/data/DataConst.kt (100%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/hook/HookEntry.kt (98%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt (100%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/hook/java/HookEntry.java (98%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/ui/MainActivity.kt (99%) rename {demo-module => samples/demo-module}/src/main/java/com/highcapable/yukihookapi/demo_module/ui/PreferenceActivity.kt (100%) rename {demo-module => samples/demo-module}/src/main/res/drawable/ic_launcher_foreground.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/layout/activity_main.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-anydpi-v26/ic_launcher.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-hdpi/ic_launcher.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-hdpi/ic_launcher_foreground.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-hdpi/ic_launcher_round.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-mdpi/ic_launcher.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-mdpi/ic_launcher_foreground.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-mdpi/ic_launcher_round.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xhdpi/ic_launcher.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xhdpi/ic_launcher_foreground.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xhdpi/ic_launcher_round.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxhdpi/ic_face_happy.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxhdpi/ic_icon.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxhdpi/ic_launcher.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxhdpi/ic_launcher_foreground.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxhdpi/ic_launcher_round.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxxhdpi/ic_launcher.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxxhdpi/ic_launcher_foreground.png (100%) rename {demo-module => samples/demo-module}/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png (100%) rename {demo-module => samples/demo-module}/src/main/res/values-night/themes.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/values/array.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/values/colors.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/values/ic_launcher_background.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/values/strings.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/values/themes.xml (100%) rename {demo-module => samples/demo-module}/src/main/res/xml/settings_preferences.xml (100%) create mode 100644 yukihookapi-core/.gitignore rename {yukihookapi => yukihookapi-core}/consumer-rules.pro (100%) rename {yukihookapi => yukihookapi-core}/proguard-rules.pro (100%) rename {yukihookapi => yukihookapi-core}/src/main/AndroidManifest.xml (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/YukiHookAPI.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/annotation/CauseProblemsApi.kt (94%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/annotation/YukiGenerateApi.kt (95%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/annotation/YukiPrivateApi.kt (94%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/annotation/xposed/InjectYukiHookWithXposed.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/bean/CurrentClass.kt (98%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/bean/GenericClass.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/bean/HookClass.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/bean/HookResources.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/bean/VariousClass.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/YukiMemberHookCreator.kt (96%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/YukiResourcesHookCreator.kt (94%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategory.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategoryHelper.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookCompatHelper.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/factory/YukiHookDelegateFactory.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiHookCallback.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberHook.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberReplacement.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/result/YukiHookResult.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/api/store/YukiHookCacheStore.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt (92%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt (98%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt (97%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt (93%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt (90%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt (98%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/param/wrapper/PackageParamWrapper.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt (85%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt (88%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt (98%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/YukiXposedModule.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/caller/YukiXposedModuleCaller.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/delegate/XSharedPreferencesDelegate.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/caller/YukiXposedEventCaller.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/proxy/IYukiXposedModuleLifecycle.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/caller/YukiXposedResourcesCaller.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/status/YukiXposedModuleStatus.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/type/HookEntryType.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt (96%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/wrapper/ChannelDataWrapper.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt (91%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/config/ActivityProxyConfig.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt (96%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/HandlerDelegateCaller.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt (93%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/HandlerDelegateImpl.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/IActivityManagerProxyImpl.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt (99%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.kt (100%) rename {yukihookapi => yukihookapi-core}/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt (100%) rename yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/{yukihookapi_ksp_xposed => yukihookapi}/YukiHookXposedProcessor.kt (92%) rename yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/{yukihookapi_ksp_xposed => yukihookapi}/bean/GenerateData.kt (97%) create mode 100644 yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/factory/CodeSourceFileFactory.kt delete mode 100644 yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/factory/CodeSourceFileFactory.kt diff --git a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/Main.java b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/Main.java deleted file mode 100644 index 1147f867..00000000 --- a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/Main.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.highcapable.yukihookapi.demo_app.test; - -public class Main extends SuperMain { - - private final String content; - - public Main() { - super(""); - content = ""; - } - - public Main(String content) { - super(content); - this.content = content; - } - - public String getTestResultFirst() { - return "The world is beautiful"; - } - - public String getTestResultFirst(String string) { - return string; - } - - public String getTestResultLast() { - return "The world is fantastic"; - } - - public final String getTestResultLast(String string) { - return string; - } - - public String getContent() { - return content; - } -} \ No newline at end of file diff --git a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/SuperMain.java b/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/SuperMain.java deleted file mode 100644 index 32efe923..00000000 --- a/demo-app/src/main/java/com/highcapable/yukihookapi/demo_app/test/SuperMain.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.highcapable.yukihookapi.demo_app.test; - -public class SuperMain { - - private final String content; - - public SuperMain(String content) { - this.content = content; - } - - public String getSuperString() { - return "The sea is blue"; - } - - public String getString() { - return getContent(); - } - - public String getContent() { - return content; - } -} \ No newline at end of file diff --git a/img-src/wechat_code.jpg b/img-src/wechat_code.jpg deleted file mode 100644 index 15dbcde732e33274e1eabce591b2b27de4d3e582..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 13706 zcmaL7WmFv75-2=42@oU@++7BT!8LfW;2zu=d~i*032s4xCc%QsV8IFQfk6U;!=S8eu2=J8c2}3~uIg1?wI6>yt^r8oeC%xi03{_h04Crccsu~$zxJ|p^aUUR zP@m9L0KnrKO1zz?r>h7Tmx~9dxfR&Ln$r^O%;jV5%EiOU%>@vX^l>$}bhP%Qv9Pwa zcM+#Mf_Bo;*jtIy=?SQEtGdcs+u1Anxm#=bscBpKIa&%^(Md|si1~>4IJ-Jqdz#bu zI6Jv`i1>)p{Y$vW)A}zo7ah&NNIV_I>7@VCN~5o;K_d%xx26%~~71&BP=Y;#m&pb%L{y>0DAbkc$)hFT|DUjmhjrz!_wW})zcpALi3kIa|^JS zr#Rh{ssHxD*;Q5bKZ5_~b~!u$<=DTdJv`r9|6|7gr1sGEb+zVtYwZE{a<{a8BB%eG z`Dye1--`Yse6mJF-QE7_shB&x23vYLTf2BFy%wi?y2EK@ZzUqYEBv&LR>D9&kN^nC z&&_KMwBWO`0P^tj@Cw-oTM1a33;iwUfAI_Q%kc4lGlkR`>%E|vfc|~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IdrudNngV2k`Enw%0taz>iXRaoz3Y>5Pqbmx_Kp7?1Xw@}LnU{}Irw(nmd8gEX6(94c{_^xN0=2MOZO84ye^aB@d=(B}!W@|8i4piiYn`Kq9YiUV$ z-=MeDHaE#UO#%9guaNh&_4fCL{}EEZtcva*ed(KCGqh+r hookResources.instance?.hookLayout(resourceId, layoutInstance!!) - { onHookLogMsg(msg = "Hook Resources Layout Id $resourceId done [$tag]") } - else -> hookResources.instance?.setReplacement(resourceId, compat(replaceInstance)) - { onHookLogMsg(msg = "Hook Resources Value Id $resourceId done [$tag]") } + layoutInstance != null -> hookResources.instance?.hookLayout(resourceId, layoutInstance!!) { + onHookLogMsg(msg = "Hook Resources Layout Id $resourceId done [$tag]") + } + else -> hookResources.instance?.setReplacement(resourceId, compat(replaceInstance)) { + onHookLogMsg(msg = "Hook Resources Value Id $resourceId done [$tag]") + } } packageParam.wrapper?.type == HookEntryType.ZYGOTE -> if (resourceId == -1) when { @@ -214,10 +216,12 @@ class YukiResourcesHookCreator @PublishedApi internal constructor( conditions!!.name, compat(replaceInstance) ) { onHookLogMsg(msg = "Hook Wide Resources Value $conditions done [$tag]") } } else when { - layoutInstance != null -> YukiResources.hookSystemWideLayout(resourceId, layoutInstance!!) - { onHookLogMsg(msg = "Hook Wide Resources Layout Id $resourceId done [$tag]") } - else -> YukiResources.setSystemWideReplacement(resourceId, compat(replaceInstance)) - { onHookLogMsg(msg = "Hook Wide Resources Value Id $resourceId done [$tag]") } + layoutInstance != null -> YukiResources.hookSystemWideLayout(resourceId, layoutInstance!!) { + onHookLogMsg(msg = "Hook Wide Resources Layout Id $resourceId done [$tag]") + } + else -> YukiResources.setSystemWideReplacement(resourceId, compat(replaceInstance)) { + onHookLogMsg(msg = "Hook Wide Resources Value Id $resourceId done [$tag]") + } } else -> yLoggerE(msg = "Resources Hook type is invalid [$tag]") } diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategory.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategory.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategoryHelper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategoryHelper.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategoryHelper.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiCategoryHelper.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookApiProperty.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookCompatHelper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookCompatHelper.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookCompatHelper.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/HookCompatHelper.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/compat/type/ExecutorType.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/factory/YukiHookDelegateFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/factory/YukiHookDelegateFactory.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/factory/YukiHookDelegateFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/factory/YukiHookDelegateFactory.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/helper/YukiHookHelper.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/priority/YukiHookPriority.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiHookCallback.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiHookCallback.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiHookCallback.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiHookCallback.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberHook.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberHook.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberHook.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberHook.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberReplacement.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberReplacement.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberReplacement.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/proxy/YukiMemberReplacement.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/result/YukiHookResult.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/result/YukiHookResult.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/result/YukiHookResult.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/result/YukiHookResult.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/store/YukiHookCacheStore.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/store/YukiHookCacheStore.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/api/store/YukiHookCacheStore.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/api/store/YukiHookCacheStore.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/BaseFinder.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/ClassBaseFinder.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/MemberBaseFinder.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/data/BaseRulesData.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/CountRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ModifierRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/NameRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/base/rules/ObjectRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt index 84ed37c8..65562f44 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/DexClassFinder.kt @@ -94,7 +94,7 @@ class DexClassFinder @PublishedApi internal constructor( * @return [SharedPreferences] */ private fun Context.currentSp(versionName: String? = null, versionCode: Long? = null) = - @Suppress("DEPRECATION") + @Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress") getSharedPreferences(packageManager?.getPackageInfo(packageName, PackageManager.GET_META_DATA) ?.let { "${CACHE_FILE_NAME}_${versionName ?: it.versionName}_${versionCode ?: PackageInfoCompat.getLongVersionCode(it)}" } ?: "${CACHE_FILE_NAME}_unknown", diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt similarity index 92% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt index 96706808..6bf6efa6 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/data/ClassRulesData.kt @@ -171,11 +171,11 @@ internal class ClassRulesData internal constructor( override val isInitialize get() = super.isInitialize || fromPackages.isNotEmpty() || fullName != null || simpleName != null || singleName != null || - fullNameConditions != null || simpleNameConditions != null || singleNameConditions != null || isAnonymousClass != null || - isNoExtendsClass != null || isNoImplementsClass != null || extendsClass.isNotEmpty() || enclosingClass.isNotEmpty() || - memberRules.isNotEmpty() || fieldRules.isNotEmpty() || methodRules.isNotEmpty() || constroctorRules.isNotEmpty() + fullNameConditions != null || simpleNameConditions != null || singleNameConditions != null || isAnonymousClass != null || + isNoExtendsClass != null || isNoImplementsClass != null || extendsClass.isNotEmpty() || enclosingClass.isNotEmpty() || + memberRules.isNotEmpty() || fieldRules.isNotEmpty() || methodRules.isNotEmpty() || constroctorRules.isNotEmpty() override fun toString() = "[$fromPackages][$fullName][$simpleName][$singleName][$fullNameConditions][$simpleNameConditions]" + - "[$singleNameConditions][$modifiers][$isAnonymousClass][$isNoExtendsClass][$isNoImplementsClass][$extendsClass][$implementsClass]" + - "[$enclosingClass][$memberRules][$fieldRules][$methodRules][$constroctorRules]" + super.toString() + "[$singleNameConditions][$modifiers][$isAnonymousClass][$isNoExtendsClass][$isNoImplementsClass][$extendsClass][$implementsClass]" + + "[$enclosingClass][$memberRules][$fieldRules][$methodRules][$constroctorRules]" + super.toString() } \ No newline at end of file diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/ConstructorRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/FieldRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MemberRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/MethodRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/base/BaseRules.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/classes/rules/result/MemberRulesResult.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt similarity index 98% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt index 8904edbf..fc9a47b7 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder.kt @@ -25,7 +25,7 @@ * * This file is Created by fankes on 2022/2/4. */ -@file:Suppress("unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "KotlinConstantConditions") +@file:Suppress("unused", "MemberVisibilityCanBePrivate", "UNCHECKED_CAST", "KotlinConstantConditions", "UNCHECKED_CAST") package com.highcapable.yukihookapi.hook.core.finder.members @@ -37,7 +37,12 @@ import com.highcapable.yukihookapi.hook.core.finder.base.BaseFinder import com.highcapable.yukihookapi.hook.core.finder.base.MemberBaseFinder import com.highcapable.yukihookapi.hook.core.finder.members.data.MethodRulesData import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool -import com.highcapable.yukihookapi.hook.core.finder.type.factory.* +import com.highcapable.yukihookapi.hook.core.finder.type.factory.CountConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.NameConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.ObjectsConditions import com.highcapable.yukihookapi.hook.factory.hasExtends import com.highcapable.yukihookapi.hook.log.yLoggerW import com.highcapable.yukihookapi.hook.type.defined.UndefinedType diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt similarity index 97% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt index a2c41e8f..3f5ff7ee 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/ConstructorRulesData.kt @@ -61,7 +61,7 @@ internal class ConstructorRulesData internal constructor( override val isInitialize get() = super.isInitializeOfSuper || paramTypes != null || paramTypesConditions != null || paramCount >= 0 || - paramCountRange.isEmpty().not() || paramCountConditions != null + paramCountRange.isEmpty().not() || paramCountConditions != null override fun toString() = "[$paramTypes][$paramTypesConditions][$paramCount][$paramCountRange]" + super.toString() } \ No newline at end of file diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/FieldRulesData.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MemberRulesData.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt similarity index 93% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt index aee3dc41..51249bf9 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/members/data/MethodRulesData.kt @@ -75,9 +75,9 @@ internal class MethodRulesData internal constructor( override val isInitialize get() = super.isInitializeOfSuper || name.isNotBlank() || nameConditions != null || paramTypes != null || paramTypesConditions != null || - paramCount >= 0 || paramCountRange.isEmpty().not() || paramCountConditions != null || - returnType != null || returnTypeConditions != null + paramCount >= 0 || paramCountRange.isEmpty().not() || paramCountConditions != null || + returnType != null || returnTypeConditions != null override fun toString() = "[$name][$nameConditions][$paramTypes][$paramTypesConditions][$paramCount]" + - "[$paramCountRange][$returnType][$returnTypeConditions]" + super.toString() + "[$paramCountRange][$returnType][$returnTypeConditions]" + super.toString() } \ No newline at end of file diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt index d12d74f5..0042ee67 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/tools/ReflectionTool.kt @@ -538,7 +538,7 @@ internal object ReflectionTool { * @return [Boolean] 返回是否成立 */ private fun Pair?.compare(need: Int, last: Int) = this == null || ((first >= 0 && first == need && second) || - (first < 0 && abs(first) == (last - need) && second) || (last == need && second.not())) + (first < 0 && abs(first) == (last - need) && second) || (last == need && second.not())) /** * 比较位置下标的前后顺序 @@ -549,8 +549,8 @@ internal object ReflectionTool { private fun Pair?.compare(need: Int, last: Int, result: (Boolean) -> Unit) { if (this == null) return ((first >= 0 && first == need && second) || - (first < 0 && abs(first) == (last - need) && second) || - (last == need && second.not())).also(result) + (first < 0 && abs(first) == (last - need) && second) || + (last == need && second.not())).also(result) } /** diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/core/finder/type/factory/TypeAliasFactory.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/entity/YukiBaseHooker.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt similarity index 90% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt index af841122..e2b8cd37 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/ReflectionFactory.kt @@ -37,11 +37,37 @@ import com.highcapable.yukihookapi.hook.core.finder.members.ConstructorFinder import com.highcapable.yukihookapi.hook.core.finder.members.FieldFinder import com.highcapable.yukihookapi.hook.core.finder.members.MethodFinder import com.highcapable.yukihookapi.hook.core.finder.tools.ReflectionTool -import com.highcapable.yukihookapi.hook.core.finder.type.factory.* -import com.highcapable.yukihookapi.hook.type.java.* +import com.highcapable.yukihookapi.hook.core.finder.type.factory.ClassConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.ConstructorConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.FieldConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.MethodConditions +import com.highcapable.yukihookapi.hook.core.finder.type.factory.ModifierConditions +import com.highcapable.yukihookapi.hook.type.java.AnyClass +import com.highcapable.yukihookapi.hook.type.java.BooleanClass +import com.highcapable.yukihookapi.hook.type.java.BooleanType +import com.highcapable.yukihookapi.hook.type.java.ByteClass +import com.highcapable.yukihookapi.hook.type.java.ByteType +import com.highcapable.yukihookapi.hook.type.java.CharClass +import com.highcapable.yukihookapi.hook.type.java.CharType +import com.highcapable.yukihookapi.hook.type.java.DoubleClass +import com.highcapable.yukihookapi.hook.type.java.DoubleType +import com.highcapable.yukihookapi.hook.type.java.FloatClass +import com.highcapable.yukihookapi.hook.type.java.FloatType +import com.highcapable.yukihookapi.hook.type.java.IntClass +import com.highcapable.yukihookapi.hook.type.java.IntType +import com.highcapable.yukihookapi.hook.type.java.LongClass +import com.highcapable.yukihookapi.hook.type.java.LongType +import com.highcapable.yukihookapi.hook.type.java.ShortClass +import com.highcapable.yukihookapi.hook.type.java.ShortType +import com.highcapable.yukihookapi.hook.type.java.UnitClass +import com.highcapable.yukihookapi.hook.type.java.UnitType import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics import dalvik.system.BaseDexClassLoader -import java.lang.reflect.* +import java.lang.reflect.Constructor +import java.lang.reflect.Field +import java.lang.reflect.Member +import java.lang.reflect.Method +import java.lang.reflect.ParameterizedType /** * 定义一个 [Class] 中的 [Member] 类型 @@ -411,4 +437,4 @@ inline fun Class<*>.allConstructors(isAccessible: Boolean = true, result: (index * @param result 回调 - ([Int] 下标,[Field] 实例) */ inline fun Class<*>.allFields(isAccessible: Boolean = true, result: (index: Int, field: Field) -> Unit) = - declaredFields.forEachIndexed { p, it -> result(p, it.also { e -> e.isAccessible = isAccessible }) } + declaredFields.forEachIndexed { p, it -> result(p, it.also { e -> e.isAccessible = isAccessible }) } \ No newline at end of file diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt index 04db07c4..2bb36957 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/factory/YukiHookFactory.kt @@ -25,7 +25,7 @@ * * This file is Created by fankes on 2022/2/2. */ -@file:Suppress("unused", "DEPRECATION", "DeprecatedCallableAddReplaceWith") +@file:Suppress("unused", "UnusedReceiverParameter", "DeprecatedCallableAddReplaceWith") package com.highcapable.yukihookapi.hook.factory diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt index 56fc8461..47ddc07b 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/log/LoggerFactory.kt @@ -40,7 +40,8 @@ import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics import java.io.File import java.io.Serializable import java.text.SimpleDateFormat -import java.util.* +import java.util.Date +import java.util.Locale /** * 需要打印的日志类型 diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/HookParam.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt similarity index 98% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt index 1fdac3a6..f45234e9 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/PackageParam.kt @@ -436,10 +436,10 @@ open class PackageParam internal constructor(@PublishedApi internal var wrapper: hooker.assignInstance(packageParam = this) else yLoggerW( msg = "This Hooker \"${hooker::class.java.name}\" is singleton or reused, " + - "but the current process has multiple package name \"${wrapper?.packageName}\", " + - "the original is \"${it.packageName}\"\n" + - "Make sure your Hooker supports multiple instances for this situation\n" + - "The process with package name \"${wrapper?.packageName}\" will be ignored" + "but the current process has multiple package name \"${wrapper?.packageName}\", " + + "the original is \"${it.packageName}\"\n" + + "Make sure your Hooker supports multiple instances for this situation\n" + + "The process with package name \"${wrapper?.packageName}\" will be ignored" ) else hooker.assignInstance(packageParam = this) } ?: hooker.assignInstance(packageParam = this) diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/wrapper/PackageParamWrapper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/wrapper/PackageParamWrapper.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/param/wrapper/PackageParamWrapper.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/param/wrapper/PackageParamWrapper.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt index ac6191b9..fe0488aa 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt @@ -29,7 +29,7 @@ package com.highcapable.yukihookapi.hook.type.android -import android.app.* +import android.app.* // ktlint-disable no-wildcard-imports import android.appwidget.AppWidgetHost import android.appwidget.AppWidgetManager import android.appwidget.AppWidgetProvider diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt similarity index 85% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt index 194d15e8..f25a9178 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt @@ -29,10 +29,33 @@ package com.highcapable.yukihookapi.hook.type.android -import android.graphics.* -import android.graphics.drawable.* +import android.graphics.Bitmap +import android.graphics.BitmapFactory +import android.graphics.Canvas +import android.graphics.ColorMatrix +import android.graphics.ColorMatrixColorFilter +import android.graphics.Matrix +import android.graphics.NinePatch +import android.graphics.Outline +import android.graphics.Paint +import android.graphics.Point +import android.graphics.PointF +import android.graphics.Rect +import android.graphics.RectF +import android.graphics.Typeface +import android.graphics.drawable.BitmapDrawable +import android.graphics.drawable.ColorDrawable +import android.graphics.drawable.Drawable +import android.graphics.drawable.GradientDrawable +import android.graphics.drawable.Icon import android.os.Build -import android.text.* +import android.text.Editable +import android.text.GetChars +import android.text.Spannable +import android.text.SpannableStringBuilder +import android.text.TextPaint +import android.text.TextUtils +import android.text.TextWatcher import android.util.Size import android.util.SizeF import com.highcapable.yukihookapi.hook.factory.classOf diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt similarity index 88% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt index 300be92f..ca9137eb 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt @@ -29,17 +29,51 @@ package com.highcapable.yukihookapi.hook.type.android -import android.animation.* +import android.animation.Animator +import android.animation.AnimatorSet +import android.animation.ObjectAnimator +import android.animation.PropertyValuesHolder +import android.animation.ValueAnimator import android.appwidget.AppWidgetHostView import android.util.AttributeSet -import android.view.* +import android.view.GestureDetector +import android.view.LayoutInflater +import android.view.MotionEvent +import android.view.Surface +import android.view.SurfaceView +import android.view.TextureView +import android.view.View +import android.view.ViewGroup +import android.view.ViewParent +import android.view.ViewPropertyAnimator +import android.view.ViewStructure +import android.view.ViewStub import android.view.animation.AlphaAnimation import android.view.animation.Animation import android.view.animation.TranslateAnimation import android.webkit.WebView import android.webkit.WebViewClient -import android.widget.* +import android.widget.ArrayAdapter +import android.widget.AutoCompleteTextView +import android.widget.BaseAdapter +import android.widget.Button +import android.widget.CheckBox +import android.widget.CompoundButton +import android.widget.EditText +import android.widget.FrameLayout +import android.widget.ImageButton +import android.widget.ImageView +import android.widget.LinearLayout +import android.widget.ListAdapter +import android.widget.ListView +import android.widget.ProgressBar +import android.widget.RelativeLayout +import android.widget.RemoteViews import android.widget.RemoteViews.RemoteView +import android.widget.TextClock +import android.widget.TextView +import android.widget.VideoView +import android.widget.ViewAnimator import com.highcapable.yukihookapi.hook.factory.classOf /** diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/defined/DefinedTypeFactory.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt index 93c6a114..7621e5c2 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt @@ -39,7 +39,7 @@ import dalvik.system.InMemoryDexClassLoader import dalvik.system.PathClassLoader import org.json.JSONArray import org.json.JSONObject -import java.io.* +import java.io.* // ktlint-disable no-wildcard-imports import java.lang.ref.Reference import java.lang.ref.WeakReference import java.lang.reflect.Constructor diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt similarity index 98% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt index 71583583..01c3a40b 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/utils/UtilsFactory.kt @@ -198,7 +198,7 @@ internal class Conditions(internal var value: T) { */ private val result by lazy { optConditions.takeIf { it.isNotEmpty() }?.any { it } == true || - andConditions.takeIf { it.isNotEmpty() }?.any { it.not() }?.not() == true + andConditions.takeIf { it.isNotEmpty() }?.any { it.not() }?.not() == true } /** diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/application/ModuleApplication.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/YukiXposedModule.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/YukiXposedModule.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/YukiXposedModule.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/YukiXposedModule.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/caller/YukiXposedModuleCaller.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/caller/YukiXposedModuleCaller.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/caller/YukiXposedModuleCaller.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/caller/YukiXposedModuleCaller.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/delegate/XSharedPreferencesDelegate.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/delegate/XSharedPreferencesDelegate.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/delegate/XSharedPreferencesDelegate.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/delegate/XSharedPreferencesDelegate.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/YukiXposedEvent.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/caller/YukiXposedEventCaller.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/caller/YukiXposedEventCaller.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/caller/YukiXposedEventCaller.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/event/caller/YukiXposedEventCaller.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/proxy/IYukiXposedModuleLifecycle.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/proxy/IYukiXposedModuleLifecycle.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/proxy/IYukiXposedModuleLifecycle.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/proxy/IYukiXposedModuleLifecycle.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiModuleResources.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResForwarder.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/YukiResources.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/caller/YukiXposedResourcesCaller.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/caller/YukiXposedResourcesCaller.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/caller/YukiXposedResourcesCaller.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/resources/caller/YukiXposedResourcesCaller.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/status/YukiXposedModuleStatus.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/status/YukiXposedModuleStatus.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/status/YukiXposedModuleStatus.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/status/YukiXposedModuleStatus.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/type/HookEntryType.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/type/HookEntryType.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/type/HookEntryType.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/bridge/type/HookEntryType.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt similarity index 96% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt index 62f1cf81..e52e9962 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/YukiHookDataChannel.kt @@ -29,6 +29,7 @@ package com.highcapable.yukihookapi.hook.xposed.channel +import android.annotation.SuppressLint import android.app.Activity import android.app.ActivityManager import android.app.Application @@ -37,10 +38,17 @@ import android.content.Context import android.content.Context.ACTIVITY_SERVICE import android.content.Intent import android.content.IntentFilter -import android.os.* +import android.os.Build +import android.os.Bundle +import android.os.Parcel +import android.os.Parcelable +import android.os.TransactionTooLargeException import com.highcapable.yukihookapi.YukiHookAPI import com.highcapable.yukihookapi.annotation.CauseProblemsApi -import com.highcapable.yukihookapi.hook.log.* +import com.highcapable.yukihookapi.hook.log.YukiHookLogger +import com.highcapable.yukihookapi.hook.log.YukiLoggerData +import com.highcapable.yukihookapi.hook.log.yLoggerE +import com.highcapable.yukihookapi.hook.log.yLoggerW import com.highcapable.yukihookapi.hook.utils.RandomSeed import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule @@ -215,6 +223,7 @@ class YukiHookDataChannel private constructor() { * 从 Android 14 (及预览版) 开始 * 外部广播必须声明 [Context.RECEIVER_EXPORTED] */ + @SuppressLint("UnspecifiedRegisterReceiverFlag") if (Build.VERSION.SDK_INT >= 33) context.registerReceiver(handlerReceiver, filter, Context.RECEIVER_EXPORTED) else context.registerReceiver(handlerReceiver, filter) @@ -576,9 +585,9 @@ class YukiHookDataChannel private constructor() { val dataByteSize = wrapper.instance.calDataByteSize() if (dataByteSize < 0 && isAllowSendTooLargeData.not()) return yLoggerE( msg = "YukiHookDataChannel cannot calculate the byte size of the data key of \"${wrapper.instance.key}\" to be sent, " + - "so this data cannot be sent\n" + - "If you want to lift this restriction, use the allowSendTooLargeData function when calling, " + - "but this may cause the app crash" + "so this data cannot be sent\n" + + "If you want to lift this restriction, use the allowSendTooLargeData function when calling, " + + "but this may cause the app crash" ) /** * 如果数据过大打印警告信息 - 仅限 [YukiHookAPI.Configs.isDebug] 启用时生效 @@ -588,7 +597,7 @@ class YukiHookDataChannel private constructor() { fun loggerForTooLargeData(name: String, size: Int) { if (YukiHookAPI.Configs.isDebug) yLoggerW( msg = "This data key of \"${wrapper.instance.key}\" type $name is too large (total ${dataByteSize / 1024f} KB, " + - "limit ${receiverDataMaxByteSize / 1024f} KB), will be segmented to $size piece to send" + "limit ${receiverDataMaxByteSize / 1024f} KB), will be segmented to $size piece to send" ) } @@ -598,11 +607,11 @@ class YukiHookDataChannel private constructor() { */ fun loggerForUnprocessableData(suggestionMessage: String = "") = yLoggerE( msg = "YukiHookDataChannel cannot send this data key of \"${wrapper.instance.key}\" type ${wrapper.instance.value?.javaClass}, " + - "because it is too large (total ${dataByteSize / 1024f} KB, " + - "limit ${receiverDataMaxByteSize / 1024f} KB) and cannot be segmented\n" + - (if (suggestionMessage.isNotBlank()) "$suggestionMessage\n" else "") + - "If you want to lift this restriction, use the allowSendTooLargeData function when calling, " + - "but this may cause the app crash" + "because it is too large (total ${dataByteSize / 1024f} KB, " + + "limit ${receiverDataMaxByteSize / 1024f} KB) and cannot be segmented\n" + + (if (suggestionMessage.isNotBlank()) "$suggestionMessage\n" else "") + + "If you want to lift this restriction, use the allowSendTooLargeData function when calling, " + + "but this may cause the app crash" ) /** @@ -681,7 +690,7 @@ class YukiHookDataChannel private constructor() { is IntArray, is LongArray, is FloatArray, is DoubleArray, is BooleanArray, is Array<*> -> loggerForUnprocessableData( suggestionMessage = "Primitive Array type like String[], int[] ... cannot be segmented, " + - "the suggestion is send those data using List type" + "the suggestion is send those data using List type" ) else -> loggerForUnprocessableData() } diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/ChannelData.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/wrapper/ChannelDataWrapper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/wrapper/ChannelDataWrapper.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/wrapper/ChannelDataWrapper.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/data/wrapper/ChannelDataWrapper.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/channel/priority/ChannelPriority.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt similarity index 91% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt index 29e58f36..272ea644 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/AppParasitics.kt @@ -30,8 +30,17 @@ package com.highcapable.yukihookapi.hook.xposed.parasitic -import android.app.* -import android.content.* +import android.annotation.SuppressLint +import android.app.Activity +import android.app.ActivityManager +import android.app.AndroidAppHelper +import android.app.Application +import android.app.Instrumentation +import android.content.BroadcastReceiver +import android.content.Context +import android.content.Intent +import android.content.IntentFilter +import android.content.SharedPreferences import android.content.pm.ApplicationInfo import android.content.pm.PackageManager import android.content.res.Configuration @@ -46,11 +55,34 @@ import com.highcapable.yukihookapi.hook.core.api.helper.YukiHookHelper import com.highcapable.yukihookapi.hook.core.api.proxy.YukiHookCallback import com.highcapable.yukihookapi.hook.core.api.proxy.YukiMemberHook import com.highcapable.yukihookapi.hook.core.api.proxy.YukiMemberReplacement -import com.highcapable.yukihookapi.hook.factory.* +import com.highcapable.yukihookapi.hook.factory.classOf +import com.highcapable.yukihookapi.hook.factory.current +import com.highcapable.yukihookapi.hook.factory.field +import com.highcapable.yukihookapi.hook.factory.hasClass +import com.highcapable.yukihookapi.hook.factory.hasMethod +import com.highcapable.yukihookapi.hook.factory.method +import com.highcapable.yukihookapi.hook.factory.toClass +import com.highcapable.yukihookapi.hook.factory.toClassOrNull import com.highcapable.yukihookapi.hook.log.yLoggerE import com.highcapable.yukihookapi.hook.log.yLoggerW -import com.highcapable.yukihookapi.hook.type.android.* -import com.highcapable.yukihookapi.hook.type.java.* +import com.highcapable.yukihookapi.hook.type.android.ActivityManagerClass +import com.highcapable.yukihookapi.hook.type.android.ActivityManagerNativeClass +import com.highcapable.yukihookapi.hook.type.android.ActivityTaskManagerClass +import com.highcapable.yukihookapi.hook.type.android.ActivityThreadClass +import com.highcapable.yukihookapi.hook.type.android.ApplicationClass +import com.highcapable.yukihookapi.hook.type.android.ContextClass +import com.highcapable.yukihookapi.hook.type.android.ContextImplClass +import com.highcapable.yukihookapi.hook.type.android.HandlerClass +import com.highcapable.yukihookapi.hook.type.android.IActivityManagerClass +import com.highcapable.yukihookapi.hook.type.android.IActivityTaskManagerClass +import com.highcapable.yukihookapi.hook.type.android.InstrumentationClass +import com.highcapable.yukihookapi.hook.type.android.IntentClass +import com.highcapable.yukihookapi.hook.type.android.SingletonClass +import com.highcapable.yukihookapi.hook.type.android.UserHandleClass +import com.highcapable.yukihookapi.hook.type.java.BooleanType +import com.highcapable.yukihookapi.hook.type.java.IntType +import com.highcapable.yukihookapi.hook.type.java.JavaClassLoader +import com.highcapable.yukihookapi.hook.type.java.StringClass import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule import com.highcapable.yukihookapi.hook.xposed.bridge.status.YukiXposedModuleStatus import com.highcapable.yukihookapi.hook.xposed.bridge.type.HookEntryType @@ -153,7 +185,7 @@ internal object AppParasitics { * @return [Int] */ internal fun findUserId(packageName: String) = runCatching { - @Suppress("DEPRECATION") + @Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress") UserHandleClass.method { name = "getUserId" param(IntType) @@ -309,6 +341,7 @@ internal object AppParasitics { * 从 Android 14 (及预览版) 开始 * 外部广播必须声明 [Context.RECEIVER_EXPORTED] */ + @SuppressLint("UnspecifiedRegisterReceiverFlag") if (Build.VERSION.SDK_INT >= 33) it.registerReceiver(receiver, this, Context.RECEIVER_EXPORTED) else it.registerReceiver(receiver, this) @@ -376,7 +409,7 @@ internal object AppParasitics { else -> error("This proxy [$it] type is not allowed") } }?.takeIf { it.isNotBlank() } ?: context.packageManager?.runCatching { - @Suppress("DEPRECATION") + @Suppress("DEPRECATION", "KotlinRedundantDiagnosticSuppress") queryIntentActivities(getLaunchIntentForPackage(context.packageName)!!, 0).first().activityInfo.name }?.getOrNull() ?: "" if ((proxyClassName.hasClass(context.classLoader) && proxyClassName.toClass(context.classLoader).hasMethod { diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppActivity.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/base/ModuleAppCompatActivity.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/config/ActivityProxyConfig.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/config/ActivityProxyConfig.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/config/ActivityProxyConfig.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/config/ActivityProxyConfig.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt similarity index 96% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt index f5c6ef5d..832a0a5b 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/InstrumentationDelegate.kt @@ -37,10 +37,19 @@ import android.content.Context import android.content.Intent import android.content.IntentFilter import android.content.pm.ActivityInfo -import android.os.* +import android.os.Build +import android.os.Bundle +import android.os.IBinder +import android.os.Looper +import android.os.PersistableBundle +import android.os.TestLooperManager import android.view.KeyEvent import android.view.MotionEvent -import com.highcapable.yukihookapi.hook.factory.* +import com.highcapable.yukihookapi.hook.factory.buildOf +import com.highcapable.yukihookapi.hook.factory.current +import com.highcapable.yukihookapi.hook.factory.injectModuleAppResources +import com.highcapable.yukihookapi.hook.factory.processName +import com.highcapable.yukihookapi.hook.factory.toClass import com.highcapable.yukihookapi.hook.xposed.bridge.YukiXposedModule import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/HandlerDelegateCaller.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/HandlerDelegateCaller.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/HandlerDelegateCaller.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/HandlerDelegateCaller.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt similarity index 93% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt index c146c027..6dda46e4 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/caller/IActivityManagerProxyCaller.kt @@ -34,7 +34,11 @@ import android.app.Activity import android.app.ActivityManager import android.content.Intent import com.highcapable.yukihookapi.annotation.YukiGenerateApi -import com.highcapable.yukihookapi.hook.factory.* +import com.highcapable.yukihookapi.hook.factory.buildOf +import com.highcapable.yukihookapi.hook.factory.classOf +import com.highcapable.yukihookapi.hook.factory.extends +import com.highcapable.yukihookapi.hook.factory.hasClass +import com.highcapable.yukihookapi.hook.factory.toClassOrNull import com.highcapable.yukihookapi.hook.xposed.parasitic.AppParasitics import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppActivity import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/HandlerDelegateImpl.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/HandlerDelegateImpl.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/HandlerDelegateImpl.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/HandlerDelegateImpl.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/IActivityManagerProxyImpl.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/IActivityManagerProxyImpl.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/IActivityManagerProxyImpl.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/activity/delegate/impl/IActivityManagerProxyImpl.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/context/wrapper/ModuleContextThemeWrapper.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/parasitic/reference/ModuleClassLoader.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt similarity index 99% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt index ad4ce4af..30dc5f6b 100644 --- a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt +++ b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/YukiHookPrefsBridge.kt @@ -129,7 +129,7 @@ class YukiHookPrefsBridge private constructor(private var context: Context? = nu private inline fun makeWorldReadable(callback: () -> T): T { val result = callback() if (isXposedEnvironment.not() && isUsingNewXSharedPreferences.not()) - runCatching { makeWorldReadable(context, prefsFileName = "${currentPrefsName}.xml") } + runCatching { makeWorldReadable(context, prefsFileName = "$currentPrefsName.xml") } return result } diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/data/PrefsData.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/prefs/ui/ModulePreferenceFragment.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/IYukiHookXposedInit.kt diff --git a/yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt b/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt similarity index 100% rename from yukihookapi/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt rename to yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/xposed/proxy/YukiHookXposedInitProxy.kt diff --git a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/YukiHookXposedProcessor.kt b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/YukiHookXposedProcessor.kt similarity index 92% rename from yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/YukiHookXposedProcessor.kt rename to yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/YukiHookXposedProcessor.kt index 1aa81aff..838a1509 100644 --- a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/YukiHookXposedProcessor.kt +++ b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/YukiHookXposedProcessor.kt @@ -27,18 +27,23 @@ */ @file:Suppress("unused", "KDocUnresolvedReference") -package com.highcapable.yukihookapi_ksp_xposed +package com.highcapable.yukihookapi import com.google.auto.service.AutoService -import com.google.devtools.ksp.processing.* +import com.google.devtools.ksp.processing.Dependencies +import com.google.devtools.ksp.processing.Resolver +import com.google.devtools.ksp.processing.SymbolProcessor +import com.google.devtools.ksp.processing.SymbolProcessorEnvironment +import com.google.devtools.ksp.processing.SymbolProcessorProvider import com.google.devtools.ksp.symbol.ClassKind import com.google.devtools.ksp.symbol.FileLocation import com.google.devtools.ksp.symbol.KSAnnotated import com.google.devtools.ksp.symbol.KSClassDeclaration -import com.highcapable.yukihookapi_ksp_xposed.bean.GenerateData -import com.highcapable.yukihookapi_ksp_xposed.factory.ClassName -import com.highcapable.yukihookapi_ksp_xposed.factory.PackageName -import com.highcapable.yukihookapi_ksp_xposed.factory.sources +import com.highcapable.yukihookapi.bean.GenerateData +import com.highcapable.yukihookapi.factory.ClassName +import com.highcapable.yukihookapi.factory.PackageName +import com.highcapable.yukihookapi.factory.sources +import com.highcapable.yukihookapi.generated.YukiHookAPIProperties import org.w3c.dom.Element import org.w3c.dom.Node import java.io.File @@ -59,7 +64,7 @@ class YukiHookXposedProcessor : SymbolProcessorProvider { private companion object { /** 自动处理程序的 TAG */ - private const val TAG = "YukiHookAPI" + private const val TAG = YukiHookAPIProperties.PROJECT_NAME /** 查找的注解名称 */ private const val ANNOTATION_NAME = "com.highcapable.yukihookapi.annotation.xposed.InjectYukiHookWithXposed" @@ -93,8 +98,8 @@ class YukiHookXposedProcessor : SymbolProcessorProvider { */ private fun SymbolProcessorEnvironment.problem(msg: String): Nothing { val helpMsg = "Looking for help? Please see the documentation link below\n" + - "- English: https://fankes.github.io/YukiHookAPI/en/config/xposed-using\n" + - "- Chinese(Simplified): https://fankes.github.io/YukiHookAPI/zh-cn/config/xposed-using" + "- English: https://fankes.github.io/YukiHookAPI/en/config/xposed-using\n" + + "- Chinese(Simplified): https://fankes.github.io/YukiHookAPI/zh-cn/config/xposed-using" logger.error(message = "[$TAG] $msg\n$helpMsg") throw RuntimeException("[$TAG] $msg\n$helpMsg") } @@ -183,14 +188,14 @@ class YukiHookXposedProcessor : SymbolProcessorProvider { data.isUsingResourcesHook = args.value as? Boolean ?: true } if ((data.customMPackageName.startsWith(".") || - data.customMPackageName.endsWith(".") || - data.customMPackageName.contains(".").not() || - data.customMPackageName.contains("..")) && + data.customMPackageName.endsWith(".") || + data.customMPackageName.contains(".").not() || + data.customMPackageName.contains("..")) && data.customMPackageName.isNotEmpty() ) problem(msg = "Invalid modulePackageName \"${data.customMPackageName}\"") if ((Pattern.compile("[*,.:~`'\"|/\\\\?!^()\\[\\]{}%@#$&\\-+=<>]").matcher(data.entryClassName).find() || - true.let { for (i in 0..9) if (data.entryClassName.startsWith(i.toString())) return@let true; false }) - && data.entryClassName.isNotEmpty() + true.let { for (i in 0..9) if (data.entryClassName.startsWith(i.toString())) return@let true; false }) && + data.entryClassName.isNotEmpty() ) problem(msg = "Invalid entryClassName \"${data.entryClassName}\"") else fetchKSClassDeclaration(sourcePath) } @@ -255,7 +260,7 @@ class YukiHookXposedProcessor : SymbolProcessorProvider { private fun generateClassFile(data: GenerateData) = environment(ignored = true) { if (data.customMPackageName.isNotBlank()) warn( msg = "You set the customize module package name to \"${data.customMPackageName}\", " + - "please check for yourself if it is correct" + "please check for yourself if it is correct" ) /** 插入 YukiHookAPI_Impl 代码 */ createCodeFile( diff --git a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/bean/GenerateData.kt b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/bean/GenerateData.kt similarity index 97% rename from yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/bean/GenerateData.kt rename to yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/bean/GenerateData.kt index efef6765..ffb58b4e 100644 --- a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/bean/GenerateData.kt +++ b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/bean/GenerateData.kt @@ -25,7 +25,7 @@ * * This file is Created by fankes on 2022/9/20. */ -package com.highcapable.yukihookapi_ksp_xposed.bean +package com.highcapable.yukihookapi.bean /** * 生成的模板数据实例 diff --git a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/factory/CodeSourceFileFactory.kt b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/factory/CodeSourceFileFactory.kt new file mode 100644 index 00000000..91abdf86 --- /dev/null +++ b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi/factory/CodeSourceFileFactory.kt @@ -0,0 +1,540 @@ +/* + * YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin. + * Copyright (C) 2019-2023 HighCapable + * https://github.com/fankes/YukiHookAPI + * + * MIT License + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * This file is Created by fankes on 2022/9/20. + */ +@file:Suppress("ConstPropertyName") + +package com.highcapable.yukihookapi.factory + +import com.highcapable.yukihookapi.bean.GenerateData +import com.highcapable.yukihookapi.generated.YukiHookAPIProperties +import java.text.SimpleDateFormat +import java.util.Date + +/** + * 包名常量定义类 + */ +object PackageName { + const val YukiHookAPI_Impl = "com.highcapable.yukihookapi" + const val ModuleApplication_Impl = "com.highcapable.yukihookapi.hook.xposed.application" + const val YukiXposedModuleStatus_Impl = "com.highcapable.yukihookapi.hook.xposed.bridge.status" + const val HandlerDelegateImpl_Impl = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.impl" + const val HandlerDelegateClass = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate" + const val IActivityManagerProxyImpl_Impl = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.impl" + const val IActivityManagerProxyClass = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate" + const val BootstrapReflectionClass = "com.highcapable.yukihookapi.thirdparty.me.weishu.reflection" +} + +/** + * 类名常量定义类 + */ +object ClassName { + const val YukiHookAPI_Impl = "YukiHookAPI_Impl" + const val ModuleApplication_Impl = "ModuleApplication_Impl" + const val YukiXposedModuleStatus_Impl = "YukiXposedModuleStatus_Impl" + const val HandlerDelegateImpl_Impl = "HandlerDelegateImpl_Impl" + const val HandlerDelegateClass = "HandlerDelegate" + const val IActivityManagerProxyImpl_Impl = "IActivityManagerProxyImpl_Impl" + const val IActivityManagerProxyClass = "IActivityManagerProxy" + const val XposedInit = "xposed_init" + const val XposedInit_Impl = "xposed_init_Impl" + const val BootstrapClass = "BootstrapClass" + const val Reflection = "Reflection" +} + +/** + * 外部调用者包名和类名定义类 + */ +object ExternalCallerName { + val YukiGenerateApiAnnotation = Pair( + "com.highcapable.yukihookapi.annotation.YukiGenerateApi", + "YukiGenerateApi" + ) + val HandlerDelegateCaller = Pair( + "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.caller.HandlerDelegateCaller", + "HandlerDelegateCaller" + ) + val IActivityManagerProxyCaller = Pair( + "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.caller.IActivityManagerProxyCaller", + "IActivityManagerProxyCaller" + ) + val YukiXposedEventCaller = Pair( + "com.highcapable.yukihookapi.hook.xposed.bridge.event.caller.YukiXposedEventCaller", + "YukiXposedEventCaller" + ) + val YukiXposedModuleCaller = Pair( + "com.highcapable.yukihookapi.hook.xposed.bridge.caller.YukiXposedModuleCaller", + "YukiXposedModuleCaller" + ) + val YukiXposedResourcesCaller = Pair( + "com.highcapable.yukihookapi.hook.xposed.bridge.resources.caller.YukiXposedResourcesCaller", + "YukiXposedResourcesCaller" + ) +} + +/** + * YukiXposedModuleStatus 方法名称定义类 + */ +object YukiXposedModuleStatusJvmName { + const val IS_ACTIVE_METHOD_NAME = "__--" + const val IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME = "_--_" + const val GET_EXECUTOR_NAME_METHOD_NAME = "_-_-" + const val GET_EXECUTOR_API_LEVEL_METHOD_NAME = "-__-" + const val GET_EXECUTOR_VERSION_NAME_METHOD_NAME = "-_-_" + const val GET_EXECUTOR_VERSION_CODE_METHOD_NAME = "___-" +} + +/** + * 创建尾部包名名称 + * @param name 前置名称 + * @return [String] + */ +private fun GenerateData.tailPackageName(name: String) = "${name}_${modulePackageName.replace(".", "_")}" + +/** + * 创建文件注释 + * @param currrentClassTag 当前注入类标签 + * @return [String] + */ +private fun createCommentContent(currrentClassTag: String) = + """ + /** + * $currrentClassTag Class + * + * Compiled from YukiHookXposedProcessor + * + * Generate Date: ${SimpleDateFormat.getDateTimeInstance().format(Date())} + * + * Powered by YukiHookAPI (C) HighCapable 2019-2023 + * + * Project URL: [${YukiHookAPIProperties.PROJECT_NAME}](${YukiHookAPIProperties.PROJECT_URL}) + */ + """.trimIndent() + +/** + * 获得注入文件代码内容 + * @return [Map]<[String], [String]> + */ +fun GenerateData.sources() = mapOf( + ClassName.YukiHookAPI_Impl to """ + @file:Suppress("ClassName") + + package ${PackageName.YukiHookAPI_Impl} + """.trimIndent() + "\n\n" + createCommentContent(ClassName.YukiHookAPI_Impl) + "\n" + """ + object ${ClassName.YukiHookAPI_Impl} { + + val compiledTimestamp get() = ${System.currentTimeMillis()} + } + """.trimIndent(), + ClassName.ModuleApplication_Impl to """ + @file:Suppress("ClassName") + + package ${PackageName.ModuleApplication_Impl} + + import $entryPackageName.$entryClassName + """.trimIndent() + "\n\n" + createCommentContent(ClassName.ModuleApplication_Impl) + "\n" + """ + object ${ClassName.ModuleApplication_Impl} { + + fun callHookEntryInit() = try { + ${if (isEntryClassKindOfObject) "$entryClassName.onInit()" else "$entryClassName().onInit()"} + } catch (_: Throwable) { + } + } + """.trimIndent(), + ClassName.YukiXposedModuleStatus_Impl to """ + @file:Suppress("ClassName") + + package ${PackageName.YukiXposedModuleStatus_Impl} + + import android.util.Log + import androidx.annotation.Keep + """.trimIndent() + "\n\n" + createCommentContent(ClassName.YukiXposedModuleStatus_Impl) + "\n" + """ + @Keep + object ${ClassName.YukiXposedModuleStatus_Impl} { + + @JvmName("${YukiXposedModuleStatusJvmName.IS_ACTIVE_METHOD_NAME}") + fun isActive(): Boolean { + placeholderExecution() + return false + } + + @JvmName("${YukiXposedModuleStatusJvmName.IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME}") + fun isSupportResourcesHook(): Boolean { + placeholderExecution() + return false + } + + @JvmName("${YukiXposedModuleStatusJvmName.GET_EXECUTOR_NAME_METHOD_NAME}") + fun getExecutorName(): String { + placeholderExecution() + return "unknown" + } + + @JvmName("${YukiXposedModuleStatusJvmName.GET_EXECUTOR_API_LEVEL_METHOD_NAME}") + fun getExecutorApiLevel(): Int { + placeholderExecution() + return -1 + } + + @JvmName("${YukiXposedModuleStatusJvmName.GET_EXECUTOR_VERSION_NAME_METHOD_NAME}") + fun getExecutorVersionName(): String { + placeholderExecution() + return "unknown" + } + + @JvmName("${YukiXposedModuleStatusJvmName.GET_EXECUTOR_VERSION_CODE_METHOD_NAME}") + fun getExecutorVersionCode(): Int { + placeholderExecution() + return -1 + } + + private fun placeholderExecution() { + /** Consume a long method body */ + if (System.currentTimeMillis() == 0L) Log.d("${(1000..9999).random()}", "${(100000..999999).random()}") + } + } + """.trimIndent(), + ClassName.HandlerDelegateImpl_Impl to """ + @file:Suppress("ClassName") + + package ${PackageName.HandlerDelegateImpl_Impl} + + import android.os.Handler + import ${ExternalCallerName.YukiGenerateApiAnnotation.first} + import ${PackageName.HandlerDelegateClass}.${tailPackageName(ClassName.HandlerDelegateClass)} + """.trimIndent() + "\n\n" + createCommentContent(ClassName.HandlerDelegateImpl_Impl) + "\n" + """ + @${ExternalCallerName.YukiGenerateApiAnnotation.second} + object ${ClassName.HandlerDelegateImpl_Impl} { + + val wrapperClassName get() = "${PackageName.HandlerDelegateClass}.${tailPackageName(ClassName.HandlerDelegateClass)}" + + fun createWrapper(baseInstance: Handler.Callback? = null): Handler.Callback = ${tailPackageName(ClassName.HandlerDelegateClass)}(baseInstance) + } + """.trimIndent(), + ClassName.HandlerDelegateClass to """ + @file:Suppress("ClassName") + + package ${PackageName.HandlerDelegateClass} + + import android.os.Handler + import android.os.Message + import androidx.annotation.Keep + import ${ExternalCallerName.YukiGenerateApiAnnotation.first} + import ${ExternalCallerName.HandlerDelegateCaller.first} + """.trimIndent() + "\n\n" + createCommentContent(ClassName.HandlerDelegateClass) + "\n" + """ + @Keep + @${ExternalCallerName.YukiGenerateApiAnnotation.second} + class ${tailPackageName(ClassName.HandlerDelegateClass)}(private val baseInstance: Handler.Callback?) : Handler.Callback { + + override fun handleMessage(msg: Message) = ${ExternalCallerName.HandlerDelegateCaller.second}.callHandleMessage(baseInstance, msg) + } + """.trimIndent(), + ClassName.IActivityManagerProxyImpl_Impl to """ + @file:Suppress("ClassName") + + package ${PackageName.IActivityManagerProxyImpl_Impl} + + import android.os.Handler + import ${ExternalCallerName.YukiGenerateApiAnnotation.first} + import ${ExternalCallerName.IActivityManagerProxyCaller.first} + import ${PackageName.IActivityManagerProxyClass}.${tailPackageName(ClassName.IActivityManagerProxyClass)} + import java.lang.reflect.Proxy + """.trimIndent() + "\n\n" + createCommentContent(ClassName.IActivityManagerProxyImpl_Impl) + "\n" + """ + @${ExternalCallerName.YukiGenerateApiAnnotation.second} + object ${ClassName.IActivityManagerProxyImpl_Impl} { + + fun createWrapper(clazz: Class<*>?, instance: Any) = + Proxy.newProxyInstance(${ExternalCallerName.IActivityManagerProxyCaller.second}.currentClassLoader, arrayOf(clazz), ${tailPackageName( + ClassName.IActivityManagerProxyClass + )}(instance)) + } + """.trimIndent(), + ClassName.IActivityManagerProxyClass to """ + @file:Suppress("ClassName") + + package ${PackageName.IActivityManagerProxyClass} + + import androidx.annotation.Keep + import ${ExternalCallerName.YukiGenerateApiAnnotation.first} + import ${ExternalCallerName.IActivityManagerProxyCaller.first} + import java.lang.reflect.InvocationHandler + import java.lang.reflect.Method + import java.lang.reflect.Proxy + """.trimIndent() + "\n\n" + createCommentContent(ClassName.IActivityManagerProxyClass) + "\n" + """ + @Keep + @${ExternalCallerName.YukiGenerateApiAnnotation.second} + class ${tailPackageName(ClassName.IActivityManagerProxyClass)}(private val baseInstance: Any) : InvocationHandler { + + override fun invoke(proxy: Any?, method: Method?, args: Array?) = ${ExternalCallerName.IActivityManagerProxyCaller.second}.callInvoke(baseInstance, method, args) + } + """.trimIndent(), + ClassName.XposedInit to """ + @file:Suppress("ClassName") + + package $entryPackageName + + import androidx.annotation.Keep + import ${ExternalCallerName.YukiXposedEventCaller.first} + import ${ExternalCallerName.YukiGenerateApiAnnotation.first} + ${if (isUsingResourcesHook) "import de.robv.android.xposed.IXposedHookInitPackageResources" else ""} + import de.robv.android.xposed.IXposedHookLoadPackage + import de.robv.android.xposed.IXposedHookZygoteInit + ${if (isUsingResourcesHook) "import de.robv.android.xposed.callbacks.XC_InitPackageResources" else ""} + import de.robv.android.xposed.callbacks.XC_LoadPackage + """.trimIndent() + "\n\n" + createCommentContent("Xposed Init") + "\n" + """ + @Keep + @${ExternalCallerName.YukiGenerateApiAnnotation.second} + class $xInitClassName : IXposedHookZygoteInit, IXposedHookLoadPackage${if (isUsingResourcesHook) ", IXposedHookInitPackageResources" else ""} { + + override fun initZygote(sparam: IXposedHookZygoteInit.StartupParam?) { + ${entryClassName}_Impl.callInitZygote(sparam) + ${ExternalCallerName.YukiXposedEventCaller.second}.callInitZygote(sparam) + } + + override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) { + ${entryClassName}_Impl.callHandleLoadPackage(lpparam) + ${ExternalCallerName.YukiXposedEventCaller.second}.callHandleLoadPackage(lpparam) + } + """.trimIndent() + + (if (isUsingResourcesHook) + "\n" + """ + + override fun handleInitPackageResources(resparam: XC_InitPackageResources.InitPackageResourcesParam?) { + ${entryClassName}_Impl.callHandleInitPackageResources(resparam) + ${ExternalCallerName.YukiXposedEventCaller.second}.callHandleInitPackageResources(resparam) + } + } + """.trimIndent() + else "\n}"), + ClassName.XposedInit_Impl to """ + @file:Suppress("ClassName") + + package $entryPackageName + + import ${ExternalCallerName.YukiGenerateApiAnnotation.first} + import ${ExternalCallerName.YukiXposedModuleCaller.first} + import ${ExternalCallerName.YukiXposedResourcesCaller.first} + import com.highcapable.yukihookapi.hook.xposed.bridge.type.HookEntryType + import de.robv.android.xposed.IXposedHookZygoteInit + import de.robv.android.xposed.XposedBridge + import de.robv.android.xposed.callbacks.XC_InitPackageResources + import de.robv.android.xposed.callbacks.XC_LoadPackage + ${if (customMPackageName.isBlank()) "import $modulePackageName.BuildConfig" else ""} + """.trimIndent() + "\n\n" + createCommentContent("Xposed Init Impl") + "\n" + """ + @${ExternalCallerName.YukiGenerateApiAnnotation.second} + object ${entryClassName}_Impl { + + private const val modulePackageName = ${if (customMPackageName.isNotBlank()) "\"$customMPackageName\"" else "BuildConfig.APPLICATION_ID"} + private var isZygoteCalled = false + private val hookEntry = ${if (isEntryClassKindOfObject) entryClassName else "$entryClassName()"} + + private fun callOnXposedModuleLoaded( + isZygoteLoaded: Boolean = false, + lpparam: XC_LoadPackage.LoadPackageParam? = null, + resparam: XC_InitPackageResources.InitPackageResourcesParam? = null + ) { + if (isZygoteCalled.not()) runCatching { + hookEntry.onXposedEvent() + hookEntry.onInit() + if (${ExternalCallerName.YukiXposedModuleCaller.second}.isXposedCallbackSetUp) { + ${ExternalCallerName.YukiXposedModuleCaller.second}.internalLoggerE("You cannot load a hooker in \"onInit\" or \"onXposedEvent\" method! Aborted") + return + } + hookEntry.onHook() + ${ExternalCallerName.YukiXposedModuleCaller.second}.callOnFinishLoadModule() + }.onFailure { ${ExternalCallerName.YukiXposedModuleCaller.second}.internalLoggerE("YukiHookAPI try to load hook entry class failed", it) } + ${ExternalCallerName.YukiXposedModuleCaller.second}.callOnPackageLoaded( + type = when { + isZygoteLoaded -> HookEntryType.ZYGOTE + lpparam != null -> HookEntryType.PACKAGE + resparam != null -> HookEntryType.RESOURCES + else -> HookEntryType.ZYGOTE + }, + packageName = lpparam?.packageName ?: resparam?.packageName, + processName = lpparam?.processName, + appClassLoader = lpparam?.classLoader ?: runCatching { XposedBridge.BOOTCLASSLOADER }.getOrNull(), + appInfo = lpparam?.appInfo, + appResources = ${ExternalCallerName.YukiXposedResourcesCaller.second}.createYukiResourcesFromXResources(resparam?.res) + ) + } + + fun callInitZygote(sparam: IXposedHookZygoteInit.StartupParam?) { + if (sparam == null) return + runCatching { + ${ExternalCallerName.YukiXposedModuleCaller.second}.callOnStartLoadModule(modulePackageName, sparam.modulePath) + callOnXposedModuleLoaded(isZygoteLoaded = true) + isZygoteCalled = true + }.onFailure { ${ExternalCallerName.YukiXposedModuleCaller.second}.internalLoggerE("An exception occurred when YukiHookAPI loading Xposed Module", it) } + } + + fun callHandleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) { + if (lpparam != null && isZygoteCalled) callOnXposedModuleLoaded(lpparam = lpparam) + } + + fun callHandleInitPackageResources(resparam: XC_InitPackageResources.InitPackageResourcesParam?) { + if (resparam != null && isZygoteCalled) callOnXposedModuleLoaded(resparam = resparam) + } + } + """.trimIndent(), + ClassName.BootstrapClass to ("package ${PackageName.BootstrapReflectionClass};\n" + + "\n" + + "import static android.os.Build.VERSION.SDK_INT;\n" + + "\n" + + "import android.os.Build;\n" + + "import android.util.Log;\n" + + "\n" + + "import androidx.annotation.Keep;\n" + + "\n" + + "import java.lang.reflect.Method;\n" + + "\n" + + createCommentContent(currrentClassTag = ClassName.BootstrapClass) + + "@Keep\n" + + "public final class BootstrapClass {\n" + + "\n" + + " private static final String TAG = \"BootstrapClass\";\n" + + " private static Object sVmRuntime;\n" + + " private static Method setHiddenApiExemptions;\n" + + "\n" + + " static {\n" + + " if (SDK_INT >= Build.VERSION_CODES.P) {\n" + + " try {\n" + + " Method forName = Class.class.getDeclaredMethod(\"forName\", String.class);\n" + + " Method getDeclaredMethod = Class.class.getDeclaredMethod(\"getDeclaredMethod\", String.class, Class[].class);\n" + + " Class vmRuntimeClass = (Class) forName.invoke(null, \"dalvik.system.VMRuntime\");\n" + + " Method getRuntime = (Method) getDeclaredMethod.invoke(vmRuntimeClass, \"getRuntime\", null);\n" + + " setHiddenApiExemptions = (Method) getDeclaredMethod.invoke(vmRuntimeClass, \"setHiddenApiExemptions\", new Class[]{String[].class});\n" + + " sVmRuntime = getRuntime.invoke(null);\n" + + " } catch (Throwable e) {\n" + + " Log.w(TAG, \"reflect bootstrap failed:\", e);\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " public static boolean exempt(String method) {\n" + + " return exempt(new String[]{method});\n" + + " }\n" + + "\n" + + " public static boolean exempt(String... methods) {\n" + + " if (sVmRuntime == null || setHiddenApiExemptions == null) {\n" + + " return false;\n" + + " }\n" + + " try {\n" + + " setHiddenApiExemptions.invoke(sVmRuntime, new Object[]{methods});\n" + + " return true;\n" + + " } catch (Throwable e) {\n" + + " return false;\n" + + " }\n" + + " }\n" + + "\n" + + " public static boolean exemptAll() {\n" + + " return exempt(new String[]{\"L\"});\n" + + " }\n" + + "}"), + ClassName.Reflection to ("package ${PackageName.BootstrapReflectionClass};\n" + + "\n" + + "import static android.os.Build.VERSION.SDK_INT;\n" + + "import static com.highcapable.yukihookapi.thirdparty.me.weishu.reflection.BootstrapClass.exemptAll;\n" + + "\n" + + "import android.content.Context;\n" + + "import android.text.TextUtils;\n" + + "import android.util.Base64;\n" + + "\n" + + "import androidx.annotation.Keep;\n" + + "\n" + + "import java.io.File;\n" + + "import java.io.FileOutputStream;\n" + + "import java.lang.reflect.Method;\n" + + "\n" + + "import dalvik.system.DexFile;\n" + + "\n" + + createCommentContent(currrentClassTag = ClassName.Reflection) + + "@Keep\n" + + "public class Reflection {\n" + + "\n" + + " private static final String TAG = \"Reflection\";\n" + + " private static final String DEX = \"ZGV4CjAzNQCXDT0vQ44GJ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BQkADgANABoFBgAaBjsAcTABAGUAKPcAAAYAAABrAAEAAQEMcgEAAQABAAAAaAgAAAQAAABwEAwAAAAOAAMAAQABAAAAbQgAAAsAAAASECMAEgASAU0CAAFxEAYAAAAKAA8AAAAIAAEAAwABAHMIAAAdAAAAEhESAmIDCQA4AwYAYgMKADkDBAABIQ8BYgMKAGIECQASFSNVEQASBk0HBQZuMA4AQwUo8g0AASEo7wAADAAAAA0AAQABAQwaAwAAAAEAAACDCAAADQAAABIQIwASABIBGgIPAE0CAAFxEAYAAAAKAA8AAAABAAEAAQAAAIgIAAAEAAAAcBAMAAAADgAEAAEAAQAAAI0IAAAeAAAAEgBgAQEAEwIcADUhAwAPAHEABwAAAAoBOQH7/xoAMgBxEA0AAABuEAAAAwAMAFIAAABxEAoAAAAKACjqBgABAAIZARkBGQEZARkBGQKBgASYEQMABQAIGgEKAQoDiIAEsBEBgYAExBMBCdwTAYkBhBQBCdwUAQADAAsaCIGABIgVAQmgFQGKAgAAAAAPAAAAAAAAAAEAAAAAAAAAAQAAAEMAAABwAAAAAgAAABMAAAB8AQAAAwAAAAsAAADIAQAABAAAAAwAAABMAgAABQAAAA8AAACsAgAABgAAAAMAAAAkAwAAAiAAAEMAAACEAwAAARAAAAcAAADgBwAABSAAAAMAAAAcCAAAAxAAAAEAAAAwCAAAAyAAAAgAAAA0CAAAASAAAAgAAACYCAAAACAAAAMAAADsCgAAABAAAAEAAAA8CwAA\";\n" + + "\n" + + " private static native int unsealNative(int targetSdkVersion);\n" + + "\n" + + " public static int unseal(Context context) {\n" + + " if (SDK_INT < 28) {\n" + + " // Below Android P, ignore\n" + + " return 0;\n" + + " }\n" + + " // try exempt API first.\n" + + " if (exemptAll()) {\n" + + " return 0;\n" + + " }\n" + + " if (unsealByDexFile(context)) {\n" + + " return 0;\n" + + " }\n" + + " return -1;\n" + + " }\n" + + "\n" + + " @SuppressWarnings({\"deprecation\", \"ResultOfMethodCallIgnored\"})\n" + + " private static boolean unsealByDexFile(Context context) {\n" + + " byte[] bytes = Base64.decode(DEX, Base64.NO_WRAP);\n" + + " File codeCacheDir = getCodeCacheDir(context);\n" + + " if (codeCacheDir == null) {\n" + + " return false;\n" + + " }\n" + + " File code = new File(codeCacheDir, \"__temp_\" + System.currentTimeMillis() + \".dex\");\n" + + " try {\n" + + " try (FileOutputStream fos = new FileOutputStream(code)) {\n" + + " fos.write(bytes);\n" + + " }\n" + + " DexFile dexFile = new DexFile(code);\n" + + " // This class is hardcoded in the dex, Don't use BootstrapClass.class to reference it\n" + + " // it maybe obfuscated!!\n" + + " Class bootstrapClass = dexFile.loadClass(\"com.highcapable.yukihookapi.thirdparty.me.weishu.reflection.BootstrapClass\", null);\n" + + " Method exemptAll = bootstrapClass.getDeclaredMethod(\"exemptAll\");\n" + + " return (boolean) exemptAll.invoke(null);\n" + + " } catch (Throwable e) {\n" + + " e.printStackTrace();\n" + + " return false;\n" + + " } finally {\n" + + " if (code.exists()) {\n" + + " code.delete();\n" + + " }\n" + + " }\n" + + " }\n" + + "\n" + + " private static File getCodeCacheDir(Context context) {\n" + + " if (context != null) {\n" + + " return context.getCodeCacheDir();\n" + + " }\n" + + " String tmpDir = System.getProperty(\"java.io.tmpdir\");\n" + + " if (TextUtils.isEmpty(tmpDir)) {\n" + + " return null;\n" + + " }\n" + + " File tmp = new File(tmpDir);\n" + + " if (!tmp.exists()) {\n" + + " return null;\n" + + " }\n" + + " return tmp;\n" + + " }\n" + + "}") +) \ No newline at end of file diff --git a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/factory/CodeSourceFileFactory.kt b/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/factory/CodeSourceFileFactory.kt deleted file mode 100644 index cb4670b0..00000000 --- a/yukihookapi-ksp-xposed/src/api/kotlin/com/highcapable/yukihookapi_ksp_xposed/factory/CodeSourceFileFactory.kt +++ /dev/null @@ -1,525 +0,0 @@ -/* - * YukiHookAPI - An efficient Hook API and Xposed Module solution built in Kotlin. - * Copyright (C) 2019-2023 HighCapable - * https://github.com/fankes/YukiHookAPI - * - * MIT License - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all - * copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * This file is Created by fankes on 2022/9/20. - */ -package com.highcapable.yukihookapi_ksp_xposed.factory - -import com.highcapable.yukihookapi_ksp_xposed.bean.GenerateData -import java.text.SimpleDateFormat -import java.util.* - -/** - * 包名常量定义类 - */ -object PackageName { - const val YukiHookAPI_Impl = "com.highcapable.yukihookapi" - const val ModuleApplication_Impl = "com.highcapable.yukihookapi.hook.xposed.application" - const val YukiXposedModuleStatus_Impl = "com.highcapable.yukihookapi.hook.xposed.bridge.status" - const val HandlerDelegateImpl_Impl = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.impl" - const val HandlerDelegateClass = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate" - const val IActivityManagerProxyImpl_Impl = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.impl" - const val IActivityManagerProxyClass = "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate" - const val BootstrapReflectionClass = "com.highcapable.yukihookapi.thirdparty.me.weishu.reflection" -} - -/** - * 类名常量定义类 - */ -object ClassName { - const val YukiHookAPI_Impl = "YukiHookAPI_Impl" - const val ModuleApplication_Impl = "ModuleApplication_Impl" - const val YukiXposedModuleStatus_Impl = "YukiXposedModuleStatus_Impl" - const val HandlerDelegateImpl_Impl = "HandlerDelegateImpl_Impl" - const val HandlerDelegateClass = "HandlerDelegate" - const val IActivityManagerProxyImpl_Impl = "IActivityManagerProxyImpl_Impl" - const val IActivityManagerProxyClass = "IActivityManagerProxy" - const val XposedInit = "xposed_init" - const val XposedInit_Impl = "xposed_init_Impl" - const val BootstrapClass = "BootstrapClass" - const val Reflection = "Reflection" -} - -/** - * 外部调用者包名和类名定义类 - */ -object ExternalCallerName { - val YukiGenerateApiAnnotation = Pair( - "com.highcapable.yukihookapi.annotation.YukiGenerateApi", - "YukiGenerateApi" - ) - val HandlerDelegateCaller = Pair( - "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.caller.HandlerDelegateCaller", - "HandlerDelegateCaller" - ) - val IActivityManagerProxyCaller = Pair( - "com.highcapable.yukihookapi.hook.xposed.parasitic.activity.delegate.caller.IActivityManagerProxyCaller", - "IActivityManagerProxyCaller" - ) - val YukiXposedEventCaller = Pair( - "com.highcapable.yukihookapi.hook.xposed.bridge.event.caller.YukiXposedEventCaller", - "YukiXposedEventCaller" - ) - val YukiXposedModuleCaller = Pair( - "com.highcapable.yukihookapi.hook.xposed.bridge.caller.YukiXposedModuleCaller", - "YukiXposedModuleCaller" - ) - val YukiXposedResourcesCaller = Pair( - "com.highcapable.yukihookapi.hook.xposed.bridge.resources.caller.YukiXposedResourcesCaller", - "YukiXposedResourcesCaller" - ) -} - -/** - * YukiXposedModuleStatus 方法名称定义类 - */ -object YukiXposedModuleStatusJvmName { - const val IS_ACTIVE_METHOD_NAME = "__--" - const val IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME = "_--_" - const val GET_EXECUTOR_NAME_METHOD_NAME = "_-_-" - const val GET_EXECUTOR_API_LEVEL_METHOD_NAME = "-__-" - const val GET_EXECUTOR_VERSION_NAME_METHOD_NAME = "-_-_" - const val GET_EXECUTOR_VERSION_CODE_METHOD_NAME = "___-" -} - -/** - * 创建尾部包名名称 - * @param name 前置名称 - * @return [String] - */ -private fun GenerateData.tailPackageName(name: String) = "${name}_${modulePackageName.replace(".", "_")}" - -/** - * 创建文件注释 - * @param entryClassName 入口类名 - 空则不生成 - * @param currrentClassTag 当前注入类标签 - * @return [String] - */ -private fun createCommentContent(entryClassName: String = "", currrentClassTag: String) = - ("/**\n" + - " * $currrentClassTag Class\n" + - " *\n" + - " * Compiled from YukiHookXposedProcessor\n" + - " *\n" + - (if (entryClassName.isNotBlank()) " * Hook entry class: [$entryClassName]\n *\n" else "") + - " * Generate Date: ${SimpleDateFormat.getDateTimeInstance().format(Date())}\n" + - " *\n" + - " * Powered by YukiHookAPI (C) HighCapable 2019-2023\n" + - " *\n" + - " * Project Address: [YukiHookAPI](https://github.com/fankes/YukiHookAPI)\n" + - " */\n") - -/** - * 获得注入文件代码内容 - * @return [Map]<[String],[String]> - */ -fun GenerateData.sources() = mapOf( - ClassName.YukiHookAPI_Impl to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.YukiHookAPI_Impl}\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.YukiHookAPI_Impl) + - "object ${ClassName.YukiHookAPI_Impl} {\n" + - "\n" + - " val compiledTimestamp get() = ${System.currentTimeMillis()}\n" + - "}"), - ClassName.ModuleApplication_Impl to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.ModuleApplication_Impl}\n" + - "\n" + - "import $entryPackageName.$entryClassName\n" + - "\n" + - createCommentContent(entryClassName, ClassName.ModuleApplication_Impl) + - "object ${ClassName.ModuleApplication_Impl} {\n" + - "\n" + - " fun callHookEntryInit() = try {\n" + - " " + (if (isEntryClassKindOfObject) "$entryClassName.onInit()\n" else "$entryClassName().onInit()\n") + - " } catch (_: Throwable) {\n" + - " }\n" + - "}"), - ClassName.YukiXposedModuleStatus_Impl to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.YukiXposedModuleStatus_Impl}\n" + - "\n" + - "import android.util.Log\n" + - "import androidx.annotation.Keep\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.YukiXposedModuleStatus_Impl) + - "@Keep\n" + - "object ${ClassName.YukiXposedModuleStatus_Impl} {\n" + - "\n" + - " @JvmName(\"${YukiXposedModuleStatusJvmName.IS_ACTIVE_METHOD_NAME}\")\n" + - " fun isActive(): Boolean {\n" + - " placeholderExecution()\n" + - " return false\n" + - " }\n" + - "\n" + - " @JvmName(\"${YukiXposedModuleStatusJvmName.IS_SUPPORT_RESOURCES_HOOK_METHOD_NAME}\")\n" + - " fun isSupportResourcesHook(): Boolean {\n" + - " placeholderExecution()\n" + - " return false\n" + - " }\n" + - "\n" + - " @JvmName(\"${YukiXposedModuleStatusJvmName.GET_EXECUTOR_NAME_METHOD_NAME}\")\n" + - " fun getExecutorName(): String {\n" + - " placeholderExecution()\n" + - " return \"unknown\"\n" + - " }\n" + - "\n" + - " @JvmName(\"${YukiXposedModuleStatusJvmName.GET_EXECUTOR_API_LEVEL_METHOD_NAME}\")\n" + - " fun getExecutorApiLevel(): Int {\n" + - " placeholderExecution()\n" + - " return -1\n" + - " }\n" + - "\n" + - " @JvmName(\"${YukiXposedModuleStatusJvmName.GET_EXECUTOR_VERSION_NAME_METHOD_NAME}\")\n" + - " fun getExecutorVersionName(): String {\n" + - " placeholderExecution()\n" + - " return \"unknown\"\n" + - " }\n" + - "\n" + - " @JvmName(\"${YukiXposedModuleStatusJvmName.GET_EXECUTOR_VERSION_CODE_METHOD_NAME}\")\n" + - " fun getExecutorVersionCode(): Int {\n" + - " placeholderExecution()\n" + - " return -1\n" + - " }\n" + - "\n" + - " private fun placeholderExecution() {\n" + - " /** Consume a long method body */\n" + - " if (System.currentTimeMillis() == 0L) Log.d(\"${(1000..9999).random()}\", \"${(100000..999999).random()}\")\n" + - " }\n" + - "}"), - ClassName.HandlerDelegateImpl_Impl to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.HandlerDelegateImpl_Impl}\n" + - "\n" + - "import android.os.Handler\n" + - "import ${ExternalCallerName.YukiGenerateApiAnnotation.first}\n" + - "import ${PackageName.HandlerDelegateClass}.${tailPackageName(ClassName.HandlerDelegateClass)}\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.HandlerDelegateImpl_Impl) + - "@${ExternalCallerName.YukiGenerateApiAnnotation.second}\n" + - "object ${ClassName.HandlerDelegateImpl_Impl} {\n" + - "\n" + - " val wrapperClassName get() = \"${PackageName.HandlerDelegateClass}.${tailPackageName(ClassName.HandlerDelegateClass)}\"\n" + - "\n" + - " fun createWrapper(baseInstance: Handler.Callback? = null): Handler.Callback = ${tailPackageName(ClassName.HandlerDelegateClass)}(baseInstance)\n" + - "}"), - ClassName.HandlerDelegateClass to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.HandlerDelegateClass}\n" + - "\n" + - "import android.os.Handler\n" + - "import android.os.Message\n" + - "import androidx.annotation.Keep\n" + - "import ${ExternalCallerName.YukiGenerateApiAnnotation.first}\n" + - "import ${ExternalCallerName.HandlerDelegateCaller.first}\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.HandlerDelegateClass) + - "@Keep\n" + - "@${ExternalCallerName.YukiGenerateApiAnnotation.second}\n" + - "class ${tailPackageName(ClassName.HandlerDelegateClass)}(private val baseInstance: Handler.Callback?) : Handler.Callback {\n" + - "\n" + - " override fun handleMessage(msg: Message) = ${ExternalCallerName.HandlerDelegateCaller.second}.callHandleMessage(baseInstance, msg)\n" + - "}"), - ClassName.IActivityManagerProxyImpl_Impl to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.IActivityManagerProxyImpl_Impl}\n" + - "\n" + - "import android.os.Handler\n" + - "import ${ExternalCallerName.YukiGenerateApiAnnotation.first}\n" + - "import ${ExternalCallerName.IActivityManagerProxyCaller.first}\n" + - "import ${PackageName.IActivityManagerProxyClass}.${tailPackageName(ClassName.IActivityManagerProxyClass)}\n" + - "import java.lang.reflect.Proxy\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.IActivityManagerProxyImpl_Impl) + - "@${ExternalCallerName.YukiGenerateApiAnnotation.second}\n" + - "object ${ClassName.IActivityManagerProxyImpl_Impl} {\n" + - "\n" + - " fun createWrapper(clazz: Class<*>?, instance: Any) = \n" + - " Proxy.newProxyInstance(${ExternalCallerName.IActivityManagerProxyCaller.second}.currentClassLoader, arrayOf(clazz)," + - " ${tailPackageName(ClassName.IActivityManagerProxyClass)}(instance))\n" + - "}"), - ClassName.IActivityManagerProxyClass to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package ${PackageName.IActivityManagerProxyClass}\n" + - "\n" + - "import androidx.annotation.Keep\n" + - "import ${ExternalCallerName.YukiGenerateApiAnnotation.first}\n" + - "import ${ExternalCallerName.IActivityManagerProxyCaller.first}\n" + - "import java.lang.reflect.InvocationHandler\n" + - "import java.lang.reflect.Method\n" + - "import java.lang.reflect.Proxy\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.IActivityManagerProxyClass) + - "@Keep\n" + - "@${ExternalCallerName.YukiGenerateApiAnnotation.second}\n" + - "class ${tailPackageName(ClassName.IActivityManagerProxyClass)}(private val baseInstance: Any) : InvocationHandler {\n" + - "\n" + - " override fun invoke(proxy: Any?, method: Method?, args: Array?) = ${ExternalCallerName.IActivityManagerProxyCaller.second}.callInvoke(baseInstance, method, args)\n" + - "}"), - ClassName.XposedInit to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package $entryPackageName\n" + - "\n" + - "import androidx.annotation.Keep\n" + - "import ${ExternalCallerName.YukiXposedEventCaller.first}\n" + - "import ${ExternalCallerName.YukiGenerateApiAnnotation.first}\n" + - (if (isUsingResourcesHook) "import de.robv.android.xposed.IXposedHookInitPackageResources\n" else "") + - "import de.robv.android.xposed.IXposedHookLoadPackage\n" + - "import de.robv.android.xposed.IXposedHookZygoteInit\n" + - (if (isUsingResourcesHook) "import de.robv.android.xposed.callbacks.XC_InitPackageResources\n" else "") + - "import de.robv.android.xposed.callbacks.XC_LoadPackage\n" + - "\n" + - createCommentContent(entryClassName, currrentClassTag = "Xposed Init") + - "@Keep\n" + - "@${ExternalCallerName.YukiGenerateApiAnnotation.second}\n" + - "class $xInitClassName : IXposedHookZygoteInit, IXposedHookLoadPackage" + - "${if (isUsingResourcesHook) ", IXposedHookInitPackageResources" else ""} {\n" + - "\n" + - " override fun initZygote(sparam: IXposedHookZygoteInit.StartupParam?) {\n" + - " ${entryClassName}_Impl.callInitZygote(sparam)\n" + - " ${ExternalCallerName.YukiXposedEventCaller.second}.callInitZygote(sparam)\n" + - " }\n" + - "\n" + - " override fun handleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {\n" + - " ${entryClassName}_Impl.callHandleLoadPackage(lpparam)\n" + - " ${ExternalCallerName.YukiXposedEventCaller.second}.callHandleLoadPackage(lpparam)\n" + - " }\n" + - (if (isUsingResourcesHook) - ("\n override fun handleInitPackageResources(resparam: XC_InitPackageResources.InitPackageResourcesParam?) {\n" + - " ${entryClassName}_Impl.callHandleInitPackageResources(resparam)\n" + - " ${ExternalCallerName.YukiXposedEventCaller.second}.callHandleInitPackageResources(resparam)\n" + - " }\n") else "") + - "}"), - ClassName.XposedInit_Impl to ("@file:Suppress(\"ClassName\")\n" + - "\n" + - "package $entryPackageName\n" + - "\n" + - "import ${ExternalCallerName.YukiGenerateApiAnnotation.first}\n" + - "import ${ExternalCallerName.YukiXposedModuleCaller.first}\n" + - "import ${ExternalCallerName.YukiXposedResourcesCaller.first}\n" + - "import com.highcapable.yukihookapi.hook.xposed.bridge.type.HookEntryType\n" + - "import de.robv.android.xposed.IXposedHookZygoteInit\n" + - "import de.robv.android.xposed.XposedBridge\n" + - "import de.robv.android.xposed.callbacks.XC_InitPackageResources\n" + - "import de.robv.android.xposed.callbacks.XC_LoadPackage\n" + - (if (customMPackageName.isBlank()) "import $modulePackageName.BuildConfig\n" else "") + - "\n" + - createCommentContent(entryClassName, currrentClassTag = "Xposed Init Impl") + - "@${ExternalCallerName.YukiGenerateApiAnnotation.second}\n" + - "object ${entryClassName}_Impl {\n" + - "\n" + - " private const val modulePackageName = " + - (if (customMPackageName.isNotBlank()) "\"$customMPackageName\"" else "BuildConfig.APPLICATION_ID") + "\n" + - " private var isZygoteCalled = false\n" + - " private val hookEntry = " + (if (isEntryClassKindOfObject) "$entryClassName\n" else "$entryClassName()\n") + - "\n" + - " private fun callOnXposedModuleLoaded(\n" + - " isZygoteLoaded: Boolean = false,\n" + - " lpparam: XC_LoadPackage.LoadPackageParam? = null,\n" + - " resparam: XC_InitPackageResources.InitPackageResourcesParam? = null\n" + - " ) {\n" + - " if (isZygoteCalled.not()) runCatching {\n" + - " hookEntry.onXposedEvent()\n" + - " hookEntry.onInit()\n" + - " if (${ExternalCallerName.YukiXposedModuleCaller.second}.isXposedCallbackSetUp) {\n" + - " ${ExternalCallerName.YukiXposedModuleCaller.second}.internalLoggerE(\"You cannot load a hooker in \\\"onInit\\\" or \\\"onXposedEvent\\\" method! Aborted\")\n" + - " return\n" + - " }\n" + - " hookEntry.onHook()\n" + - " ${ExternalCallerName.YukiXposedModuleCaller.second}.callOnFinishLoadModule()\n" + - " }.onFailure { ${ExternalCallerName.YukiXposedModuleCaller.second}.internalLoggerE(\"YukiHookAPI try to load hook entry class failed\", it) }\n" + - " ${ExternalCallerName.YukiXposedModuleCaller.second}.callOnPackageLoaded(\n" + - " type = when {\n" + - " isZygoteLoaded -> HookEntryType.ZYGOTE\n" + - " lpparam != null -> HookEntryType.PACKAGE\n" + - " resparam != null -> HookEntryType.RESOURCES\n" + - " else -> HookEntryType.ZYGOTE\n" + - " },\n" + - " packageName = lpparam?.packageName ?: resparam?.packageName,\n" + - " processName = lpparam?.processName,\n" + - " appClassLoader = lpparam?.classLoader ?: runCatching { XposedBridge.BOOTCLASSLOADER }.getOrNull(),\n" + - " appInfo = lpparam?.appInfo,\n" + - " appResources = ${ExternalCallerName.YukiXposedResourcesCaller.second}.createYukiResourcesFromXResources(resparam?.res)\n" + - " )\n" + - " }\n" + - "\n" + - " fun callInitZygote(sparam: IXposedHookZygoteInit.StartupParam?) {\n" + - " if (sparam == null) return\n" + - " runCatching {\n" + - " ${ExternalCallerName.YukiXposedModuleCaller.second}.callOnStartLoadModule(modulePackageName, sparam.modulePath)\n" + - " callOnXposedModuleLoaded(isZygoteLoaded = true)\n" + - " isZygoteCalled = true\n" + - " }.onFailure { ${ExternalCallerName.YukiXposedModuleCaller.second}.internalLoggerE(\"An exception occurred when YukiHookAPI loading Xposed Module\", it) }\n" + - " }\n" + - "\n" + - " fun callHandleLoadPackage(lpparam: XC_LoadPackage.LoadPackageParam?) {\n" + - " if (lpparam != null && isZygoteCalled) callOnXposedModuleLoaded(lpparam = lpparam)\n" + - " }\n" + - "\n" + - " fun callHandleInitPackageResources(resparam: XC_InitPackageResources.InitPackageResourcesParam?) {\n" + - " if (resparam != null && isZygoteCalled) callOnXposedModuleLoaded(resparam = resparam)\n" + - " }\n" + - "}"), - ClassName.BootstrapClass to ("package ${PackageName.BootstrapReflectionClass};\n" + - "\n" + - "import static android.os.Build.VERSION.SDK_INT;\n" + - "\n" + - "import android.os.Build;\n" + - "import android.util.Log;\n" + - "\n" + - "import androidx.annotation.Keep;\n" + - "\n" + - "import java.lang.reflect.Method;\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.BootstrapClass) + - "@Keep\n" + - "public final class BootstrapClass {\n" + - "\n" + - " private static final String TAG = \"BootstrapClass\";\n" + - " private static Object sVmRuntime;\n" + - " private static Method setHiddenApiExemptions;\n" + - "\n" + - " static {\n" + - " if (SDK_INT >= Build.VERSION_CODES.P) {\n" + - " try {\n" + - " Method forName = Class.class.getDeclaredMethod(\"forName\", String.class);\n" + - " Method getDeclaredMethod = Class.class.getDeclaredMethod(\"getDeclaredMethod\", String.class, Class[].class);\n" + - " Class vmRuntimeClass = (Class) forName.invoke(null, \"dalvik.system.VMRuntime\");\n" + - " Method getRuntime = (Method) getDeclaredMethod.invoke(vmRuntimeClass, \"getRuntime\", null);\n" + - " setHiddenApiExemptions = (Method) getDeclaredMethod.invoke(vmRuntimeClass, \"setHiddenApiExemptions\", new Class[]{String[].class});\n" + - " sVmRuntime = getRuntime.invoke(null);\n" + - " } catch (Throwable e) {\n" + - " Log.w(TAG, \"reflect bootstrap failed:\", e);\n" + - " }\n" + - " }\n" + - " }\n" + - "\n" + - " public static boolean exempt(String method) {\n" + - " return exempt(new String[]{method});\n" + - " }\n" + - "\n" + - " public static boolean exempt(String... methods) {\n" + - " if (sVmRuntime == null || setHiddenApiExemptions == null) {\n" + - " return false;\n" + - " }\n" + - " try {\n" + - " setHiddenApiExemptions.invoke(sVmRuntime, new Object[]{methods});\n" + - " return true;\n" + - " } catch (Throwable e) {\n" + - " return false;\n" + - " }\n" + - " }\n" + - "\n" + - " public static boolean exemptAll() {\n" + - " return exempt(new String[]{\"L\"});\n" + - " }\n" + - "}"), - ClassName.Reflection to ("package ${PackageName.BootstrapReflectionClass};\n" + - "\n" + - "import static android.os.Build.VERSION.SDK_INT;\n" + - "import static com.highcapable.yukihookapi.thirdparty.me.weishu.reflection.BootstrapClass.exemptAll;\n" + - "\n" + - "import android.content.Context;\n" + - "import android.text.TextUtils;\n" + - "import android.util.Base64;\n" + - "\n" + - "import androidx.annotation.Keep;\n" + - "\n" + - "import java.io.File;\n" + - "import java.io.FileOutputStream;\n" + - "import java.lang.reflect.Method;\n" + - "\n" + - "import dalvik.system.DexFile;\n" + - "\n" + - createCommentContent(currrentClassTag = ClassName.Reflection) + - "@Keep\n" + - "public class Reflection {\n" + - "\n" + - " private static final String TAG = \"Reflection\";\n" + - " private static final String DEX = \"ZGV4CjAzNQCXDT0vQ44GJqsrjm32y0qlQmxUevbk56r0Cw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UAKPcAAAYAAABrAAEAAQEMcgEAAQABAAAAaAgAAAQAAABwEAwAAAAOAAMAAQABAAAAbQgAAAsAAAASECMAEgASAU0CAAFxEAYAAAAKAA8AAAAIAAEAAwABAHMIAAAdAAAAEhESAmIDCQA4AwYAYgMKADkDBAABIQ8BYgMKAGIECQASFSNVEQASBk0HBQZuMA4AQwUo8g0AASEo7wAADAAAAA0AAQABAQwaAwAAAAEAAACDCAAADQAAABIQIwASABIBGgIPAE0CAAFxEAYAAAAKAA8AAAABAAEAAQAAAIgIAAAEAAAAcBAMAAAADgAEAAEAAQAAAI0IAAAeAAAAEgBgAQEAEwIcADUhAwAPAHEABwAAAAoBOQH7/xoAMgBxEA0AAABuEAAAAwAMAFIAAABxEAoAAAAKACjqBgABAAIZARkBGQEZARkBGQKBgASYEQMABQAIGgEKAQoDiIAEsBEBgYAExBMBCdwTAYkBhBQBCdwUAQADAAsaCIGABIgVAQmgFQGKAgAAAAAPAAAAAAAAAAEAAAAAAAAAAQAAAEMAAABwAAAAAgAAABMAAAB8AQAAAwAAAAsAAADIAQAABAAAAAwAAABMAgAABQAAAA8AAACsAgAABgAAAAMAAAAkAwAAAiAAAEMAAACEAwAAARAAAAcAAADgBwAABSAAAAMAAAAcCAAAAxAAAAEAAAAwCAAAAyAAAAgAAAA0CAAAASAAAAgAAACYCAAAACAAAAMAAADsCgAAABAAAAEAAAA8CwAA\";\n" + - "\n" + - " private static native int unsealNative(int targetSdkVersion);\n" + - "\n" + - " public static int unseal(Context context) {\n" + - " if (SDK_INT < 28) {\n" + - " // Below Android P, ignore\n" + - " return 0;\n" + - " }\n" + - " // try exempt API first.\n" + - " if (exemptAll()) {\n" + - " return 0;\n" + - " }\n" + - " if (unsealByDexFile(context)) {\n" + - " return 0;\n" + - " }\n" + - " return -1;\n" + - " }\n" + - "\n" + - " @SuppressWarnings({\"deprecation\", \"ResultOfMethodCallIgnored\"})\n" + - " private static boolean unsealByDexFile(Context context) {\n" + - " byte[] bytes = Base64.decode(DEX, Base64.NO_WRAP);\n" + - " File codeCacheDir = getCodeCacheDir(context);\n" + - " if (codeCacheDir == null) {\n" + - " return false;\n" + - " }\n" + - " File code = new File(codeCacheDir, \"__temp_\" + System.currentTimeMillis() + \".dex\");\n" + - " try {\n" + - " try (FileOutputStream fos = new FileOutputStream(code)) {\n" + - " fos.write(bytes);\n" + - " }\n" + - " DexFile dexFile = new DexFile(code);\n" + - " // This class is hardcoded in the dex, Don't use BootstrapClass.class to reference it\n" + - " // it maybe obfuscated!!\n" + - " Class bootstrapClass = dexFile.loadClass(\"com.highcapable.yukihookapi.thirdparty.me.weishu.reflection.BootstrapClass\", null);\n" + - " Method exemptAll = bootstrapClass.getDeclaredMethod(\"exemptAll\");\n" + - " return (boolean) exemptAll.invoke(null);\n" + - " } catch (Throwable e) {\n" + - " e.printStackTrace();\n" + - " return false;\n" + - " } finally {\n" + - " if (code.exists()) {\n" + - " code.delete();\n" + - " }\n" + - " }\n" + - " }\n" + - "\n" + - " private static File getCodeCacheDir(Context context) {\n" + - " if (context != null) {\n" + - " return context.getCodeCacheDir();\n" + - " }\n" + - " String tmpDir = System.getProperty(\"java.io.tmpdir\");\n" + - " if (TextUtils.isEmpty(tmpDir)) {\n" + - " return null;\n" + - " }\n" + - " File tmp = new File(tmpDir);\n" + - " if (!tmp.exists()) {\n" + - " return null;\n" + - " }\n" + - " return tmp;\n" + - " }\n" + - "}") -) \ No newline at end of file