232 Commits

Author SHA1 Message Date
e1544a8ae3 refactor: merge to BetterAndroid new usage 2025-08-19 19:09:00 +08:00
276503ccf4 chore: update target sdk to 36 2025-08-19 19:07:00 +08:00
36bb1bf108 chore: bump gradle to 8.14.3 2025-08-19 19:06:47 +08:00
edb22f1bd3 chore: bump dependencies 2025-08-19 19:06:35 +08:00
61c0c5960b chore: bump dependencies 2025-08-16 02:09:11 +08:00
3dbc33a301 docs(fix): normalized 2025-08-03 02:16:15 +08:00
03304e3c22 docs(fix): normalized 2025-08-03 02:00:45 +08:00
7c9e84f0ed docs:(fix): normalized 2025-08-03 01:25:35 +08:00
sorrw.
525d716256 docs: update Gradle dependencies syntax (#105) 2025-07-18 19:30:12 +08:00
a136832e77 refactor: update KavaRef usage to 1.0.1 2025-07-06 21:15:02 +08:00
243ec6ea1e docs: update README 2025-06-25 21:45:21 +08:00
2c1d99e0ea Bump version to 1.3.0 2025-06-25 20:11:00 +08:00
db5516ad6d chore: bump dependencies 2025-06-25 20:10:16 +08:00
7135d34381 docs: update yukihookapi-projectbuilder 2025-06-25 17:59:55 +08:00
67e2dac3c4 style: update demo 2025-06-25 17:59:33 +08:00
e17e7681ec docs: update README 2025-06-24 15:52:53 +08:00
932f644c7f docs: some tweaks in docs 2025-06-19 15:30:45 +08:00
f8c1a27169 docs: update move-to-api-1-3-x 2025-06-19 15:25:36 +08:00
6b08287991 refactor: allow any incoming to log in YLog 2025-06-19 15:22:05 +08:00
311926b3cb fix: inner log not init KavaRef log in YLog 2025-06-19 14:48:53 +08:00
684e3abbdc feat: update demo 2025-06-18 20:40:28 +08:00
14399538ea refactor: merge ModuleAppActivity, ModuleAppCompatActivity to ModuleActivity and some tweaks 2025-06-18 20:39:26 +08:00
701cbe0fc0 docs: update comment in ReflectionMigration 2025-06-17 18:52:19 +08:00
de5a3ffe83 feat: update demo 2025-06-17 16:32:06 +08:00
4ecc67507a refactor: take over KavaRef log to YLog 2025-06-17 16:32:01 +08:00
beb7b431f8 refactor: remove repeated hook feature in YukiMemberHookCreator 2025-06-16 18:20:47 +08:00
d36a6a10e0 fix: MemberResolver not encase in PackageParam 2025-06-16 17:20:31 +08:00
242322954a feat: update demo 2025-06-16 17:05:36 +08:00
c8f1e3441e refactor: big modified
- update dependencies
- migration reflection api to KavaRef
- merge to new api usage
2025-06-16 17:05:06 +08:00
cca6e1d2a8 refactor: remove Java example 2025-06-15 03:22:00 +08:00
6ead14e65b refactor: migration layout to Hikage 2025-06-11 12:39:05 +08:00
wizpizz
fafd54139b Add OnePlusPlusLauncher to 'Cooperations' (#101)
* Add OnePlusPlusLauncher to 'Cooperations'

Recently made a module using YukiHookAPI, would love to add it to the Cooperations section

* misc: update README

---------

Co-authored-by: fankesyooni <qzmmcn@163.com>
2025-05-27 16:32:53 +08:00
sorrw.
54c4379e97 BaseFinder: remove explicit type cast (#99) 2025-04-07 11:31:05 +08:00
sorrw.
34a701a83c refactor: optimize random string generation with Kotlin idioms (#98) 2025-03-31 02:32:26 +08:00
2f832d46d4 chore: update project files 2025-03-17 01:59:12 +08:00
d81c74c60a chore: update .editorconfig 2025-03-17 00:02:33 +08:00
7509112177 chore: bump dependencies 2025-03-16 23:59:53 +08:00
3e6435905e chore: bump gradle to 8.13 2025-03-16 23:59:48 +08:00
155077436d chore: bump ci to v4 2025-02-22 02:10:28 +08:00
67116bba5a chore: update .gitignore 2025-02-22 02:09:46 +08:00
34f90a2466 chore: update project files 2025-02-22 02:09:40 +08:00
d6db8925c9 docs: update move-to-new-api 2025-01-13 12:56:05 +08:00
7f97ad7197 docs: update license 2025-01-13 10:48:52 +08:00
5262e15749 chore: update target sdk to 35 2024-11-10 21:56:30 +08:00
1fd68bf6e3 chore: update project files 2024-11-10 21:56:05 +08:00
7aecf84829 fix: try-catch Context.MODE_WORLD_READABLE if failure of non-hook environment in ModulePreferenceFragment 2024-11-10 21:55:41 +08:00
8b607b2243 chore: bump dependencies 2024-11-10 21:48:17 +08:00
fddd2991a1 chore: bump gradle to 8.10.2 2024-11-10 21:48:09 +08:00
Hd
32c430650f docs: update README, README-zh-CN (#92) 2024-11-04 11:54:38 +08:00
kazutoiris
5dd117c8bb Add infinite-illusion to cooperation (#90)
* Update README.md

* Update README-zh-CN.md
2024-10-31 13:35:17 +08:00
Cledwyn Lew
a72bc47c4f fix: prefs created by ModulePreferenceFragement is not WORLD_READABLE (#87) 2024-10-01 09:43:27 +08:00
dependabot[bot]
ff256bd41d chore(deps): bump rollup from 4.9.1 to 4.22.4 in /docs-source (#84)
Bumps [rollup](https://github.com/rollup/rollup) from 4.9.1 to 4.22.4.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.9.1...v4.22.4)

---
updated-dependencies:
- dependency-name: rollup
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-24 19:15:30 +08:00
kazutoiris
9c7c9248f8 Add dingda-adfree to cooperation (#83)
* Add cooperation

* Update README-zh-CN.md
2024-09-16 18:25:48 +08:00
dependabot[bot]
e4ea41e46c chore(deps): bump micromatch from 4.0.5 to 4.0.8 in /docs-source (#82)
Bumps [micromatch](https://github.com/micromatch/micromatch) from 4.0.5 to 4.0.8.
- [Release notes](https://github.com/micromatch/micromatch/releases)
- [Changelog](https://github.com/micromatch/micromatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/micromatch/compare/4.0.5...4.0.8)

---
updated-dependencies:
- dependency-name: micromatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-09-03 10:09:23 +08:00
dependabot[bot]
71e977b6cf chore(deps): bump braces from 3.0.2 to 3.0.3 in /docs-source (#79) 2024-06-23 12:15:21 +08:00
a10c15d5ab chore: update .editorconfig 2024-06-21 10:16:13 +08:00
e397a301d4 Bump version to 1.2.1 2024-06-20 10:47:03 +08:00
c5b191ad8a chore: update .editorconfig 2024-06-20 10:35:12 +08:00
9ef793695c feat: add SymbolConverterTool to resolve kotlin keywords package name 2024-06-20 10:26:18 +08:00
5c946f7fd9 chore: bump dependencies 2024-06-20 09:42:33 +08:00
e8754c7ede fix: curly brace syntax in YukiHookAPI 2024-06-20 09:42:26 +08:00
xihan123
04405c5a53 更新依赖库以支持 kotlin 2.0.0 版本 (#76)
* chore: bump gradle to 8.7

* chore: bump dependencies

* fix(style): 'if' must have both main and 'else' branches when used as an expression.
2024-05-31 01:53:07 +08:00
Light_summer
f5a3f31cc9 fix: fix https://github.com/HighCapable/YukiHookAPI/issues/65 (#71) 2024-04-12 19:17:45 +08:00
e655e185b4 chore: bump dependencies 2024-02-20 11:55:07 +08:00
bccd46ffde chore: bump gradle to 8.6 2024-02-20 11:55:02 +08:00
f29ce486e1 chore: update .editorconfig 2024-01-13 21:29:44 +08:00
e019ad5ed7 docs: update contacts 2024-01-02 03:45:50 +08:00
cac9460335 docs: update copyright date to 2024 for all existing files 2024-01-01 01:37:34 +08:00
1005cd0eea docs: update about 2023-12-31 21:05:15 +08:00
c1aaa97681 style: merge to new ktlint version & rules 2023-12-29 21:40:15 +08:00
20c4eced2b chore: update .gitignore 2023-12-28 23:13:08 +08:00
fe2342ba42 chore: merge to new maven publish way 2023-12-28 23:09:25 +08:00
500b416650 chore: update project files 2023-12-28 22:46:20 +08:00
6b7a9961cc chore: bump dependencies 2023-12-28 22:46:20 +08:00
f9120b7422 chore: bump gradle to 8.5 2023-12-28 22:46:19 +08:00
87b651420c docs: updates (some unimportant) 2023-12-18 09:09:05 +08:00
039392e729 chore(docs): bump dependencies 2023-12-18 09:07:31 +08:00
b4ee6a0e15 docs: use relative link 2023-12-11 02:33:55 +08:00
ece229c683 chore: update project files 2023-12-11 02:33:51 +08:00
95f309e0f6 chore: bump dependency versions 2023-12-11 01:15:05 +08:00
6df206ce7d docs: update README, README-zh-CN 2023-12-11 01:12:41 +08:00
Fankesyooni
e4799af576 Merge pull request #57 from pwh-pwh/master
add fuck_shake pj
2023-11-23 23:00:51 +08:00
coderpwh
142ea597ac Update README-zh-CN.md 2023-11-22 16:02:13 +08:00
coderpwh
49a3a87e06 Update README.md 2023-11-22 16:01:08 +08:00
2f72812e58 docs: update promotion 2023-11-18 18:12:31 +08:00
b8450e9a2e chore: bump "com.highcapable.sweetdependency" version to 1.0.4 2023-11-14 01:07:00 +08:00
0ca2365aa1 chore: bump "com.highcapable.sweetproperty" version to 1.0.5 2023-11-08 15:27:46 +08:00
7b527186c8 chore: bump dependencies 2023-11-04 03:30:26 +08:00
6e8a7db742 chore: bump plugin versions
- bump "com.highcapable.sweetdependency" version to 1.0.3
- bump "com.highcapable.sweetproperty" version to 1.0.4
2023-11-04 03:22:36 +08:00
31e3b7a678 docs: update promotion 2023-10-24 22:15:04 +08:00
69419f9f2e feat: catching the single hooker exceptions 2023-10-16 16:01:35 +08:00
9a152a436d docs: fix some typo 2023-10-11 14:19:59 +08:00
dc4b0281bd Bump version to 1.2.0 2023-10-07 19:09:05 +08:00
d55e4e3f16 refactor: change license to Apache-2.0 2023-10-07 18:52:55 +08:00
333877c4de refactor: change repository owner to HighCapable 2023-10-07 17:50:15 +08:00
87adab8029 docs: add LSPlant 2023-10-07 16:50:05 +08:00
8f523d470d style: use "2.0.0" instead "2.x.x" 2023-10-07 16:42:56 +08:00
6d82c28081 docs: merge some future to migrate docs 2023-10-07 16:29:05 +08:00
5939e1dcd3 fix: normal logs not output throwable 2023-10-07 11:22:55 +08:00
ba9928b43c fix: typo 2023-10-07 11:19:05 +08:00
8462d9cb34 docs: update api-exception, example 2023-10-07 11:17:35 +08:00
94ffac84bc docs: update api docs 2023-10-07 11:17:05 +08:00
8d8002df87 refactor: merge some legacy apis 2023-10-07 11:13:35 +08:00
ce3c2fa360 fix: when not using injectMember function create instance still show error when members is empty 2023-10-06 04:27:59 +08:00
973e406b95 docs: update future 2023-10-06 03:11:15 +08:00
fc1a8ae5e1 docs: update api docs 2023-10-06 02:32:35 +08:00
7b9af68fe6 refactor: make appClassLoader nullable 2023-10-06 02:32:20 +08:00
c4100247f8 docs: update example, reflection 2023-10-06 02:20:59 +08:00
c801f2aeca docs: update api docs 2023-10-06 02:20:25 +08:00
6687c69b17 feat: add lazyClass, lazyClassOrNull functions 2023-10-06 02:19:50 +08:00
29a594d272 refactor: mark some functions to legacy hook api 2023-10-05 22:23:25 +08:00
c7cafa11a9 docs: update api docs 2023-10-05 22:22:15 +08:00
a19dfb3b5f feat: add direct hook functions 2023-10-05 22:15:15 +08:00
a2056db45e refactor: disable hook when got empty members and optimize some functions 2023-10-05 05:16:55 +08:00
6e57dc9ab0 fix: legacy hook api may cause problem when class not found 2023-10-05 04:10:35 +08:00
39656b81b3 feat: log warn when no callback of already hooked members 2023-10-05 03:19:05 +08:00
e0b18eb81c docs: update Java requirement description 2023-10-05 02:27:05 +08:00
5d9b473bd6 feat: update demo 2023-10-05 02:15:35 +08:00
545f7f92ab docs: update xposed-using 2023-10-05 02:15:25 +08:00
b38d2b63ea fix: module package name obtain function 2023-10-05 02:15:15 +08:00
c921348572 feat: update demo 2023-10-05 00:37:55 +08:00
4e0f88dbad docs: update example, xposed-using 2023-10-05 00:37:35 +08:00
c7decb4119 docs: update api docs 2023-10-05 00:37:15 +08:00
da26016630 refactor: move xposed module status function to auto generator 2023-10-05 00:36:55 +08:00
922907fa0f refactor: make YukiXposedModuleStatus anonymous 2023-10-04 23:30:55 +08:00
a003a4ea07 refactor: remove FreeReflection auto generation, add it using dependency 2023-10-04 19:48:35 +08:00
ae71bea0a0 feat: support single process multiple AppLifecycle instance 2023-10-04 04:16:15 +08:00
92106d6e92 feat: dynamic name for PackageParam and HookParam 2023-10-04 03:51:25 +08:00
044e67ae7f fix: demo bugs 2023-10-04 03:39:55 +08:00
58ed2b962e chore(fix): suppress warning 2023-10-04 03:39:35 +08:00
73e09bef25 feat: update demo 2023-10-04 03:15:56 +08:00
89cec45326 refactor: optimize opt-in annotations 2023-10-04 03:15:50 +08:00
3d149a92ca docs: update api docs 2023-10-04 03:10:25 +08:00
d04b9a5211 refactor: merge hook priority to YukiHookPriority 2023-10-04 03:07:50 +08:00
fa24de805a fix: spelling case problems 2023-10-04 02:27:05 +08:00
f5c2ce2468 feat: update demo 2023-10-04 02:23:55 +08:00
3f5114851c docs: update api docs 2023-10-04 02:23:35 +08:00
edcc17907b refactor: remove hook tag and remove old api usage 2023-10-04 02:23:25 +08:00
786b2ad9ea docs: update reflection 2023-10-04 01:01:15 +08:00
da170e7ae1 feat: update api-exception 2023-10-03 23:23:15 +08:00
5c415c8d61 feat: allow no condition finding and ignore member access exception 2023-10-03 23:22:50 +08:00
8c8cfc5498 feat: update demo 2023-10-03 04:17:35 +08:00
6e658baf17 docs: update to new usage 2023-10-03 04:17:25 +08:00
375b2f3398 refactor: disable resources hook by default 2023-10-03 04:16:55 +08:00
7d2dc3c268 docs: update api docs 2023-10-03 04:16:25 +08:00
7280397d79 feat: add new api preview functions, mark old api to legacy 2023-10-03 04:15:59 +08:00
1ffa0fab4f refactor: merge opt-in api to new annotations 2023-10-03 01:59:55 +08:00
71203cd9bf refactor: make BaseFinder.BaseResult public 2023-10-02 23:07:15 +08:00
b8bb903ff7 feat: update demo 2023-10-02 22:41:55 +08:00
ea86a2b60a docs: update api-example, example, move-to-new-api, reflection 2023-10-02 22:41:35 +08:00
3ca7f4b017 docs: update api docs 2023-10-02 22:41:05 +08:00
b531fce974 refactor: deprecated findClass and String.hook functions 2023-10-02 22:40:38 +08:00
d7b670c94d docs: update api-exception 2023-10-02 02:36:35 +08:00
3118b3a5e6 docs: update api docs 2023-10-02 02:36:25 +08:00
18ec0e2727 feat: add replace resources hook callback functions 2023-10-02 02:36:15 +08:00
e813aaf97a fix: HookParam call timing problem and refactor HookParam 2023-10-02 01:15:35 +08:00
460ac083b0 refactor: merge HashSet/ArraySet to MutableSet, HashMap/ArrayMap to MutableMap, ArrayList to MutableList 2023-10-02 00:35:20 +08:00
00bea93085 refactor: merge HashSet, ArrayList to MutableList 2023-10-01 23:00:55 +08:00
2ee38ee54e docs: update api docs 2023-10-01 01:00:20 +08:00
c9e2720afc fix: make actualTypeArguments not force cast to Class type 2023-10-01 00:59:55 +08:00
e3da58952f feat: update demo 2023-09-30 23:32:56 +08:00
0709317d36 refactor: disable debug mode by default 2023-09-30 23:32:45 +08:00
bca5a07826 refactor: optimize some code 2023-09-30 23:25:55 +08:00
fd84b22532 feat: update demo 2023-09-28 00:53:00 +08:00
fe2f5c802e docs: update logger 2023-09-28 00:52:55 +08:00
dbe451d29c docs: update api docs 2023-09-28 00:52:35 +08:00
c651776da0 refactor: split LoggerFactory to YLog and YLogData 2023-09-28 00:50:45 +08:00
ee1fc85a4e refactor: make CauseProblemsApi open again 2023-09-28 00:11:43 +08:00
3ab4a8ee12 refactor: remove some comments 2023-09-27 22:15:05 +08:00
18172145ef refactor: remove "" and other comments 2023-09-27 18:17:45 +08:00
418fd9de00 refactor: use magic to hide lint on non-public, inline api
- remove all YukiGenerateApi, YukiPrivateApi and @PublishedApi
2023-09-27 18:01:35 +08:00
24290a7ee2 fix: typo in demo-module 2023-09-27 17:48:13 +08:00
92daf533c9 chore: bump plugin versions
- bump "com.highcapable.sweetdependency" version to 1.0.2
- bump "com.highcapable.sweetproperty" version to 1.0.3
- update build script usage
- update config file usage
2023-09-26 08:59:49 +08:00
4d0dce8fd3 style: rename toStackTrack to dumpToString 2023-09-26 02:33:39 +08:00
68f8b0f571 refactor: optimize core finder code
- fix remedy plan not show any errors problem
- rearrange some code
2023-09-24 01:09:03 +08:00
cfeac9075a feat: update demo 2023-09-23 22:25:37 +08:00
38b296274c docs(fix): tag level error 2023-09-23 22:23:55 +08:00
00788cce5a fix: debug mode use debug log 2023-09-23 21:59:17 +08:00
e14c3e3808 style: use TAG instead hardcode 2023-09-23 21:00:29 +08:00
c849690699 refactor: merge all util functions to factory 2023-09-23 20:55:43 +08:00
d0d1ce1cb9 feat: update demo 2023-09-23 20:55:38 +08:00
09e96feda4 docs: update api docs 2023-09-23 20:25:55 +08:00
1af4ff8525 feat: add TAG & merge API_VERSION_NAME, API_VERSION_CODE to VERSION 2023-09-23 20:23:25 +08:00
e7cca9b5ca docs: correct comments 2023-09-23 19:39:10 +08:00
1f1a0b6c11 docs(style): optimize symbols 2023-09-23 12:49:35 +08:00
24412eea84 ci: add docs deploy 2023-09-23 12:09:42 +08:00
b518376c00 docs(chore): update dependencies & remove old file 2023-09-23 12:09:11 +08:00
fe0bae8dfd docs: remove manually deployed 2023-09-23 12:08:58 +08:00
8aa5f34c36 docs: update docs compile files 2023-09-22 21:38:53 +08:00
a8a40b562f docs: optimize features 2023-09-22 21:38:16 +08:00
20618c10ec docs: update docs compile files 2023-09-22 20:37:45 +08:00
2c21554902 docs: fix typo 2023-09-22 20:36:09 +08:00
23f4da648a docs: optimize comments 2023-09-22 17:15:24 +08:00
9ebe38e358 docs: update docs compile files 2023-09-22 12:17:58 +08:00
d6f83ffc3c docs: add milestone related plans & modify some documents 2023-09-22 12:16:20 +08:00
ac316d1427 docs: update structure diagram 2023-09-22 09:15:20 +08:00
208c49cc0a docs: update docs compile files 2023-09-21 04:40:59 +08:00
a65dbe2c2f docs: add new contacts 2023-09-21 04:40:15 +08:00
0c239dcda4 docs: update docs compile files 2023-09-21 04:28:09 +08:00
2db28d8aab docs: update some functions 2023-09-21 04:26:20 +08:00
5bd18269c2 docs: optimize comments 2023-09-21 03:20:46 +08:00
8ba166dab9 style: lots of changes
- move demo-app, demo-module to samples
- rename yukihookapi to yukihookapi-core
- optimize code
- other small changes
2023-09-21 03:19:13 +08:00
dd7912a577 docs: update README, README-zh-CN 2023-09-21 03:16:23 +08:00
fc2187ddc8 chore: migrate build script from groovy to kts
- using SweetDependency, SweetProperty
- using new maven publish function
- update gradle and dependencies
2023-09-21 03:13:14 +08:00
bdae1944f2 chore: clean up build step files 2023-09-21 03:10:36 +08:00
e4063866f9 [Change Commit Specification] Use the new commit spec from here on
child commits:
chore: add .editorconfig
2023-09-21 03:06:43 +08:00
53de203733 Refactor optimize code in YukiHookDataChannel 2023-08-29 20:07:43 +08:00
db8cafe1f4 Modify rearrange code in YukiHookAPI 2023-08-29 20:06:13 +08:00
a88e88786e Refactor optimize code in YukiHookDataChannel, AppParasitics 2023-08-29 20:03:55 +08:00
Fankesyooni
f02e512ad8 Merge pull request #44 from BlueCat300/master
Fixed context-registered receivers
2023-08-29 19:53:47 +08:00
Blue cat
9da4743feb Fixed context-registered receivers 2023-08-24 19:09:46 +03:00
befa2d26ee Modify reformat code in README 2023-08-17 06:10:06 +08:00
Fankesyooni
4e8c46a85b Merge pull request #41 from kazutoiris/master
Add `zuiyou-adfree` to cooperation
2023-08-14 19:19:16 +08:00
kazutoiris
52739b9572 Add cooperation 2023-08-14 19:09:50 +08:00
30b4fda708 Fix naming of "ShortArrayType" in VariableTypeFactory 2023-06-26 06:00:06 +08:00
1e030ee72c Automatically compile documentation (1.1.11) 2023-05-12 17:05:56 +08:00
482efff67c Fix project url changed problem in type define documentation 2023-05-12 17:03:25 +08:00
1012777858 Fix translation problem in reflection documentation 2023-05-12 17:01:56 +08:00
Fankesyooni
a40318378f Merge pull request #38 from yangyiyu08/master
Fix get interfaces of class in ReflectionFactory
2023-05-05 23:47:45 +08:00
Fankesyooni
d2d95703dc Refactor optimize code in ReflectionFactory 2023-05-05 23:45:49 +08:00
qingyu
1bb2c4e5a2 fix get interfaces of class
fix get interfaces of class
2023-05-05 23:29:15 +08:00
9f24bffedc Automatically compile documentation (1.1.11) 2023-04-26 15:00:36 +08:00
f85cafc73d Fix "GitHub" spelling in all files 2023-04-26 14:59:35 +08:00
c5f2163fa3 Modify make makeWorldReadable function to inline in YukiHookPrefsBridge 2023-04-26 14:55:38 +08:00
e986a85d5a Automatically compile documentation (1.1.11) 2023-04-25 05:48:36 +08:00
0454c6faee Update version to 1.1.11 2023-04-25 05:45:05 +08:00
a398720755 Update demo 2023-04-25 05:05:55 +08:00
f6096721b7 Modify remove Members cache function and remove LruCache function, optimizing performance of finder 2023-04-25 05:03:20 +08:00
0b5bb7f09c Added Sequence.findLastIndex, Sequence.lastIndex functions in UtilsFactory 2023-04-25 04:29:55 +08:00
160856ebad Update demo 2023-04-25 01:22:05 +08:00
21970d1bc2 Modify remove prefs cache function in YukiHookPrefsBridge, YukiHookAPI 2023-04-25 01:21:05 +08:00
c2e4651137 Modify refactor code style in ReflectionTool 2023-04-24 22:15:43 +08:00
895 changed files with 17583 additions and 36097 deletions

35
.editorconfig Normal file
View File

@@ -0,0 +1,35 @@
# noinspection EditorConfigKeyCorrectness
[{*.kt,*.kts}]
ktlint_standard_annotation = disabled
ktlint_standard_filename = disabled
ktlint_standard_wrapping = disabled
ktlint_standard_import-ordering = enabled
ktlint_standard_max-line-length = disabled
ktlint_standard_multiline-if-else = disabled
ktlint_standard_argument-list-wrapping = disabled
ktlint_standard_parameter-list-wrapping = disabled
ktlint_standard_trailing-comma-on-declaration-site = disabled
ktlint_function_signature_body_expression_wrapping = multiline
ktlint_standard_string-template-indent = disabled
ktlint_standard_function-signature = disabled
ktlint_standard_trailing-comma-on-call-site = disabled
ktlint_standard_multiline-expression-wrapping = disabled
ktlint_standard_no-empty-first-line-in-class-body = disabled
ktlint_standard_if-else-wrapping = disabled
ktlint_standard_if-else-bracing = disabled
ktlint_standard_statement-wrapping = disabled
ktlint_standard_blank-line-before-declaration = disabled
ktlint_standard_no-empty-file = disabled
ktlint_standard_property-naming = disabled
ktlint_standard_function-naming = disabled
ktlint_standard_chain-method-continuation = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_condition-wrapping = disabled
ktlint_standard_class-signature = disabled
ktlint_standard_no-trailing-spaces = disabled
ktlint_standard_multiline-loop = disabled
ij_continuation_indent_size = 2
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 150

37
.github/workflows/docs-deploy.yml vendored Normal file
View File

@@ -0,0 +1,37 @@
name: Deploy to GitHub pages
on:
workflow_dispatch:
push:
branches: [ master ]
paths:
- 'docs-source/**'
- '.github/workflows/**'
permissions:
contents: write
jobs:
docs:
if: ${{ success() }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
- name: Build VuePress site
run: |
cd docs-source
yarn -i
yarn docs:build-gh-pages
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v4
with:
target_branch: gh-pages
build_dir: docs-source/dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

118
.gitignore vendored
View File

@@ -1,16 +1,110 @@
## Fully .gtignore for IntelliJ, Android Studio and Gradle based Java projects
## References:
## - https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
## - https://github.com/android/platform-samples/blob/main/.gitignore
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
.idea/.name
.idea/artifacts
.idea/compiler.xml
.idea/jarRepositories.xml
.idea/modules.xml
.idea/*.iml
.idea/modules
.idea/caches
.idea/material_theme**
.idea/other.xml
*.iml
.gradle
.maven
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
*.ipr
# Kotlin
.kotlin
# Misc
.idea/misc.xml
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# Android studio 3.1+ additional
.idea/deployment*.xml
.idea/assetWizardSettings.xml
.idea/androidTestResultsUserPreferences.xml
# Android projects
**/local.properties
/captures
.externalNativeBuild
.cxx
local.properties
# Gradle projects
.gradle
build/
# Mkdocs temporary serving folder
docs-gen
site
*.bak
.idea/appInsightsSettings.xml
# Mac OS
.DS_Store

4
.idea/.gitignore generated vendored
View File

@@ -1,3 +1,5 @@
# Default ignored files
/shelf/
/workspace.xml
/gradle.xml
/misc.xml
/workspace.xml

6
.idea/AndroidProjectSystem.xml generated Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AndroidProjectSystem">
<option name="providerId" value="com.android.tools.idea.GradleProjectSystem" />
</component>
</project>

9
.idea/compiler.xml generated
View File

@@ -1,9 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11">
<module name="YukiHookAPI.app" target="11" />
<module name="YukiHookAPI.yukihookapi-yaya" target="11" />
</bytecodeTargetLevel>
</component>
</project>

24
.idea/gradle.xml generated
View File

@@ -1,24 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="Embedded JDK" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/demo-app" />
<option value="$PROJECT_DIR$/demo-module" />
<option value="$PROJECT_DIR$/yukihookapi" />
<option value="$PROJECT_DIR$/yukihookapi-ksp-xposed" />
<option value="$PROJECT_DIR$/yukihookapi-stub" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

View File

@@ -1,10 +1,12 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="CheckImageSize" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="SpellCheckingInspection" enabled="false" level="TYPO" enabled_by_default="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="UnstableApiUsage" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

View File

@@ -1,45 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven3" />
<option name="name" value="maven3" />
<option name="url" value="https://www.jitpack.io" />
</remote-repository>
<remote-repository>
<option name="id" value="maven" />
<option name="name" value="maven" />
<option name="url" value="https://maven.aliyun.com/nexus/content/groups/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/jcenter" />
</remote-repository>
<remote-repository>
<option name="id" value="Google" />
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven4" />
<option name="name" value="maven4" />
<option name="url" value="https://dl.bintray.com/kotlin/kotlin-eap" />
</remote-repository>
</component>
</project>

2
.idea/kotlinc.xml generated
View File

@@ -7,6 +7,6 @@
<option name="additionalArguments" value="-version -Xopt-in=kotlin.RequiresOptIn" />
</component>
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.7.20" />
<option name="version" value="2.2.10" />
</component>
</project>

11
.idea/ktlint-plugin.xml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtLint plugin">
<ktlintMode>MANUAL</ktlintMode>
<formatOnSave>false</formatOnSave>
</component>
<component name="com.nbadal.ktlint.KtlintProjectSettings">
<ktlintMode>MANUAL</ktlintMode>
<ktlintRulesetVersion>DEFAULT</ktlintRulesetVersion>
</component>
</project>

11
.idea/ktlint.xml generated Normal file
View File

@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtlintProjectConfiguration">
<treatAsErrors>false</treatAsErrors>
<disabledRules>
<list>
<option value="package-name" />
</list>
</disabledRules>
</component>
</project>

10
.idea/migrations.xml generated Normal file
View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectMigrations">
<option name="MigrateToGradleLocalJavaHome">
<set>
<option value="$PROJECT_DIR$" />
</set>
</option>
</component>
</project>

36
.idea/misc.xml generated
View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="app/src/main/res/layout/activity_main.xml" value="0.4169230769230769" />
<entry key="app_demo/src/main/res/layout/activity_main.xml" value="0.4375" />
<entry key="demo-app/src/main/res/drawable/ic_launcher_background.xml" value="0.238" />
<entry key="demo-app/src/main/res/layout/activity_main.xml" value="0.4375" />
<entry key="demo-module/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.238" />
<entry key="demo-module/src/main/res/drawable/ic_launcher_background.xml" value="0.238" />
<entry key="demo-module/src/main/res/layout/activity_main.xml" value="0.4375" />
<entry key="demo-module/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.238" />
<entry key="demo-module/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml" value="0.238" />
<entry key="demo-module/src/main/res/xml/settings_preference.xml" value="0.4359375" />
<entry key="demo-module/src/main/res/xml/settings_preferences.xml" value="0.43697916666666664" />
<entry key="demo/src/main/res/layout/activity_main.xml" value="0.4375" />
<entry key="module_demo/src/main/res/layout/activity_main.xml" value="0.4375" />
<entry key="yukihookapi-ui-component/src/main/kotlin/com/highcapable/yukihookapi/ui/view/ModuleActiveBannerView.kt" value="0.44074074074074077" />
<entry key="yukihookapi-ui-component/src/main/res/drawable-night/bg_dark_round.xml" value="0.238" />
<entry key="yukihookapi-ui-component/src/main/res/drawable/bg_button_round.xml" value="0.238" />
<entry key="yukihookapi-ui-component/src/main/res/drawable/bg_dark_round.xml" value="0.238" />
<entry key="yukihookapi-ui-component/src/main/res/drawable/bg_green_round.xml" value="0.238" />
<entry key="yukihookapi-ui-component/src/main/res/drawable/bg_orange_round.xml" value="0.238" />
<entry key="yukihookapi-ui-component/src/main/res/drawable/bg_yellow_round.xml" value="0.238" />
<entry key="yukihookapi-ui-component/src/main/res/layout/wgt_module_active_banner.xml" value="0.4359375" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="11" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

17
.idea/runConfigurations.xml generated Normal file
View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RunConfigurationProducerService">
<option name="ignoredProducers">
<set>
<option value="com.intellij.execution.junit.AbstractAllInDirectoryConfigurationProducer" />
<option value="com.intellij.execution.junit.AllInPackageConfigurationProducer" />
<option value="com.intellij.execution.junit.PatternConfigurationProducer" />
<option value="com.intellij.execution.junit.TestInClassConfigurationProducer" />
<option value="com.intellij.execution.junit.UniqueIdConfigurationProducer" />
<option value="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinJUnitRunConfigurationProducer" />
<option value="org.jetbrains.kotlin.idea.junit.KotlinPatternConfigurationProducer" />
</set>
</option>
</component>
</project>

215
LICENSE
View File

@@ -1,21 +1,202 @@
MIT License
Copyright (c) 2022 HighCapable
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
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:
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
1. Definitions.
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.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright HighCapable [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -1,46 +1,40 @@
# Yuki Hook API
![Blank](https://img.shields.io/badge/license-MIT-blue)
![Blank](https://img.shields.io/badge/version-v1.1.10-green)
[![Telegram](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/YukiHookAPI)
<br/><br/>
<img src="https://github.com/fankes/YuKiHookAPI/blob/master/img-src/icon.png?raw=true" width = "100" height = "100"/>
<br/>
<br/>
⛱️ 一个使用 Kotlin 构建的高效 Hook API 与 Xposed 模块解决方案。
<br/>
[![GitHub license](https://img.shields.io/github/license/HighCapable/YukiHookAPI?color=blue&style=flat-square)](https://github.com/HighCapable/YukiHookAPI/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/HighCapable/YukiHookAPI?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/HighCapable/YukiHookAPI/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/YukiHookAPI)
[![Telegram](https://img.shields.io/badge/discussion%20dev-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/HighCapable_Dev)
[![QQ](https://img.shields.io/badge/discussion%20dev-QQ-blue.svg?logo=tencent-qq&logoColor=red&style=flat-square)](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
[English](https://github.com/fankes/YukiHookAPI/blob/master/README.md) | 简体中文
<img src="img-src/icon.png" width = "100" height = "100" alt="LOGO"/>
⛱️ 一个使用 Kotlin 构建的高效 Hook API 与 Xposed 模块解决方案。
[English](README.md) | 简体中文
| <img src="https://github.com/HighCapable/.github/blob/main/img-src/logo.jpg?raw=true" width = "30" height = "30" alt="LOGO"/> | [HighCapable](https://github.com/HighCapable) |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
这个项目属于上述组织,**点击上方链接关注这个组织**,发现更多好项目。
## 这是什么
- 这是一个使用 Kotlin 基于 Xposed API 重新构建的高效 Hook API同时为 Xposed 模块的开发打造了丰富的功能扩展
- 名称取自 [《ももくり》女主 栗原 雪(Yuki)](https://www.bilibili.com/bangumi/play/ss5016)
- 前身为 [开发学习项目](https://github.com/fankes/TMore) 中使用的 Innocent Xposed API现在重新命名并开源
这是一个使用 Kotlin 基于 Xposed API 重新构建的高效 Hook API同时为 Xposed 模块的开发打造了丰富的功能扩展
## 支持的功能
名称取自 [《ももくり》女主 栗原 雪(Yuki)](https://www.bilibili.com/bangumi/play/ss5016)。
- Hook Framework 支持的基本 ART 动态方法 Hook 功能
- Xposed 资源钩子 (Resources Hook)
## 扩展功能
- 自动化 Xposed 模块构建 (完全无需自行创建 `assets/xposed_init`)
- [New XSharedPreferences](https://github.com/LSPosed/LSPosed/wiki/New-XSharedPreferences#for-the-module) 支持
- DataChannel (宿主 ←→ 模块) 无序广播通讯通道功能
- 简单快捷地实现混淆的字节码反射、查找功能
前身为 [开发学习项目](https://github.com/fankes/TMore) 中使用的 Innocent Xposed API现在重新命名并开源。
## 开始使用
- [点击这里](https://fankes.github.io/YukiHookAPI/zh-cn/) 前往文档页面查看更多详细教程和内容。
[点击这里](https://highcapable.github.io/YukiHookAPI/zh-cn/) 前往文档页面查看更多详细教程和内容。
## 联系我们
有关支持性的相关信息,你可以直接 [点击这里](https://highcapable.github.io/YukiHookAPI/zh-cn/guide/supportive) 进行查看。
- [点击加入 Telegram 群组](https://t.me/YukiHookAPI)
| <img src="https://github.com/HighCapable/KavaRef/blob/main/img-src/icon.svg?raw=true" width = "30" height = "30" alt="LOGO"/> | [KavaRef](https://github.com/HighCapable/KavaRef) |
|-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
## 展望未来
如果你喜欢 `YukiHookAPI` 项目,欢迎为此项目贡献你的代码 **PR**,可以是任何改进的建议以及新增的功能。
🚀 `YukiHookAPI` 正使用 `KavaRef` 作为反射 API 强力驱动,**点击上方链接 star 这个项目**,你也可以优雅地使用它!
## 合作项目
@@ -63,20 +57,32 @@
| [QDReadHook](https://github.com/xihan123/QDReadHook) | [xihan123](https://github.com/xihan123) |
| [HXReadHook](https://github.com/xihan123/HXReadHook) | [xihan123](https://github.com/xihan123) |
| [WxRecordRead](https://github.com/pwh-pwh/wxrecordread) | [Coderpwh](https://github.com/pwh-pwh) |
| [FuckShake](https://github.com/pwh-pwh/fuck_shake) | [Coderpwh](https://github.com/pwh-pwh) |
| [MIUI更新进化](https://miup.utssg.xyz) | [ZQDesigned](https://github.com/ZQDesigned) |
| [MIUI录屏进化](https://www.coolapk.com/apk/UTSSG.ZQDesigned.miuirecordercracker) | [ZQDesigned](https://github.com/ZQDesigned) |
| [Fuck AD](https://github.com/hujiayucc/Fuck-AD) | [hujiayucc](https://github.com/hujiayucc) |
| [最右强力去广告](https://github.com/kazutoiris/zuiyou-adfree) | [kazutoiris](https://github.com/kazutoiris) |
| [叮嗒出行强力去广告](https://github.com/kazutoiris/dingda-adfree) | [kazutoiris](https://github.com/kazutoiris) |
| [无限幻境](https://github.com/kazutoiris/infinite-illusion) | [kazutoiris](https://github.com/kazutoiris) |
| [HookGG](https://github.com/HdShare/HookGG) | [HdShare](https://github.com/HdShare) |
| [OnePlusPlusLauncher](https://github.com/wizpizz/OnePlusPlusLauncher) | [wizpizz](https://github.com/wizpizz) |
你也在使用 `YukiHookAPI` 吗?快来 **PR** 将你的存储仓库添加到上方的列表(私有仓库可以不需要注明网页链接)。
你也在使用 `YukiHookAPI` 吗?快来 **PR** 将你的存储仓库添加到上方的列表 (私有仓库可以不需要注明网页链接)。
## 捐赠支持
## 项目推广
- 工作不易,无意外情况此项目将继续维护下去,提供更多可能,欢迎打赏。<br/><br/>
<img src="https://github.com/fankes/YuKiHookAPI/blob/master/img-src/wechat_code.jpg?raw=true" width = "200" height = "200"/>
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<h2>嘿,还请君留步!👋</h2>
<h3>这里有 Android 开发工具、UI 设计、Gradle 插件、Xposed 模块和实用软件等相关项目。</h3>
<h3>如果下方的项目能为你提供帮助,不妨为我点个 star 吧!</h3>
<h3>所有项目免费、开源,遵循对应开源许可协议。</h3>
<h1><a href="https://github.com/fankes/fankes/blob/main/project-promote/README-zh-CN.md">→ 查看更多关于我的项目,请点击这里 ←</a></h1>
</div>
## Star History
![Star History Chart](https://api.star-history.com/svg?repos=fankes/YukiHookAPI&type=Date)
![Star History Chart](https://api.star-history.com/svg?repos=HighCapable/YukiHookAPI&type=Date)
## 第三方开源使用声明
@@ -85,30 +91,24 @@
## 许可证
- [MIT](https://choosealicense.com/licenses/mit)
- [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
```
MIT License
Apache License Version 2.0
Copyright (C) 2019-2023 HighCapable
Copyright (C) 2019 HighCapable
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:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
https://www.apache.org/licenses/LICENSE-2.0
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.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
版权所有 © 2019-2023 HighCapable
版权所有 © 2019 HighCapable

106
README.md
View File

@@ -1,47 +1,42 @@
# Yuki Hook API
![Blank](https://img.shields.io/badge/license-MIT-blue)
![Blank](https://img.shields.io/badge/version-v1.1.10-green)
[![Telegram](https://img.shields.io/badge/Follow-Telegram-blue.svg?logo=telegram)](https://t.me/YukiHookAPI)
<br/><br/>
<img src="https://github.com/fankes/YuKiHookAPI/blob/master/img-src/icon.png?raw=true" width = "100" height = "100"/>
<br/>
<br/>
⛱️ An efficient Hook API and Xposed Module solution built in Kotlin.
<br/>
[![GitHub license](https://img.shields.io/github/license/HighCapable/YukiHookAPI?color=blue&style=flat-square)](https://github.com/HighCapable/YukiHookAPI/blob/master/LICENSE)
[![GitHub release](https://img.shields.io/github/v/release/HighCapable/YukiHookAPI?display_name=release&logo=github&color=green&style=flat-square)](https://github.com/HighCapable/YukiHookAPI/releases)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/YukiHookAPI)
[![Telegram](https://img.shields.io/badge/discussion%20dev-Telegram-blue.svg?logo=telegram&style=flat-square)](https://t.me/HighCapable_Dev)
[![QQ](https://img.shields.io/badge/discussion%20dev-QQ-blue.svg?logo=tencent-qq&logoColor=red&style=flat-square)](https://qm.qq.com/cgi-bin/qm/qr?k=Pnsc5RY6N2mBKFjOLPiYldbAbprAU3V7&jump_from=webapi&authKey=X5EsOVzLXt1dRunge8ryTxDRrh9/IiW1Pua75eDLh9RE3KXE+bwXIYF5cWri/9lf)
English | [简体中文](https://github.com/fankes/YukiHookAPI/blob/master/README-zh-CN.md)
<img src="img-src/icon.png" width = "100" height = "100" alt="LOGO"/>
⛱️ An efficient Hook API and Xposed Module solution built in Kotlin.
English | [简体中文](README-zh-CN.md)
| <img src="https://github.com/HighCapable/.github/blob/main/img-src/logo.jpg?raw=true" width = "30" height = "30" alt="LOGO"/> | [HighCapable](https://github.com/HighCapable) |
|-------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------|
This project belongs to the above-mentioned organization, **click the link above to follow this organization** and discover more good projects.
## What's this
- This is an efficient Hook API rebuilt based on the Xposed API using Kotlin, and creates rich function extensions for the development of
Xposed Modules
- The name is taken from ["ももくり" heroine Yuki Kurihara](https://www.bilibili.com/bangumi/play/ss5016)
- Formerly the Innocent Xposed API used in [Development Learning Project](https://github.com/fankes/TMore), now renamed and open sourced
This is an efficient Hook API rebuilt based on the Xposed API using Kotlin,
and creates rich function extensions for the development of Xposed Modules.
## Supports
The name is taken from ["ももくり" heroine Yuki Kurihara](https://www.bilibili.com/bangumi/play/ss5016).
- Basic ART dynamic method hook functions supported by Hook Framework
- Xposed Resources Hook
## Extensions
- Automatic Xposed Module Build (No need to create `assets/xposed_init` by yourself)
- [New XSharedPreferences](https://github.com/LSPosed/LSPosed/wiki/New-XSharedPreferences#for-the-module) Supports
- DataChannel (Host ←→ Module)
- Simple and quick implementation of obfuscated bytecode reflection and finding functions
Formerly the Innocent Xposed API used in [Development Learning Project](https://github.com/fankes/TMore), now renamed and open sourced.
## Get Started
- [Click here](https://fankes.github.io/YukiHookAPI/en/) go to the documentation page for more detailed tutorials and content.
[Click here](https://highcapable.github.io/YukiHookAPI/en/) go to the documentation page for more detailed tutorials and content.
## Contacts
For supportive related information, you can check it directly [click here](https://highcapable.github.io/YukiHookAPI/en/guide/supportive).
- [Follow us on Telegram](https://t.me/YukiHookAPI)
| <img src="https://github.com/HighCapable/KavaRef/blob/main/img-src/icon.svg?raw=true" width = "30" height = "30" alt="LOGO"/> | [KavaRef](https://github.com/HighCapable/KavaRef) |
|-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
## Features
If you like the `YukiHookAPI` project, we welcome you to make a **PR** in this project, any suggestions for improvement and new features.
🚀 `YukiHookAPI` is using `KavaRef` as a powerful driver for the reflection API.
**Click on the link above star project**, and you can also use it gracefully!
## Cooperations
@@ -64,16 +59,33 @@ The following are projects that have collaborated and are using `YukiHookAPI`.
| [QDReadHook](https://github.com/xihan123/QDReadHook) | [xihan123](https://github.com/xihan123) |
| [HXReadHook](https://github.com/xihan123/HXReadHook) | [xihan123](https://github.com/xihan123) |
| [WxRecordRead](https://github.com/pwh-pwh/wxrecordread) | [Coderpwh](https://github.com/pwh-pwh) |
| [FuckShake](https://github.com/pwh-pwh/fuck_shake) | [Coderpwh](https://github.com/pwh-pwh) |
| [MIUI更新进化](https://miup.utssg.xyz) | [ZQDesigned](https://github.com/ZQDesigned) |
| [MIUI录屏进化](https://www.coolapk.com/apk/UTSSG.ZQDesigned.miuirecordercracker) | [ZQDesigned](https://github.com/ZQDesigned) |
| [Fuck AD](https://github.com/hujiayucc/Fuck-AD) | [hujiayucc](https://github.com/hujiayucc) |
| [Zuiyou ADFree](https://github.com/kazutoiris/zuiyou-adfree) | [kazutoiris](https://github.com/kazutoiris) |
| [Dingda ADFree](https://github.com/kazutoiris/dingda-adfree) | [kazutoiris](https://github.com/kazutoiris) |
| [Infinite Illusion](https://github.com/kazutoiris/infinite-illusion) | [kazutoiris](https://github.com/kazutoiris) |
| [HookGG](https://github.com/HdShare/HookGG) | [HdShare](https://github.com/HdShare) |
| [OnePlusPlusLauncher](https://github.com/wizpizz/OnePlusPlusLauncher) | [wizpizz](https://github.com/wizpizz) |
Are you also using `YukiHookAPI`? Come and **PR** to add your repository to the list above (private repositories do not need to indicate web
links).
## Promotion
<!--suppress HtmlDeprecatedAttribute -->
<div align="center">
<h2>Hey, please stay! 👋</h2>
<h3>Here are related projects such as Android development tools, UI design, Gradle plugins, Xposed Modules and practical software. </h3>
<h3>If the project below can help you, please give me a star! </h3>
<h3>All projects are free, open source, and follow the corresponding open source license agreement. </h3>
<h1><a href="https://github.com/fankes/fankes/blob/main/project-promote/README.md">→ To see more about my projects, please click here ←</a></h1>
</div>
## Star History
![Star History Chart](https://api.star-history.com/svg?repos=fankes/YukiHookAPI&type=Date)
![Star History Chart](https://api.star-history.com/svg?repos=HighCapable/YukiHookAPI&type=Date)
## Third-Party Open Source Usage Statement
@@ -82,30 +94,24 @@ links).
## License
- [MIT](https://choosealicense.com/licenses/mit)
- [Apache-2.0](https://www.apache.org/licenses/LICENSE-2.0)
```
MIT License
Apache License Version 2.0
Copyright (C) 2019-2023 HighCapable
Copyright (C) 2019 HighCapable
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:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
https://www.apache.org/licenses/LICENSE-2.0
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.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
Copyright © 2019-2023 HighCapable
Copyright © 2019 HighCapable

View File

@@ -1,67 +0,0 @@
import groovy.json.JsonSlurper
plugins {
id 'com.android.application' version '7.4.1' apply false
id 'com.android.library' version '7.4.1' apply false
id 'org.jetbrains.kotlin.android' version '1.8.20' apply false
id 'com.google.devtools.ksp' version '1.8.20-1.0.10' apply false
}
ext {
android = [
compileSdk: 33,
minSdk : 21,
targetSdk : 33
]
app = [
versionName: 'universal',
versionCode: 1
]
maven = [
developer : [
id : '0',
user : 'fankesyooni',
email: 'qzmmcn@163.com'
],
repository : [
groupId : 'com.highcapable.yukihookapi',
apiVersion : [
name: '1.1.10',
code: 43
],
name : 'YukiHookAPI',
description: 'An efficient Hook API and Xposed Module solution built in Kotlin.',
website : 'https://github.com/fankes/YukiHookAPI',
licence : [
name: 'MIT License',
url : 'https://github.com/fankes/YukiHookAPI/blob/master/LICENSE'
]
],
configurations: [
githubConnection : 'scm:git:git://github.com/path/to/repo.git',
githubDeveloperConnection: 'scm:git:ssh://github.com/path/to/repo.git',
githubUrl : 'https://github.com/path/to/repo',
ossName : 'OSSRH',
ossUrl : 'https://s01.oss.sonatype.org/service/local/staging/deploy/maven2'
]
]
}
/**
* 获取 Maven 授权信息 - 用于 Maven 的提交
* @param childProjectDir 子项目的目录
* @return [Object]
*/
@SuppressWarnings('unused')
static Object getMavenCredentials(File childProjectDir) {
def slurper = new JsonSlurper()
try {
return slurper.parse(new File("${childProjectDir.getParent()}/.maven/credentials.json"))
} catch (Throwable ignored) {
return slurper.parseText('{"username":"-NEEDED-","password":"-NEEDED-"}')
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}

23
build.gradle.kts Normal file
View File

@@ -0,0 +1,23 @@
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
plugins {
autowire(libs.plugins.android.application) apply false
autowire(libs.plugins.android.library) apply false
autowire(libs.plugins.kotlin.jvm) apply false
autowire(libs.plugins.kotlin.android) apply false
autowire(libs.plugins.kotlin.ksp) apply false
}
allprojects {
tasks.withType<KotlinJvmCompile>().configureEach {
compilerOptions {
jvmTarget = JvmTarget.JVM_17
freeCompilerArgs.addAll(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
}
}

1
demo-app/.gitignore vendored
View File

@@ -1 +0,0 @@
/build

View File

@@ -1,57 +0,0 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.highcapable.yukihookapi.demo_app'
compileSdk rootProject.ext.android.compileSdk
defaultConfig {
applicationId 'com.highcapable.yukihookapi.demo_app'
minSdk rootProject.ext.android.minSdk
targetSdk rootProject.ext.android.targetSdk
versionCode rootProject.ext.app.versionCode
versionName rootProject.ext.app.versionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs = [
'-Xno-param-assertions',
'-Xno-call-assertions',
'-Xno-receiver-assertions'
]
}
lintOptions {
checkReleaseBuilds false
}
buildFeatures {
viewBinding true
}
}
dependencies {
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

View File

@@ -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;
}
}

View File

@@ -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;
}
}

View File

@@ -1,70 +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/2/9.
*/
@file:Suppress("SameParameterValue", "UsePropertyAccessSyntax")
package com.highcapable.yukihookapi.demo_app.ui
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import com.highcapable.yukihookapi.demo_app.databinding.ActivityMainBinding
import com.highcapable.yukihookapi.demo_app.test.Main
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ActivityMainBinding.inflate(layoutInflater).apply {
setContentView(root)
appDemoFirstText.text = getFirstText()
appDemoSecondText.text = secondText
appDemoThirdText.text = Main("Feel real").getString()
appDemoFourthText.text = getRegularText("Have fun day")
appDemoFifthText.text = getDataText()
appDemoSixthText.text = getArray(arrayOf("apple", "banana")).let { "${it[0]}, ${it[1]}" }
appDemoSeventhText.text = Main().getTestResultFirst()
appDemoEighthText.text = Main().getTestResultFirst("Find something interesting")
appDemoNinthText.text = Main().getTestResultLast()
appDemoTenthText.text = Main().getTestResultLast("This is the last sentence")
appDemoEleventhText.text = Main().getSuperString()
appDemoButton.setOnClickListener { toast() }
}
}
private val secondText = "This is a miracle"
private fun getArray(array: Array<String>) = array
private fun getFirstText() = "Hello World!"
private fun getRegularText(string: String) = string
private fun getDataText() = "No data found"
private fun toast() = Toast.makeText(this, "Nothing to show", Toast.LENGTH_SHORT).show()
}

View File

@@ -1,132 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
tools:ignore="HardcodedText,ContentDescription">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="vertical">
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginBottom="15dp"
android:src="@mipmap/ic_face_unhappy" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:text="@string/test_string"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_first_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_second_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_eleventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_third_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_fourth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_seventh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_eighth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_ninth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_tenth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_sixth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<TextView
android:id="@+id/app_demo_fifth_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="sample"
android:textSize="17.5sp" />
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_marginBottom="15dp"
android:src="@android:mipmap/sym_def_app_icon" />
<Button
android:id="@+id/app_demo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Click Me!"
android:textAllCaps="false" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -1,3 +0,0 @@
/build
/src/main/assets/xposed_init
/src/main/resources/META-INF/yukihookapi_init

View File

@@ -1,66 +0,0 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.devtools.ksp'
}
android {
namespace 'com.highcapable.yukihookapi.demo_module'
compileSdk rootProject.ext.android.compileSdk
defaultConfig {
applicationId 'com.highcapable.yukihookapi.demo_module'
minSdk rootProject.ext.android.minSdk
targetSdk rootProject.ext.android.targetSdk
versionCode rootProject.ext.app.versionCode
versionName rootProject.ext.app.versionName
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs = [
'-Xno-param-assertions',
'-Xno-call-assertions',
'-Xno-receiver-assertions'
]
}
lintOptions {
checkReleaseBuilds false
}
buildFeatures {
viewBinding true
}
aaptOptions.additionalParameters '--allow-reserved-package-id', '--package-id', '0x64'
}
dependencies {
// Used 82 API Version
compileOnly 'de.robv.android.xposed:api:82'
// Implementation API
implementation project(':yukihookapi')
// Implementation Processor
ksp project(':yukihookapi-ksp-xposed')
implementation 'androidx.preference:preference-ktx:1.2.0'
implementation 'androidx.core:core-ktx:1.10.0'
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.1'
implementation 'com.google.android.material:material:1.8.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.1'
}

View File

@@ -1,39 +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/4/15.
*/
package com.highcapable.yukihookapi.demo_module.application
import com.highcapable.yukihookapi.hook.log.loggerD
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
class DemoApplication : ModuleApplication() {
override fun onCreate() {
super.onCreate()
loggerD(msg = "I am running in module space")
}
}

View File

@@ -1,38 +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/3/27.
*/
package com.highcapable.yukihookapi.demo_module.data
import com.highcapable.yukihookapi.hook.xposed.channel.data.ChannelData
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
object DataConst {
val TEST_KV_DATA = PrefsData("test_data", "Test data is nothing")
val TEST_CN_DATA = ChannelData<String>("key_from_host")
}

View File

@@ -1,62 +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/8/16.
*/
package com.highcapable.yukihookapi.demo_module.hook.factory
import android.graphics.drawable.Drawable
import android.util.TypedValue
import android.widget.Button
import androidx.appcompat.app.AlertDialog
import com.highcapable.yukihookapi.hook.factory.current
/**
* Fixed [AlertDialog] dialog button issue after injecting Module App's Resources in some Host Apps
*
* Reset button text color and background by reflection [Drawable]
*
* 修复 [AlertDialog] 对话框按钮在一些宿主中注入模块资源后会发生问题
*
* 通过反射重新设置按钮的文字颜色和背景 [Drawable]
* @return [AlertDialog]
*/
fun AlertDialog.compatStyle(): AlertDialog {
current().field { name = "mAlert" }.current {
arrayOf(
field { name = "mButtonPositive" }.cast<Button>(),
field { name = "mButtonNegative" }.cast<Button>(),
field { name = "mButtonNeutral" }.cast<Button>()
).forEach {
it?.setBackgroundResource(TypedValue().apply {
context.theme.resolveAttribute(android.R.attr.selectableItemBackground, this, true)
}.resourceId)
it?.setTextColor(TypedValue().apply {
context.theme.resolveAttribute(android.R.attr.colorPrimary, this, true)
}.data)
}
}
return this
}

View File

@@ -1,129 +0,0 @@
/*
* YukiHookAPI - An efficient Kotlin version of the Xposed Hook API.
* Copyright (C) 2019-2022 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/5/25.
*/
package com.highcapable.yukihookapi.demo_module.hook.java;
import android.app.Activity;
import android.os.Bundle;
import com.highcapable.yukihookapi.YukiHookAPI;
import com.highcapable.yukihookapi.hook.log.YukiHookLogger;
import com.highcapable.yukihookapi.hook.xposed.bridge.event.YukiXposedEvent;
import com.highcapable.yukihookapi.hook.xposed.proxy.IYukiHookXposedInit;
import kotlin.Unit;
// ========
// This only demonstrates how to use it in the Java case (Java 1.8+ only)
// The code here is for demonstration only does not mean that it will work in the future Demo will only sync the latest Kotlin usage
// It is recommended to use Kotlin to complete the writing of the Hook part
// Please remove the code note "//" below to use this demo, but make sure to comment out the HookEntry annotation on the Kotlin side
// 这里仅演示了 Java 情况下的使用方式 (仅限 Java 1.8+)
// 这里的代码仅供演示 - 并不代表今后都可以正常运行 - Demo 只会同步最新的 Kotlin 使用方法
// 建议还是使用 Kotlin 来完成 Hook 部分的编写
// 请删除下方的注释 "//" 以使用此 Demo - 但要确保注释掉 Kotlin 一边的 HookEntry 的注解
// ========
// @InjectYukiHookWithXposed
public class HookEntry implements IYukiHookXposedInit {
@Override
public void onInit() {
YukiHookAPI.Configs config = YukiHookAPI.Configs.INSTANCE;
YukiHookLogger.Configs.INSTANCE.setTag("YukiHookAPI-Demo");
YukiHookLogger.Configs.INSTANCE.setEnable(true);
YukiHookLogger.Configs.INSTANCE.setRecord(false);
YukiHookLogger.Configs.INSTANCE.elements(
YukiHookLogger.Configs.TAG,
YukiHookLogger.Configs.PRIORITY,
YukiHookLogger.Configs.PACKAGE_NAME,
YukiHookLogger.Configs.USER_ID
);
config.setDebug(true);
config.setEnableModulePrefsCache(true);
config.setEnableModuleAppResourcesCache(true);
config.setEnableHookModuleStatus(true);
config.setEnableDataChannel(true);
config.setEnableMemberCache(true);
}
@Override
public void onHook() {
// Here is the Java writing method that is more similar to the Kotlin writing method, just for reference
// Calling Kotlin's lambda in Java also needs to return Unit.INSTANCE in the Unit case
// 这里介绍了比较近似于 Kotlin 写法的 Java 写法 - 仅供参考
// 在 Java 中调用 Kotlin 的 lambda 在 Unit 情况下也需要 return Unit.INSTANCE
YukiHookAPI.INSTANCE.encase(e -> {
e.loadZygote(l -> {
l.hook(Activity.class, false, h -> {
h.injectMember(h.getPRIORITY_DEFAULT(), "Default", i -> {
i.method(m -> {
m.setName("onCreate");
m.param(Bundle.class);
return null;
});
i.afterHook(a -> {
Activity instance = ((Activity) a.getInstance());
instance.setTitle(instance.getTitle() + " [Active]");
return Unit.INSTANCE;
});
return Unit.INSTANCE;
});
return Unit.INSTANCE;
});
return Unit.INSTANCE;
});
// The rest of the code has been omitted, you can continue to refer to the above method to complete
// 余下部分代码已略 - 可继续参考上述方式完成
// ...
return Unit.INSTANCE;
});
}
@Override
public void onXposedEvent() {
// Since Java does not support some methods that do not override Kotlin Interface
// So this method is not needed here, you can leave the content blank
// 由于 Java 不支持不重写 Kotlin Interface 的部分方法
// 所以不需要此方法这里可以不填写内容
YukiXposedEvent event = YukiXposedEvent.INSTANCE;
event.onInitZygote(startupParam -> {
// Write the startupParam method here
// 这里编写 startupParam 方法
return Unit.INSTANCE;
});
event.onHandleLoadPackage(loadPackageParam -> {
// Write the loadPackageParam method here
// 这里编写 loadPackageParam 方法
return Unit.INSTANCE;
});
event.onHandleInitPackageResources(resourcesParam -> {
// Write the resourcesParam method here
// 这里编写 resourcesParam 方法
return Unit.INSTANCE;
});
}
}

View File

@@ -1,114 +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/1/29.
*/
@file:Suppress("SetTextI18n")
package com.highcapable.yukihookapi.demo_module.ui
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.demo_module.R
import com.highcapable.yukihookapi.demo_module.data.DataConst
import com.highcapable.yukihookapi.demo_module.databinding.ActivityMainBinding
import com.highcapable.yukihookapi.hook.factory.dataChannel
import com.highcapable.yukihookapi.hook.factory.prefs
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
import java.text.SimpleDateFormat
import java.util.*
class MainActivity : ModuleAppCompatActivity() {
override val moduleTheme get() = R.style.Theme_Default
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
ActivityMainBinding.inflate(layoutInflater).apply {
setContentView(root)
moduleEnvironment {
dataChannel(packageName = "com.highcapable.yukihookapi.demo_app").with {
wait(DataConst.TEST_CN_DATA) {
Toast.makeText(applicationContext, it, Toast.LENGTH_SHORT).show()
}
}
}
moduleDemoActiveText.text = "Module is Active${YukiHookAPI.Status.isModuleActive}"
moduleDemoActiveZhText.text = "Xposed 模块激活状态"
moduleDemoFrameworkText.text = "Hook Framework${YukiHookAPI.Status.Executor.name}"
moduleDemoFrameworkZhText.text = "当前的 Hook 框架"
moduleDemoApiVersionText.text = "Xposed API Version${YukiHookAPI.Status.Executor.apiLevel}"
moduleDemoApiVersionZhText.text = "Xposed API 版本"
moduleDemoYukiHookApiVersionText.text = "YukiHookAPI Version${YukiHookAPI.API_VERSION_NAME}(${YukiHookAPI.API_VERSION_CODE})"
moduleDemoYukiHookApiVersionZhText.text = "YukiHookAPI 版本"
moduleDemoNewXshareText.text =
"${if (YukiHookAPI.Status.isXposedEnvironment) "XSharedPreferences Readable" else "New XSharedPreferences"}${prefs().isPreferencesAvailable}"
moduleDemoNewXshareZhText.text =
if (YukiHookAPI.Status.isXposedEnvironment) "XSharedPreferences 是否可用" else "New XSharedPreferences 支持状态"
moduleDemoResHookText.text = "Support Resources Hook${YukiHookAPI.Status.isSupportResourcesHook}"
moduleDemoResHookZhText.text = "资源钩子支持状态"
moduleDemoComTimeStampText.text =
"Compiled Time${SimpleDateFormat.getDateTimeInstance().format(Date(YukiHookAPI.Status.compiledTimestamp))}"
moduleDemoEditText.also {
hostEnvironment {
it.isEnabled = false
moduleDemoButton.isEnabled = false
}
it.setText(prefs().get(DataConst.TEST_KV_DATA))
moduleDemoButton.setOnClickListener { _ ->
moduleEnvironment {
if (it.text.toString().isNotEmpty()) {
prefs().edit { put(DataConst.TEST_KV_DATA, it.text.toString()) }
Toast.makeText(applicationContext, "Saved", Toast.LENGTH_SHORT).show()
} else Toast.makeText(applicationContext, "Please enter the text", Toast.LENGTH_SHORT).show()
}
}
}
moduleDemoFrgButton.setOnClickListener { startActivity(Intent(this@MainActivity, PreferenceActivity::class.java)) }
}
}
/**
* Running only in (Xposed) Host environment
*
* 仅在 (Xposed) 宿主环境执行
* @param callback Running in the (Xposed) Host environment / 在宿主环境执行
*/
private inline fun hostEnvironment(callback: () -> Unit) {
if (YukiHookAPI.Status.isXposedEnvironment) callback()
}
/**
* Running only in Module environment
*
* 仅在模块环境执行
* @param callback Running in the Module environment / 在模块环境执行
*/
private inline fun moduleEnvironment(callback: () -> Unit) {
if (YukiHookAPI.Status.isXposedEnvironment.not()) callback()
}
}

View File

@@ -1,64 +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/4/18.
*/
package com.highcapable.yukihookapi.demo_module.ui
import android.os.Bundle
import androidx.preference.SwitchPreference
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.demo_module.R
import com.highcapable.yukihookapi.hook.xposed.parasitic.activity.base.ModuleAppCompatActivity
import com.highcapable.yukihookapi.hook.xposed.prefs.ui.ModulePreferenceFragment
class PreferenceActivity : ModuleAppCompatActivity() {
override val moduleTheme get() = R.style.Theme_Default
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
title = "PreferenceFragment"
supportActionBar?.setDisplayHomeAsUpEnabled(true)
if (savedInstanceState == null)
supportFragmentManager
.beginTransaction()
.replace(android.R.id.content, SettingsFragment())
.commitAllowingStateLoss()
}
override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}
class SettingsFragment : ModulePreferenceFragment() {
override fun onCreatePreferencesInModuleApp(savedInstanceState: Bundle?, rootKey: String?) {
setPreferencesFromResource(R.xml.settings_preferences, rootKey)
findPreference<SwitchPreference>("show_dialog_when_demo_app_opend")?.isEnabled = YukiHookAPI.Status.isXposedEnvironment.not()
}
}
}

View File

@@ -1,213 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:fillViewport="true"
android:scrollbars="none"
tools:ignore="HardcodedText">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="20dp"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="50dp"
android:layout_marginRight="50dp"
android:layout_marginBottom="15dp"
android:gravity="center|start"
android:orientation="vertical">
<TextView
android:id="@+id/module_demo_active_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_active_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_framework_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_framework_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_api_version_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_api_version_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_yuki_hook_api_version_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_yuki_hook_api_version_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_new_xshare_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_new_xshare_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:id="@+id/module_demo_res_hook_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="5dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="18sp" />
<TextView
android:id="@+id/module_demo_res_hook_zh_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="25dp"
android:alpha="0.85"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="sample"
android:textSize="15sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="5dp"
android:layout_marginBottom="15dp"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="Leave something in there"
android:textSize="15sp" />
<EditText
android:id="@+id/module_demo_edit_text"
android:layout_width="250dp"
android:layout_height="wrap_content"
android:hint="Please enter the text"
android:singleLine="true"
android:textSize="18sp"
tools:ignore="Autofill,LabelFor,TextFields" />
</LinearLayout>
<Button
android:id="@+id/module_demo_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="15dp"
android:text="Save Test Data"
android:textAllCaps="false" />
<Button
android:id="@+id/module_demo_frg_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Open PreferenceFragment"
android:textAllCaps="false" />
<TextView
android:id="@+id/module_demo_com_time_stamp_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="25dp"
android:alpha="0.45"
android:ellipsize="end"
android:gravity="center|start"
android:singleLine="true"
android:text="placeholder"
android:textSize="13sp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@@ -1,3 +0,0 @@
<resources>
<string name="app_name">YukiHookDemoModule</string>
</resources>

View File

@@ -1,3 +1,4 @@
node_modules
src/.vuepress/.cache
src/.vuepress/.temp
/node_modules
/src/.vuepress/.cache
/src/.vuepress/.temp
/dist

View File

@@ -1,15 +1,16 @@
{
"name": "yukihookapi_docs",
"license": "MIT",
"license": "Apache-2.0",
"devDependencies": {
"@mr-hope/vuepress-plugin-copy-code": "^1.30.0",
"@vuepress/plugin-prismjs": "^2.0.0-beta.51",
"@vuepress/plugin-search": "^2.0.0-beta.51",
"@vuepress/plugin-shiki": "^2.0.0-beta.51",
"vuepress": "^2.0.0-beta.51"
"@vuepress/plugin-prismjs": "2.0.0-rc.0",
"@vuepress/plugin-search": "2.0.0-rc.0",
"@vuepress/plugin-shiki": "2.0.0-rc.0",
"vuepress": "2.0.0-rc.0"
},
"scripts": {
"docs:dev": "vuepress dev src",
"docs:build": "vuepress build src"
"docs:build": "vuepress build src",
"docs:build-gh-pages": "vuepress build src && touch dist/.nojekyll"
}
}

View File

@@ -25,7 +25,7 @@ export default {
navbar: navBarItems['/en/'],
selectLanguageText: 'English (US)',
selectLanguageName: 'English',
editLinkText: 'Edit this page on Github',
editLinkText: 'Edit this page on GitHub',
tip: 'Tips',
warning: 'Notice',
danger: 'Pay Attention',
@@ -34,7 +34,7 @@ export default {
navbar: navBarItems['/zh-cn/'],
selectLanguageText: '简体中文 (CN)',
selectLanguageName: '简体中文',
editLinkText: '在 Github 上编辑此页',
editLinkText: '在 GitHub 上编辑此页',
notFound: ['这里什么都没有', '我们怎么到这来了?', '这是一个 404 页面', '看起来我们进入了错误的链接'],
backToHome: '回到首页',
contributorsText: '贡献者',

View File

@@ -5,6 +5,7 @@ const baseApiPath = '/api/public/com/highcapable/yukihookapi/';
const navigationLinks = {
start: [
'/guide/home',
'/guide/supportive',
'/guide/knowledge',
'/guide/quick-start',
'/guide/example',
@@ -15,6 +16,8 @@ const navigationLinks = {
'/config/api-exception',
'/config/xposed-using',
'/config/api-using',
'/config/move-to-api-1-2-x',
'/config/move-to-api-1-3-x',
'/config/r8-proguard'
],
tools: '/tools/yukihookapi-projectbuilder',
@@ -49,11 +52,13 @@ const navigationLinks = {
baseApiPath + 'hook/type/android/ViewTypeFactory',
baseApiPath + 'hook/type/java/VariableTypeFactory',
baseApiPath + 'hook/type/defined/DefinedTypeFactory',
baseApiPath + 'hook/log/LoggerFactory',
baseApiPath + 'hook/log/YLog',
baseApiPath + 'hook/log/data/YLogData',
baseApiPath + 'hook/factory/ReflectionFactory',
baseApiPath + 'hook/factory/YukiHookFactory',
baseApiPath + 'hook/entity/YukiBaseHooker',
baseApiPath + 'hook/core/api/compat/type/ExecutorType',
baseApiPath + 'hook/core/api/priority/YukiHookPriority',
baseApiPath + 'hook/core/YukiMemberHookCreator',
baseApiPath + 'hook/core/YukiResourcesHookCreator',
baseApiPath + 'hook/core/finder/members/MethodFinder',
@@ -94,7 +99,7 @@ const navigationLinks = {
export const configs = {
dev: {
dest: '../docs/',
dest: 'dist',
port: 9000
},
website: {
@@ -114,7 +119,7 @@ export const configs = {
}
},
github: {
repo: 'https://github.com/fankes/YukiHookAPI',
repo: 'https://github.com/HighCapable/YukiHookAPI',
branch: 'master',
dir: 'docs-source/src'
}
@@ -127,10 +132,11 @@ export const navBarItems = {
text: 'Get Started',
children: [
{ text: 'Introduce', link: i18n.string(navigationLinks.start[0], 'en') },
{ text: 'Basic Knowledge', link: i18n.string(navigationLinks.start[1], 'en') },
{ text: 'Quick Start', link: i18n.string(navigationLinks.start[2], 'en') },
{ text: 'Usage Example', link: i18n.string(navigationLinks.start[3], 'en') },
{ text: 'Migrate from Xposed API', link: i18n.string(navigationLinks.start[4], 'en') }
{ text: 'Supportive', link: i18n.string(navigationLinks.start[1], 'en') },
{ text: 'Basic Knowledge', link: i18n.string(navigationLinks.start[2], 'en') },
{ text: 'Quick Start', link: i18n.string(navigationLinks.start[3], 'en') },
{ text: 'Usage Example', link: i18n.string(navigationLinks.start[4], 'en') },
{ text: 'Migrate from Other Hook APIs', link: i18n.string(navigationLinks.start[5], 'en') }
]
}, {
text: 'Configs',
@@ -139,7 +145,9 @@ export const navBarItems = {
{ text: 'API Exception Handling', link: i18n.string(navigationLinks.config[1], 'en') },
{ text: 'Use as Xposed Module Configs', link: i18n.string(navigationLinks.config[2], 'en') },
{ text: 'Use as Hook API Configs', link: i18n.string(navigationLinks.config[3], 'en') },
{ text: 'R8 & Proguard Obfuscate', link: i18n.string(navigationLinks.config[4], 'en') }
{ text: 'Migrate to YukiHookAPI 1.2.x', link: i18n.string(navigationLinks.config[4], 'en') },
{ text: 'Migrate to YukiHookAPI 1.3.x', link: i18n.string(navigationLinks.config[5], 'en') },
{ text: 'R8 & Proguard Obfuscate', link: i18n.string(navigationLinks.config[6], 'en') }
]
}, {
text: 'Tools',
@@ -176,10 +184,11 @@ export const navBarItems = {
text: '入门',
children: [
{ text: '介绍', link: i18n.string(navigationLinks.start[0], 'zh-cn') },
{ text: '基础知识', link: i18n.string(navigationLinks.start[1], 'zh-cn') },
{ text: '快速开始', link: i18n.string(navigationLinks.start[2], 'zh-cn') },
{ text: '用法示例', link: i18n.string(navigationLinks.start[3], 'zh-cn') },
{ text: '从 Xposed API 迁移', link: i18n.string(navigationLinks.start[4], 'zh-cn') }
{ text: '支持性', link: i18n.string(navigationLinks.start[1], 'zh-cn') },
{ text: '基础知识', link: i18n.string(navigationLinks.start[2], 'zh-cn') },
{ text: '快速开始', link: i18n.string(navigationLinks.start[3], 'zh-cn') },
{ text: '用法示例', link: i18n.string(navigationLinks.start[4], 'zh-cn') },
{ text: '从其它 Hook API 迁移', link: i18n.string(navigationLinks.start[5], 'zh-cn') }
]
}, {
text: '配置',
@@ -188,7 +197,9 @@ export const navBarItems = {
{ text: 'API 异常处理', link: i18n.string(navigationLinks.config[1], 'zh-cn') },
{ text: '作为 Xposed 模块使用的相关配置', link: i18n.string(navigationLinks.config[2], 'zh-cn') },
{ text: '作为 Hook API 使用的相关配置', link: i18n.string(navigationLinks.config[3], 'zh-cn') },
{ text: 'R8 与 Proguard 混淆', link: i18n.string(navigationLinks.config[4], 'zh-cn') }
{ text: '迁移至 YukiHookAPI 1.2.x', link: i18n.string(navigationLinks.config[4], 'zh-cn') },
{ text: '迁移至 YukiHookAPI 1.3.x', link: i18n.string(navigationLinks.config[5], 'zh-cn') },
{ text: 'R8 与 Proguard 混淆', link: i18n.string(navigationLinks.config[6], 'zh-cn') }
]
}, {
text: '工具',

View File

@@ -1,33 +1,27 @@
# About this Document
# About This Document
> This document is powered by [VuePress](https://v2.vuepress.vuejs.org/en).
## License
[The MIT License (MIT)](https://github.com/fankes/YukiHookAPI/blob/master/LICENSE)
[Apache-2.0](https://github.com/HighCapable/YukiHookAPI/blob/master/LICENSE)
```:no-line-numbers
MIT License
Apache License Version 2.0
Copyright (C) 2019-2023 HighCapable
Copyright (C) 2019 HighCapable
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:
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
https://www.apache.org/licenses/LICENSE-2.0
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.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
```
Copyright © 2019-2023 HighCapable
Copyright © 2019 HighCapable

View File

@@ -16,7 +16,65 @@ Time zone of version release date: **UTC+8**
:::
### 1.1.10 | 2023.04.21 &ensp;<Badge type="tip" text="latest" vertical="middle" />
### 1.3.0 | 2024.06.25 &ensp;<Badge type="tip" text="latest" vertical="middle" />
- This is a major update, please refer to [Migrate to YukiHookAPI 1.3.x](https://highcapable.github.io/YukiHookAPI/zh-cn/config/move-to-api-1-3-x)
- The reflection API of `YukiHookAPI` is deprecated, please move to the brand new [KavaRef](https://github.com/HighCapable/KavaRef)
- The limitation of duplicate Hooks has been deprecated, now you can repeat the same method of the Hook
- Deprecated ~~`ModuleAppActivity`~~, ~~`ModuleAppCompatActivity`~~, please use `ModuleActivity` to create your own proxy `Activity`
- `YLog` is now allowed to pass `msg` into any object and will be automatically converted to a string for printing
- `FreeReflection` has been deprecated and has now switched to [AndroidHiddenApiBypass](https://github.com/LSPosed/AndroidHiddenApiBypass)
### 1.2.1 | 2024.06.20 &ensp;<Badge type="warning" text="stale" vertical="middle" />
- Catch exceptions in singleton Hooker to prevent it from blocking the entire process
- Add automatic use of "`" in the automatic handler to fix the situation where Kotlin keywords are package names, thanks to [Fengning Zhu](https://github.com/zhufengning) for [PR](https://github.com/HighCapable/YukiHookAPI/pull/70)
- Adapt to Kotlin 2.0.0+, fix the problem that it cannot be compiled during automatic processing, thanks to [xihan123](https://github.com/xihan123) for [PR](https://github.com/HighCapable/YukiHookAPI/pull/76)
### 1.2.0 | 2023.10.07 &ensp;<Badge type="warning" text="stale" vertical="middle" />
- The license agreement has been changed from `MIT` to `Apache-2.0`, subsequent versions will be distributed under this license agreement, you should change the relevant license agreement after using this version
- This is a breaking update, please refer to [Migrate to YukiHookAPI 1.2.x](https://highcapable.github.io/YukiHookAPI/en/config/move-to-api-1-2-x) for details
- Adapted to Android 14, thanks to [BlueCat300](https://github.com/BlueCat300) for [PR](https://github.com/HighCapable/YukiHookAPI/pull/44)
- Fixed `findAllInterfaces` related issues, thanks to [buffcow](https://github.com/buffcow) for [PR](https://github.com/HighCapable/YukiHookAPI/pull/38)
- Fixed the delayed callback problem in the Hook process, thanks to [cesaryuan](https://github.com/cesaryuan) for his [Issue](https://github.com/HighCapable/YukiHookAPI/issues/47)
- Added support for Resources Hook related functions, please refer to this [Issue](https://github.com/HighCapable/YukiHookAPI/issues/36) for details
- Added `YukiHookAPI.TAG`
- Deprecated ~~`YukiHookAPI.API_VERSION_NAME`~~, ~~`YukiHookAPI.API_VERSION_CODE`~~, merged into `YukiHookAPI.VERSION`
- Added `YukiHookAPI.TAG`
- Deprecated ~~`YukiHookAPI.API_VERSION_NAME`~~, ~~`YukiHookAPI.API_VERSION_CODE`~~, merged into `YukiHookAPI.VERSION`
- Deprecated ~~`useDangerousOperation`~~ method in `YukiMemberHookCreator`
- Deprecated ~~`instanceClass`~~ function in `YukiMemberHookCreator`, it is no longer recommended
- Modify `instanceClass` in `HookParam` to be a null safe return value type
- Detach all Hook objects created using `injectMember` to `LegacyCreator`
- Modify `appClassLoader` in `PackageParam` to be a null safe return value type
- Refactor all `logger...` methods to new usage `YLog`
- Removed the `-->` style behind the print log function
- Fixed and improved the problem that the module package name cannot be obtained through KSP after using `namespace`
- Functions such as whether to enable module activation status have now been moved to the `InjectYukiHookWithXposed` annotation
- Detached [FreeReflection](https://github.com/tiann/FreeReflection) will no longer be automatically generated and will be automatically imported as a dependency
- Added a warning log that will be automatically printed when the same Hook method is repeated
- The `findClass(...)` method in `PackageParam` is obsolete, please migrate to the `"...".toClass()` method
- The `String.hook { ... }` method in `PackageParam` is obsolete, and it is recommended to use a new method for Hook
- `AppLifecycle` can now be created repeatedly in different Hookers
- The old version of Hook priority writing is obsolete and migrated to `YukiHookPriority`
- Removed the `tag` function in the Hook process
- Refactored `remendy` functionality in find methods, which now prints exceptions in steps
- The multi-method find result type is changed from `HashSet` to `MutableList`
- Added `method()`, `constructor()`, `field()` to directly obtain all object functions in the class
- `constructor()` no longer behaves like `constructor { emptyParam() }`
- Added `lazyClass` and `lazyClassOrNull` methods to lazily load `Class`
### 1.1.11 | 2023.04.25 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Fixed a critical issue since `1.1.5` version where the `Member` cache did not take effect and persistent storage eventually caused app out of memory (OOM), thanks to [Art-Chen](https://github.com/Art-Chen)
- Remove the direct cache function of `Member` and deprecated ~~`YukiReflection.Configs.isEnableMemberCache`~~, keep the cache function of `Class`
- Modified finder to `Sequence`, optimize the finding speed and performance of `Member`
- Remove the `YukiHookPrefsBridge`'s direct key-value cache function and removed `LruCache` related functions
- Deprecated ~~`YukiHookAPI.Configs.isEnablePrefsBridgeCache`~~
- Deprecated ~~`direct`~~, ~~`clearCache`~~ functions in `YukiHookPrefsBridge`
### 1.1.10 | 2023.04.21 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- The `Activity` proxy function adds the function of specifying a separate proxy `Activity` for each proxied `Activity`
- Fixed problem that the `contains` and `all` methods in `YukiHookPrefsBridge` did not judge the `native` function
@@ -25,7 +83,7 @@ Time zone of version release date: **UTC+8**
- Modify part of `HashMap` used for caching to `ArrayMap` to reduce memory consumption
- Fix some other possible problems
### 1.1.9 | 2023.04.17 &ensp;<Badge type="warning" text="stale" vertical="middle" />
### 1.1.9 | 2023.04.17 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Change the type of dependent library from **Java Library** (jar) to **Android Library** (aar)
- Remove the inspection function of internal methods and parameters through Hook or reflection API
@@ -45,9 +103,9 @@ Time zone of version release date: **UTC+8**
- Modify the proxy class of the `Activity` proxy function to be dynamically generated to prevent conflicts caused by injecting different modules into the host
- Fixed some other possible problems
### 1.1.8 | 2023.02.01 &ensp;<Badge type="warning" text="stale" vertical="middle" />
### 1.1.8 | 2023.02.01 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Fixed the problem that the underlying Hook method cannot update the modified state synchronously when modifying parameters such as `result` during callback, thanks to the [Issue](https://github.com/fankes/YukiHookAPI/issues/23) of [Yongzheng Lai](https://github.com/elvizlai)
- Fixed the problem that the underlying Hook method cannot update the modified state synchronously when modifying parameters such as `result` during callback, thanks to the [Issue](https://github.com/HighCapable/YukiHookAPI/issues/23) of [Yongzheng Lai](https://github.com/elvizlai)
- Move the entry class name file automatically generated by `YukiHookAPI` from `assets/yukihookapi_init` to `resources/META-INF/yukihookapi_init`
- When only printing the exception stack, the `msg` parameter is allowed to be empty and the `msg` parameter can not be set, and the log with the `msg` parameter left blank will not be logged unless the exception stack is not empty
- Fixed the bug that the log printed by the exception that occurs in the body of the Hook callback method has no specific method information
@@ -59,7 +117,7 @@ Time zone of version release date: **UTC+8**
- Fixed the problem that there may be multiple registration lifecycles in `PackageParam.AppLifecycle`
- Revert: The 1.1.7 version has been withdrawn due to a serious problem, please update to this version directly (the update log is the same as version 1.1.7)
### 1.1.6 | 2023.01.21 &ensp;<Badge type="warning" text="stale" vertical="middle" />
### 1.1.6 | 2023.01.21 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Fixed the serious problem that `ClassLoader` does not match after `PackageParam` keeps a single instance when there may be multiple package names in the same process when Xposed Module is loaded
- When the package name is not distinguished when there are multiple package names in the same process, stop loading the singleton child Hooker and print a warning message
@@ -67,7 +125,7 @@ Time zone of version release date: **UTC+8**
- Modify the method parameter name `param` of reflection calls in `MethodFinder`, `ConstructorFinder`, `ReflectionFactory` to `args`
- Added the function of judging the parameters of the entry class constructor in the automatic processing program of the Xposed Module, the entry class needs to ensure that it does not have any constructor parameters
### 1.1.5 | 2023.01.13 &ensp;<Badge type="warning" text="stale" vertical="middle" />
### 1.1.5 | 2023.01.13 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Standardize and optimize the overall code style
- Privatized some APIs called internally
@@ -109,7 +167,7 @@ Time zone of version release date: **UTC+8**
- Fixed the problem that the debug log data package name processed by `YukiHookLogger` may be incorrect in the (Xposed) Host environment
- Fixed the problem that the package name may be incorrect on some systems (in some system apps) when the Xposed Module loads the Resource Hook event
### 1.1.4 | 2022.10.04 &ensp;<Badge type="warning" text="stale" vertical="middle" />
### 1.1.4 | 2022.10.04 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Fixed the issue that `YukiHookDataChannel` may not respond to broadcast events in the system framework, reproduced in A13
- Fixed the issue that `YukiHookDataChannel` could not communicate with Module App in Host App for multiple versions
@@ -119,7 +177,7 @@ Time zone of version release date: **UTC+8**
- Added `loadApp`, `loadZygote`, `loadSystem`, `withProcess` multi-parameter methods of the same name in `PackageParam`
- Fixed some possible bugs
### 1.1.3 | 2022.09.30 &ensp;<Badge type="warning" text="stale" vertical="middle" />
### 1.1.3 | 2022.09.30 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
- Fixed a fatal bug where the Hook entry class name could not be customized
- Added some code notes in `LoggerFactory` and updated special features documentation
@@ -164,7 +222,7 @@ Time zone of version release date: **UTC+8**
- Added `generic` function to reflect and call generics, you can use it in `Class` or `CurrentClass`
- obsolete the `buildOfAny` method, now use the `buildOf` method directly (without generics) to use the constructor to create a new object and get the result `Any`
- Fixed the issue of null pointer exception when using `hasExtends`
- `CurrentClass` added non-`lambda` method of calling
- `CurrentClass` added non-**lambda** method of calling
- `CurrentClass` adds `name` and `simpleName` functions
- Completely rewrite the core method of `ReflectionTool`, sorting and classifying different search conditions
- Fixed the problem that `Member` obtained by directly calling `declared` in `ReflectionTool` throws an exception
@@ -180,7 +238,7 @@ Time zone of version release date: **UTC+8**
- Added multiple search function in reflection search, you can use relative search conditions to obtain multiple search results at the same time, thanks to **AA** and [Kitsune](https://github.com/KyuubiRan) for suggestions
- Fixed the problem that the object obtained by `appClassLoader` is incorrect in system applications in some systems, thanks to [Luckyzyx](https://github.com/luckyzyx) for the feedback
- Modified the calling method of `XposedBridge.invokeOriginalMethod` and added `original` function in `MethodFinder.Result.Instance`
- Fixed the problem of wrong value of `getStringSet` method in `YukiHookModulePrefs` and optimize the code style, thanks to [Teddy_Zhu](https://github.com/Teddy-Zhu) [PR](https://github.com/fankes/YukiHookAPI/pull/19)
- Fixed the problem of wrong value of `getStringSet` method in `YukiHookModulePrefs` and optimize the code style, thanks to [Teddy_Zhu](https://github.com/Teddy-Zhu) [PR](https://github.com/HighCapable/YukiHookAPI/pull/19)
- Modify `YukiHookModulePrefs` to intercept exceptions that may not exist in `XSharePreference`
- Fixed the problem that `YukiHookDataChannel` could not be successfully registered in some third-party ROM system frameworks
- Secured `YukiHookDataChannel`, now it can only communicate between modules from the specified package name and the host
@@ -203,7 +261,7 @@ Time zone of version release date: **UTC+8**
- Added the function of removing Hook in the Hook process, you can use the `remove` and `removeSelf` methods to remove the hook
- Fixed the issue that caused the host to throw an exception when ReplaceHook failed, and now it is modified to call the original method to ensure the normal operation of the host function
- Added the function of checking the return value of the method in the Hook process. If the return value does not match, it will automatically throw an exception or print an error according to the situation
- Added `array` type to Resources Hook, thanks to [PR](https://github.com/fankes/YukiHookAPI/pull/12) of [GSWXXN](https://github.com/GSWXXN)
- Added `array` type to Resources Hook, thanks to [PR](https://github.com/HighCapable/YukiHookAPI/pull/12) of [GSWXXN](https://github.com/GSWXXN)
- Moved `me.weishu.reflection` to `thirdparty` to prevent conflicting dependencies of the same name introduced at the same time
- Remove the exception thrown when the Hook method body is empty, and modify it to print the warning log
- Modify the exception handling logic of `AppLifecycle` and throw it directly to the host when an exception occurs
@@ -293,7 +351,7 @@ Time zone of version release date: **UTC+8**
- ~~`YukiHookXposedInitProxy`~~ renamed to `IYukiHookXposedInit`, the original interface name has been invalidated and will be deleted directly in subsequent versions
- Added `initZygote` and Resources Hook functions to support Hook Layout
- Added `onXposedEvent` method to listen to all events of native Xposed API
- Perform `inline` processing on the `lambda` of the Hook function to avoid generating excessively broken anonymous classes and improve the running performance after compilation
- Perform `inline` processing on the **lambda** of the Hook function to avoid generating excessively broken anonymous classes and improve the running performance after compilation
- Fixed `PrefsData` compiled method body copy is too large
- Added `XSharePreference` readability test, which will automatically print a warning log if it fails
- `PackageParam` adds `appResources`, `moduleAppResources`, `moduleAppFilePath` functions
@@ -321,7 +379,7 @@ Time zone of version release date: **UTC+8**
- Fixed `YukiHookModulePrefs` working in `New XSharePreference` mode
- Added `ModulePreferenceFragment`, now you can completely replace `PreferenceFragmentCompat` and start using the new functionality
- Adapt the Sp data storage solution of `PreferenceFragmentCompat`, thanks to [mahoshojoHCG](https://github.com/mahoshojoHCG) for feedback
- Update autohandlers and `Kotlin` dependencies to the latest version
- Update autohandlers and Kotlin dependencies to the latest version
- Fixed some bugs in documentation and code comments
### 1.0.77 | 2022.04.15 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
@@ -412,7 +470,7 @@ Time zone of version release date: **UTC+8**
- Added `MethodFinder` and `FieldFinder` new return value calling methods
- Fixed possible problems and fix possible problems during the use of Tai Chi
- Fixed possible problems with auto-generated Xposed entry classes
- Added `android` type and `java` type in `type`
- Added `android` type and Java type in `type`
### 1.0.6 | 2022.03.20 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
@@ -429,7 +487,7 @@ Time zone of version release date: **UTC+8**
- Fixed an annotation error
- Temporarily fix a bug
- Added a large number of `android` types in `type` and a small number of `java` types
- Added a large number of `android` types in `type` and a small number of Java types
- Fixed compatibility issues between new and old Kotlin APIs
### 1.0.5 | 2022.03.18 &ensp;<Badge type="danger" text="outdate" vertical="middle" />
@@ -465,7 +523,7 @@ Time zone of version release date: **UTC+8**
- `RemedyPlan` adds `onFind` function
- Integrate and modify some reflection API code
- Added `java` type in `type`
- Added Java type in `type`
- Fixed the issue that ignored errors still output in the console
### 1.0 | 2022.02.14 &ensp;<Badge type="danger" text="outdate" vertical="middle" />

View File

@@ -1,13 +1,16 @@
# Contact Us
> If you have any questions in use, or have any constructive suggestions, you can contact us.
> If you have any questions during usage, or have any constructive suggestions, you can contact us.
Join us [Click to join Telegram group](https://t.me/YukiHookAPI)
Join our developers group.
Find me on **Twitter** [@fankesyooni](https://twitter.com/fankesyooni)
- [Click to join Telegram group](https://t.me/YukiHookAPI)
- [Click to join Telegram group (Developer)](https://t.me/HighCapable_Dev)
Find me on **Twitter** [@fankesyooni](https://twitter.com/fankesyooni).
## Help with Maintenance
Thank you for choosing and using `YukiHookAPI`.
If you have code-related suggestions and requests, you can submit a Pull Request on Github.
If you have code-related suggestions and requests, you can submit a Pull Request on GitHub.

View File

@@ -1,4 +1,4 @@
# Looking for Future
# Looking Toward the Future
> The future is bright and uncertain, let us look forward to the future development space of `YukiHookAPI`.
@@ -16,6 +16,14 @@ Some Xposed Module developers currently choose the Hook target app self's Shared
In the later period, the permissions of the Android system will become more and more strict, and `selinux` is a big problem currently facing, which needs to be discussed and studied.
::: tip Updated on 2023.10.06
LSPosed has now experimentally launched [Modern Xposed API](https://github.com/libxposed), which uses Service to communicate with modules, which will solve the problem of module data storage.
In order to ensure the compatibility of most modules, **YukiHookAPI** plans to use a customized ContentProvider to realize data exchange between the Module App and the Host App in the future, so stay tuned.
:::
## Future Plans
> Features that `YukiHookAPI` may add later are included here.
@@ -26,7 +34,10 @@ If you like the Reflection API of `YukiHookAPI`, but your project may not need r
Well here is some good news for you:
The core Reflection API of `YukiHookAPI` has been decoupled into [YukiReflection](https://github.com/fankes/YukiReflection) project, which can now be used in any Android project.
~~The core Reflection API of `YukiHookAPI` has been decoupled into [YukiReflection](https://github.com/HighCapable/YukiReflection) project, which can now be used in any Android project.~~
The `YukiReflection` project has been deprecated due to many unsolved black box issues, so we no longer recommend anyone to use it.
Please now migrate to the brand new design [KavaRef](https://github.com/HighCapable/KavaRef).
::: tip To be Discussed
@@ -42,8 +53,12 @@ You can submit **issues** with us.
We have provided the Xposed native API listening interface, you can find or view the implementation method of the Demo [here](../config/xposed-using#native-xposed-api-events).
### Support for More Hook Framework
### Milestone Plan
As an API, currently only docking `XposedBridge` as a compatibility layer still has certain limitations.
The plans below have been published in `issues` on GitHub, and you can view the progress of each project.
Most `inline hook` do not have a `Java` compatibility layer, and the `Java` compatibility layer adaptation of `native hook` may be considered later.
All functions are expected to be completed in `2.0.0` version, so stay tuned.
- [New Xposed Module Config Plan](https://github.com/HighCapable/YukiHookAPI/issues/49)
- [New Hook Entry Class](https://github.com/HighCapable/YukiHookAPI/issues/48)
- ~~[New Hook Code Style](https://github.com/HighCapable/YukiHookAPI/issues/33)~~ (Replaced by [KavaRef](https://github.com/HighCapable/KavaRef))

View File

@@ -8,6 +8,14 @@ next:
> The document here will synchronize the relevant usage of the latest API version, please keep `YukiHookAPI` as the latest version to use the latest version of the function.
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the
Dokka plugin in version `2.0.0`.
If you encounter unsolvable problems, you can contact us via [Contact Us](../about/contacts).
:::
## Function Description
> The function description mainly introduces the related usage and purpose of the current API.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -24,33 +30,53 @@ object YukiHookAPI
> 这是 `YukiHookAPI` 的 API 调用总类Hook 相关功能的开始、Hook 相关功能的配置都在这里。
## API_VERSION_NAME <span class="symbol">- field</span>
## TAG <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val API_VERSION_NAME: String
const val TAG: String
```
**Change Records**
`v1.0.4` `added`
`v1.2.0` `added`
**Function Illustrate**
> 获取当前 `YukiHookAPI` 的名称 (标签)。
## VERSION <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val VERSION: String
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 获取当前 `YukiHookAPI` 的版本。
## API_VERSION_CODE <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val API_VERSION_CODE: Int
```
<h2 class="deprecated">API_VERSION_NAME - field</h2>
**Change Records**
`v1.0.4` `added`
**Function Illustrate**
`v1.2.0` `deprecated`
> 获取当前 `YukiHookAPI` 的版本号。
不再区分版本名称和版本号,请迁移到 `VERSION`
<h2 class="deprecated">API_VERSION_CODE - field</h2>
**Change Records**
`v1.0.4` `added`
`v1.2.0` `deprecated`
不再区分版本名称和版本号,请迁移到 `VERSION`
<h2 class="deprecated">executorName - field</h2>
@@ -60,7 +86,7 @@ const val API_VERSION_CODE: Int
`v1.0.91` `removed`
移到 `Status.Executor.name`
移到 `Status.Executor.name`
<h2 class="deprecated">executorVersion - field</h2>
@@ -70,7 +96,7 @@ const val API_VERSION_CODE: Int
`v1.0.91` `removed`
移到 `Status.Executor.apiLevel`、`Status.Executor.versionName`、`Status.Executor.versionCode`
移到 `Status.Executor.apiLevel`、`Status.Executor.versionName`、`Status.Executor.versionCode`
## Status <span class="symbol">- object</span>
@@ -114,7 +140,7 @@ val isXposedEnvironment: Boolean
> 获取当前是否为 (Xposed) 宿主环境。
<h3 class="deprecated">executorName - field</h3>
<h2 class="deprecated">executorName - field</h2>
**Change Records**
@@ -122,9 +148,9 @@ val isXposedEnvironment: Boolean
`v1.1.5` `deprecated`
移到 `Executor.name`
移到 `Executor.name`
<h3 class="deprecated">executorVersion - field</h3>
<h2 class="deprecated">executorVersion - field</h2>
**Change Records**
@@ -132,7 +158,7 @@ val isXposedEnvironment: Boolean
`v1.1.5` `deprecated`
移到 `Executor.apiLevel`、`Executor.versionName`、`Executor.versionCode`
移到 `Executor.apiLevel`、`Executor.versionName`、`Executor.versionCode`
### isModuleActive <span class="symbol">- field</span>
@@ -152,7 +178,7 @@ val isModuleActive: Boolean
在模块环境中你需要将 **Application** 继承于 **ModuleApplication**。
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
在 (Xposed) 宿主环境中仅返回非 **isTaiChiModuleActive** 的激活状态。
@@ -174,7 +200,7 @@ val isXposedModuleActive: Boolean
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
在 (Xposed) 宿主环境中始终返回 true。
@@ -214,11 +240,11 @@ val isSupportResourcesHook: Boolean
**Function Illustrate**
> 判断当前 Hook Framework 是否支持资源钩子(Resources Hook)。
> 判断当前 Hook Framework 是否支持资源钩子 (Resources Hook)。
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
在 (Xposed) 宿主环境中可能会延迟等待事件回调后才会返回 true。
@@ -256,7 +282,7 @@ val name: String
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
:::
@@ -276,7 +302,7 @@ val type: ExecutorType
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
:::
@@ -296,7 +322,7 @@ val apiLevel: Int
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
:::
@@ -316,7 +342,7 @@ val versionName: String
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
:::
@@ -336,7 +362,7 @@ val versionCode: Int
::: warning
在模块环境中需要启用 **Configs.isEnableHookModuleStatus**。
在模块环境中需要启用 **InjectYukiHookWithXposed.isUsingXposedModuleStatus**。
:::
@@ -357,7 +383,7 @@ object Configs
### debugLog <span class="symbol">- method</span>
```kotlin:no-line-numbers
inline fun debugLog(initiate: YukiHookLogger.Configs.() -> Unit)
inline fun debugLog(initiate: YLog.Configs.() -> Unit)
```
**Change Records**
@@ -366,7 +392,7 @@ inline fun debugLog(initiate: YukiHookLogger.Configs.() -> Unit)
**Function Illustrate**
> 配置 `YukiHookLogger.Configs` 相关参数。
> 配置 `YLog.Configs` 相关参数。
<h3 class="deprecated">debugTag - field</h3>
@@ -376,7 +402,7 @@ inline fun debugLog(initiate: YukiHookLogger.Configs.() -> Unit)
`v1.1.0` `deprecated`
移到 `YukiHookLogger.Configs.tag`
移到 `YLog.Configs.tag`
### isDebug <span class="symbol">- field</span>
@@ -392,7 +418,7 @@ var isDebug: Boolean
> 是否启用 Debug 模式。
默认为开启状态,开启后模块将会向 `Logcat` 和 (Xposed) 宿主环境中的日志功能打印详细的 Hook 日志,关闭后仅会打印 `E` 级别的日志。
默认不启用,启用后模块将会向 `Logcat` 和 (Xposed) 宿主环境中的日志功能打印详细的 Hook 日志,关闭后仅会打印 `E` 级别的日志。
<h3 class="deprecated">isAllowPrintingLogs - field</h3>
@@ -402,7 +428,7 @@ var isDebug: Boolean
`v1.1.0` `deprecated`
移到 `YukiHookLogger.Configs.isEnable`
移到 `YLog.Configs.isEnable`
<h3 class="deprecated">isEnableModulePrefsCache - field</h3>
@@ -412,25 +438,17 @@ var isDebug: Boolean
`v1.1.9` `deprecated`
移到 `isEnablePrefsBridgeCache`
移到 `isEnablePrefsBridgeCache`
### isEnablePrefsBridgeCache <span class="symbol">- field</span>
```kotlin:no-line-numbers
var isEnablePrefsBridgeCache: Boolean
```
<h3 class="deprecated">isEnablePrefsBridgeCache - field</h3>
**Change Records**
`v1.1.9` `added`
**Function Illustrate**
`v1.1.11` `deprecated`
> 是否启用 `YukiHookPrefsBridge` 的键值缓存功能。
为防止内存复用过高问题,此功能默认启用。
你可以手动在 `YukiHookPrefsBridge` 中自由开启和关闭缓存功能以及清除缓存。
键值的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
### isEnableModuleAppResourcesCache <span class="symbol">- field</span>
@@ -456,27 +474,15 @@ var isEnableModuleAppResourcesCache: Boolean
:::
### isEnableHookModuleStatus <span class="symbol">- field</span>
<h3 class="deprecated">isEnableHookModuleStatus - field</h3>
```kotlin:no-line-numbers
var isEnableHookModuleStatus: Boolean
```
**Change Records**
**变更记录**
`v1.0.88` `added`
**Function Illustrate**
`v1.2.0` `deprecated`
> 是否启用 Hook Xposed 模块激活等状态功能.
为原生支持 Xposed 模块激活状态检测,此功能默认启用。
::: warning
关闭后你将不能再在模块环境中使用 **YukiHookAPI.Status** 中的激活状态判断功能。
:::
请手动迁移到 `InjectYukiHookWithXposed.isUsingXposedModuleStatus`
### isEnableHookSharedPreferences <span class="symbol">- field</span>
@@ -520,29 +526,15 @@ var isEnableDataChannel: Boolean
此功能默认启用,关闭后将不会在功能初始化的时候装载 `YukiHookDataChannel`。
### isEnableMemberCache <span class="symbol">- field</span>
```kotlin:no-line-numbers
var isEnableMemberCache: Boolean
```
<h3 class="deprecated">isEnableMemberCache - field</h3>
**Change Records**
`v1.0.68` `added`
**Function Illustrate**
`v1.1.11` `deprecated`
> 是否启用 `Member` 缓存功能
为防止 `Member` 复用过高造成的系统 GC 问题,此功能默认启用。
启用后会缓存已经找到的 `Method`、`Constructor`、`Field`。
缓存的 `Member` 都将处于 `ReflectsCacheStore` 的全局静态实例中。
推荐使用 `MethodFinder`、`ConstructorFinder`、`FieldFinder` 来获取 `Member`。
除非缓存的 `Member` 发生了混淆的问题,例如使用 R8 混淆后的 APP 的目标 `Member`,否则建议启用。
`Member` 的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
## configs <span class="symbol">- method</span>
@@ -560,7 +552,7 @@ inline fun configs(initiate: Configs.() -> Unit)
**Function Illustrate**
> 对 `Configs` 类实现了一个 `lambda` 方法体。
> 对 `Configs` 类实现了一个 **lambda** 方法体。
你可以轻松地调用它进行配置。
@@ -582,12 +574,10 @@ object HookEntry : IYukiHookXposedInit {
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
}
isDebug = BuildConfig.DEBUG
isEnablePrefsBridgeCache = true
isEnableModuleAppResourcesCache = true
isEnableHookModuleStatus = true
isEnableHookSharedPreferences = false
isEnableDataChannel = true
isEnableMemberCache = true
}
}
@@ -612,12 +602,10 @@ object HookEntry : IYukiHookXposedInit {
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
}
isDebug = BuildConfig.DEBUG
isEnablePrefsBridgeCache = true
isEnableModuleAppResourcesCache = true
isEnableHookModuleStatus = true
isEnableHookSharedPreferences = false
isEnableDataChannel = true
isEnableMemberCache = true
}
override fun onHook() {
@@ -634,22 +622,20 @@ object HookEntry : IYukiHookXposedInit {
object HookEntry : IYukiHookXposedInit {
override fun onInit() {
YukiHookLogger.Configs.tag = "YukiHookAPI"
YukiHookLogger.Configs.isEnable = true
YukiHookLogger.Configs.isRecord = false
YukiHookLogger.Configs.elements(
YukiHookLogger.Configs.TAG,
YukiHookLogger.Configs.PRIORITY,
YukiHookLogger.Configs.PACKAGE_NAME,
YukiHookLogger.Configs.USER_ID
YLog.Configs.tag = "YukiHookAPI"
YLog.Configs.isEnable = true
YLog.Configs.isRecord = false
YLog.Configs.elements(
YLog.Configs.TAG,
YLog.Configs.PRIORITY,
YLog.Configs.PACKAGE_NAME,
YLog.Configs.USER_ID
)
YukiHookAPI.Configs.isDebug = BuildConfig.DEBUG
YukiHookAPI.Configs.isEnablePrefsBridgeCache = true
YukiHookAPI.Configs.isEnableModuleAppResourcesCache = true
YukiHookAPI.Configs.isEnableHookModuleStatus = true
YukiHookAPI.InjectYukiHookWithXposed.isUsingXposedModuleStatus = true
YukiHookAPI.Configs.isEnableHookSharedPreferences = false
YukiHookAPI.Configs.isEnableDataChannel = true
YukiHookAPI.Configs.isEnableMemberCache = true
}
override fun onHook() {

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -17,6 +23,7 @@ annotation class InjectYukiHookWithXposed(
val sourcePath: String,
val modulePackageName: String,
val entryClassName: String,
val isUsingXposedModuleStatus: Boolean,
val isUsingResourcesHook: Boolean
)
```
@@ -33,6 +40,10 @@ annotation class InjectYukiHookWithXposed(
新增 `isUsingResourcesHook` 参数
`v1.2.0` `modified`
新增 `isUsingXposedModuleStatus` 参数
**Function Illustrate**
> 标识 `YukiHookAPI` 注入 Xposed 入口的类注解。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# CurrentClass <span class="symbol">- class</span>
```kotlin:no-line-numbers
class CurrentClass internal constructor(internal val classSet: Class<*>, internal val instance: Any)
class CurrentClass internal constructor(private val classSet: Class<*>, internal val instance: Any)
```
**Change Records**
@@ -133,7 +139,7 @@ inline fun method(initiate: MethodConditions): MethodFinder.Result.Instance
## SuperClass <span class="symbol">- class</span>
```kotlin:no-line-numbers
inner class SuperClass internal constructor(internal val superClassSet: Class<*>)
inner class SuperClass internal constructor(private val superClassSet: Class<*>)
```
**Change Records**

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -27,11 +33,11 @@ class GenericClass internal constructor(private val type: ParameterizedType)
## argument <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun argument(index: Int): Class<*>
fun argument(index: Int): Class<*>?
```
```kotlin:no-line-numbers
inline fun <reified T> argument(index: Int): Class<T>
inline fun <reified T> argument(index: Int): Class<T>?
```
**Change Records**
@@ -42,6 +48,16 @@ inline fun <reified T> argument(index: Int): Class<T>
新增泛型返回值 `Class<T>` 方法
`v1.2.0` `modified`
方法的返回值可为 `null`
**Function Illustrate**
> 获得泛型参数数组下标的 `Class` 实例。
> 获得泛型参数数组下标的 `Class` 实例。
::: warning
在运行时局部变量的泛型会被擦除,获取不到时将会返回 **null**
:::

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# YukiMemberHookCreator <span class="symbol">- class</span>
```kotlin:no-line-numbers
class YukiMemberHookCreator internal constructor(internal val packageParam: PackageParam, internal val hookClass: HookClass)
class YukiMemberHookCreator internal constructor(private val packageParam: PackageParam, private val hookClass: HookClass)
```
**Change Records**
@@ -36,53 +42,37 @@ class YukiMemberHookCreator internal constructor(internal val packageParam: Pack
> `YukiHookAPI` 的 `Member` 核心 Hook 实现类。
## PRIORITY_DEFAULT <span class="symbol">- field</span>
```kotlin:no-line-numbers
val PRIORITY_DEFAULT: Int
```
<h2 class="deprecated">PRIORITY_DEFAULT - field</h2>
**Change Records**
`v1.0.80` `added`
**Function Illustrate**
`v1.2.0` `deprecated`
> 默认 Hook 回调优先级。
请迁移到 `YukiHookPriority`
## PRIORITY_LOWEST <span class="symbol">- field</span>
```kotlin:no-line-numbers
val PRIORITY_LOWEST: Int
```
<h2 class="deprecated">PRIORITY_LOWEST - field</h2>
**Change Records**
`v1.0.80` `added`
**Function Illustrate**
`v1.2.0` `deprecated`
> 延迟回调 Hook 方法结果。
请迁移到 `YukiHookPriority`
## PRIORITY_HIGHEST <span class="symbol">- field</span>
```kotlin:no-line-numbers
val PRIORITY_HIGHEST: Int
```
<h2 class="deprecated">PRIORITY_HIGHEST - field</h2>
**Change Records**
`v1.0.80` `added`
**Function Illustrate**
`v1.2.0` `deprecated`
> 更快回调 Hook 方法结果。
请迁移到 `YukiHookPriority`
## instanceClass <span class="symbol">- field</span>
```kotlin:no-line-numbers
val instanceClass: Class<*>
```
<h2 class="deprecated">instanceClass - field</h2>
**Change Records**
@@ -92,21 +82,11 @@ val instanceClass: Class<*>
~~`thisClass`~~ 更名为 `instanceClass`
**Function Illustrate**
`v1.2.0` `deprecated`
> 得到当前被 Hook 的 `Class`。
不再推荐使用
::: danger
不推荐直接使用,万一得不到 **Class** 对象则会无法处理异常导致崩溃。
:::
## injectMember <span class="symbol">- method</span>
```kotlin:no-line-numbers
inline fun injectMember(priority: Int, tag: String, initiate: MemberHookCreator.() -> Unit): MemberHookCreator.Result
```
<h2 class="deprecated">injectMember - method</h2>
**Change Records**
@@ -118,72 +98,38 @@ inline fun injectMember(priority: Int, tag: String, initiate: MemberHookCreator.
增加 `priority` Hook 优先级
`v1.2.0` `deprecated`
请迁移到另一个 `injectMember`
## injectMember <span class="symbol">- method</span>
```kotlin:no-line-numbers
inline fun injectMember(priority: YukiHookPriority, initiate: MemberHookCreator.LegacyCreator.() -> Unit): MemberHookCreator.Result
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 注入要 Hook 的 `Method`、`Constructor`。
**Function Example**
你可以注入任意 `Method` 与 `Constructor`,使用 `injectMember` 即可创建一个 `Hook` 对象。
> The following example
```kotlin
injectMember {
// Your code here.
}
```
你还可以自定义 `tag`,方便你在调试的时候能够区分你的 `Hook` 对象。
> The following example
```kotlin
injectMember(tag = "KuriharaYuki") {
// Your code here.
}
```
你还可以自定义 `priority`,以控制当前 Hook 对象并列执行的优先级速度。
> The following example
```kotlin
injectMember(priority = PRIORITY_HIGHEST) {
// Your code here.
}
```
## useDangerousOperation <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun useDangerousOperation(option: String)
```
<h2 class="deprecated">useDangerousOperation - method</h2>
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
`v1.2.0` `deprecated`
> 允许 Hook 过程中的所有危险行为。
请在 `option` 中键入 `Yes do as I say!` 代表你同意允许所有危险行为。
你还需要在整个调用域中声明注解 `CauseProblemsApi` 以消除警告。
若你只需要 Hook `ClassLoader` 的 `loadClass` 方法,请参考 [ClassLoader.onLoadClass](../factory/ReflectionFactory#classloader-onloadclass-ext-method)。
::: danger
若你不知道允许此功能会带来何种后果,请勿使用。
:::
此功能已被弃用
## MemberHookCreator <span class="symbol">- class</span>
```kotlin:no-line-numbers
inner class MemberHookCreator internal constructor(private val priority: Int, internal val tag: String)
inner class MemberHookCreator internal constructor(private val priority: YukiHookPriority, private val hookMode: HookMode)
```
**Change Records**
@@ -204,343 +150,41 @@ inner class MemberHookCreator internal constructor(private val priority: Int, in
修正拼写错误的 **Creater** 命名到 **Creator**
`v1.2.0` `modified`
移除 `tag`
`priority` 类型由 `Int` 变更为 `YukiHookPriority`
增加 `hookMode` Hook 模式
**Function Illustrate**
> Hook 核心功能实现类,查找和处理需要 Hook 的 `Method`、`Constructor`。
<h3 class="deprecated">member - field</h3>
**Change Records**
`v1.0` `first`
`v1.1.0` `removed`
请转移到 `members`
### members <span class="symbol">- method</span>
### before <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun members(vararg member: Member?)
fun before(initiate: HookParam.() -> Unit): HookCallback
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 手动指定要 Hook 的 `Method`、`Constructor`。
::: warning
不建议使用此方法设置目标需要 Hook 的 **Member** 对象,你可以使用 **method** 或 **constructor** 方法。
:::
**Function Example**
你可以调用 `instanceClass` 来手动查找要 Hook 的 `Method`、`Constructor`。
> The following example
```kotlin
injectMember {
members(instanceClass.getDeclaredMethod("test", StringClass))
beforeHook {}
afterHook {}
}
```
同样地,你也可以传入一组 `Member` 同时进行 Hook。
> The following example
```kotlin
injectMember {
members(
instanceClass.getDeclaredMethod("test1", StringClass),
instanceClass.getDeclaredMethod("test2", StringClass),
instanceClass.getDeclaredMethod("test3", StringClass)
)
beforeHook {}
afterHook {}
}
```
<h3 class="deprecated">allMethods - method</h3>
**Change Records**
`v1.0` `first`
`v1.1.0` `deprecated`
请使用 `method { name = /** name */ }.all()` 来取代它
<h3 class="deprecated">allConstructors - method</h3>
**Change Records**
`v1.0` `first`
`v1.1.0` `deprecated`
请使用 `allMembers(MembersType.CONSTRUCTOR)` 来取代它
### allMembers <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun allMembers(type: MembersType)
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 查找并 Hook `hookClass` 中的全部 `Method`、`Constructor`。
::: warning
无法准确处理每个 **Member** 的返回值和 **param**,建议使用 **method** or **constructor** 对每个 **Member** 单独 Hook。
:::
### method <span class="symbol">- method</span>
```kotlin:no-line-numbers
inline fun method(initiate: MethodConditions): MethodFinder.Result
```
**Change Records**
`v1.0` `first`
`v1.0.80` `modified`
将方法体进行 inline
**Function Illustrate**
> 查找当前 `Class` 需要 Hook 的 `Method` 。
**Function Example**
你可参考 [MethodFinder](finder/members/MethodFinder) 查看详细用法。
> The following example
```kotlin
injectMember {
method {
name = "test"
param(StringClass)
returnType = UnitType
}
beforeHook {}
afterHook {}
}
```
若想 Hook 当前查找 `method { ... }` 条件的全部结果,你只需要在最后加入 `all` 即可。
> The following example
```kotlin
injectMember {
method {
name = "test"
paramCount(1..5)
}.all()
beforeHook {}
afterHook {}
}
```
此时 `beforeHook` 与 `afterHook` 会在每个查找到的结果中多次回调 Hook 方法体。
::: warning
若没有 **all**,默认只会 Hook 当前条件查找到的数组下标结果第一位。
:::
### constructor <span class="symbol">- method</span>
```kotlin:no-line-numbers
inline fun constructor(initiate: ConstructorConditions): ConstructorFinder.Result
```
**Change Records**
`v1.0` `first`
`v1.0.80` `modified`
将方法体进行 inline
**Function Illustrate**
> 查找当前 `Class` 需要 Hook 的 `Constructor`。
**Function Example**
你可参考 [ConstructorFinder](finder/members/ConstructorFinder) 查看详细用法。
> The following example
```kotlin
injectMember {
constructor { param(StringClass) }
beforeHook {}
afterHook {}
}
```
若想 Hook 当前查找 `constructor { ... }` 条件的全部结果,你只需要在最后加入 `all` 即可。
> The following example
```kotlin
injectMember {
constructor { paramCount(1..5) }.all()
beforeHook {}
afterHook {}
}
```
此时 `beforeHook` 与 `afterHook` 会在每个查找到的结果中多次回调 Hook 方法体。
::: warning
若没有 **all**,默认只会 Hook 当前条件查找到的数组下标结果第一位。
:::
### HookParam.field <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun HookParam.field(initiate: FieldConditions): FieldFinder.Result
```
**Change Records**
`v1.0` `first`
`v1.0.80` `modified`
将方法体进行 inline
**Function Illustrate**
> 使用当前 `hookClass` 查找并得到 `Field`。
**Function Example**
你可参考 [FieldFinder](finder/members/FieldFinder) 查看详细用法。
> The following example
```kotlin
injectMember {
method {
name = "test"
param(StringClass)
returnType = UnitType
}
afterHook {
// 这里不需要再调用 instanceClass.field 进行查找
field {
name = "isSweet"
type = BooleanType
}.get(instance).setTrue()
}
}
```
### HookParam.method <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun HookParam.method(initiate: MethodConditions): MethodFinder.Result
```
**Change Records**
`v1.0.2` `first`
`v1.0.80` `modified`
将方法体进行 inline
**Function Illustrate**
> 使用当前 `hookClass` 查找并得到 `Method` 。
### HookParam.constructor <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun HookParam.constructor(initiate: ConstructorConditions): ConstructorFinder.Result
```
**Change Records**
`v1.0.2` `first`
`v1.0.80` `modified`
将方法体进行 inline
**Function Illustrate**
> 使用当前 `hookClass` 查找并得到 `Constructor`。
### HookParam.injectMember <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun HookParam.injectMember(priority: Int, tag: String, initiate: MemberHookCreator.() -> Unit): MemberHookCreator.Result
```
**Change Records**
`v1.0.88` `added`
**Function Illustrate**
> 注入要 Hook 的 `Method`、`Constructor` (嵌套 Hook)。
### beforeHook <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun beforeHook(initiate: HookParam.() -> Unit): HookCallback
```
**Change Records**
`v1.0` `first`
`v1.1.0` `modified`
新增 `HookCallback` 返回类型
`v1.2.0` `added`
**Function Illustrate**
> 在 `Member` 执行完成前 Hook。
### afterHook <span class="symbol">- method</span>
### after <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun afterHook(initiate: HookParam.() -> Unit): HookCallback
fun after(initiate: HookParam.() -> Unit): HookCallback
```
**Change Records**
`v1.0` `first`
`v1.1.0` `modified`
新增 `HookCallback` 返回类型
`v1.2.0` `added`
**Function Illustrate**
@@ -670,6 +314,26 @@ fun removeSelf(result: (Boolean) -> Unit)
:::
### LegacyCreator <span class="symbol">- class</span>
```kotlin:no-line-numbers
inner class LegacyCreator internal constructor()
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 使用 `injectMember` 创建的 Hook 核心功能实现类 (旧版本)。
::: warning
大部分旧版 API 已被迁移至此处,将不再特殊说明其中包含的旧版 API。
:::
### HookCallback <span class="symbol">- class</span>
```kotlin:no-line-numbers
@@ -734,24 +398,6 @@ inline fun result(initiate: Result.() -> Unit): Result
> 创建监听失败事件方法体。
**Function Example**
你可以使用此方法为 `Result` 类创建 `lambda` 方法体。
> The following example
```kotlin
injectMember {
// Your code here.
}.result {
onHooked {}
onAlreadyHooked {}
ignoredConductFailure()
onHookingFailure {}
// ...
}
```
#### by <span class="symbol">- method</span>
```kotlin:no-line-numbers

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -291,6 +297,52 @@ injectResource {
}
```
### replaceTo <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun replaceTo(result: (original: Any) -> Any?)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 替换指定 Resources 为指定的值。
::: warning
此方法只支持部分类型,例如 **String**、**Boolean**。
此方法不支持在 **HookEntryType.ZYGOTE** 时使用。
:::
### replaceToModuleResource <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun replaceToModuleResource(result: (original: Any) -> Int)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 替换为当前 Xposed 模块的 Resources。
你可以直接使用模块的 `R.string.xxx`、`R.mipmap.xxx`、`R.drawable.xxx` 替换 Hook APP 的 Resources。
::: warning
此方法只支持部分类型,例如 **String**、**Boolean**。
此方法不支持在 **HookEntryType.ZYGOTE** 时使用。
:::
### injectAsLayout <span class="symbol">- method</span>
```kotlin:no-line-numbers

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -0,0 +1,77 @@
---
pageClass: code-page
---
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
:::
# YukiHookPriority <span class="symbol">- class</span>
```kotlin:no-line-numbers
enum class YukiHookPriority
```
**Change Records**
`v1.1.5` `added`
`v1.2.0` `modified`
移除 `internal` 对外公开
**Function Illustrate**
> Hook 回调优先级配置类。
## DEFAULT <span class="symbol">- enum</span>
```kotlin:no-line-numbers
DEFAULT
```
**Change Records**
`v1.1.5` `added`
**Function Illustrate**
> 默认 Hook 回调优先级。
## LOWEST <span class="symbol">- enum</span>
```kotlin:no-line-numbers
LOWEST
```
**Change Records**
`v1.1.5` `added`
**Function Illustrate**
> 延迟回调 Hook 方法结果。
## HIGHEST <span class="symbol">- enum</span>
```kotlin:no-line-numbers
HIGHEST
```
**Change Records**
`v1.1.5` `added`
**Function Illustrate**
> 更快回调 Hook 方法结果。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -32,7 +38,7 @@ class DexClassFinder internal constructor(
::: warning
此功能尚在验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
此功能尚在验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
:::
@@ -441,7 +447,7 @@ fun enclosing(vararg name: String)
## FromPackageRules <span class="symbol">- class</span>
```kotlin:no-line-numbers
inner class FromPackageRules internal constructor(private val packages: ArrayList<ClassRulesData.PackageRulesData>)
inner class FromPackageRules internal constructor(private val packages: MutableList<ClassRulesData.PackageRulesData>)
```
**Change Records**
@@ -625,20 +631,24 @@ fun get(): Class<*>?
### all <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun all(): HashSet<Class<*>>
fun all(): MutableList<Class<*>>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 得到 `Class` 本身数组。
返回全部查找条件匹配的多个 `Class` 实例。
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
若你设置了 `async` 请使用 [waitAll](#waitall-method) 方法。
@@ -685,20 +695,24 @@ fun wait(result: (Class<*>?) -> Unit): Result
### waitAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun waitAll(result: (HashSet<Class<*>>) -> Unit): Result
fun waitAll(result: (MutableList<Class<*>>) -> Unit): Result
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
`result` 类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 得到 `Class` 本身数组 (异步)。
回调全部查找条件匹配的多个 `Class` 实例。
在查找条件找不到任何结果的时候将回调空的 `HashSet`。
在查找条件找不到任何结果的时候将回调空的 `MutableList`。
你需要设置 `async` 后此方法才会被回调,否则请使用 [all](#all-method) 方法。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# ConstructorRules <span class="symbol">- class</span>
```kotlin:no-line-numbers
class ConstructorRules internal constructor(internal val rulesData: ConstructorRulesData) : BaseRules
class ConstructorRules internal constructor(private val rulesData: ConstructorRulesData) : BaseRules
```
**Change Records**

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# FieldRules <span class="symbol">- class</span>
```kotlin:no-line-numbers
class FieldRules internal constructor(internal val rulesData: FieldRulesData) : BaseRules
class FieldRules internal constructor(private val rulesData: FieldRulesData) : BaseRules
```
**Change Records**

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# MemberRules <span class="symbol">- class</span>
```kotlin:no-line-numbers
class MemberRules internal constructor(internal val rulesData: MemberRulesData) : BaseRules
class MemberRules internal constructor(private val rulesData: MemberRulesData) : BaseRules
```
**Change Records**

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# MethodRules <span class="symbol">- class</span>
```kotlin:no-line-numbers
class MethodRules internal constructor(internal val rulesData: MethodRulesData) : BaseRules
class MethodRules internal constructor(private val rulesData: MethodRulesData) : BaseRules
```
**Change Records**

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -291,7 +297,7 @@ inner class Result internal constructor()
#### onFind <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
fun onFind(initiate: MutableList<Constructor<*>>.() -> Unit)
```
**Change Records**
@@ -302,6 +308,10 @@ fun onFind(initiate: HashSet<Constructor<*>>.() -> Unit)
`initiate` 参数 `Constructor` 变为 `HashSet<Constructor>`
`v1.2.0` `modified`
`initiate` 类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 当在 `RemedyPlan` 中找到结果时。
@@ -350,7 +360,7 @@ inline fun result(initiate: Process.() -> Unit): Process
**Function Example**
你可以使用 `lambda` 形式创建 `Result` 类。
你可以使用 **lambda** 形式创建 `Result` 类。
> The following example
@@ -467,7 +477,7 @@ inline fun result(initiate: Result.() -> Unit): Result
**Function Example**
你可以使用 `lambda` 形式创建 `Result` 类。
你可以使用 **lambda** 形式创建 `Result` 类。
> The following example
@@ -543,13 +553,17 @@ constructor {
### all <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun all(): ArrayList<Instance>
fun all(): MutableList<Instance>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `ArrayList` 修改为 `MutableList`
**Function Illustrate**
> 获得 `Constructor` 实例处理类数组。
@@ -591,20 +605,24 @@ fun give(): Constructor<*>?
### giveAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun giveAll(): HashSet<Constructor<*>>
fun giveAll(): MutableList<Constructor<*>>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 得到 `Constructor` 本身数组。
返回全部查找条件匹配的多个 `Constructor` 实例。
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
### wait <span class="symbol">- method</span>
@@ -633,13 +651,17 @@ fun wait(initiate: Instance.() -> Unit)
### waitAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun waitAll(initiate: ArrayList<Instance>.() -> Unit)
fun waitAll(initiate: MutableList<Instance>.() -> Unit)
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
**Function Illustrate**
> 获得 `Constructor` 实例处理类数组,配合 `RemedyPlan` 使用。
@@ -743,7 +765,7 @@ fun ignored(): Result
`v1.1.0` `deprecated`
移到新方法 `ignored()`
移到新方法 `ignored()`
### Instance <span class="symbol">- class</span>

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -44,7 +50,7 @@ class FieldFinder internal constructor(override val classSet: Class<*>?) : Membe
`v1.0` `first`
`v1.0.2` `removed`
`v1.0.2` `移除`
## name <span class="symbol">- field</span>
@@ -289,22 +295,26 @@ inner class Result internal constructor()
#### onFind <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun onFind(initiate: HashSet<Field>.() -> Unit)
fun onFind(initiate: MutableList<Field>.() -> Unit)
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
`initiate` 类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 当在 `RemedyPlan` 中找到结果时。
**Function Example**
**功能示例**
你可以方便地对重查找的 `Field` 实现 `onFind` 方法。
> The following example
> 示例如下
```kotlin
field {
@@ -317,7 +327,7 @@ field {
## Result <span class="symbol">- class</span>
```kotlin:no-line-numbers
inner class Result internal constructor(internal val isNoSuch: Boolean, private val throwable: Throwable?) : BaseResult
inner class Result internal constructor(internal val isNoSuch: Boolean, internal val throwable: Throwable?) : BaseResult
```
**Change Records**
@@ -350,11 +360,11 @@ inline fun result(initiate: Result.() -> Unit): Result
> 创建监听结果事件方法体。
**Function Example**
**功能示例**
你可以使用 `lambda` 形式创建 `Result` 类。
你可以使用 **lambda** 形式创建 `Result` 类。
> The following example
> 示例如下
```kotlin
field {
@@ -387,11 +397,11 @@ fun get(instance: Any?): Instance
若有多个 `Field` 结果只会返回第一个。
**Function Example**
**功能示例**
你可以轻松地得到 `Field` 的实例以及使用它进行设置实例。
> The following example
> 示例如下
```kotlin
field {
@@ -401,7 +411,7 @@ field {
如果你取到的是静态 `Field`,可以不需要设置实例。
> The following example
> 示例如下
```kotlin
field {
@@ -412,24 +422,28 @@ field {
### all <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun all(instance: Any?): ArrayList<Instance>
fun all(instance: Any?): MutableList<Instance>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `ArrayList` 修改为 `MutableList`
**Function Illustrate**
> 获得 `Field` 实例处理类数组。
返回全部查找条件匹配的多个 `Field` 实例结果。
**Function Example**
**功能示例**
你可以通过此方法来获得当前条件结果中匹配的全部 `Field`,其 `Field` 所在实例用法与 `get` 相同。
> The following example
> 示例如下
```kotlin
field {
@@ -460,20 +474,24 @@ fun give(): Field?
### giveAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun giveAll(): HashSet<Field>
fun giveAll(): MutableList<Field>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 得到 `Field` 本身数组。
返回全部查找条件匹配的多个 `Field` 实例。
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
### wait <span class="symbol">- method</span>
@@ -502,13 +520,17 @@ fun wait(instance: Any?, initiate: Instance.() -> Unit)
### waitAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
**Function Illustrate**
> 获得 `Field` 实例处理类数组,配合 `RemedyPlan` 使用。
@@ -537,13 +559,13 @@ inline fun remedys(initiate: RemedyPlan.() -> Unit): Result
> 创建 `Field` 重查找功能。
**Function Example**
**功能示例**
当你遇到一种 `Field` 可能存在不同形式的存在时,可以使用 `RemedyPlan` 重新查找它,而没有必要使用 `onNoSuchField` 捕获异常二次查找 `Field`。
若第一次查找失败了,你还可以在这里继续添加此方法体直到成功为止。
> The following example
> 示例如下
```kotlin
field {
@@ -602,7 +624,7 @@ fun ignored(): Result
`v1.1.0` `deprecated`
移到新方法 `ignored()`
移到新方法 `ignored()`
### Instance <span class="symbol">- class</span>
@@ -630,7 +652,7 @@ inner class Instance internal constructor(private val instance: Any?, private va
`v1.0` `first`
`v1.1.0` `removed`
`v1.1.0` `移除`
请直接使用 `any` 方法得到 `Field` 自身的实例化对象

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -435,7 +441,7 @@ inner class Result internal constructor()
#### onFind <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun onFind(initiate: HashSet<Method>.() -> Unit)
fun onFind(initiate: MutableList<Method>.() -> Unit)
```
**Change Records**
@@ -446,6 +452,10 @@ fun onFind(initiate: HashSet<Method>.() -> Unit)
`initiate` 参数 `Method` 变为 `HashSet<Method>`
`v1.2.0` `modified`
`initiate` 类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 当在 `RemedyPlan` 中找到结果时。
@@ -494,7 +504,7 @@ inline fun result(initiate: Process.() -> Unit): Process
**Function Example**
你可以使用 `lambda` 形式创建 `Result` 类。
你可以使用 **lambda** 形式创建 `Result` 类。
> The following example
@@ -611,7 +621,7 @@ inline fun result(initiate: Result.() -> Unit): Result
**Function Example**
你可以使用 `lambda` 形式创建 `Result` 类。
你可以使用 **lambda** 形式创建 `Result` 类。
> The following example
@@ -673,13 +683,17 @@ method {
### all <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun all(instance: Any?): ArrayList<Instance>
fun all(instance: Any?): MutableList<Instance>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `ArrayList` 修改为 `MutableList`
**Function Illustrate**
> 获得 `Method` 实例处理类数组。
@@ -721,20 +735,24 @@ fun give(): Method?
### giveAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun giveAll(): HashSet<Method>
fun giveAll(): MutableList<Method>
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
返回值类型由 `HashSet` 修改为 `MutableList`
**Function Illustrate**
> 得到 `Method` 本身数组。
返回全部查找条件匹配的多个 `Method` 实例。
在查找条件找不到任何结果的时候将返回空的 `HashSet`。
在查找条件找不到任何结果的时候将返回空的 `MutableList`。
### wait <span class="symbol">- method</span>
@@ -763,13 +781,17 @@ fun wait(instance: Any?, initiate: Instance.() -> Unit)
### waitAll <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun waitAll(instance: Any?, initiate: ArrayList<Instance>.() -> Unit)
fun waitAll(instance: Any?, initiate: MutableList<Instance>.() -> Unit)
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `modified`
`initiate` 类型由 `ArrayList` 修改为 `MutableList`
**Function Illustrate**
> 获得 `Method` 实例处理类数组,配合 `RemedyPlan` 使用。
@@ -873,7 +895,7 @@ fun ignored(): Result
`v1.1.0` `deprecated`
移到新方法 `ignored()`
移到新方法 `ignored()`
### Instance <span class="symbol">- class</span>

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -76,6 +82,24 @@ CONSTRUCTOR
> 全部 `Constructor`。
## LazyClass <span class="symbol">- class</span>
```kotlin:no-line-numbers
open class LazyClass<T> internal constructor(
private val instance: Any,
private val initialize: Boolean,
private val loader: ClassLoaderInitializer?
)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 懒装载 `Class` 实例。
## ClassLoader.listOfClasses <span class="symbol">- ext-method</span>
```kotlin:no-line-numbers
@@ -118,7 +142,7 @@ inline fun ClassLoader.searchClass(name: String, async: Boolean, initiate: Class
建议启用 **async** 或设置 **name** 参数,**name** 参数将在 Hook APP (宿主) 不同版本中自动进行本地缓存以提升效率。
此功能尚在验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
此功能尚在验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
:::
@@ -536,7 +560,7 @@ inline fun <reified T> classOf(loader: ClassLoader?, initialize: Boolean): Class
**Function Example**
我们要获取一个 `Class` 在 `Kotlin` 下不通过反射时应该这样做。
我们要获取一个 `Class` 在 Kotlin 下不通过反射时应该这样做。
> The following example
@@ -561,6 +585,50 @@ val customClassLoader: ClassLoader? = ... // 假设这个就是你的 ClassLoade
classOf<DemoClass>(customClassLoader)
```
## lazyClass <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun lazyClass(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.NonNull<Any>
```
```kotlin:no-line-numbers
inline fun <reified T> lazyClass(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.NonNull<T>
```
```kotlin:no-line-numbers
fun lazyClass(variousClass: VariousClass, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.NonNull<Any>
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 懒装载 `Class`。
## lazyClassOrNull <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun lazyClassOrNull(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.Nullable<Any>
```
```kotlin:no-line-numbers
inline fun <reified T> lazyClassOrNull(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.Nullable<T>
```
```kotlin:no-line-numbers
fun lazyClassOrNull(variousClass: VariousClass, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.Nullable<Any>
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 懒装载 `Class`。
## String.hasClass <span class="symbol">- ext-method</span>
```kotlin:no-line-numbers
@@ -904,7 +972,7 @@ inline fun <reified T : Any> T.current(ignored: Boolean, initiate: CurrentClass.
`v1.1.0` `deprecated`
移到 `buildOf` 方法
移到 `buildOf` 方法
## Class.buildOf <span class="symbol">- ext-method</span>

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -22,7 +28,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
**Function Illustrate**
> 这是 `YukiHookAPI` 相关 `lambda` 方法的封装类以及部分 API 用法。
> 这是 `YukiHookAPI` 相关 **lambda** 方法的封装类以及部分 API 用法。
## IYukiHookXposedInit.configs <span class="symbol">- ext-method</span>
@@ -72,7 +78,7 @@ fun IYukiHookXposedInit.encase(vararg hooker: YukiBaseHooker)
`v1.1.9` `deprecated`
移到 `prefs` 方法
移到 `prefs` 方法
<h2 class="deprecated">Context.modulePrefs - ext-method</h2>
@@ -82,7 +88,7 @@ fun IYukiHookXposedInit.encase(vararg hooker: YukiBaseHooker)
`v1.1.9` `deprecated`
移到 `prefs` 方法
移到 `prefs` 方法
## Context.prefs <span class="symbol">- ext-method</span>
@@ -224,7 +230,7 @@ fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleC
`v1.0.91` `removed`
移到 `YukiHookAPI.Status.isSupportResourcesHook`
移到 `YukiHookAPI.Status.isSupportResourcesHook`
<h2 class="deprecated">isModuleActive - field</h2>
@@ -234,7 +240,7 @@ fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleC
`v1.0.91` `removed`
移到 `YukiHookAPI.Status.isModuleActive`
移到 `YukiHookAPI.Status.isModuleActive`
<h2 class="deprecated">isXposedModuleActive - field</h2>
@@ -244,7 +250,7 @@ fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleC
`v1.0.91` `removed`
移到 `YukiHookAPI.Status.isXposedModuleActive`
移到 `YukiHookAPI.Status.isXposedModuleActive`
<h2 class="deprecated">isTaiChiModuleActive - field</h2>
@@ -254,7 +260,7 @@ fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleC
`v1.0.91` `removed`
移到 `YukiHookAPI.Status.isTaiChiModuleActive`
移到 `YukiHookAPI.Status.isTaiChiModuleActive`
<h1 class="deprecated">YukiHookModuleStatus - class</h1>
@@ -264,4 +270,4 @@ fun Context.applyModuleTheme(theme: Int, configuration: Configuration?): ModuleC
`v1.0.91` `deprecated`
移到 `YukiHookAPI.Status`
移到 `YukiHookAPI.Status`

View File

@@ -4,35 +4,403 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
:::
# LoggerFactory <span class="symbol">- kt</span>
**Change Records**
`v1.0` `first`
**Function Illustrate**
> 这是 `YukiHookAPI` 的日志封装类,可实现同时向 `Logcat` 和 (Xposed) 宿主环境打印日志的功能。
## LoggerType <span class="symbol">- class</span>
# YLog <span class="symbol">- object</span>
```kotlin:no-line-numbers
enum class LoggerType
object YLog
```
**Change Records**
`v1.1.0` `added`
`v1.2.0` `added`
**Function Illustrate**
> 需要打印的日志类型
> 全局 Log 管理类
## inMemoryData <span class="symbol">- field</span>
```kotlin:no-line-numbers
val inMemoryData: MutableList<YLogData>
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 当前全部已记录的日志数据。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
## contents <span class="symbol">- field</span>
```kotlin:no-line-numbers
val contents: String
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 获取当前日志文件内容。
如果当前没有已记录的日志会返回空字符串。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
## contents <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun contents(data: List<YLogData>): String
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 获取、格式化当前日志文件内容。
如果当前没有已记录的日志 (`data` 为空) 会返回空字符串。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
## clear <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun clear()
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 清除全部已记录的日志。
你也可以直接获取 [inMemoryData](#inmemorydata-field) 来清除。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
## saveToFile <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun saveToFile(fileName: String, data: List<YLogData>)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 保存当前日志到文件。
若当前未开启 `Configs.isRecord` 或记录为空则不会进行任何操作。
日志文件会追加到 `fileName` 的文件结尾,若文件不存在会自动创建。
::: danger
文件读写权限取决于当前宿主、模块已获取的权限。
:::
## Configs <span class="symbol">- object</span>
```kotlin:no-line-numbers
object Configs
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 配置 `YLog`
### TAG <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val TAG: Int
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 标签。
### PRIORITY <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val PRIORITY: Int
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 优先级。
### PACKAGE_NAME <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val PACKAGE_NAME: Int
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 当前宿主的包名。
### USER_ID <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val USER_ID: Int
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 当前宿主的用户 ID (主用户不显示)。
### tag <span class="symbol">- field</span>
```kotlin:no-line-numbers
var tag: String
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 这是一个调试日志的全局标识。
默认文案为 `YukiHookAPI`
你可以修改为你自己的文案。
### isEnable <span class="symbol">- field</span>
```kotlin:no-line-numbers
var isEnable: Boolean
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 是否启用调试日志的输出功能。
关闭后将会停用 `YukiHookAPI` 对全部日志的输出。
但是不影响当你手动调用下面这些方法输出日志。
`debug``info``warn``error`
`isEnable` 关闭后 `YukiHookAPI.Configs.isDebug` 也将同时关闭。
### isRecord <span class="symbol">- field</span>
```kotlin:no-line-numbers
var isRecord: Boolean
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 是否启用调试日志的记录功能。
开启后将会在内存中记录全部可用的日志和异常堆栈。
需要同时启用 [isEnable](#isenable-field) 才能有效。
::: danger
过量的日志可能会导致宿主运行缓慢或造成频繁 GC。
:::
开启后你可以调用 [YLog.saveToFile](#savetofile-method) 实时保存日志到文件或使用 [YLog.contents](#contents-field) 获取实时日志文件。
### elements <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun elements(vararg item: Int)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 自定义调试日志对外显示的元素。
只对日志记录和 (Xposed) 宿主环境的日志生效。
日志元素的排列将按照你在 `item` 中设置的顺序进行显示。
你还可以留空 `item` 以不显示除日志内容外的全部元素。
可用的元素有:`TAG``PRIORITY``PACKAGE_NAME``USER_ID`
**功能示例**
打印的日志样式将按照你设置的排列顺序和元素内容进行。
> 示例如下
```kotlin
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
```
以上内容定义的日志将显示为如下样式。
> 示例如下
```:no-line-numbers
[YukiHookAPI][D][com.demo.test][999]--> This is a log
```
如果我们调整元素顺序以及减少个数,那么结果又会不一样。
> 示例如下
```kotlin
elements(PACKAGE_NAME, USER_ID, PRIORITY)
```
以上内容定义的日志将显示为如下样式。
> 示例如下
```:no-line-numbers
[com.demo.test][999][D]--> This is a log
```
## debug <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun debug(msg: String, e: Throwable?, tag: String, env: EnvType)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 打印 Debug 级别 Log。
## info <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun info(msg: String, e: Throwable?, tag: String, env: EnvType)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 打印 Info 级别 Log。
## warn <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun warn(msg: String, e: Throwable?, tag: String, env: EnvType)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 打印 Warn 级别 Log。
## error <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun error(msg: String, e: Throwable?, tag: String, env: EnvType)
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 打印 Error 级别 Log。
## EnvType <span class="symbol">- class</span>
```kotlin:no-line-numbers
enum class EnvType
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 需要打印的日志环境类型。
决定于模块与 (Xposed) 宿主环境使用的打印方式。
@@ -44,22 +412,12 @@ LOGD
**Change Records**
`v1.1.0` `added`
`v1.2.0` `added`
**Function Illustrate**
> 仅使用 `android.util.Log`
<h3 class="deprecated">XPOSEDBRIDGE - enum</h3>
**Change Records**
`v1.1.0` `added`
`v1.1.5` `deprecated`
请转移到 `XPOSED_ENVIRONMENT`
### XPOSED_ENVIRONMENT <span class="symbol">- enum</span>
```kotlin:no-line-numbers
@@ -68,7 +426,7 @@ XPOSED_ENVIRONMENT
**Change Records**
`v1.1.5` `added`
`v1.2.0` `added`
**Function Illustrate**
@@ -88,7 +446,7 @@ SCOPE
**Change Records**
`v1.1.0` `added`
`v1.2.0` `added`
**Function Illustrate**
@@ -106,7 +464,7 @@ BOTH
**Change Records**
`v1.1.0` `added`
`v1.2.0` `added`
**Function Illustrate**
@@ -116,433 +474,12 @@ BOTH
模块环境仅使用 `LOGD`
## YukiLoggerData <span class="symbol">- class</span>
```kotlin:no-line-numbers
data class YukiLoggerData internal constructor(
var timestamp: Long,
var time: String,
var tag: String,
var priority: String,
var packageName: String,
var userId: Int,
var msg: String,
var throwable: Throwable?
) : Serializable
```
**Change Records**
`v1.1.2` `added`
`v1.1.4` `modified`
实现 `Serializable` 接口并标识为 `data class`
**Function Illustrate**
> 调试日志数据实现类。
## YukiHookLogger <span class="symbol">- object</span>
```kotlin:no-line-numbers
object YukiHookLogger
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 调试日志实现类。
### inMemoryData <span class="symbol">- field</span>
```kotlin:no-line-numbers
val inMemoryData: ArrayList<YukiLoggerData>
```
**Change Records**
`v1.1.2` `added`
`v1.1.4` `modified`
类型由 `HashSet` 修改为 `ArrayList`
**Function Illustrate**
> 当前全部已记录的日志数据。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
### contents <span class="symbol">- field</span>
```kotlin:no-line-numbers
val contents: String
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 获取当前日志文件内容。
如果当前没有已记录的日志会返回空字符串。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
### contents <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun contents(data: ArrayList<YukiLoggerData>): String
```
**Change Records**
`v1.1.5` `added`
**Function Illustrate**
> 获取、格式化当前日志文件内容。
如果当前没有已记录的日志 (`data` 为空) 会返回空字符串。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
### clear <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun clear()
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 清除全部已记录的日志。
::: danger
获取到的日志数据在 Hook APP (宿主) 及模块进程中是相互隔离的。
:::
你也可以直接获取 [inMemoryData](#inmemorydata-field) 来清除。
### saveToFile <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun saveToFile(fileName: String, data: ArrayList<YukiLoggerData>)
```
**Change Records**
`v1.1.0` `added`
`v1.1.5` `modified`
新增 `data` 参数
**Function Illustrate**
> 保存当前日志到文件。
若当前未开启 `Configs.isRecord` 或记录为空则不会进行任何操作。
日志文件会追加到 `fileName` 的文件结尾,若文件不存在会自动创建。
::: danger
文件读写权限取决于当前宿主、模块已获取的权限。
:::
### Configs <span class="symbol">- object</span>
```kotlin:no-line-numbers
object Configs
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 配置 `YukiHookLogger`
#### TAG <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val TAG: Int
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 标签。
#### PRIORITY <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val PRIORITY: Int
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 优先级。
#### PACKAGE_NAME <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val PACKAGE_NAME: Int
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 当前宿主的包名。
#### USER_ID <span class="symbol">- field</span>
```kotlin:no-line-numbers
const val USER_ID: Int
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 当前宿主的用户 ID (主用户不显示)。
#### isEnable <span class="symbol">- field</span>
```kotlin:no-line-numbers
var isEnable: Boolean
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 是否启用调试日志的输出功能。
关闭后将会停用 `YukiHookAPI` 对全部日志的输出。
但是不影响当你手动调用下面这些方法输出日志。
`loggerD``loggerI``loggerW``loggerE`
`isEnable` 关闭后 `YukiHookAPI.Configs.isDebug` 也将同时关闭。
#### isRecord <span class="symbol">- field</span>
```kotlin:no-line-numbers
var isRecord: Boolean
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 是否启用调试日志的记录功能。
开启后将会在内存中记录全部可用的日志和异常堆栈。
需要同时启用 [isEnable](#isenable-field) 才能有效。
::: danger
过量的日志可能会导致宿主运行缓慢或造成频繁 GC。
:::
开启后你可以调用 [YukiHookLogger.saveToFile](#savetofile-method) 实时保存日志到文件或使用 [YukiHookLogger.contents](#contents-field) 获取实时日志文件。
#### tag <span class="symbol">- field</span>
```kotlin:no-line-numbers
var tag: String
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 这是一个调试日志的全局标识。
默认文案为 `YukiHookAPI`
你可以修改为你自己的文案。
#### elements <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun elements(vararg item: Int)
```
**Change Records**
`v1.1.0` `added`
**Function Illustrate**
> 自定义调试日志对外显示的元素。
只对日志记录和 (Xposed) 宿主环境的日志生效。
日志元素的排列将按照你在 `item` 中设置的顺序进行显示。
你还可以留空 `item` 以不显示除日志内容外的全部元素。
可用的元素有:`TAG``PRIORITY``PACKAGE_NAME``USER_ID`
**Function Example**
打印的日志样式将按照你设置的排列顺序和元素内容进行。
> The following example
```kotlin
elements(TAG, PRIORITY, PACKAGE_NAME, USER_ID)
```
以上内容定义的日志将显示为如下样式。
> The following example
```:no-line-numbers
[YukiHookAPI][D][com.demo.test][999]--> This is a log
```
如果我们调整元素顺序以及减少个数,那么结果又会不一样。
> The following example
```kotlin
elements(PACKAGE_NAME, USER_ID, PRIORITY)
```
以上内容定义的日志将显示为如下样式。
> The following example
```:no-line-numbers
[com.demo.test][999][D]--> This is a log
```
## loggerD <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun loggerD(tag: String, msg: String, type: LoggerType)
```
<h1 class="deprecated">LoggerFactory - kt</h1>
**Change Records**
`v1.0` `first`
`v1.1.0` `modified`
`v1.2.0` `deprecated`
新增 `type` 参数
**Function Illustrate**
> 向 `Logcat` 和 (Xposed) 宿主环境打印日志,级别 `D`
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
## loggerI <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun loggerI(tag: String, msg: String, type: LoggerType)
```
**Change Records**
`v1.0` `first`
`v1.1.0` `modified`
新增 `type` 参数
**Function Illustrate**
> 向 `Logcat` 和 (Xposed) 宿主环境打印日志,级别 `I`
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
## loggerW <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun loggerW(tag: String, msg: String, type: LoggerType)
```
**Change Records**
`v1.0` `first`
`v1.1.0` `modified`
新增 `type` 参数
**Function Illustrate**
> 向 `Logcat` 和 (Xposed) 宿主环境打印日志,级别 `W`
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
## loggerE <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun loggerE(tag: String, msg: String, e: Throwable?, type: LoggerType)
```
**Change Records**
`v1.0` `first`
`v1.1.0` `modified`
新增 `type` 参数
**Function Illustrate**
> 向 `Logcat` 和 (Xposed) 宿主环境打印日志,级别 `E`,可携带 `e` 异常信息,将打印异常堆栈。
`tag` 的默认参数为 `YukiHookAPI.Configs.debugTag`,你可以进行自定义。
请迁移到 `YLog`

View File

@@ -0,0 +1,40 @@
---
pageClass: code-page
---
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
:::
# YLogData <span class="symbol">- class</span>
```kotlin:no-line-numbers
data class YLogData internal constructor(
var timestamp: Long,
var time: String,
var tag: String,
var priority: String,
var packageName: String,
var userId: Int,
var msg: String,
var throwable: Throwable?
) : Serializable
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 调试日志数据实现类。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -13,7 +19,7 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
# HookParam <span class="symbol">- class</span>
```kotlin:no-line-numbers
class HookParam internal constructor(
class HookParam private constructor(
private val creatorInstance: YukiMemberHookCreator,
private var paramId: String,
private var param: YukiHookCallback.Param?
@@ -34,6 +40,10 @@ class HookParam internal constructor(
新增 `paramId` 参数
`v1.2.0` `modified`
不再开放构造方法
**Function Illustrate**
> Hook 方法、构造方法的目标对象实现类。
@@ -119,17 +129,27 @@ val instanceOrNull: Any?
## instanceClass <span class="symbol">- field</span>
```kotlin:no-line-numbers
val instanceClass: Class<*>
val instanceClass: Class<*>?
```
**Change Records**
`v1.0` `first`
`v1.2.0` `modified`
加入可空类型 (空安全)
**Function Illustrate**
> 获取当前 Hook 实例的类对象。
::: danger
如果你当前 Hook 的对象是一个静态,那么它将不存在实例的对象。
:::
## member <span class="symbol">- field</span>
```kotlin:no-line-numbers
@@ -248,7 +268,7 @@ fun Throwable.throwToApp()
使用 `throwable` 获取当前设置的方法调用抛出异常。
仅会在回调方法的 `MemberHookCreator.beforeHook` 或 `MemberHookCreator.afterHook` 中生效。
仅会在回调方法的 `MemberHookCreator.before` 或 `MemberHookCreator.after` 中生效。
::: danger
@@ -265,11 +285,8 @@ Hook 过程中的异常仅会作用于 (Xposed) 宿主环境,目标 Hook APP
> The following example
```kotlin
injectMember {
method {
// ...
}
beforeHook {
hook {
before {
RuntimeException("Test Exception").throwToApp()
}
}
@@ -479,20 +496,19 @@ fun <T> callOriginal(): T?
此方法可以 `invoke` 原始未经 Hook 的 `Member` 对象,取决于原始 `Member` 的参数。
调用自身原始的方法不会再经过当前 `beforeHook`、`afterHook` 以及 `replaceUnit`、`replaceAny`。
调用自身原始的方法不会再经过当前 `before`、`after` 以及 `replaceUnit`、`replaceAny`。
比如我们 Hook 的这个方法被这样调用 `test("test value")`,使用此方法会调用其中的 `"test value"` 作为参数。
> The following example
```kotlin
injectMember {
method {
name = "test"
param(StringClass)
returnType = StringClass
}
afterHook {
method {
name = "test"
param(StringClass)
returnType = StringClass
}.hook {
after {
// <方案1> 不使用泛型,不获取方法执行结果,调用将使用原方法传入的 args 自动传参
callOriginal()
// <方案2> 使用泛型,已知方法执行结果参数类型进行 cast
@@ -530,20 +546,19 @@ fun <T> invokeOriginal(vararg args: Any?): T?
此方法可以 `invoke` 原始未经 Hook 的 `Member` 对象,可自定义需要调用的参数内容。
调用自身原始的方法不会再经过当前 `beforeHook`、`afterHook` 以及 `replaceUnit`、`replaceAny`。
调用自身原始的方法不会再经过当前 `before`、`after` 以及 `replaceUnit`、`replaceAny`。
比如我们 Hook 的这个方法被这样调用 `test("test value")`,使用此方法可自定义其中的 `args` 作为参数。
> The following example
```kotlin
injectMember {
method {
name = "test"
param(StringClass)
returnType = StringClass
}
afterHook {
method {
name = "test"
param(StringClass)
returnType = StringClass
}.hook {
after {
// <方案1> 不使用泛型,不获取方法执行结果
invokeOriginal("test value")
// <方案2> 使用泛型,已知方法执行结果参数类型进行 cast假设返回值为 String失败会返回 null

View File

@@ -4,12 +4,22 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
:::
---
pageClass: code-page
---
# PackageParam <span class="symbol">- class</span>
```kotlin:no-line-numbers
@@ -27,7 +37,7 @@ open class PackageParam internal constructor(internal var wrapper: PackageParamW
## appClassLoader <span class="symbol">- field</span>
```kotlin:no-line-numbers
var appClassLoaderClassLoader
var appClassLoaderClassLoader?
```
**Change Records**
@@ -38,6 +48,10 @@ var appClassLoaderClassLoader
可以动态修改此变量的值
`v1.2.0` `modified`
加入可空类型 (空安全)
**Function Illustrate**
> 获取、设置当前 Hook APP 的 `ClassLoader`。
@@ -412,7 +426,7 @@ fun loadApp(isExcludeSelf: Boolean, vararg hooker: YukiBaseHooker)
> 装载并 Hook 指定、全部包名的 APP。
`name` 为 APP 的包名,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
`name` 为 APP 的包名,后方的两个参数一个可作为 **lambda** 方法体使用,一个可以直接装载子 Hooker。
装载并 Hook 指定、全部包名的 APP。
@@ -422,7 +436,7 @@ fun loadApp(isExcludeSelf: Boolean, vararg hooker: YukiBaseHooker)
**Function Example**
你可以使用 `loadApp` 的 `lambda` 方法体形式或直接装载一个 Hooker。
你可以使用 `loadApp` 的 **lambda** 方法体形式或直接装载一个 Hooker。
> The following example
@@ -450,7 +464,7 @@ loadApp(hooker = CustomHooker)
若要在全部可被 Hook 的 APP 中过滤掉模块自身,你只需加入 `isExcludeSelf = true`。
> 示例如下
> The following example
```kotlin
// 使用 lambda
@@ -507,7 +521,7 @@ fun loadZygote(vararg hooker: YukiBaseHooker)
> 装载 APP Zygote 事件。
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
方法中的两个参数一个可作为 **lambda** 方法体使用,一个可以直接装载子 Hooker。
## loadSystem <span class="symbol">- method</span>
@@ -535,7 +549,7 @@ fun loadSystem(vararg hooker: YukiBaseHooker)
> 装载并 Hook 系统框架。
方法中的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
方法中的两个参数一个可作为 **lambda** 方法体使用,一个可以直接装载子 Hooker。
## withProcess <span class="symbol">- method</span>
@@ -567,7 +581,7 @@ fun withProcess(name: String, vararg hooker: YukiBaseHooker)
> 装载并 Hook APP 的指定进程。
`name` 为 APP 的进程名称,后方的两个参数一个可作为 `lambda` 方法体使用,一个可以直接装载子 Hooker。
`name` 为 APP 的进程名称,后方的两个参数一个可作为 **lambda** 方法体使用,一个可以直接装载子 Hooker。
## loadHooker <span class="symbol">- method</span>
@@ -605,7 +619,7 @@ inline fun searchClass(name: String, async: Boolean, initiate: ClassConditions):
建议启用 **async** 或设置 **name** 参数,**name** 参数将在 Hook APP (宿主) 不同版本中自动进行本地缓存以提升效率。
此功能尚在验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
此功能尚在验阶段,性能与稳定性可能仍然存在问题,使用过程遇到问题请向我们报告并帮助我们改进。
:::
@@ -617,7 +631,7 @@ inline fun searchClass(name: String, async: Boolean, initiate: ClassConditions):
`v1.1.0` `deprecated`
移到 `toClass(...)` 方法
移到 `toClass(...)` 方法
<h2 class="deprecated">String.hasClass - i-ext-field</h2>
@@ -627,7 +641,7 @@ inline fun searchClass(name: String, async: Boolean, initiate: ClassConditions):
`v1.1.0` `deprecated`
移到 `hasClass(...)` 方法
移到 `hasClass(...)` 方法
## String+VariousClass.toClass <span class="symbol">- i-ext-method</span>
@@ -768,6 +782,50 @@ fun VariousClass.toClassOrNull(loader: ClassLoader?, initialize: Boolean): Class
用法请参考 [String+VariousClass.toClass](#string-variousclass-toclass-i-ext-method) 方法。
## lazyClass <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun lazyClass(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.NonNull<Any>
```
```kotlin:no-line-numbers
inline fun <reified T> lazyClass(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.NonNull<T>
```
```kotlin:no-line-numbers
fun lazyClass(variousClass: VariousClass, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.NonNull<Any>
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 懒装载 `Class`。
## lazyClassOrNull <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun lazyClassOrNull(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.Nullable<Any>
```
```kotlin:no-line-numbers
inline fun <reified T> lazyClassOrNull(name: String, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.Nullable<T>
```
```kotlin:no-line-numbers
fun lazyClassOrNull(variousClass: VariousClass, initialize: Boolean, loader: ClassLoaderInitializer?): LazyClass.Nullable<Any>
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 懒装载 `Class`。
## String.hasClass <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
@@ -807,15 +865,7 @@ if("com.example.demo.DemoClass".hasClass(customClassLoader)) {
}
```
## findClass <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun findClass(name: String, loader: ClassLoader?): HookClass
```
```kotlin:no-line-numbers
fun findClass(vararg name: String, loader: ClassLoader?): VariousClass
```
<h2 class="deprecated">findClass - method</h2>
**Change Records**
@@ -829,67 +879,11 @@ fun findClass(vararg name: String, loader: ClassLoader?): VariousClass
新增 `loader` 参数
**Function Illustrate**
`v1.2.0` `deprecated`
> 通过完整包名+名称查找需要被 Hook 的 `Class`
请直接使用 `String.toClass(...)` 或 `VariousClass(...)`
::: warning
使用此方法会得到一个 **HookClass** 仅用于 Hook若想查找 **Class** 请使用 [toClass](#string-variousclass-toclass-i-ext-method) 功能。
:::
**Function Example**
你可以使用三种方式查找你需要 Hook 的目标 `Class`。
你可以直接将被查找的 `Class` 完整包名+名称填入 `name` 中。
> The following example
```kotlin
findClass(name = "com.example.demo.DemoClass")
```
若你不确定多个版本的 `Class` 以及不同名称,你可以将多个完整包名+名称填入 `name` 中。
> The following example
```kotlin
findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2", "com.example.demo.DemoClass3")
```
你还可以创建一个 `VariousClass`,将 `Class` 的完整包名+名称填入 `VariousClass` 的 `name` 中并填入 `various` 参数中。
> The following example
```kotlin
val variousClass = VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2", "com.example.demo.DemoClass3")
```
若你当前需要查找的 `Class` 不属于 `appClassLoader`,你可以使用 `loader` 参数指定你要装载的 `ClassLoader`。
> The following example
```kotlin
val outsideLoader: ClassLoader? = ... // 假设这就是你的 ClassLoader
findClass(name = "com.example.demo.OutsideClass", loader = outsideLoader)
```
同样地,在不确定多个版本的 `Class` 以及不同名称时,也可以使用 `loader` 参数指定你要装载的 `ClassLoader`。
> The following example
```kotlin
val outsideLoader: ClassLoader? = ... // 假设这就是你的 ClassLoader
findClass("com.example.demo.OutsideClass1", "com.example.demo.OutsideClass2", "com.example.demo.OutsideClass3", loader = outsideLoader)
```
## String+Class+VariousClass+HookClass.hook <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun String.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result
```
## Class+VariousClass+HookClass.hook <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun Class<*>.hook(isForceUseAbsolute: Boolean, initiate: YukiMemberHookCreator.() -> Unit): YukiMemberHookCreator.Result
@@ -933,76 +927,86 @@ inline fun HookClass.hook(initiate: YukiMemberHookCreator.() -> Unit): YukiMembe
添加了 `isForceUseAbsolute` 参数到 `Class.hook` 方法
`v1.2.0` `modified`
作废了 ~~`String.hook`~~ 方法
**Function Illustrate**
> 这是一切 Hook 的入口创建方法,Hook 方法、构造方法。
> Hook 方法、构造方法。
**Function Example**
## Member+BaseFinder.BaseResult.hook <span class="symbol">- i-ext-method</span>
如你所见Hook 方法体的创建可使用 4 种方式。
通过字符串类名得到 `HookClass` 实例进行创建。
> The following example
```kotlin
"com.example.demo.DemoClass".hook {
// Your code here.
}
```
通过 `findClass` 得到 `HookClass` 实例进行创建。
> The following example
```kotlin
findClass(name = "com.example.demo.DemoClass").hook {
// Your code here.
}
```kotlin:no-line-numbers
inline fun Member.hook(priority: YukiHookPriority): YukiMemberHookCreator.MemberHookCreator
```
使用 `stub` 或直接拿到 `Class` 实例进行创建。
默认情况下 API 会将 `Class` 实例转换为类名并绑定到 `appClassLoader`,若失败,则会使用原始 `Class` 实例直接进行 Hook。
> The following example
```kotlin
Stub::class.java.hook {
// Your code here.
}
```kotlin:no-line-numbers
inline fun Member.hook(priority: YukiHookPriority, initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit): YukiMemberHookCreator.MemberHookCreator.Result
```
若当前 `Class` 不在 `appClassLoader` 且自动匹配无法找到该 `Class`,请启用 `isForceUseAbsolute`。
> The following example
```kotlin
YourClass::class.java.hook(isForceUseAbsolute = true) {
// Your code here.
}
```kotlin:no-line-numbers
inline fun BaseFinder.BaseResult.hook(priority: YukiHookPriority): YukiMemberHookCreator.MemberHookCreator
```
使用 `VariousClass` 实例进行创建。
> The following example
```kotlin
VariousClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook {
// Your code here.
}
```kotlin:no-line-numbers
inline fun BaseFinder.BaseResult.hook(priority: YukiHookPriority, initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit): YukiMemberHookCreator.MemberHookCreator.Result
```
或者直接使用可变字符串数组进行创建。
**Change Records**
> The following example
`v1.2.0` `added`
```kotlin
findClass("com.example.demo.DemoClass1", "com.example.demo.DemoClass2").hook {
// Your code here.
}
**Function Illustrate**
> 直接 Hook 方法、构造方法。
::: warning
此功能尚在实验阶段,在 **1.x.x** 版本将暂定于此,在 **2.0.0** 版本将完全合并到新 API。
:::
## Array&lt;Member&gt;+List&lt;Member&gt;+BaseFinder.BaseResult.hookAll <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
inline fun Array<Member>.hookAll(priority: YukiHookPriority): YukiMemberHookCreator.MemberHookCreator
```
```kotlin:no-line-numbers
inline fun Array<Member>.hookAll(priority: YukiHookPriority, initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit): YukiMemberHookCreator.MemberHookCreator.Result
```
```kotlin:no-line-numbers
inline fun List<Member>.hookAll(priority: YukiHookPriority): YukiMemberHookCreator.MemberHookCreator
```
```kotlin:no-line-numbers
inline fun List<Member>.hookAll(priority: YukiHookPriority, initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit): YukiMemberHookCreator.MemberHookCreator.Result
```
```kotlin:no-line-numbers
inline fun BaseFinder.BaseResult.hookAll(priority: YukiHookPriority): YukiMemberHookCreator.MemberHookCreator
```
```kotlin:no-line-numbers
inline fun BaseFinder.BaseResult.hookAll(priority: YukiHookPriority, initiate: YukiMemberHookCreator.MemberHookCreator.() -> Unit): YukiMemberHookCreator.MemberHookCreator.Result
```
**Change Records**
`v1.2.0` `added`
**Function Illustrate**
> 直接 Hook 方法、构造方法 (批量)。
::: warning
此功能尚在实验阶段,在 **1.x.x** 版本将暂定于此,在 **2.0.0** 版本将完全合并到新 API。
:::
## HookResources.hook <span class="symbol">- i-ext-method</span>
```kotlin:no-line-numbers
@@ -1019,7 +1023,7 @@ inline fun HookResources.hook(initiate: YukiResourcesHookCreator.() -> Unit)
::: danger
请注意你需要确保当前 Hook Framework 支持且 **InjectYukiHookWithXposed.isUsingResourcesHook** 已启用
此功能将不再默认启用,如需启用,请手动设置 **InjectYukiHookWithXposed.isUsingResourcesHook**。
:::
@@ -1041,7 +1045,7 @@ resources().hook {
:::
将 Resources 的 Hook 设置为这样是为了与 `findClass(...).hook` 做到统一,使得调用起来逻辑不会混乱。
将 Resources 的 Hook 设置为这样是为了与 `String.toClass(...).hook` 做到统一,使得调用起来逻辑不会混乱。
## AppLifecycle <span class="symbol">- class</span>

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -20,4 +26,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
> 这是一个预置反射类型的常量类,主要为 `Android` 相关组件的 `Class` 内容,跟随版本更新会逐一进行增加。
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。
详情可 [点击这里](https://github.com/HighCapable/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ComponentTypeFactory.kt) 进行查看。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -20,4 +26,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Graphics` 的 `Class` 内容,跟随版本更新会逐一进行增加。
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。
详情可 [点击这里](https://github.com/HighCapable/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/GraphicsTypeFactory.kt) 进行查看。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -20,4 +26,4 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
> 这是一个预置反射类型的常量类,主要为 `Android` 相关 `Widget` 的 `Class` 内容,跟随版本更新会逐一进行增加。
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。
详情可 [点击这里](https://github.com/HighCapable/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/android/ViewTypeFactory.kt) 进行查看。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -18,6 +24,6 @@ You can use the **Chrome Translation Plugin** to translate entire pages for refe
**Function Illustrate**
> 这是一个预置反射类型的常量类,主要为 `Java` 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
> 这是一个预置反射类型的常量类,主要为 Java 相关基本变量类型的 `Class` 内容,跟随版本更新会逐一进行增加。
详情可 [点击这里](https://github.com/fankes/YukiHookAPI/blob/master/yukihookapi/src/api/kotlin/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。
详情可 [点击这里](https://github.com/HighCapable/YukiHookAPI/blob/master/yukihookapi-core/src/main/java/com/highcapable/yukihookapi/hook/type/java/VariableTypeFactory.kt) 进行查看。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -27,7 +33,7 @@ class YukiResources private constructor(private val baseInstance: XResources) :
## LayoutInflatedParam <span class="symbol">- class</span>
```kotlin:no-line-numbers
class LayoutInflatedParam(internal val baseParam: XC_LayoutInflated.LayoutInflatedParam)
class LayoutInflatedParam(private val baseParam: XC_LayoutInflated.LayoutInflatedParam)
```
**Change Records**

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -142,7 +148,7 @@ fun allowSendTooLargeData(): NameSpace
仅会在每次调用时生效,下一次没有调用此方法则此功能将被自动关闭。
你还需要在整个调用域中声明注解 `CauseProblemsApi` 以消除警告。
你还需要在整个调用域中声明注解 `SendTooLargeChannelData` 以消除警告。
::: danger
@@ -259,7 +265,7 @@ fun checkingVersionEquals(priority: ChannelPriority?, result: (Boolean) -> Unit)
### obtainLoggerInMemoryData <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun obtainLoggerInMemoryData(priority: ChannelPriority?, result: (ArrayList<YukiLoggerData>) -> Unit)
fun obtainLoggerInMemoryData(priority: ChannelPriority?, result: (List<YLogData>) -> Unit)
```
**Change Records**
@@ -272,13 +278,13 @@ fun obtainLoggerInMemoryData(priority: ChannelPriority?, result: (ArrayList<Yuki
**Function Illustrate**
> 获取模块与宿主之间的 `ArrayList<YukiLoggerData>` 数据。
> 获取模块与宿主之间的 `List<YLogData>` 数据。
由于模块与宿主处于不同的进程,我们可以使用数据通讯桥访问各自的调试日志数据。
::: danger
模块与宿主必须启用 [YukiHookLogger.Configs.isRecord](../../log/LoggerFactory#isrecord-field) 才能获取到调试日志数据。
模块与宿主必须启用 [YLog.Configs.isRecord](../../log/YLog#isrecord-field) 才能获取到调试日志数据。
由于 Android 限制了数据传输大小的最大值,如果调试日志过多将会自动进行分段发送,数据越大速度越慢。

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -70,7 +76,7 @@ class YukiHookPrefsBridge private constructor(private var context: Context?)
`v1.1.5` `deprecated`
移到 `isPreferencesAvailable`
移到 `isPreferencesAvailable`
<h2 class="deprecated">isRunInNewXShareMode - field</h2>
@@ -80,7 +86,7 @@ class YukiHookPrefsBridge private constructor(private var context: Context?)
`v1.1.5` `deprecated`
移到 `isPreferencesAvailable`
移到 `isPreferencesAvailable`
## isPreferencesAvailable <span class="symbol">- field</span>
@@ -132,23 +138,15 @@ prefs("custom_name").getString("custom_key")
prefs("custom_name").getString("custom_key")
```
## direct <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun direct(): YukiHookPrefsBridge
```
<h2 class="deprecated">direct - method</h2>
**Change Records**
`v1.0.5` `added`
**Function Illustrate**
`v1.1.11` `deprecated`
> 忽略缓存直接读取键值。
无论是否开启 `YukiHookAPI.Configs.isEnablePrefsBridgeCache`。
仅在 `XSharedPreferences` 下生效。
键值的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
## native <span class="symbol">- method</span>
@@ -267,7 +265,7 @@ fun contains(key: String): Boolean
## all <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun all(): HashMap<String, Any?>
fun all(): MutableMap<String, Any?>
```
**Change Records**
@@ -294,7 +292,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">clear - method</h2>
@@ -304,7 +302,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">putString - method</h2>
@@ -314,7 +312,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">putStringSet - method</h2>
@@ -324,7 +322,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">putBoolean - method</h2>
@@ -334,7 +332,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">putInt - method</h2>
@@ -344,7 +342,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">putLong - method</h2>
@@ -354,7 +352,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
<h2 class="deprecated">putFloat - method</h2>
@@ -364,7 +362,7 @@ fun all(): HashMap<String, Any?>
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
## get <span class="symbol">- method</span>
@@ -388,7 +386,7 @@ inline fun <reified T> get(prefs: PrefsData<T>, value: T): T
`v1.1.9` `deprecated`
移到 `edit` 方法
移到 `edit` 方法
## edit <span class="symbol">- method</span>
@@ -436,23 +434,15 @@ fun edit(initiate: Editor.() -> Unit)
:::
## clearCache <span class="symbol">- method</span>
```kotlin:no-line-numbers
fun clearCache()
```
<h2 class="deprecated">clearCache - method</h2>
**Change Records**
`v1.0.5` `added`
**Function Illustrate**
`v1.1.11` `deprecated`
> 清除 `YukiHookPrefsBridge` 中缓存的键值数据。
无论是否开启 `YukiHookAPI.Configs.isEnablePrefsBridgeCache`。
调用此方法将清除当前存储的全部键值缓存。
键值的直接缓存功能已被移除,因为其存在内存溢出 (OOM) 问题
## Editor <span class="symbol">- class</span>

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.

View File

@@ -4,6 +4,12 @@ pageClass: code-page
::: warning
Due to maintenance costs, the `YukiHookAPI` will no longer update this document from version `1.3.0` and switch to the API document automatically generated by the Dokka plugin in version `2.0.0`.
:::
::: warning
The English translation of this page has not been completed, you are welcome to contribute translations to us.
You can use the **Chrome Translation Plugin** to translate entire pages for reference.
@@ -24,7 +30,7 @@ interface IYukiHookXposedInit
作废了 ~~`YukiHookXposedInitProxy`~~ 名称但保留接口
移到 `IYukiHookXposedInit` 新名称
移到 `IYukiHookXposedInit` 新名称
**Function Illustrate**
@@ -106,4 +112,4 @@ fun onXposedEvent()
`v1.0.80` `deprecated`
移到 `IYukiHookXposedInit`
移到 `IYukiHookXposedInit`

View File

@@ -4,24 +4,26 @@
Before using the following functions, in order to prevent Resource Id from conflicting with each other, you need to modify the Resource Id in the `build.gradle` of the current Xposed Module project.
- Kotlin Gradle DSL
> Kotlin DSL
```kotlin
android {
androidResources.additionalParameters("--allow-reserved-package-id", "--package-id", "0x64")
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x64")
}
```
- Groovy
> Groovy DSL
```groovy
android {
aaptOptions.additionalParameters '--allow-reserved-package-id', '--package-id', '0x64'
androidResources.additionalParameters += ['--allow-reserved-package-id', '--package-id', '0x64']
}
```
::: warning
**aaptOptions.additionalParameters** in previous versions has been deprecated, please refer to the above writing method and keep your **Android Gradle Plugin** to the latest version.
The sample Resource Id value provided is for reference only, **0x7f** cannot be used, the default is **0x64**.
In order to prevent the existence of multiple Xposed Modules in the current Host App, it is recommended to customize your own Resource Id.
@@ -35,12 +37,11 @@ After the Host App is hooked, we can directly inject the `Context` obtained in t
> The following example
```kotlin
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook {
resolve().firstMethod {
name = "onCreate"
parameters(Bundle::class)
}.hook {
after {
instance<Activity>().also {
// <Scenario 1> Inject Module App's Resources through Context
it.injectModuleAppResources()
@@ -89,12 +90,11 @@ After the Host App is hooked, we can directly register the `Activity` proxy of t
> The following example
```kotlin
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook {
resolve().firstMethod {
name = "onCreate"
parameters(Bundle::class)
}.hook {
after {
instance<Activity>().registerModuleAppActivities()
}
}
@@ -146,34 +146,45 @@ Alternatively, if you write a `stub` for the Host App's class, you can register
registerModuleAppActivities(TestActivity::class.java)
```
After the registration is complete, extends the `Activity` in the Module App you need to use the Host App to start by `ModuleAppActivity` or `ModuleAppCompatActivity`.
After registration is completed, please implement the `ModuleActivity` interface using the `Activity` module in the host-started module.
These `Activity` now live seamlessly in the Host App without registration.
These `Activity` (ies) now live seamlessly in the host without registration.
We recommend that you create `BaseActivity` as the base class for all modules `Activity`.
> The following example
```kotlin
class HostTestActivity : ModuleAppActivity() {
abstract class BaseActivity : AppCompatActivity(), ModuleActivity {
// Set up AppCompat Theme (if currently is [AppCompatActivity])
override val moduleTheme get() = R.style.YourAppTheme
override fun getClassLoader() = delegate.getClassLoader()
override fun onCreate(savedInstanceState: Bundle?) {
delegate.onCreate(savedInstanceState)
super.onCreate(savedInstanceState)
// Module App's Resources have been injected automatically
// You can directly use xml to load the layout
setContentView(R.layout.activity_main)
}
override fun onConfigurationChanged(newConfig: Configuration) {
delegate.onConfigurationChanged(newConfig)
super.onConfigurationChanged(newConfig)
}
override fun onRestoreInstanceState(savedInstanceState: Bundle) {
delegate.onRestoreInstanceState(savedInstanceState)
super.onRestoreInstanceState(savedInstanceState)
}
}
```
If you need to extends `ModuleAppCompatActivity`, you need to set the AppCompat theme manually.
Then inherit the `Activity` you want to implement in `BaseActivity`.
> The following example
```kotlin
class HostTestActivity : ModuleAppCompatActivity() {
// The theme name here is for reference only
// Please fill in the theme name already in your Module App
override val moduleTheme get() = R.style.Theme_AppCompat
class HostTestActivity : BaseActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -200,7 +211,7 @@ If you need to specify a delegated `Activity` to use another Host App's `Activit
> The following example
```kotlin
class HostTestActivity : ModuleAppActivity() {
class HostTestActivity : BaseActivity() {
// Specify an additional proxy Activity class name
// Which must also exist in the Host App's AndroidManifest
@@ -210,7 +221,7 @@ class HostTestActivity : ModuleAppActivity() {
super.onCreate(savedInstanceState)
// Module App's Resources have been injected automatically
// You can directly use xml to load the layout
setContentView(R. layout. activity_main)
setContentView(R.layout.activity_main)
}
}
```
@@ -236,12 +247,11 @@ At this time, we want to use `MaterialAlertDialogBuilder` to create a dialog in
> The following example
```kotlin
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook {
resolve().firstMethod {
name = "onCreate"
parameters(Bundle::class)
}.hook {
after {
// Use applyModuleTheme to create a theme resource in the current Module App
val appCompatContext = instance<Activity>().applyModuleTheme(R.style.Theme_AppCompat)
// Directly use this Context that wraps the Module App's theme to create a dialog
@@ -261,12 +271,11 @@ Which requires at least Android 10 and above system version support and the curr
> The following example
```kotlin
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook {
resolve().firstMethod {
name = "onCreate"
parameters(Bundle::class)
}.hook {
after {
// Define the theme resource in the current Module App
var appCompatContext: ModuleContextThemeWrapper
// <Scenario 1> Get the Configuration object directly to set
@@ -296,7 +305,7 @@ This way, we can create dialogs in the Host App very simply using `MaterialAlert
Because some **androidx** dependent libraries or custom themes used by some apps may interfere with the actual style of the current **MaterialAlertDialog**, such as the button style of the dialog.
You can refer to the **Module App Demo** in this case and see [here is the sample code](https://github.com/fankes/YukiHookAPI/tree/master/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt) to fix this problem.
You can refer to the **Module App Demo** in this case and see [here is the sample code](https://github.com/HighCapable/YukiHookAPI/tree/master/samples/demo-module/src/main/java/com/highcapable/yukihookapi/demo_module/hook/factory/ComponentCompatFactory.kt) to fix this problem.
**ClassCastException** may occur when some apps are created, please manually specify a new **Configuration** instance to fix.
@@ -325,7 +334,7 @@ The exclusion list determines whether these `Class` need to be loaded by the Mod
```kotlin
// Exclude Class names belonging to the Host App
// They will be loaded by the Host App's ClassLoader
// The following content is for demonstration only
// The following content is for demonstration only
// DO NOT USE IT DIRECTLY, please refer to your actual situation
ModuleClassLoader.excludeHostClasses(
"androidx.core.app.ActivityCompat",
@@ -333,7 +342,7 @@ ModuleClassLoader.excludeHostClasses(
)
// Exclude Class names belonging to the Module App
// They will be loaded by the ClassLoader of the Module App (the current Hook process)
// The following content is for demonstration only
// The following content is for demonstration only
// DO NOT USE IT DIRECTLY, please refer to your actual situation
ModuleClassLoader.excludeModuleClasses(
"com.demo.entry.HookEntry",

View File

@@ -2,28 +2,37 @@
> Log is the most important part of the debugging process, `YukiHookAPI` encapsulates a set of stable and efficient debugging log functions for developers.
::: tip
The logs of `KavaRef` can be managed separately by itself. For detailed configuration plans,
you can refer to [here](https://highcapable.github.io/KavaRef/en/library/kavaref-core#log-management), which will jump to the `KavaRef` document.
`YukiHookAPI` has taken over the logging function of `KavaRef` by default, and you can also configure the logging function of `KavaRef` yourself.
:::
## Normal Logs
You can call `loggerD`, `loggerI`, `loggerW` to print normal logs to the console.
You can call `YLog.debug`, `YLog.info`, `YLog.warn` to print normal logs to the console.
The usage method is as follows.
> The following example
```kotlin
loggerD(msg = "This is a log")
YLog.debug(msg = "This is a log")
```
At this ponit, `YukiHookAPI` will call `android.util.Log` and log function in (Xposed) Host environment to print this log at the same time.
The default `TAG` of the log is the value you set in `YukiHookLogger.Configs.tag`.
The default `TAG` of the log is the value you set in `YLog.Configs.tag`.
You can also customize this value dynamically, but it is not recommended to modify `TAG` easily to prevent logs from being filtered.
> The following example
```kotlin
loggerD(tag = "YukiHookAPI", msg = "This is a log")
YLog.debug(tag = "YukiHookAPI", msg = "This is a log")
```
The printed result is as shown below.
@@ -31,21 +40,21 @@ The printed result is as shown below.
> The following example
```:no-line-numbers
[YukiHookAPI][D][host package name]--> This is a log
[YukiHookAPI][D][host package name] This is a log
```
You can also use `LoggerType` to customize the type of log printing.
You can also use `YLog.EnvType` to customize the type of log printing.
You can choose to use `android.util.Log` or the log function in the (Xposed) Host environment to print logs.
The default type is `LoggerType.BOTH`, which means that both methods are used to print logs.
The default type is `YLog.EnvType.BOTH`, which means that both methods are used to print logs.
For example we only use `android.util.Log` to print logs.
> The following example
```kotlin
loggerD(tag = "YukiHookAPI", msg = "This is a log", type = LoggerType.LOGD)
YLog.debug(tag = "YukiHookAPI", msg = "This is a log", env = YLog.EnvType.LOGD)
```
Or just use the log function that in the (Xposed) Host environment to print the log, this method can only be used in the (Xposed) Host environment.
@@ -53,7 +62,7 @@ Or just use the log function that in the (Xposed) Host environment to print the
> The following example
```kotlin
loggerD(tag = "YukiHookAPI", msg = "This is a log", type = LoggerType.XPOSED_ENVIRONMENT)
YLog.debug(tag = "YukiHookAPI", msg = "This is a log", env = YLog.EnvType.XPOSED_ENVIRONMENT)
```
If you want to intelligently distinguish the (Xposed) Host environment from the Module environment, you can write it in the following form.
@@ -61,27 +70,27 @@ If you want to intelligently distinguish the (Xposed) Host environment from the
> The following example
```kotlin
loggerD(tag = "YukiHookAPI", msg = "This is a log", type = LoggerType.SCOPE)
YLog.debug(tag = "YukiHookAPI", msg = "This is a log", env = YLog.EnvType.SCOPE)
```
In this way, the API will intelligently select the specified method type to print this log in different environments.
::: tip
For more functions, please refer to [loggerD](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#loggerd-method), [loggerI](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#loggeri-method) and [loggerW](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#loggerw-method) methods.
For more functions, please refer to [YLog.debug](../public/com/highcapable/yukihookapi/hook/log/YLog#debug-method), [YLog.info](../public/com/highcapable/yukihookapi/hook/log/YLog#info-method) and [YLog.warn](../public/com/highcapable/yukihookapi/hook/log/YLog#warn-method) methods.
:::
## Error Logs
You can call `loggerE` to print `E` level logs to the console.
You can call `YLog.error` to print `E` level logs to the console.
The usage method is as follows.
> The following example
```kotlin
loggerE(msg = "This is an error")
YLog.error(msg = "This is an error")
```
The error log is the highest level, regardless of whether you have filtered only `E` level logs.
@@ -92,7 +101,7 @@ For error-level logging, you can also append an exception stack.
// Assume this is the exception that was thrown
val throwable = Throwable(...)
// Print log
loggerE(msg = "This is an error", e = throwable)
YLog.error(msg = "This is an error", e = throwable)
```
The printed result is as shown below.
@@ -100,7 +109,7 @@ The printed result is as shown below.
> The following example
```:no-line-numbers
[YukiHookAPI][E][host package name]--> This is an error
[YukiHookAPI][E][host package name] This is an error
```
At the same time, the log will help you print the entire exception stack.
@@ -109,25 +118,25 @@ At the same time, the log will help you print the entire exception stack.
```:no-line-numbers
java.lang.Throwable
at com.demo.Test.<init>(...)
at com.demo.Test.doTask(...)
at com.demo.Test.stop(...)
at com.demo.Test.init(...)
at a.a.a(...)
... 3 more
at com.demo.Test.<init>(...)
at com.demo.Test.doTask(...)
at com.demo.Test.stop(...)
at com.demo.Test.init(...)
at a.a.a(...)
... 3 more
```
In the error log, you can also use `LoggerType` to specify the method type currently used to print the log.
In the error log, you can also use `YLog.EnvType` to specify the method type currently used to print the log.
::: tip
For more functions, please refer to the [loggerE](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#loggere-method) method.
For more functions, please refer to the [YLog.error](../public/com/highcapable/yukihookapi/hook/log/YLog#error-method) method.
:::
## Save Logs and Custom Elements
You can save all currently printed logs directly to a file using the `YukiHookLogger.saveToFile` method.
You can save all currently printed logs directly to a file using the `YLog.saveToFile` method.
> The following example
@@ -135,25 +144,25 @@ You can save all currently printed logs directly to a file using the `YukiHookLo
// Please note
// The saved file path must have read and write permissions
// Otherwise an exception will be thrown
YukiHookLogger.saveToFile("/sdcard/Documents/debug_log.log")
YLog.saveToFile("/sdcard/Documents/debug_log.log")
```
You can also use `YukiHookLogger.contents` to get all the log file contents that have been printed so far.
You can also use `YLog.contents` to get all the log file contents that have been printed so far.
> The following example
```kotlin
// Get the contents of all log files that have been printed so far
val fileContent = YukiHookLogger.contents
val fileContent = YLog.contents
```
If you need an array of real-time log data structures, you can directly get the content of `YukiHookLogger.inMemoryData`.
If you need an array of real-time log data structures, you can directly get the content of `YLog.inMemoryData`.
> The following example
```kotlin
// Get the currently printed real-time log data structure array
YukiHookLogger.inMemoryData.forEach {
YLog.inMemoryData.forEach {
it.timestamp // Get timestamp
it.time // Get UTC time
it.priority // Get priority
@@ -169,19 +178,19 @@ If you want to format or save the obtained custom log data to a file, you only n
```kotlin
// Assume this is the custom log data you get
val data: ArrayList<YukiLoggerData>
val data: List<YLogData>
// Format log data to String
val dataString = YukiHookLogger.contents(data)
val dataString = YLog.contents(data)
// Save log data to file
// Please note
// The saved file path must have read and write permissions
// Otherwise an exception will be thrown
YukiHookLogger.saveToFile("/sdcard/Documents/debug_log.log", data)
YLog.saveToFile("/sdcard/Documents/debug_log.log", data)
```
::: danger
You need to enable **YukiHookLogger.Configs.isRecord** to get the contents of **YukiHookLogger.inMemoryData**.
You need to enable **YLog.Configs.isRecord** to get the contents of **YLog.inMemoryData**.
The obtained log data is isolated from each other in the Host App and the Module App's process.
@@ -193,7 +202,7 @@ If you only want to get log data in real time through Module App or Host App, Pl
:::
You can also use `YukiHookLogger.Configs.elements` to customize the elements that debug logs display externally.
You can also use `YLog.Configs.elements` to customize the elements that debug logs display externally.
This function requires `YukiHookAPI.Configs` to be configured in `onInit` of the Hook entry class.
@@ -211,6 +220,6 @@ override fun onInit() = configs {
::: tip
For more functions, please refer to [YukiHookLogger.inMemoryData](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#inmemorydata-field), [YukiHookLogger.contents](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#contents-field), [YukiHookLogger.contents](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#contents-method), [YukiHookLogger.saveToFile](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#savetofile-method) methods and [YukiHookLogger.Configs](../public/com/highcapable/yukihookapi/hook/log/LoggerFactory#configs-object).
For more functions, please refer to [YLog.inMemoryData](../public/com/highcapable/yukihookapi/hook/log/YLog#inmemorydata-field), [YLog.contents](../public/com/highcapable/yukihookapi/hook/log/YLog#contents-field), [YLog.contents](../public/com/highcapable/yukihookapi/hook/log/YLog#contents-method), [YLog.saveToFile](../public/com/highcapable/yukihookapi/hook/log/YLog#savetofile-method) methods and [YLog.Configs](../public/com/highcapable/yukihookapi/hook/log/YLog#configs-object).
:::

View File

@@ -1,12 +1,26 @@
# Reflection Extensions
# Reflection Extensions (Migrated)
> `YukiHookAPI` encapsulates a set of reflection API with near-zero reflection writing for developers, which can almost completely replace the usage of reflection API in Java.
The core part of this functionality has been decoupled into the [YukiReflection](https://github.com/fankes/YukiReflection) project, which can be used independently in any Android project.
~~The core part of this functionality has been decoupled into the [YukiReflection](https://github.com/HighCapable/YukiReflection) project, which can be used independently in any Java or Android project.~~
Now `YukiReflection` is integrated into `YukiHookAPI` as a core dependency.
~~Now `YukiReflection` is integrated into `YukiHookAPI` as a core dependency.~~
`YukiHookAPI` adds related extensions for Hook functions on the basis of `YukiReflection`, and there is no need to introduce this dependency to use `YukiHookAPI`.
~~`YukiHookAPI` adds related extensions for Hook functions on the basis of `YukiReflection`, and there is no need to introduce this dependency to use `YukiHookAPI`.~~
::: warning
Starting with version `1.3.0`, `YukiHookAPI` has moved its own reflection API partially to
[KavaRef](https://github.com/HighCapable/KavaRef), we no longer recommend the reflection API of `YukiHookAPI` itself, which have been marked as deprecated.
The `YukiReflection` project has been deprecated due to many unsolved black box issues, and we no longer recommend anyone to use it.
If you are still using the reflection API section of `YukiHookAPI`,
please refer to the migration document [here](https://highcapable.github.io/KavaRef/zh-cn/config/migration) which will jump to the `KavaRef` document.
:::
<div style="opacity: 0.35">
## Class Extensions
@@ -78,6 +92,54 @@ For more functions, please refer to [classOf](../public/com/highcapable/yukihook
:::
### Lazy Loading
Suppose we want to get a `Class` that cannot be called directly, but we do not need this `Class` immediately.
At this time, you can use `lazyClass` to complete this function.
> The following example
```kotlin
// Lazy loading of this Class
// If you are currently in a PackageParam environment, then you do not need to consider ClassLoader
val instance by lazyClass("com.demo.Test")
// Customize the ClassLoader where the Class is located
val customClassLoader: ClassLoader? = ... // Assume this is your ClassLoader
val instance by lazyClass("com.demo.Test") { customClassLoader }
// Call this Class at the appropriate time
instance.method {
// ...
}
```
If the current `Class` does not exist, using the above method will throw an exception.
If you are not sure whether `Class` exists, you can refer to the following solution.
> The following example
```kotlin
// Lazy loading of this Class
// If you are currently in a PackageParam environment, then you do not need to consider ClassLoader
// If not available, the result will be null but no exception will be thrown
val instance by lazyClassOrNull("com.demo.Test")
// Customize the ClassLoader where the Class is located
val customClassLoader: ClassLoader? = ... // Assume this is your ClassLoader
// If not available, the result will be null but no exception will be thrown
val instance by lazyClassOrNull("com.demo.Test") { customClassLoader }
// Call this Class at the appropriate time
instance?.method {
// ...
}
```
::: tip
For more functions, please refer to [lazyClass](../public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory#lazyclass-method), [lazyClassOrNull](../public/com/highcapable/yukihookapi/hook/factory/ReflectionFactory#lazyclassornull-method), [PackageParam → lazyClass](../public/com/highcapable/yukihookapi/hook/param/PackageParam#lazyclass-method), [PackageParam → lazyClassOrNull](../public/com/highcapable/yukihookapi/hook/param/PackageParam#lazyclassornull-method) methods.
:::
### Existential Judgment
Suppose we want to determine whether a `Class` exists.
@@ -151,6 +213,14 @@ Please note that the more the same type **Class** is matched, the slower the spe
:::
::: danger
~~After **YukiHookAPI** **2.0.0** released, this function will be deprecated and will no longer be migrated to [YukiReflection](https://github.com/HighCapable/YukiReflection).~~
We welcome all developers to start using [DexKit](https://github.com/LuckyPray/DexKit), which is a high-performance runtime parsing library for **Dex** implemented in C++, which is more efficient than the Java layer in terms of performance, efficient and excellent, it is still in the development stage, your valuable suggestions are welcome.
:::
#### Get Started
Below is a simple usage example.
@@ -1162,7 +1232,7 @@ instance.current {
name = "stop"
emptyParam()
}.call()
// Note that because current() returns the CurrentClass object itself
// Note that because current() returns the CurrentClass object itself
// It CANNOT BE CALLED like the following
instance.current().current()
```
@@ -1290,15 +1360,12 @@ Here's how the `getString` method in this `Class` Hooks.
> The following example
```kotlin
Test::class.java.hook {
injectMember {
method {
name = "getString"
emptyParam()
returnType = StringClass
}
replaceTo("Hooked")
}
Test::class.java.method {
name = "getString"
emptyParam()
returnType = StringClass
}.hook {
replaceTo("Hooked")
}
```
@@ -1439,34 +1506,8 @@ Test::class.java.method {
}
```
Take the current `Class` as an example, if [Multiple Find](#multiple-find) is used in conjunction with `RemedyPlan` when creating a Hook, you need to change the usage slightly.
> The following example
```kotlin
injectMember {
method {
name = "doTask"
emptyParam()
}.remedys {
method {
name = "doTask"
paramCount(0..1)
}
method {
name = "doTask"
paramCount(1..2)
}
}.all()
beforeHook {}
afterHook {}
}
```
::: tip
When creating a Hook, please refer to [MethodFinder.Process.all](../public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder#all-method), [ConstructorFinder.Process.all]( ../public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder#all-method) methods.
For more functions, please refer to [MethodFinder.RemedyPlan](../public/com/highcapable/yukihookapi/hook/core/finder/members/MethodFinder#remedyplan-class), [ConstructorFinder.RemedyPlan](../public/com/highcapable/yukihookapi/hook/core/finder/members/ConstructorFinder#remedyplan-class), [FieldFinder.RemedyPlan](../public/com/highcapable/yukihookapi/hook/core/finder/members/FieldFinder#remedyplan-class) .
:::
@@ -1570,15 +1611,7 @@ For more functions, please refer to [VariousClass](../public/com/highcapable/yuk
If it is used when creating a Hook, it can be more convenient, and it can also automatically intercept the exception that `Class` cannot be found.
> The following example
```kotlin
findClass("com.demo.ATest", "com.demo.BTest").hook {
// Your code here.
}
```
You can also define this `Class` as a constant type to use.
You can define this `Class` as a constant type to use.
> The following example
@@ -1591,12 +1624,6 @@ ABTestClass.hook {
}
```
::: tip
For more functions, please refer to the [PackageParam.findClass](../public/com/highcapable/yukihookapi/hook/param/PackageParam#findclass-method) method.
:::
### Calling Generics
In the process of reflection, we may encounter generic problems.
@@ -1677,11 +1704,7 @@ For more functions, please refer to [CurrentClass.generic](../public/com/highcap
#### Restrictive Find Conditions
::: danger
In find conditions you can only use **index** function once except **order**.
:::
In find conditions you can <u>**only**</u> use `index` function once except `order`.
> The following example
@@ -1689,7 +1712,7 @@ In find conditions you can only use **index** function once except **order**.
method {
name = "test"
param(BooleanType).index(num = 2)
// Wrong usage, please keep only one index method
// Wrong usage, please keep only one index method
returnType(StringClass).index(num = 1)
}
```
@@ -1708,12 +1731,8 @@ method {
#### Necessary Find Conditions
::: danger
In common method find conditions, <u>**even methods without parameters need to set find conditions**</u>.
:::
Suppose we have the following `Class`.
> The following example
@@ -1769,9 +1788,7 @@ In the past historical versions of the API, it was allowed to match the method w
:::
#### Abbreviated Find Conditions
> In the construction method find conditions, <u>**constructors without parameters do not need to fill in the find conditions**</u>.
In the find conditions for constructors, <u>**even constructors without parameters need to set find conditions**</u>.
Suppose we have the following `Class`.
@@ -1786,7 +1803,7 @@ public class TestFoo {
}
```
We want to get the `public TestFoo()` constructor, which can be written as follows.
To get the `public TestFoo()` constructor, we must write it in the following form.
> The following example
@@ -1794,31 +1811,57 @@ We want to get the `public TestFoo()` constructor, which can be written as follo
TestFoo::class.java.constructor { emptyParam() }
```
The above example can successfully obtain the `public TestFoo()` constructor, but it feels a bit cumbersome.
The above example can successfully obtain the `public TestFoo()` constructor.
Unlike normal methods, since the constructor does not need to consider the `name`, when the constructor has no parameters, we can omit the `emptyParam` parameter.
If you write `constructor()` and miss `emptyParam()`, the result found at this time will be the first one in bytecode order, <u>**may not be parameterless** </u>.
::: tip Compatibility Notes
In past historical versions of the API, if the constructor does not fill in any search parameters, the constructor will not be found directly.
<u>**This is a BUG and has been fixed in the latest version**</u>, please make sure you are using the latest API version.
:::
::: danger API Behavior Changes
In **1.2.0** and later versions, the behavior of **constructor()** is no longer **constructor { emptyParam() }** but **constructor {}**, please pay attention to the behavior change reasonably adjust the find parameters.
:::
#### No Find Conditions
Without setting find conditions, using `field()`, `constructor()`, `method()` will return all members under the current `Class`.
Using `get(...)` or `give()` will only get the first bit in bytecode order.
> The following example
```kotlin
TestFoo::class.java.constructor()
Test::class.java.field().get(...)
Test::class.java.method().give()
```
If you want to get all members, you can use `all(...)` or `giveAll()`
> The following example
```kotlin
Test::class.java.field().all(...)
Test::class.java.method().giveAll()
```
::: tip Compatibility Notes
In the past historical versions of the API, if the constructor does not fill in any find conditions, the constructor will not be found directly.
In past historical versions of the API, failure to set find conditions will throw an exception.
<u>**This is a bug, the latest version has been fixed**</u>, please make sure you are using the latest API version.
This feature was added in **1.2.0** and later versions.
:::
#### Bytecode Type
::: danger
In the bytecode call result, the **cast** method can only specify the type corresponding to the bytecode.
:::
In the bytecode call result, the **cast** method can <u>**only**</u> specify the type corresponding to the bytecode.
For example we want to get a field of type `Boolean` and cast it to `String`.
@@ -1830,7 +1873,7 @@ The following is the wrong way to use it.
field {
name = "test"
type = BooleanType
}.get().string() // Wrong usage, must be cast to the bytecode target type
}.get().string() // Wrong usage, must be cast to the bytecode target type
```
The following is the correct way to use it.
@@ -1857,7 +1900,7 @@ field {
}
```
Expressing the type of `Boolean::class.javaPrimitiveType` in `Kotlin` is very long and inconvenient.
Expressing the type of `Boolean::class.javaPrimitiveType` in Kotlin is very long and inconvenient.
Therefore, `YukiHookAPI` encapsulates common type calls for developers, including Android related types and Java common types and **primitive type keywords**.
@@ -1919,7 +1962,7 @@ At the same time, they all have their own corresponding package types in Java, s
Similarly, arrays also have corresponding wrapper types, which also need to be distinguished from Java **primitive type keywords**.
For example, the encapsulation type of **byte[]** is **ByteArrayType** or **ArrayClass(ByteType)**, and the encapsulation type of **Byte[]** is **ByteArrayClass** or **ArrayClass(ByteClass )**, these types are also <u>**unequal**</u>.
For example, the encapsulation type of **byte[]** is **ByteArrayType** or **ArrayClass(ByteType)**, and the encapsulation type of **Byte[]** is **ByteArrayClass** or **ArrayClass(ByteClass)**, these types are also <u>**unequal**</u>.
:::
@@ -1929,4 +1972,6 @@ For more types, see [ComponentTypeFactory](../public/com/highcapable/yukihookapi
:::
At the same time, you are welcome to contribute more commonly used types.
At the same time, you are welcome to contribute more commonly used types.
</div>

Some files were not shown because too many files have changed in this diff Show More