204 Commits
1.0.1 ... 1.3

Author SHA1 Message Date
389f3a69ee Bump version to 1.3 2023-11-03 20:05:58 +08:00
e0b8799a9b feat: ignore user-terminated crash 2023-11-03 19:51:44 +08:00
a64ad86e64 feat: add stack trace share optional dialog 2023-11-03 18:46:07 +08:00
2d42581e36 docs: update release channel 2023-10-26 21:40:50 +08:00
936d66a81e feat: add errors app's target and min sdk record 2023-10-22 23:13:26 +08:00
66b9407b34 fix: catch toast when no looper 2023-10-22 22:36:29 +08:00
c8a0631034 feat: add module app version in shared errors info data 2023-10-21 17:13:57 +08:00
32ca130da0 feat: use handleAppCrashLSPB method on system higher than Android 11 2023-10-21 02:30:11 +08:00
273dca6042 chore: update target sdk to 34 2023-10-21 01:27:10 +08:00
315dfd7e22 feat(docs): update YukiHookAPI owner link 2023-10-21 01:26:20 +08:00
b5baf8243e refactor: remove DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION 2023-10-21 01:25:04 +08:00
2064c01350 chore: bump "com.highcapable.flexilocale" version to 1.0.1 2023-10-13 20:02:06 +08:00
72d76a486c refactor: migrate i18ns generation to FlexiLocale plugin 2023-10-13 18:49:15 +08:00
d215440e83 refactor: migrate to YukiHookAPI new usage 2023-10-07 21:15:15 +08:00
52367b5c41 chore: bump dependency versions 2023-10-07 21:15:05 +08:00
061b73fef7 chore: bump plugin versions
- bump "com.highcapable.sweetdependency" version to 1.0.2
- bump "com.highcapable.sweetproperty" version to 1.0.3
2023-09-26 09:10:38 +08:00
13e63a8fb3 refactor: change "Url" to "URL" 2023-09-21 00:42:16 +08:00
7eacb56857 refactor: add new R8 rules to fix possible problems 2023-09-19 08:13:54 +08:00
684456bb5b style: rearrange imports 2023-09-19 07:41:23 +08:00
3b5aee9fb8 fix: data format and style problems 2023-09-19 07:30:58 +08:00
86ba9749be ci: use allowed symbols 2023-09-19 05:29:00 +08:00
4fff1d7c17 docs: optimize comments 2023-09-19 05:13:25 +08:00
c1e584d739 feat: lots of changes
- add BuildConfigWrapper
- add project promote
- add ci version tag support
- change app analytics config item show when available
- fix system api compat issues
2023-09-19 05:12:44 +08:00
ccc50d720e feat: add i18n strings 2023-09-19 05:10:35 +08:00
8df2fd5c14 docs: update README, README-zh-CN 2023-09-19 05:09:43 +08:00
99472dedc4 refactor: add package name 2023-09-19 05:07:19 +08:00
d22c5801b2 docs: add icon in img-src 2023-09-19 05:06:26 +08:00
0a87f13af7 ci: optimize and add artifacts post to Telegram 2023-09-19 05:02:57 +08:00
fd7bb9bf77 chore: add Android 14 option 2023-09-19 05:02:37 +08:00
b0a6c71300 chore: migrate build script from groovy to kts
- using SweetDependency, SweetProperty
- merge singing key file configs to properties
- update gradle and dependencies
2023-09-19 05:02:15 +08:00
00512d6f95 chore: clean up build step files 2023-09-19 05:00:58 +08:00
4bc2d84e7d [Change Commit Specification] Use the new commit spec from here on
child commits:
chore: add .editorconfig
2023-09-19 04:59:33 +08:00
Fankesyooni
75e6f1c16c Merge pull request #132 from ZQDesigned/master
[BUG FIX] Deprecated AppErrorInfo when dialog covers AppErrorsDetailActivity
2023-06-21 02:03:30 +08:00
886e8d1e37 Complete method annotation 2023-06-21 01:43:29 +08:00
a876854010 Revert some changes and Refactor code style again 2023-06-21 01:32:06 +08:00
9834b6c8dd Refactor code style 2023-06-21 01:14:17 +08:00
3a5a1df270 Fix:deprecated AppErrorInfo when dialog covers AppErrorsDetailActivity 2023-06-21 00:22:43 +08:00
4afe549a8d Modify refactor the locales config code 2023-05-09 11:51:11 +08:00
3a7c97a1ac Update Gradle dependencies 2023-05-09 11:50:06 +08:00
Fankesyooni
2b8b769aa9 Merge pull request #112 from huajijam/master
feat: Per-app language preferences
2023-05-04 22:34:22 +08:00
‭huajijam
fa793d764b feat: Per-app language preferences 2023-05-04 21:42:35 +08:00
4f9ef060ea Update Gradle dependencies 2023-04-25 07:30:55 +08:00
47be6b10b7 Modify merge to YukiHookAPI new usage 2023-04-25 06:29:55 +08:00
340034b531 Update YukiHookAPI 2023-04-25 06:29:35 +08:00
58aa7bc498 Update YukiHookAPI 2023-04-21 01:26:35 +08:00
06324d104a Update version to 1.25 2023-04-17 06:41:55 +08:00
0ed2cf4903 Modify merge to YukiHookAPI new usage 2023-04-17 06:38:05 +08:00
d278faf7c9 Modify merge to YukiHookAPI new usage 2023-04-17 06:06:35 +08:00
823c5c690f Update Gradle dependencies 2023-04-17 06:05:05 +08:00
a4e1c82ad0 Update YukiHookAPI 2023-04-17 06:03:55 +08:00
07e13ccf04 Modify merge contents of build.gradle into constant definitions 2023-04-15 23:01:55 +08:00
e19f8ea4af Update Gradle dependencies 2023-04-14 17:57:05 +08:00
45c337d475 Modify change uninstalled apps or unknown apps to show their package name for users 2023-04-09 20:52:55 +08:00
8690e8afdb Modify change apps related functions returned "" for default value in FunctionFactory 2023-04-09 20:51:55 +08:00
ec7dcabdb8 Added loading view and errors records count in AppErrorsRecordActivity, activity_app_errors_record 2023-04-09 20:31:55 +08:00
0db82b5630 Added i18n strings 2023-04-09 20:30:35 +08:00
1207dbb561 Modify replace YukiHookAPI to YukiReflection in demo-app 2023-04-08 00:06:05 +08:00
785208a5bb Update Gradle & Kotlin
- Update Kotlin version to 1.8.20
- Update Gradle version to 8.0.2
- Update Gradle dependencies
2023-04-08 00:03:55 +08:00
3dbd80e06e Added start history chart in README 2023-02-19 14:39:55 +08:00
f452bb2b32 Modify change ProgressBar to CircularProgressIndicator in activity_config 2023-02-08 13:42:55 +08:00
39b779eab9 Added new bug report issues template 2023-02-08 13:25:55 +08:00
948095c016 Fix CI compiler problem and add debug version on CI 2023-02-08 13:03:15 +08:00
1a7775d5cc Fix "GitHub" spelling in all files 2023-02-07 05:27:55 +08:00
00cfca12b0 Modify change ProgressBar to CircularProgressIndicator in DialogBuilderFactory 2023-02-03 23:17:15 +08:00
556951c27c Fix some problems in CompoundButtonFactory 2023-02-03 03:39:05 +08:00
b478654008 Modify merge to CompoundButtonDataBinder and optimize code in AppErrorsDetailActivity 2023-02-03 02:26:09 +08:00
b47543e71a Modify merge to CompoundButtonDataBinder and optimize code in MainActivity 2023-02-03 02:22:05 +08:00
6ffe4bc15d Update YukiHookAPI 2023-02-01 04:32:05 +08:00
bb94689baa Update .gitignore 2023-02-01 04:31:10 +08:00
6803b60dca Update Gradle dependencies 2023-01-31 23:50:05 +08:00
82946e55fe Update version to 1.2 2023-01-23 12:19:06 +08:00
910b3523a3 Update copyright date to 2023 for all existing files 2023-01-23 12:13:50 +08:00
a6fd0b699c Modify remove scrollbar and reset scroll view when view changed in AppErrorsDetailActivity, activity_app_errors_detail 2023-01-23 11:59:35 +08:00
6ddbfb5444 Added check for updates feature from GitHub Release 2023-01-23 11:43:55 +08:00
fe4f91291e Added i18n strings 2023-01-23 11:42:04 +08:00
5e0336a434 Added disable automatic wrapping error stack trace contents function in ConfigData, AppErrorsDetailActivity, activity_app_errors_detail 2023-01-22 15:51:31 +08:00
55a4d68a18 Added i18n strings 2023-01-22 15:49:31 +08:00
358ac848e2 Modify remove screenOrientation parameter for AppErrorsDetailActivity in AndroidManifest 2023-01-22 15:32:18 +08:00
567d0a7b6c Modify add cpuAbi, versionName, versionCode default value for legacy data transfer of AppErrorsInfoBean in AppErrorsRecordData 2023-01-22 14:55:16 +08:00
4d5dadae8b Modify make crashed apps info persistence and add more info to stackOutputShareContent, stackOutputFileContent in AppErrorsInfoBean, FrameworkHooker, AppErrorsDetailActivity 2023-01-22 14:51:15 +08:00
9dce54f326 Added appVersionNameOf, appVersionCodeOf functions and merge to appVersionBrandOf function in FunctionFactory 2023-01-22 14:23:41 +08:00
37af877a7d Modify change the judgment logic when fetched installed packages list is empty in FrameworkHooker 2023-01-22 14:11:05 +08:00
59f5b27d19 Modify change view id "app_api" to "app_cpu_abi" in AppErrorsDetailActivity, activity_app_errors_detail 2023-01-22 14:05:08 +08:00
1299779868 Modify change apps config filters function with 3 types such as user apps, system apps and all apps 2023-01-22 13:05:05 +08:00
27c5e92879 Added i18n strings and remove some unused translations 2023-01-22 13:03:02 +08:00
d22745f2ea Modify make radio button singleLine in dia_app_config 2023-01-22 12:59:38 +08:00
dfcee71168 Modify add @throws code note in putAppShowingType function in AppErrorsConfigData 2023-01-22 11:49:37 +08:00
5b30499cc3 Update YukiHookAPI 2023-01-21 00:53:45 +08:00
1889b848b0 Update Android Gradle Plugin to 7.4.0 2023-01-21 00:49:40 +08:00
c349ee5dc7 Added global app config template function and remove old implementations 2023-01-20 03:09:25 +08:00
72e99bd4f2 Added i18n strings and fix some translations 2023-01-20 02:59:15 +08:00
2d9550d5b9 Modify remove fetch installed packages list log and only print for empty list in FrameworkHooker 2023-01-20 02:33:25 +08:00
27e068898e Fix translations for i18n strings 2023-01-19 23:59:28 +08:00
92a0591d5b Update Gradle dependencies 2023-01-19 22:29:12 +08:00
2a97dcbc06 Added access root failed tips dialog in FrameworkTool 2023-01-19 21:53:58 +08:00
0dc12ae3e6 Added i18n strings 2023-01-19 21:53:51 +08:00
075850d239 Modify remove @Keep in all beans and add @SerializedName in AppErrorsInfoBean 2023-01-19 13:07:26 +08:00
c48a23f07d Modify change empty mark for AppErrorsInfoBean in AppErrorsInfoBean, FrameworkHooker 2023-01-19 12:57:02 +08:00
cf1796b7cb Modify optimize code in FrameworkHooker 2023-01-17 13:45:16 +08:00
5bb1f38146 Modify ignored "android" package name when getting app list data in FrameworkHooker 2023-01-17 13:13:21 +08:00
a055d7f53d Modify rename ui/view to ui/widget 2023-01-17 11:15:48 +08:00
2eae45a640 Modify change the way of getting app list data in FrameworkHooker 2023-01-17 05:12:23 +08:00
fd168f8810 Modify change multi-user app display name with suffix its user id in FrameworkHooker 2023-01-17 05:02:15 +08:00
37580519db Modify change appNameOf function returned default blank content to "unknown" in FunctionFactory 2023-01-17 04:56:37 +08:00
5144494f82 Modify make app errors record files sorted by last modified date in AppErrorsRecordData 2023-01-17 04:35:47 +08:00
01a6c1ffa5 Fix the previous fix caused the text could not be selected in AppErrorsDetailActivity, activity_app_errors_detail 2023-01-17 03:59:48 +08:00
2aaa422a56 Modify change AppErrorsData to AppErrorsProcessData in FrameworkHooker 2023-01-17 03:22:37 +08:00
7c0c1754e9 Modify merge to new way to save and read the app errors record data 2023-01-17 03:17:37 +08:00
587c718d0a Added List.toArrayList function in FunctionFactory 2023-01-17 03:03:27 +08:00
6b2b538047 Added Any?.toJsonOrNull, String.toEntityOrNull functions in GsonFormatFactory 2023-01-17 01:37:08 +08:00
6a5fee830c Fix code style in build.gradle 2023-01-16 23:36:20 +08:00
1d0cc1d24f Fix the central color problem of views such as CheckBox 2023-01-16 22:40:26 +08:00
eeaf386635 Fix the interface automatically slides up problem on Android versions lower than 10 in activity_app_errors_detail 2023-01-16 22:21:21 +08:00
a15b5b008d Added "Go It Now" button in app errors dialog for unable get app errors record in AppErrorsDetailActivity 2023-01-16 22:20:02 +08:00
37962fa12f Modify merge app errors functions implementation code to AppErrorsData in FrameworkHooker 2023-01-15 14:35:06 +08:00
3798479c23 Fix crashed apps user id mismatch problem in FrameworkHooker, AppErrorsInfoBean 2023-01-15 04:12:50 +08:00
a214f5773f Fix the app first crash report not responded problem in some customize ROMs in FrameworkHooker 2023-01-15 03:57:41 +08:00
aeda0f183e Modify support Android 7.0 2023-01-15 02:39:03 +08:00
c6d5f07b8c Fix PackageList class not exist problem in Android 8.1 and fix app errors dialog no show problem in FrameworkHooker 2023-01-15 02:37:16 +08:00
5991d976b9 Modify optimize code format in MainActivity 2023-01-15 01:35:02 +08:00
3fb4e4f375 Fix no onCreate method in AppErrorDialog class problem in Android 10 in FrameworkHooker 2023-01-14 01:55:52 +08:00
8c4a1ea5f0 Modify make HookEntry singleton 2023-01-14 01:55:29 +08:00
7749cb9aeb Modify merge to YukiHookAPI new usage 2023-01-14 01:55:22 +08:00
9d9cb473e8 Update Gradle & Kotlin
- Update Kotlin version to 1.7.22
- Update Gradle version to 7.6
- Update Gradle dependencies
2023-01-14 01:28:08 +08:00
afeb16e69d Update YukiHookAPI 2023-01-14 01:24:19 +08:00
211343a6e7 Modify remove "contains", "replace" method's param name statement 2023-01-14 01:22:16 +08:00
2c0cfb6863 Modify add release channel description, release status description in README 2022-11-26 00:12:48 +08:00
15293950a9 Modify change action file name for ci 2022-11-25 23:32:43 +08:00
88fe23ab9a Modify change action name for ci 2022-11-25 23:29:03 +08:00
Fankesyooni
150d2e8aa5 Merge pull request #24 from KitsunePie/ci
Upgrade ci deps
2022-11-14 13:13:57 +08:00
Howard Wu
dd6e971a34 gradlew chmod +x 2022-11-14 12:13:50 +08:00
Howard Wu
051da4df5f Update push_ci.yml 2022-11-14 12:10:41 +08:00
Howard Wu
368a4b347f Upgrade ci deps 2022-11-14 12:08:46 +08:00
30b92770e9 Update Gradle & PlatformSDK
- Update Android Gradle Plugin version to 7.3.1
- Update Kotlin version to 1.7.20
- Update YukiHookAPI version to 1.1.4 in demo-app
2022-10-20 00:18:46 +08:00
Fankesyooni
2491547e3e Merge pull request #10 from cracky5322/master
Update Traditional Chinese
2022-10-12 12:00:25 +08:00
Jia-Bin
182a65255f Update Traditional Chinese
Better quality and beautiful localization translation optimization
2022-10-12 11:42:17 +08:00
aef2e0814a Fix file naming bug 2022-10-05 09:57:39 +08:00
e5062d3947 Update version to 1.1 2022-10-05 07:03:16 +08:00
1a1856ce9e Added Microsoft App Center analytics 2022-10-05 06:45:49 +08:00
4ae7fff484 Added i18n strings 2022-10-05 06:44:33 +08:00
1f29ac1bba Update .gitignore 2022-10-05 05:51:46 +08:00
92f6837c30 Added debug log viewing function 2022-10-05 04:36:55 +08:00
a44d29e102 Added i18n strings 2022-10-05 04:35:52 +08:00
6fbaf6d7a2 Modify add debug log and change crash log in FrameworkHooker 2022-10-05 04:32:58 +08:00
5320ce1b0e Modify change ListView padding bottom in activity_app_errors_muted, activity_app_errors_record, activity_config 2022-10-05 03:00:56 +08:00
2b317070a2 Fix when "proc" field got null System Framework maybe crashed in FrameworkHooker 2022-10-05 02:22:36 +08:00
f7784b393d Update YukiHookAPI 2022-10-04 07:31:50 +08:00
8eb814a345 Modify change app errors log's "App" to "Application" in FrameworkHooker 2022-10-04 03:47:52 +08:00
d350944f0d Modify change Context.openApp function command "am start ..." to system startActivityAsUser function in FunctionFactory 2022-10-04 03:03:52 +08:00
56b3656bf2 Fix code style in FunctionFactory 2022-10-04 02:38:50 +08:00
332cf0d3c0 Fix tip text not full width in activity_main in demo-app 2022-10-04 02:04:58 +08:00
0974c38d76 Fix destroyed Activity reading list data maybe out of bounds or called adapter's data confusion error in ConfigureActivity 2022-10-04 00:49:56 +08:00
a35dcfed66 Added system version text click notice dialog in MainActivity 2022-10-03 22:25:29 +08:00
5944842c8e Fix English translation for i18n strings 2022-10-03 22:21:01 +08:00
0b39bd9865 Modify move unable read errors data on-time tip to AppErrorsDetailActivity 2022-10-03 21:29:09 +08:00
d194da21ca Update i18n strings 2022-10-03 21:28:07 +08:00
777af500d4 Modify change missing output log's timestamp file name to UTC time file name 2022-10-03 08:04:13 +08:00
2472f8b7e5 Fix some custom system can't read application crash info on-time will get wrong errors data problem 2022-10-03 07:19:13 +08:00
1153494dfa Added pid showing for log in FrameworkHooker 2022-10-03 07:05:02 +08:00
95ee9de477 Added i18n strings 2022-10-03 06:40:11 +08:00
fe94441e9a Modify allowed multi-user app errors dialog's "Reopen App" option to start Activity with correct user id 2022-10-03 06:15:42 +08:00
3156a1721e Modify change Context.openApp function can open multi-user's Activity 2022-10-03 06:11:49 +08:00
9948a3fbc1 Fix UTC time displayed directly on UI 2022-10-03 05:44:34 +08:00
2481263c00 Added multi-user display app's user id feature 2022-10-03 05:43:49 +08:00
a6bf4e8a80 Added i18n strings 2022-10-03 05:33:29 +08:00
64e54348f4 Added INTERACT_ACROSS_USERS permission in AndroidManifest 2022-10-03 04:41:17 +08:00
33ee056ed9 Fix app errors record's current Context may not has INTERACT_ACROSS_USERS permission problem 2022-10-03 04:40:46 +08:00
1fc9f07b9f Added Material 3 dynamic colors theme for app errors dialog 2022-10-03 04:09:54 +08:00
499e7d9296 Added Resources.colorOf function in FunctionFactory 2022-10-03 04:02:53 +08:00
f2311f31cb Added i18n strings 2022-10-03 03:39:18 +08:00
b9f52b4e67 Added dynamic colors Material 3 theme for Translucent 2022-10-03 03:17:42 +08:00
c272dbc109 Modify code notes in ConfigData 2022-10-03 03:15:10 +08:00
4c47cbb271 Added isDisableMaterial3 function in DialogBuilderFactory 2022-10-03 03:08:14 +08:00
3de258f95d Update i18n strings 2022-10-03 02:48:06 +08:00
b173d3bfed Modify make app errors records data to persistent storage 2022-10-03 02:41:32 +08:00
310bc2c9dc Added Gson format function 2022-10-03 02:37:08 +08:00
af0d29a8f4 Modify merge thread to thread pool in ConfigureActivity, AppErrorsRecordActivity 2022-10-03 02:35:04 +08:00
4db70d02ec Added thread pool function 2022-10-03 02:34:16 +08:00
167199ba34 Added getResolverString / putResolverString function in ConfigData 2022-10-03 02:19:35 +08:00
98f22d6bca Update proguard-rules.pro 2022-10-03 01:32:27 +08:00
8f09a32d22 Added Gson in Gradle dependencies 2022-10-03 01:31:32 +08:00
f14b7d8f20 Added @Keep to data beans for R8 2022-10-03 01:29:06 +08:00
d38474e082 Modify merge all png elements to svg elements 2022-10-03 01:17:10 +08:00
5c1b8d3d6a Modify change icon to svg in activity_main 2022-10-02 23:11:07 +08:00
68dff21c42 Modify format code style in FrameworkHooker 2022-10-02 02:19:17 +08:00
1014f42584 Modify change code style in AppErrorsInfoBean 2022-10-02 00:52:58 +08:00
1a57a331b9 Modify change timestamp displayed text to UTC time in AppErrorsInfoBean, AppErrorsRecordActivity 2022-10-02 00:50:15 +08:00
bfb5e037e5 Added Long.toUtcTime function in FunctionFactory 2022-10-02 00:50:15 +08:00
1862faf637 Modify merge DataConst to ConfigData and move DataFactory to data/factory 2022-10-02 00:25:16 +08:00
abf6103b9d Added system locale display info on stack output content in AppErrorsInfoBean 2022-10-01 03:57:18 +08:00
c47d356e4c Modify replace app errors info's display text "null" to "unknown" in AppErrorsInfoBean 2022-10-01 03:57:18 +08:00
e8990f50f9 Fix add a scroll view to resolve app errors dialog bottom occlusion problem 2022-10-01 03:48:14 +08:00
a1d2d7ddf0 Added scroll view in MainActivity and remove rotation lock on demo-app 2022-10-01 03:40:12 +08:00
ec829a85af Added fast restart problem dialog in FrameworkTool 2022-10-01 03:32:52 +08:00
ce7a483106 Added i18n strings 2022-10-01 03:32:45 +08:00
8d64f9c989 Modify merge YukiHookAPI new usage and compatible with API 33 2022-10-01 03:32:23 +08:00
1973c1acaf Update Gradle & PlatformSDK 2022-10-01 00:18:09 +08:00
936a5b6802 Update YukiHookAPI 2022-10-01 00:15:14 +08:00
c5e9df257d Update .idea 2022-10-01 00:13:05 +08:00
57836f4a7f Added Project icon 2022-09-30 22:25:44 +08:00
2e09ab584d Update .gitignore 2022-09-30 22:25:05 +08:00
a9a7b5bf26 Added readme document language isolation 2022-07-26 23:50:05 +08:00
981e0ba746 Update Gradle & Kotlin & PlatformSDK
- Update Kotlin version to 1.7.10
- Update Gradle version
2022-07-20 23:13:53 +08:00
fed9fd3ae8 Merge dependencies 2022-07-20 02:14:39 +08:00
228 changed files with 6308 additions and 4641 deletions

17
.editorconfig Normal file
View File

@@ -0,0 +1,17 @@
# 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
ij_continuation_indent_size = 2
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 150

101
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,101 @@
name: Issues and Bugs Report / 问题与 BUG 反馈
description: 问题反馈必须使用此模板进行提交 / Issues and bugs report must be submitted using this template
labels: [ bug ]
title: "[Issues and Bugs Report] (Briefly describe the cause of the problem)"
body:
- type: markdown
attributes:
value: |
### Please fill in the specific reason and steps to reproduce the problem below.
In the event of an exception, crash functional problem, you must submit a problem log, if not, your issues will be closed directly.
### 请在下方填写问题发生的具体原因和复现步骤。
发生异常、崩溃、闪退或功能性问题,必须提交问题 Log (日志),没有 Log 的 issues 将直接被关闭。
- type: input
attributes:
label: Module App version / 模块版本
description: |
Please fill in the complete version of the Module App currently in use, for example: **1.0**
请填写当前使用的模块完整版本号,例如:**1.0**
validations:
required: true
- type: input
attributes:
label: Device model and system in used / 正在使用的设备型号以及使用的系统
description: |
Fill in the current device model and system here, the system such as (MIUI, ColorOS, OxygenOS, PE/Native)
这里填写当前使用的设备型号以及使用的系统,系统例如 (MIUI、ColorOS、OxygenOS、PE/原生)
validations:
required: true
- type: dropdown
attributes:
label: Android version / Android 版本
options:
- 14
- 13
- 12L/12.1
- 12
- 11
- 10
- 9
- 8.1
- 8.0.0
- 7.1.2
- 7.1.1
- 7.0
validations:
required: true
- type: input
attributes:
label: Xposed Framework name and version / Xposed 框架名称与版本号
description: |
Please fill in the currently used Xposed Framework, for example: **LSPosed 1.8.4 (version code)**
请填写当前使用的 Xposed 框架,例如:**LSPosed 1.8.4 (次版本号)**
validations:
required: true
- type: input
attributes:
label: Xposed Modules with the same scope / 与当前同作用域的 Xposed 模块
description: |
The scope of this module is the System Framework (Android System).
To ensure that the problem is not caused by conflicts with other modules, please be sure to fill in the relevant modules that you are currently activating at the same time.
If not, please fill in "none" directly below.
此模块的作用域为系统框架 (Android 系统),为确保非其它模块冲突造成的问题,请一定要填写当前你同时激活的相关模块。
若没有,请直接在下方填写“无”。
validations:
required: true
- type: textarea
attributes:
label: Describe in detail why the problem occurred / 详细描述问题发生的具体原因
description: 请在下方详细描述问题发生的具体场景、复现步骤和经过,以便我们能够按照你所描述的步骤复现这个问题。
validations:
required: true
- type: textarea
attributes:
label: Provide module problem logs or necessary logs / 提供模块问题 Log 或必要 Log
description: |
If you are using LSPosed, you can view and filter the logs containing `AppErrorsTracking` in the log management.
LSPosed 可在日志管理中查看并筛选包含 `AppErrorsTracking` 的日志。
value: |
<details><summary>Click to expand / 展开查看</summary><pre><code>
(Paste problem log here / 此处粘贴问题 Log)
</code></pre></details>
<!-- When submitting, please delete the parentheses including the parentheses, paste the logs you copied, and do not break the code format -->
<!-- 提交时请将括号内容包括括号全部删除,粘贴你复制的日志,不要破坏代码格式 -->
validations:
required: true
- type: checkboxes
attributes:
label: Confirm the contents you submitted / 确认一下你提交的信息
description: |
In order to ensure the quality of issues and avoid wasting unnecessary time, issues that do not check the options below will be closed directly.
Please make sure you have **checked the option below** before submitting.
为了确保 issues 的质量和避免浪费不必要的时间,未勾选下方选项的 issues 将直接被关闭。
请一定确保你已经**勾选下方的选项**后再提交。
options:
- label: I certify that the above contents is correct / 我确保上述信息准确无误
required: false

108
.github/workflows/commit_ci.yml vendored Normal file
View File

@@ -0,0 +1,108 @@
name: Automatic Build on Commit
on:
workflow_dispatch:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.txt'
- '.github/**'
- '!.github/workflows/**'
jobs:
build:
name: Build CI
if: ${{ success() }}
runs-on: ubuntu-latest
env:
MODULE_APK_OUTPUT_PATH: 'module-app/build/outputs/apk'
DEMO_APK_OUTPUT_PATH: 'demo-app/build/outputs/apk'
APP_CENTER_SECRET: ${{ secrets.APP_CENTER_SECRET }}
TG_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }}
TG_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }}
COMMIT_MESSAGE: |+
New push to GitHub\!
```
${{ github.event.head_commit.message }}
```by `${{ github.event.head_commit.author.name }}`
See commit detail [here](${{ github.event.head_commit.url }})
COMMIT_URL: ${{ github.event.head_commit.url }}
steps:
- uses: actions/checkout@v3
- name: Prepare GitHub Env
run: |
GITHUB_SHA=${{ github.sha }}
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7}
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: '3.22.1'
- name: Prepare Java 17
uses: actions/setup-java@v3
with:
java-version: 17
java-package: jdk
distribution: 'temurin'
cache: 'gradle'
- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }}
restore-keys: |
gradle-deps
- name: Cache Gradle Build
uses: actions/cache@v3
with:
path: |
~/.gradle/caches/build-cache-*
key: gradle-builds-core-${{ github.sha }}
restore-keys: |
gradle-builds
- name: Build with Gradle
run: |
./gradlew :module-app:assembleDebug
./gradlew :module-app:assembleRelease
./gradlew :demo-app:assembleDebug
./gradlew :demo-app:assembleRelease
echo "MODULE_DEBUG_APK_PATH=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
echo "MODULE_RELEASE_APK_PATH=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
echo "DEMO_DEBUG_APK_PATH=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
echo "DEMO_RELEASE_APK_PATH=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
- name: Upload Artifacts (Module-Debug)
uses: actions/upload-artifact@v3
with:
path: ${{ env.MODULE_DEBUG_APK_PATH }}
name: AppErrorsTracking-module-debug-${{ github.event.head_commit.id }}
- name: Upload Artifacts (Module-Release)
uses: actions/upload-artifact@v3
with:
path: ${{ env.MODULE_RELEASE_APK_PATH }}
name: AppErrorsTracking-module-release-${{ github.event.head_commit.id }}
- name: Upload Artifacts (Demo-Debug)
uses: actions/upload-artifact@v3
with:
path: ${{ env.DEMO_DEBUG_APK_PATH }}
name: AppErrorsTracking-demo-debug-${{ github.event.head_commit.id }}
- name: Upload Artifacts (Demo-Release)
uses: actions/upload-artifact@v3
with:
path: ${{ env.DEMO_RELEASE_APK_PATH }}
name: AppErrorsTracking-demo-release-${{ github.event.head_commit.id }}
- name: Post Artifacts to Telegram
run: |
export module_debug=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/debug -name "*.apk")
export module_release=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/release -name "*.apk")
export demo_debug=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/debug -name "*.apk")
export demo_release=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/release -name "*.apk")
ESCAPED=`python3 -c 'import json,os,urllib.parse; msg = json.dumps(os.environ["COMMIT_MESSAGE"]); print(urllib.parse.quote(msg if len(msg) <= 1024 else json.dumps(os.environ["COMMIT_URL"])))'`
curl -v "https://api.telegram.org/bot${TG_BOT_TOKEN}/sendMediaGroup?chat_id=${TG_CHAT_ID}&media=%5B%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fmodule_debug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fmodule_release%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdemo_debug%22%7D%2C%7B%22type%22%3A%22document%22%2C%20%22media%22%3A%22attach%3A%2F%2Fdemo_release%22%2C%22parse_mode%22%3A%22MarkdownV2%22%2C%22caption%22:${ESCAPED}%7D%5D" \
-F module_debug="@$module_debug" \
-F module_release="@$module_release" \
-F demo_debug="@$demo_debug" \
-F demo_release="@$demo_release"

View File

@@ -1,62 +0,0 @@
name: main
on:
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.txt'
- '.github/**'
- '!.github/workflows/**'
jobs:
build:
name: Pull request check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.12
with:
cmake-version: '3.22.1'
- name: Prepare Java 11
uses: actions/setup-java@v1
with:
java-version: 11
java-package: jdk
- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle') }}
restore-keys: |
gradle-deps
- name: Cache Gradle Build
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/build-cache-*
key: gradle-builds-core-${{ github.sha }}
restore-keys: |
gradle-builds
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: |
./gradlew :app:assembleRelease
./gradlew :demo-app:assembleRelease
echo "APK_FILE=$(find app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV
echo "DEMO_APK_FILE=$(find demo-app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV
- name: Upload Artifacts(module)
uses: actions/upload-artifact@v2
with:
path: ${{ env.APK_FILE }}
name: module-release
- name: Upload Artifacts(demo-app)
uses: actions/upload-artifact@v2
with:
path: ${{ env.DEMO_APK_FILE }}
name: demo-release

85
.github/workflows/pull_request_ci.yml vendored Normal file
View File

@@ -0,0 +1,85 @@
name: Pull Request Checker
on:
pull_request:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.txt'
- '.github/**'
- '!.github/workflows/**'
jobs:
build:
name: Pull Request Check
if: ${{ success() }}
runs-on: ubuntu-latest
env:
MODULE_APK_OUTPUT_PATH: 'module-app/build/outputs/apk'
DEMO_APK_OUTPUT_PATH: 'demo-app/build/outputs/apk'
steps:
- uses: actions/checkout@v3
- name: Prepare GitHub Env
run: |
GITHUB_SHA=${{ github.sha }}
GITHUB_CI_COMMIT_ID=${GITHUB_SHA:0:7}
echo "GITHUB_CI_COMMIT_ID=$GITHUB_CI_COMMIT_ID" >> $GITHUB_ENV
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1
with:
cmake-version: '3.22.1'
- name: Prepare Java 17
uses: actions/setup-java@v3
with:
java-version: 17
java-package: jdk
distribution: 'temurin'
cache: 'gradle'
- name: Cache Gradle Dependencies
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle.kts') }}
restore-keys: |
gradle-deps
- name: Cache Gradle Build
uses: actions/cache@v3
with:
path: |
~/.gradle/caches/build-cache-*
key: gradle-builds-core-${{ github.sha }}
restore-keys: |
gradle-builds
- name: Build with Gradle
run: |
./gradlew :module-app:assembleDebug
./gradlew :module-app:assembleRelease
./gradlew :demo-app:assembleDebug
./gradlew :demo-app:assembleRelease
echo "MODULE_DEBUG_APK_PATH=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
echo "MODULE_RELEASE_APK_PATH=$(find ${{ env.MODULE_APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
echo "DEMO_DEBUG_APK_PATH=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/debug -name '*.apk')" >> $GITHUB_ENV
echo "DEMO_RELEASE_APK_PATH=$(find ${{ env.DEMO_APK_OUTPUT_PATH }}/release -name '*.apk')" >> $GITHUB_ENV
- name: Upload Artifacts (Module-Debug)
uses: actions/upload-artifact@v3
with:
path: ${{ env.MODULE_DEBUG_APK_PATH }}
name: AppErrorsTracking-module-debug-${{ github.event.head_commit.id }}
- name: Upload Artifacts (Module-Release)
uses: actions/upload-artifact@v3
with:
path: ${{ env.MODULE_RELEASE_APK_PATH }}
name: AppErrorsTracking-module-release-${{ github.event.head_commit.id }}
- name: Upload Artifacts (Demo-Debug)
uses: actions/upload-artifact@v3
with:
path: ${{ env.DEMO_DEBUG_APK_PATH }}
name: AppErrorsTracking-demo-debug-${{ github.event.head_commit.id }}
- name: Upload Artifacts (Demo-Release)
uses: actions/upload-artifact@v3
with:
path: ${{ env.DEMO_RELEASE_APK_PATH }}
name: AppErrorsTracking-demo-release-${{ github.event.head_commit.id }}

View File

@@ -1,63 +0,0 @@
name: main
on:
workflow_dispatch:
push:
branches: [ master ]
paths-ignore:
- '**.md'
- '**.txt'
- '.github/**'
- '!.github/workflows/**'
jobs:
build:
name: Build CI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.12
with:
cmake-version: '3.22.1'
- name: Prepare Java 11
uses: actions/setup-java@v1
with:
java-version: 11
java-package: jdk
- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
!~/.gradle/caches/build-cache-*
key: gradle-deps-core-${{ hashFiles('**/build.gradle') }}
restore-keys: |
gradle-deps
- name: Cache Gradle Build
uses: actions/cache@v2
with:
path: |
~/.gradle/caches/build-cache-*
key: gradle-builds-core-${{ github.sha }}
restore-keys: |
gradle-builds
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: |
./gradlew :app:assembleRelease
./gradlew :demo-app:assembleRelease
echo "APK_FILE=$(find app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV
echo "DEMO_APK_FILE=$(find demo-app/build/outputs/apk/release -name '*.apk')" >> $GITHUB_ENV
- name: Upload Artifacts(module)
uses: actions/upload-artifact@v2
with:
path: ${{ env.APK_FILE }}
name: module-release
- name: Upload Artifacts(demo-app)
uses: actions/upload-artifact@v2
with:
path: ${{ env.DEMO_APK_FILE }}
name: demo-release

9
.gitignore vendored
View File

@@ -2,6 +2,12 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
@@ -10,5 +16,4 @@
local.properties
/app/releaseHasController/
/app/debug/
/app/release/
/.idea/
/app/release/

5
.idea/.gitignore generated vendored Normal file
View File

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

26
.idea/appInsightsSettings.xml generated Normal file
View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AppInsightsSettings">
<option name="tabSettings">
<map>
<entry key="Firebase Crashlytics">
<value>
<InsightsFilterSettings>
<option name="connection">
<ConnectionSetting>
<option name="appId" value="PLACEHOLDER" />
<option name="mobileSdkAppId" value="" />
<option name="projectId" value="" />
<option name="projectNumber" value="" />
</ConnectionSetting>
</option>
<option name="signal" value="SIGNAL_UNSPECIFIED" />
<option name="timeIntervalDays" value="THIRTY_DAYS" />
<option name="visibilityType" value="ALL" />
</InsightsFilterSettings>
</value>
</entry>
</map>
</option>
</component>
</project>

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" />
</component>
</project>

13
.idea/deploymentTargetDropDown.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<value>
<entry key="demo-app">
<State />
</entry>
<entry key="module-app">
<State />
</entry>
</value>
</component>
</project>

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -0,0 +1,11 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<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="YAMLSchemaValidation" enabled="false" level="WARNING" enabled_by_default="false" />
</profile>
</component>

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinJpsPluginSettings">
<option name="version" value="1.9.10" />
</component>
</project>

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KtlintProjectConfiguration">
<treatAsErrors>false</treatAsErrors>
</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>

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

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

1
.secret/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
/secret.properties

122
README-zh-CN.md Normal file
View File

@@ -0,0 +1,122 @@
# AppErrorsTracking
[![GitHub license](https://img.shields.io/github/license/KitsunePie/AppErrorsTracking?color=blue)](https://github.com/KitsunePie/AppErrorsTracking/blob/master/LICENSE)
[![GitHub CI](https://img.shields.io/github/actions/workflow/status/KitsunePie/AppErrorsTracking/commit_ci.yml?label=CI%20builds)](https://github.com/KitsunePie/AppErrorsTracking/actions/workflows/commit_ci.yml)
[![GitHub release](https://img.shields.io/github/v/release/KitsunePie/AppErrorsTracking?display_name=release&logo=github&color=green)](https://github.com/KitsunePie/AppErrorsTracking/releases)
![GitHub all releases](https://img.shields.io/github/downloads/KitsunePie/AppErrorsTracking/total?label=downloads)
![GitHub all releases](https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.fankes.apperrorstracking/total?label=LSPosed%20downloads&labelColor=F48FB1)
[![Telegram CI](https://img.shields.io/badge/CI%20builds-Telegram-blue.svg?logo=telegram)](https://t.me/AppErrorsTracking_CI)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram)](https://t.me/XiaofangInternet)
[![QQ](https://img.shields.io/badge/discussion-QQ-blue.svg?logo=tencent-qq&logoColor=red)](https://qm.qq.com/cgi-bin/qm/qr?k=dp2h5YhWiga9WWb_Oh7kSHmx01X8I8ii&jump_from=webapi&authKey=Za5CaFP0lk7+Zgsk2KpoBD7sSaYbeXbsDgFjiWelOeH4VSionpxFJ7V0qQBSqvFM)
[![QQ 频道](https://img.shields.io/badge/discussion-QQ%20频道-blue.svg?logo=tencent-qq&logoColor=red)](https://pd.qq.com/s/44gcy28h)
<img src="https://github.com/KitsunePie/AppErrorsTracking/blob/master/img-src/icon.png?raw=true" width = "100" height = "100" alt="LOGO"/>
[English](https://github.com/KitsunePie/AppErrorsTracking/blob/master/README.md) | 简体中文
为原生 FC 对话框增加更多功能并修复国内定制 ROM 删除 FC 对话框的问题,给 Android 开发者带来更好的体验。
此项目为 Xposed 模块,可用在任何 Android 系统中,目前仅在 **LSPosed** 中测试通过。
此模块专为 Android 开发者而打造。
在可能的无法连接电脑,不能进行 ADB 调试的时候,可通过此模块来快速捕获任意已安装应用的任意异常,以便快速定位问题。
应用发生崩溃的错误日志对开发者来说是无价的财富,若你不是开发者,你依然可以安装此模块,以便给开发者提供更多异常信息快速解决问题。
> 最低支持 Android 7.0
## 项目缘由
我实在是不能理解,国内 ROM 除了 MIUI(稳定版除外) 都选择了删除应用程序崩溃的对话框(FC 对话框),我曾以为这一直是一个特性,直到我去反编译了系统框架,才确认确实是被删掉了。
难道产品经理认为,让用户看不到错误,应用直接闪退,逃避就是最好的解决方案吗,还是说**另有隐情**呢?
## 工作原理
不同于 `Thread.UncaughtExceptionHandler`,我们通过注入系统框架,使用原生方式全方位捕获应用异常,不会产生额外的注册监听,在性能上相比原始的异常监听会更好。
同时系统级别的异常捕获还可捕获原生层的 `stack trace`
## 注意事项
系统原生方式捕获的异常只能为 APP 自身未进行处理的异常,若 APP 自身拥有自定义的 `Thread.UncaughtExceptionHandler`
类似 **Bugly** 这样的自动收集异常功能,系统就无法获取到 APP 是否真正发生异常而闪退(FC),例如 **QQ**、**TIM**。
## 功能列表
- [x] 完全取代系统的应用错误对话框
- [x] 记录每个应用的异常,直到重新启动前持续保留
- [x] 复制、分享、导出异常堆栈功能
- [x] 异常历史记录功能,可通过通知栏磁贴“异常历史记录”进入和模块主界面进入
- [x] 应用异常统计功能
- [x] 多进程应用的异常显示功能
## 翻译贡献
欢迎为此项目做出贡献,将其翻译为您国家的语言。
## 发行渠道
| <img src="https://avatars.githubusercontent.com/in/15368?s=64&v=4" width = "30" height = "30" alt="LOGO"/> | [GitHub CI](https://github.com/KitsunePie/AppErrorsTracking/actions/workflows/commit_ci.yml) | CI 自动构建 (测试版) |
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|---------------|
| <img src="https://github.com/peter-iakovlev/Telegram/blob/public/Icon.png?raw=true" width = "30" height = "30" alt="LOGO"/> | [Telegram CI 频道](https://t.me/AppErrorsTracking_CI) | CI 自动构建 (测试版) |
|-----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|---------------|
| <img src="https://avatars.githubusercontent.com/in/15368?s=64&v=4" width = "30" height = "30" alt="LOGO"/> | [GitHub Releases](https://github.com/KitsunePie/AppErrorsTracking/releases) | 正式版 (稳定版) |
|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|-----------|
| <img src="https://avatars.githubusercontent.com/u/78217009?s=200&v=4?raw=true" width = "30" height = "30" alt="LOGO"/> | [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.apperrorstracking/releases) | 正式版 (稳定版) |
|------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|-----------|
本模块发布地址仅限于上述所列出的地址,从其他非正规渠道下载到的版本或对您造成任何影响均与我们无关。
## 项目推广
如果你正在寻找一个可以自动管理 Gradle 项目依赖的 Gradle 插件,你可以了解一下 [SweetDependency](https://github.com/HighCapable/SweetDependency) 项目。
如果你正在寻找一个可以自动生成属性键值的 Gradle 插件,你可以了解一下 [SweetProperty](https://github.com/HighCapable/SweetProperty) 项目。
本项目同样使用了 **SweetDependency****SweetProperty**
## 捐赠支持
工作不易,无意外情况此项目将继续维护下去,提供更多可能,欢迎打赏。
<img src="https://github.com/fankes/fankes/blob/main/img-src/payment_code.jpg?raw=true" width = "500" alt="Payment Code"/>
## Star History
![Star History Chart](https://api.star-history.com/svg?repos=KitsunePie/AppErrorsTracking&type=Date)
## 许可证
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
```
Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
```
Powered by [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI)
版权所有 © 2017-2023 Fankes Studio(qzmmcn@163.com)

131
README.md
View File

@@ -1,38 +1,33 @@
# AppErrorsTracking
[![Blank](https://img.shields.io/badge/build-passing-brightgreen)](https://github.com/KitsunePie/AppErrorsTracking)
[![Blank](https://img.shields.io/badge/license-AGPL3.0-blue)](https://github.com/KitsunePie/AppErrorsTracking/blob/master/LICENSE)
[![Blank](https://img.shields.io/badge/version-v1.0.1-green)](https://github.com/KitsunePie/AppErrorsTracking/releases)
[![Blank](https://img.shields.io/github/downloads/KitsunePie/AppErrorsTracking/total?label=Release)](https://github.com/KitsunePie/AppErrorsTracking/releases)
[![Blank](https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.fankes.apperrorstracking/total?label=LSPosed%20Repo&logo=Android&style=flat&labelColor=F48FB1&logoColor=ffffff)](https://github.com/Xposed-Modules-Repo/com.fankes.apperrorstracking/releases)
<br/><br/>
[![GitHub license](https://img.shields.io/github/license/KitsunePie/AppErrorsTracking?color=blue)](https://github.com/KitsunePie/AppErrorsTracking/blob/master/LICENSE)
[![GitHub CI](https://img.shields.io/github/actions/workflow/status/KitsunePie/AppErrorsTracking/commit_ci.yml?label=CI%20builds)](https://github.com/KitsunePie/AppErrorsTracking/actions/workflows/commit_ci.yml)
[![GitHub release](https://img.shields.io/github/v/release/KitsunePie/AppErrorsTracking?display_name=release&logo=github&color=green)](https://github.com/KitsunePie/AppErrorsTracking/releases)
![GitHub all releases](https://img.shields.io/github/downloads/KitsunePie/AppErrorsTracking/total?label=downloads)
![GitHub all releases](https://img.shields.io/github/downloads/Xposed-Modules-Repo/com.fankes.apperrorstracking/total?label=LSPosed%20downloads&labelColor=F48FB1)
[![Telegram CI](https://img.shields.io/badge/CI%20builds-Telegram-blue.svg?logo=telegram)](https://t.me/AppErrorsTracking_CI)
[![Telegram](https://img.shields.io/badge/discussion-Telegram-blue.svg?logo=telegram)](https://t.me/XiaofangInternet)
[![QQ](https://img.shields.io/badge/discussion-QQ-blue.svg?logo=tencent-qq&logoColor=red)](https://qm.qq.com/cgi-bin/qm/qr?k=dp2h5YhWiga9WWb_Oh7kSHmx01X8I8ii&jump_from=webapi&authKey=Za5CaFP0lk7+Zgsk2KpoBD7sSaYbeXbsDgFjiWelOeH4VSionpxFJ7V0qQBSqvFM)
[![QQ 频道](https://img.shields.io/badge/discussion-QQ%20频道-blue.svg?logo=tencent-qq&logoColor=red)](https://pd.qq.com/s/44gcy28h)
<img src="https://github.com/KitsunePie/AppErrorsTracking/blob/master/img-src/icon.png?raw=true" width = "100" height = "100" alt="LOGO"/>
English | [简体中文](https://github.com/KitsunePie/AppErrorsTracking/blob/master/README-zh-CN.md)
Added more features to app's errors dialog, fixed custom rom deleted dialog, the best experience to Android developer.
This project is an Xposed module that can be used in any Android system, currently only tested in **LSPosed**.
This project is a Xposed Module that can be used in any Android system, currently only tested in **LSPosed**.
This module is specially designed for Android developers.
This Xposed Module is specially designed for Android developers.
When it is possible that the computer cannot be connected and ADB cannot be performed, this module can be used to quickly capture any exception
of any installed apps, so as to quickly locate the problem.
When it is possible that the computer cannot be connected and ADB cannot be performed, this module can be used to quickly capture any errors of
any installed apps, to quickly locate the problem.
The error log of apps crashing is an invaluable asset for developers. If you are not a developer, you can still install this module to provide
developers with more exception information to quickly solve problems.
> Minimum support Android 8.1
**应用异常跟踪**
为原生 FC 对话框增加更多功能并修复国内定制 ROM 删除 FC 对话框的问题,给 Android 开发者带来更好的体验。
此项目为 Xposed 模块,可用在任何 Android 系统中,目前仅在 **LSPosed** 中测试通过。
此模块专为 Android 开发者而打造。
在可能的无法连接电脑,不能进行 ADB 调试的时候,可通过此模块来快速捕获任意已安装应用的任意异常,以便快速定位问题。
应用发生崩溃的错误日志对开发者来说是无价的财富,若你不是开发者,你依然可以安装此模块,以便给开发者提供更多异常信息快速解决问题。
> 最低支持 Android 8.1
> Minimum support Android 7.0
## Project Reason
@@ -42,12 +37,6 @@ dialog) of apps crashes. I thought this was always a feature until I decompiled
Does the product manager think that it is the best solution to let the user not see the error, and the apps will crash and exit directly, or is
there another **hidden secret**?
**项目缘由**
我实在是不能理解,国内 ROM 除了 MIUI(稳定版除外) 都选择了删除应用程序崩溃的对话框(FC 对话框),我曾以为这一直是一个特性,直到我去反编译了系统框架,才确认确实是被删掉了。
难道产品经理认为,让用户看不到错误,应用直接闪退,逃避就是最好的解决方案吗,还是说**另有隐情**呢?
## Woking Principle
Unlike `Thread.UncaughtExceptionHandler`, we use the native method to capture apps errors in all directions by injecting the system framework,
@@ -55,55 +44,69 @@ without generating additional registration monitoring, which is better than the
At the same time, the system-level exception capture can also capture the `stack trace` of the native platform.
**工作原理**
## Precautions
不同于 `Thread.UncaughtExceptionHandler`,我们通过注入系统框架,使用原生方式全方位捕获应用异常,不会产生额外的注册监听,在性能上相比原始的异常监听会更好。
The errors captured by the system natively can only be errors that are not handled by the apps itself. If the apps itself has a
custom `Thread.UncaughtExceptionHandler`
Similar to **Bugly** to automatically collect errors, the system cannot obtain whether the apps actually crashes **(FC)**.
同时系统级别的异常捕获还可捕获原生层的 `stack trace`
## Features List
## Feature
- [x] Completely replaces the system's apps errors dialog
- Completely replaces the system's apps errors dialog
- [x] Logs exceptions for each app and persists until restart
- Logs exceptions for each apps and persists until restart
- [x] Copy, share, export errors stack trace functions
- Copy, share, export errors stack trace functions
- [x] Errors history record function,
which can be entered through the notification bar tile "errors history record" and the main interface of the module
- Errors history record function, which can be entered through the notification bar tile "errors history record" and the main interface of the
module
- [x] Apps errors statistics function
- Apps errors statistics function
- [x] Errors display function for multi-process apps
- Errors display function for multi-process apps
**功能**
- 完全取代系统的应用错误对话框
- 记录每个应用的异常,直到重新启动前持续保留
- 复制、分享、导出异常堆栈功能
- 异常历史记录功能,可通过通知栏磁贴“异常历史记录”进入和模块主界面进入
- 应用异常统计功能
- 多进程应用的异常显示功能
## Translation contribution
## Translation Contribution
Contributions to this project are welcome to translate it into your country's language.
**翻译贡献**
## Release Channel
欢迎为此项目做出贡献,将其翻译为您国家的语言。
| <img src="https://avatars.githubusercontent.com/in/15368?s=64&v=4" width = "30" height = "30" alt="LOGO"/> | [GitHub CI](https://github.com/KitsunePie/AppErrorsTracking/actions/workflows/commit_ci.yml) | CI automatic build (test version) |
|------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------|-----------------------------------|
| <img src="https://github.com/peter-iakovlev/Telegram/blob/public/Icon.png?raw=true" width = "30" height = "30" alt="LOGO"/> | [Telegram CI Channel](https://t.me/AppErrorsTracking_CI) | CI automatic build (test version) |
|-----------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------|-----------------------------------|
| <img src="https://avatars.githubusercontent.com/in/15368?s=64&v=4" width = "30" height = "30" alt="LOGO"/> | [GitHub Releases](https://github.com/KitsunePie/AppErrorsTracking/releases) | Formal edition (stable version) |
|------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|---------------------------------|
| <img src="https://avatars.githubusercontent.com/u/78217009?s=200&v=4?raw=true" width = "30" height = "30" alt="LOGO"/> | [Xposed-Modules-Repo](https://github.com/Xposed-Modules-Repo/com.fankes.apperrorstracking/releases) | Formal edition (stable version) |
|------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|---------------------------------|
The releases of this Xposed Module is limited to the urls listed above.
We have nothing to do with versions downloaded from other informal channels or any impact on you.
## Promotion
If you are looking for a Gradle plugin that can automatically manage Gradle project dependencies,
you can check out the [SweetDependency](https://github.com/HighCapable/SweetDependency) project.
If you are looking for a Gradle plugin that can automatically generate properties key-values,
you can check out the [SweetProperty](https://github.com/HighCapable/SweetProperty) project.
This project also uses **SweetDependency** and **SweetProperty**.
## Star History
![Star History Chart](https://api.star-history.com/svg?repos=KitsunePie/AppErrorsTracking&type=Date)
## License
- [AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.html)
```
Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
@@ -116,9 +119,9 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
along with this program. If not, see <https://www.gnu.org/licenses/>.
```
Powered by [YukiHookAPI](https://github.com/fankes/YukiHookAPI)
Powered by [YukiHookAPI](https://github.com/HighCapable/YukiHookAPI)
版权所有 © 2019-2022 Fankes Studio(qzmmcn@163.com)
Copyright © 2017-2023 Fankes Studio(qzmmcn@163.com)

15
app/.gitignore vendored
View File

@@ -1,15 +0,0 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

View File

@@ -1,72 +0,0 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
id 'com.google.devtools.ksp' version '1.7.0-1.0.6'
}
android {
namespace 'com.fankes.apperrorstracking'
compileSdk 32
signingConfigs {
debug {
storeFile file('../keystore/public')
storePassword '123456'
keyAlias 'public'
keyPassword '123456'
v1SigningEnabled true
v2SigningEnabled true
}
}
defaultConfig {
applicationId "com.fankes.apperrorstracking"
minSdk 27
targetSdk 32
versionCode rootProject.ext.appVersionCode
versionName rootProject.ext.appVersionName
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled rootProject.ext.enableR8
shrinkResources rootProject.ext.enableR8
zipAlignEnabled rootProject.ext.enableR8
signingConfig signingConfigs.debug
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'
]
}
buildFeatures {
viewBinding true
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
compileOnly 'de.robv.android.xposed:api:82'
implementation 'com.highcapable.yukihookapi:api:1.0.92'
ksp 'com.highcapable.yukihookapi:ksp-xposed:1.0.92'
implementation "com.github.topjohnwu.libsu:core:3.1.2"
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

View File

@@ -1,42 +0,0 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings
-optimizationpasses 10
-dontusemixedcaseclassnames
-dontoptimize
-verbose
-overloadaggressively
-allowaccessmodification
-adaptclassstrings
-adaptresourcefilenames
-adaptresourcefilecontents
-renamesourcefileattribute P
-keepattributes SourceFile,LineNumberTable
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static *** throwUninitializedProperty(...);
public static *** throwUninitializedPropertyAccessException(...);
}
-keep class com.fankes.apperrorstracking.databinding**{*;}

View File

@@ -1 +0,0 @@
com.fankes.apperrorstracking.hook.AppErrorsTracking

View File

@@ -1 +0,0 @@
com.fankes.apperrorstracking.hook.HookEntry

View File

@@ -1,147 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
*/
package com.fankes.apperrorstracking.bean
import android.app.ApplicationErrorReport
import android.os.Build
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.utils.factory.difference
import java.io.Serializable
import java.text.SimpleDateFormat
import java.util.*
/**
* 应用异常信息 bean
* @param packageName 包名
* @param isNativeCrash 是否为原生层异常
* @param exceptionClassName 异常类名
* @param exceptionMessage 异常信息
* @param throwClassName 抛出异常的类名
* @param throwFileName 抛出异常的文件名
* @param throwMethodName 抛出异常的方法名
* @param throwLineNumber 抛出异常的行号
* @param stackTrace 异常堆栈
* @param timestamp 记录时间戳
*/
data class AppErrorsInfoBean(
var packageName: String,
var isNativeCrash: Boolean,
var exceptionClassName: String,
var exceptionMessage: String,
var throwFileName: String,
var throwClassName: String,
var throwMethodName: String,
var throwLineNumber: Int,
var stackTrace: String,
var timestamp: Long,
) : Serializable {
companion object {
/**
* 从 [ApplicationErrorReport.CrashInfo] 克隆
* @param packageName APP 包名
* @param crashInfo [ApplicationErrorReport.CrashInfo]
* @return [AppErrorsInfoBean]
*/
fun clone(packageName: String?, crashInfo: ApplicationErrorReport.CrashInfo?) =
(crashInfo?.exceptionClassName?.lowercase() == "native crash").let { isNativeCrash ->
AppErrorsInfoBean(
packageName = packageName ?: "null",
isNativeCrash = isNativeCrash,
exceptionClassName = crashInfo?.exceptionClassName ?: "null",
exceptionMessage = if (isNativeCrash) crashInfo?.stackTrace.let {
if (it?.contains(other = "Abort message: '") == true)
runCatching { it.split("Abort message: '")[1].split("'")[0] }.getOrNull()
?: crashInfo?.exceptionMessage ?: "null"
else crashInfo?.exceptionMessage ?: "null"
} else crashInfo?.exceptionMessage ?: "null",
throwFileName = crashInfo?.throwFileName ?: "null",
throwClassName = crashInfo?.throwClassName ?: "null",
throwMethodName = crashInfo?.throwMethodName ?: "null",
throwLineNumber = crashInfo?.throwLineNumber ?: -1,
stackTrace = crashInfo?.stackTrace?.trim() ?: "null",
timestamp = System.currentTimeMillis()
)
}
}
/**
* 获取异常本地化经过时间
* @return [String]
*/
val crossTime
get() = timestamp.difference(
now = LocaleString.momentAgo,
second = LocaleString.secondAgo,
minute = LocaleString.minuteAgo,
hour = LocaleString.hourAgo,
day = LocaleString.dayAgo,
month = LocaleString.monthAgo,
year = LocaleString.yearAgo
)
/**
* 获取异常本地化量化时间
* @return [String]
*/
val dateTime get() = SimpleDateFormat.getDateTimeInstance().format(Date(timestamp)) ?: "DateTime not found"
/**
* 获取异常堆栈分享模板
* @return [String]
*/
val stackOutputShareContent
get() = "Generated by AppErrorsTracking\n" +
"Project Url: https://github.com/KitsunePie/AppErrorsTracking\n" +
"===============\n" +
"[Device Brand]: ${Build.BRAND}\n" +
"[Device Model]: ${Build.MODEL}\n" +
"[Display]: ${Build.DISPLAY}\n" +
"[Android Version]: ${Build.VERSION.RELEASE}\n" +
"[API Version]: ${Build.VERSION.SDK_INT}\n" +
"[Package Name]: $packageName\n" +
"[Error Type]: ${if (isNativeCrash) "Native" else "Jvm"}\n" +
"[Crash Time]: $dateTime\n" +
"[Stack Trace]:\n" +
stackTrace
/**
* 获取异常堆栈文件模板
* @return [String]
*/
val stackOutputFileContent
get() = "================================================================\n" +
" Generated by AppErrorsTracking\n" +
" Project Url: https://github.com/KitsunePie/AppErrorsTracking\n" +
"================================================================\n" +
"[Device Brand]: ${Build.BRAND}\n" +
"[Device Model]: ${Build.MODEL}\n" +
"[Display]: ${Build.DISPLAY}\n" +
"[Android Version]: ${Build.VERSION.RELEASE}\n" +
"[API Version]: ${Build.VERSION.SDK_INT}\n" +
"[Package Name]: $packageName\n" +
"[Error Type]: ${if (isNativeCrash) "Native" else "Jvm"}\n" +
"[Crash Time]: $dateTime\n" +
"[Stack Trace]:\n" +
stackTrace
}

View File

@@ -1,35 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/14.
*/
package com.fankes.apperrorstracking.data
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
object DataConst {
val SHOW_DEVELOPER_NOTICE = PrefsData("_show_developer_notice", true)
val ENABLE_HIDE_ICON = PrefsData("_hide_icon", false)
val ENABLE_ONLY_SHOW_ERRORS_IN_FRONT = PrefsData("_enable_only_show_errors_in_front", false)
val ENABLE_ONLY_SHOW_ERRORS_IN_MAIN = PrefsData("_enable_only_show_errors_in_main", false)
val ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS = PrefsData("_enable_always_shows_reopen_app_options", false)
val ENABLE_APP_CONFIG_TEMPLATE = PrefsData("_enable_app_config_template", false)
}

View File

@@ -1,309 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
@file:Suppress("UseCompatLoadingForDrawables")
package com.fankes.apperrorstracking.hook.entity
import android.app.Dialog
import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.os.Build
import android.os.Message
import androidx.core.graphics.drawable.IconCompat
import androidx.core.graphics.drawable.toBitmap
import com.fankes.apperrorstracking.BuildConfig
import com.fankes.apperrorstracking.R
import com.fankes.apperrorstracking.bean.AppErrorsDisplayBean
import com.fankes.apperrorstracking.bean.AppErrorsInfoBean
import com.fankes.apperrorstracking.bean.AppInfoBean
import com.fankes.apperrorstracking.bean.MutedErrorsAppBean
import com.fankes.apperrorstracking.data.DataConst
import com.fankes.apperrorstracking.hook.factory.isAppShowErrorsNotify
import com.fankes.apperrorstracking.hook.factory.isAppShowErrorsToast
import com.fankes.apperrorstracking.hook.factory.isAppShowNothing
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.ui.activity.errors.AppErrorsDisplayActivity
import com.fankes.apperrorstracking.ui.activity.errors.AppErrorsRecordActivity
import com.fankes.apperrorstracking.utils.factory.*
import com.fankes.apperrorstracking.utils.tool.FrameworkTool
import com.highcapable.yukihookapi.hook.bean.VariousClass
import com.highcapable.yukihookapi.hook.entity.YukiBaseHooker
import com.highcapable.yukihookapi.hook.factory.field
import com.highcapable.yukihookapi.hook.factory.hasMethod
import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.log.loggerE
import com.highcapable.yukihookapi.hook.type.android.BundleClass
import com.highcapable.yukihookapi.hook.type.android.MessageClass
object FrameworkHooker : YukiBaseHooker() {
private const val ActivityManagerServiceClass = "com.android.server.am.ActivityManagerService"
private const val UserControllerClass = "com.android.server.am.UserController"
private const val AppErrorsClass = "com.android.server.am.AppErrors"
private const val AppErrorDialogClass = "com.android.server.am.AppErrorDialog"
private const val AppErrorDialog_DataClass = "com.android.server.am.AppErrorDialog\$Data"
private const val ProcessRecordClass = "com.android.server.am.ProcessRecord"
private const val ActivityTaskManagerService_LocalServiceClass = "com.android.server.wm.ActivityTaskManagerService\$LocalService"
private val PackageListClass = VariousClass(
"com.android.server.am.ProcessRecord\$PackageList",
"com.android.server.am.PackageList"
)
private val ErrorDialogControllerClass = VariousClass(
"com.android.server.am.ProcessRecord\$ErrorDialogController",
"com.android.server.am.ErrorDialogController"
)
/** 已忽略错误的 APP 数组 - 直到重新解锁 */
private var mutedErrorsIfUnlockApps = HashSet<String>()
/** 已忽略错误的 APP 数组 - 直到重新启动 */
private var mutedErrorsIfRestartApps = HashSet<String>()
/** 已记录的 APP 异常信息数组 - 直到重新启动 */
private val appErrorsRecords = ArrayList<AppErrorsInfoBean>()
/** 注册 */
private fun register() {
onAppLifecycle {
/** 解锁后清空已记录的忽略错误 APP */
registerReceiver(Intent.ACTION_USER_PRESENT) { _, _ -> mutedErrorsIfUnlockApps.clear() }
/** 刷新模块 Resources 缓存 */
registerReceiver(Intent.ACTION_LOCALE_CHANGED) { _, _ -> refreshModuleAppResources() }
}
FrameworkTool.Host.with(instance = this) {
onOpenAppUsedFramework { appContext.openApp(it) }
onPushAppErrorsInfoData { appErrorsRecords }
onRemoveAppErrorsInfoData { appErrorsRecords.remove(it) }
onClearAppErrorsInfoData { appErrorsRecords.clear() }
onMutedErrorsIfUnlock { mutedErrorsIfUnlockApps.add(it) }
onMutedErrorsIfRestart { mutedErrorsIfRestartApps.add(it) }
onPushMutedErrorsAppsData {
arrayListOf<MutedErrorsAppBean>().apply {
mutedErrorsIfUnlockApps.takeIf { it.isNotEmpty() }
?.forEach { add(MutedErrorsAppBean(MutedErrorsAppBean.MuteType.UNTIL_UNLOCKS, it)) }
mutedErrorsIfRestartApps.takeIf { it.isNotEmpty() }
?.forEach { add(MutedErrorsAppBean(MutedErrorsAppBean.MuteType.UNTIL_REBOOTS, it)) }
}
}
onUnmuteErrorsApp {
when (it.type) {
MutedErrorsAppBean.MuteType.UNTIL_UNLOCKS -> mutedErrorsIfUnlockApps.remove(it.packageName)
MutedErrorsAppBean.MuteType.UNTIL_REBOOTS -> mutedErrorsIfRestartApps.remove(it.packageName)
}
}
onUnmuteAllErrorsApps {
mutedErrorsIfUnlockApps.clear()
mutedErrorsIfRestartApps.clear()
}
onPushAppListData { filters ->
arrayListOf<AppInfoBean>().apply {
appContext.packageManager.getInstalledPackages(PackageManager.GET_CONFIGURATIONS).also { info ->
(if (filters.name.isNotBlank())
info.filter { it.packageName.contains(filters.name) || appContext.appName(it.packageName).contains(filters.name) }
else info).let { result ->
if (filters.isContainsSystem.not()) result.filter { (it.applicationInfo.flags and ApplicationInfo.FLAG_SYSTEM) == 0 }
else result
}.sortedByDescending { it.lastUpdateTime }
.forEach { add(AppInfoBean(name = appContext.appName(it.packageName), packageName = it.packageName)) }
/** 移除模块自身 */
removeIf { it.packageName == BuildConfig.APPLICATION_ID }
}
}
}
}
}
override fun onHook() {
/** 注册 */
register()
/** 干掉原生错误对话框 - 如果有 */
ErrorDialogControllerClass.hook {
injectMember {
method {
name = "hasCrashDialogs"
emptyParam()
}
replaceToTrue()
}
injectMember {
method {
name = "showCrashDialogs"
paramCount = 1
}
intercept()
}
}.ignoredHookClassNotFoundFailure()
/** 干掉原生错误对话框 - API 30 以下 */
ActivityTaskManagerService_LocalServiceClass.hook {
injectMember {
method {
name = "canShowErrorDialogs"
emptyParam()
}
replaceToFalse()
}
}.by { Build.VERSION.SDK_INT <= Build.VERSION_CODES.Q }
/** 干掉原生错误对话框 - 如果上述方法全部失效则直接结束对话框 */
AppErrorDialogClass.hook {
injectMember {
method {
name = "onCreate"
param(BundleClass)
}
afterHook { instance<Dialog>().cancel() }
}
}
/** 注入自定义错误对话框 */
AppErrorsClass.hook {
injectMember {
method {
name = "handleShowAppErrorUi"
param(MessageClass)
}
afterHook {
/** 当前实例 */
val context = field { name = "mContext" }.get(instance).cast<Context>() ?: return@afterHook
/** 错误数据 */
val errData = args().first().cast<Message>()?.obj
/** 当前进程信息 */
val proc = AppErrorDialog_DataClass.clazz.field { name = "proc" }.get(errData).any()
/** 当前 UserId 信息 */
val userId = ProcessRecordClass.clazz.field { name = "userId" }.get(proc).int()
/** 当前 APP 信息 */
val appInfo = ProcessRecordClass.clazz.field { name = "info" }.get(proc).cast<ApplicationInfo>()
/** 当前进程名称 */
val processName = ProcessRecordClass.clazz.field { name = "processName" }.get(proc).string()
/** 当前 APP、进程 包名 */
val packageName = appInfo?.packageName ?: processName
/** 当前 APP 名称 */
val appName = appInfo?.let { context.appName(it.packageName) } ?: packageName
/** 是否为 APP */
val isApp = (PackageListClass.clazz.method {
name = "size"
emptyParam()
}.get(if (ProcessRecordClass.clazz.hasMethod {
name = "getPkgList"
emptyParam()
}) ProcessRecordClass.clazz.method {
name = "getPkgList"
emptyParam()
}.get(proc).call() else ProcessRecordClass.clazz.field {
name = "pkgList"
}.get(proc).self).int() == 1 && appInfo != null)
/** 是否为主进程 */
val isMainProcess = packageName == processName
/** 是否为后台进程 */
val isBackgroundProcess = UserControllerClass.clazz.method { name = "getCurrentProfileIds" }
.get(ActivityManagerServiceClass.clazz.field { name = "mUserController" }
.get(field { name = "mService" }.get(instance).any()).any())
.invoke<IntArray>()?.takeIf { it.isNotEmpty() }?.any { it != userId } ?: false
/** 是否短时内重复错误 */
val isRepeating = AppErrorDialog_DataClass.clazz.field { name = "repeating" }.get(errData).boolean()
/** 崩溃标题 */
val errorTitle = if (isRepeating) LocaleString.aerrRepeatedTitle(appName) else LocaleString.aerrTitle(appName)
/** 是否始终显示重新打开按钮 */
val isAlwaysShowsReopenApp = prefs.get(DataConst.ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS)
/** 打印错误日志 */
if (isApp) loggerE(
msg = "App \"$packageName\"${if (packageName != processName) " --process \"$processName\"" else ""}" +
" has crashed${if (isRepeating) " again" else ""}"
) else loggerE(msg = "Process \"$processName\" has crashed${if (isRepeating) " again" else ""}")
/** 判断是否为模块自身崩溃 */
if (packageName == BuildConfig.APPLICATION_ID) {
context.toast(msg = "AppErrorsTracking has crashed, please see the log in console")
return@afterHook
}
/** 判断是否为已忽略的 APP */
if (mutedErrorsIfUnlockApps.contains(packageName) || mutedErrorsIfRestartApps.contains(packageName)) return@afterHook
/** 判断配置模块启用状态 */
if (prefs.get(DataConst.ENABLE_APP_CONFIG_TEMPLATE)) {
if (isAppShowNothing(packageName)) return@afterHook
if (isAppShowErrorsNotify(packageName)) {
context.pushNotify(
channelId = "APPS_ERRORS",
channelName = LocaleString.appName,
title = errorTitle,
content = LocaleString.appErrorsTip,
icon = IconCompat.createWithBitmap(R.mipmap.ic_notify.drawableOf(moduleAppResources).toBitmap()),
color = 0xFFFF6200.toInt(),
intent = AppErrorsRecordActivity.intent()
)
return@afterHook
}
if (isAppShowErrorsToast(packageName)) {
context.toast(errorTitle)
return@afterHook
}
}
/** 判断是否为后台进程 */
if ((isBackgroundProcess || context.isAppCanOpened(packageName).not())
&& prefs.get(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_FRONT)
) return@afterHook
/** 判断是否为主进程 */
if (isMainProcess.not() && prefs.get(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_MAIN)) return@afterHook
/** 启动错误对话框显示窗口 */
AppErrorsDisplayActivity.start(
context, AppErrorsDisplayBean(
packageName = packageName,
processName = processName,
appName = appName,
title = errorTitle,
isShowAppInfoButton = isApp,
isShowReopenButton = isApp && (isRepeating.not() || isAlwaysShowsReopenApp)
&& context.isAppCanOpened(packageName) && isMainProcess,
isShowCloseAppButton = isApp
)
)
}
}
injectMember {
method {
name = "crashApplication"
paramCount = 2
}
afterHook {
/** 当前 APP 信息 */
val appInfo = ProcessRecordClass.clazz.field { name = "info" }.get(args().first().any()).cast<ApplicationInfo>()
/** 添加当前异常信息到第一位 */
appErrorsRecords.add(0, AppErrorsInfoBean.clone(appInfo?.packageName, args().last().cast()))
}
}
}
}
}

View File

@@ -1,104 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/6/8.
*/
@file:Suppress("unused")
package com.fankes.apperrorstracking.hook.factory
import android.content.Context
import com.highcapable.yukihookapi.hook.factory.modulePrefs
import com.highcapable.yukihookapi.hook.param.PackageParam
/**
* 获取此 APP 是否配置显示错误对话框
* @param packageName APP 包名
*/
fun PackageParam.isAppShowErrorsDialog(packageName: String) = prefs.getBoolean("${packageName}_show_errors_dialog", true)
/**
* 获取此 APP 是否配置显示错误通知推送
* @param packageName APP 包名
*/
fun PackageParam.isAppShowErrorsNotify(packageName: String) = prefs.getBoolean("${packageName}_show_errors_notify", false)
/**
* 获取此 APP 是否配置显示错误 Toast 提示
* @param packageName APP 包名
*/
fun PackageParam.isAppShowErrorsToast(packageName: String) = prefs.getBoolean("${packageName}_show_errors_toast", false)
/**
* 获取此 APP 是否配置不显示任何提示
* @param packageName APP 包名
*/
fun PackageParam.isAppShowNothing(packageName: String) = prefs.getBoolean("${packageName}_show_nothing", false)
/**
* 获取此 APP 是否配置显示错误对话框
* @param packageName APP 包名
*/
fun Context.isAppShowErrorsDialog(packageName: String) = modulePrefs.getBoolean("${packageName}_show_errors_dialog", true)
/**
* 获取此 APP 是否配置显示错误通知推送
* @param packageName APP 包名
*/
fun Context.isAppShowErrorsNotify(packageName: String) = modulePrefs.getBoolean("${packageName}_show_errors_notify", false)
/**
* 获取此 APP 是否配置显示错误 Toast 提示
* @param packageName APP 包名
*/
fun Context.isAppShowErrorsToast(packageName: String) = modulePrefs.getBoolean("${packageName}_show_errors_toast", false)
/**
* 获取此 APP 是否配置不显示任何提示
* @param packageName APP 包名
*/
fun Context.isAppShowNothing(packageName: String) = modulePrefs.getBoolean("${packageName}_show_nothing", false)
/**
* 设置此 APP 是否配置显示错误对话框
* @param packageName APP 包名
* @param isApply 是否设置
*/
fun Context.putAppShowErrorsDialog(packageName: String, isApply: Boolean) = modulePrefs.putBoolean("${packageName}_show_errors_dialog", isApply)
/**
* 设置此 APP 是否配置显示错误通知推送
* @param packageName APP 包名
* @param isApply 是否设置
*/
fun Context.putAppShowErrorsNotify(packageName: String, isApply: Boolean) = modulePrefs.putBoolean("${packageName}_show_errors_notify", isApply)
/**
* 设置此 APP 是否配置显示错误 Toast 提示
* @param packageName APP 包名
* @param isApply 是否设置
*/
fun Context.putAppShowErrorsToast(packageName: String, isApply: Boolean) = modulePrefs.putBoolean("${packageName}_show_errors_toast", isApply)
/**
* 设置此 APP 是否配置不显示任何提示
* @param packageName APP 包名
* @param isApply 是否设置
*/
fun Context.putAppShowNothing(packageName: String, isApply: Boolean) = modulePrefs.putBoolean("${packageName}_show_nothing", isApply)

View File

@@ -1,457 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/11.
*/
@file:Suppress("MemberVisibilityCanBePrivate", "StaticFieldLeak", "unused")
package com.fankes.apperrorstracking.locale
import android.content.Context
import android.content.res.Resources
import com.fankes.apperrorstracking.R
import com.highcapable.yukihookapi.hook.param.PackageParam
/**
* I18n 字符串实例
*/
object LocaleString {
/** 当前的 [Context] */
private var baseContext: Context? = null
/** 当前的 [PackageParam] */
private var basePackageParam: PackageParam? = null
/** 当前的 [Resources] */
private var baseResources: Resources? = null
/**
* 当前的 [Resources]
* @return [Resources]
* @throws IllegalStateException 如果 [LocaleString] 没有被绑定
*/
private val resources
get() = baseContext?.resources ?: basePackageParam?.moduleAppResources ?: baseResources
?: error("LocaleString must bind an instance first")
/**
* 绑定并初始化
* @param instance 可以是 [Context]、[PackageParam]、[Resources]
*/
fun bind(instance: Any) {
when (instance) {
is Context -> baseContext = instance
is PackageParam -> basePackageParam = instance
is Resources -> baseResources = instance
else -> error("LocaleString bind an unknown instance")
}
}
/**
* 根据资源 Id 获取字符串
* @param objArrs 格式化实例
* @return [String]
*/
private fun Int.bind(vararg objArrs: Any) = resources.getString(this, *objArrs)
/** @string Automatic generated */
val appName get() = appName()
/** @string Automatic generated */
fun appName(vararg objArrs: Any) = R.string.app_name.bind(*objArrs)
/** @string Automatic generated */
val copied get() = copied()
/** @string Automatic generated */
fun copied(vararg objArrs: Any) = R.string.copied.bind(*objArrs)
/** @string Automatic generated */
val copyFail get() = copyFail()
/** @string Automatic generated */
fun copyFail(vararg objArrs: Any) = R.string.copy_fail.bind(*objArrs)
/** @string Automatic generated */
val printToLogcatSuccess get() = printToLogcatSuccess()
/** @string Automatic generated */
fun printToLogcatSuccess(vararg objArrs: Any) = R.string.print_to_logcat_success.bind(*objArrs)
/** @string Automatic generated */
val outputStackSuccess get() = outputStackSuccess()
/** @string Automatic generated */
fun outputStackSuccess(vararg objArrs: Any) = R.string.output_stack_success.bind(*objArrs)
/** @string Automatic generated */
val outputStackFail get() = outputStackFail()
/** @string Automatic generated */
fun outputStackFail(vararg objArrs: Any) = R.string.output_stack_fail.bind(*objArrs)
/** @string Automatic generated */
val aerrTitle get() = aerrTitle()
/** @string Automatic generated */
fun aerrTitle(vararg objArrs: Any) = R.string.aerr_title.bind(*objArrs)
/** @string Automatic generated */
val aerrRepeatedTitle get() = aerrRepeatedTitle()
/** @string Automatic generated */
fun aerrRepeatedTitle(vararg objArrs: Any) = R.string.aerr_repeated_title.bind(*objArrs)
/** @string Automatic generated */
val appInfo get() = appInfo()
/** @string Automatic generated */
fun appInfo(vararg objArrs: Any) = R.string.app_info.bind(*objArrs)
/** @string Automatic generated */
val closeApp get() = closeApp()
/** @string Automatic generated */
fun closeApp(vararg objArrs: Any) = R.string.close_app.bind(*objArrs)
/** @string Automatic generated */
val reopenApp get() = reopenApp()
/** @string Automatic generated */
fun reopenApp(vararg objArrs: Any) = R.string.reopen_app.bind(*objArrs)
/** @string Automatic generated */
val errorDetail get() = errorDetail()
/** @string Automatic generated */
fun errorDetail(vararg objArrs: Any) = R.string.error_detail.bind(*objArrs)
/** @string Automatic generated */
val muteIfUnlock get() = muteIfUnlock()
/** @string Automatic generated */
fun muteIfUnlock(vararg objArrs: Any) = R.string.mute_if_unlock.bind(*objArrs)
/** @string Automatic generated */
val muteIfRestart get() = muteIfRestart()
/** @string Automatic generated */
fun muteIfRestart(vararg objArrs: Any) = R.string.mute_if_restart.bind(*objArrs)
/** @string Automatic generated */
val muteIfUnlockTip get() = muteIfUnlockTip()
/** @string Automatic generated */
fun muteIfUnlockTip(vararg objArrs: Any) = R.string.mute_if_unlock_tip.bind(*objArrs)
/** @string Automatic generated */
val muteIfRestartTip get() = muteIfRestartTip()
/** @string Automatic generated */
fun muteIfRestartTip(vararg objArrs: Any) = R.string.mute_if_restart_tip.bind(*objArrs)
/** @string Automatic generated */
val confirm get() = confirm()
/** @string Automatic generated */
fun confirm(vararg objArrs: Any) = R.string.confirm.bind(*objArrs)
/** @string Automatic generated */
val cancel get() = cancel()
/** @string Automatic generated */
fun cancel(vararg objArrs: Any) = R.string.cancel.bind(*objArrs)
/** @string Automatic generated */
val more get() = more()
/** @string Automatic generated */
fun more(vararg objArrs: Any) = R.string.more.bind(*objArrs)
/** @string Automatic generated */
val notice get() = notice()
/** @string Automatic generated */
fun notice(vararg objArrs: Any) = R.string.notice.bind(*objArrs)
/** @string Automatic generated */
val areYouSureClearErrors get() = areYouSureClearErrors()
/** @string Automatic generated */
fun areYouSureClearErrors(vararg objArrs: Any) = R.string.are_you_sure_clear_errors.bind(*objArrs)
/** @string Automatic generated */
val allErrorsClearSuccess get() = allErrorsClearSuccess()
/** @string Automatic generated */
fun allErrorsClearSuccess(vararg objArrs: Any) = R.string.all_errors_clear_success.bind(*objArrs)
/** @string Automatic generated */
val areYouSureExportAllErrors get() = areYouSureExportAllErrors()
/** @string Automatic generated */
fun areYouSureExportAllErrors(vararg objArrs: Any) = R.string.are_you_sure_export_all_errors.bind(*objArrs)
/** @string Automatic generated */
val exportAllErrorsSuccess get() = exportAllErrorsSuccess()
/** @string Automatic generated */
fun exportAllErrorsSuccess(vararg objArrs: Any) = R.string.export_all_errors_success.bind(*objArrs)
/** @string Automatic generated */
val exportAllErrorsFail get() = exportAllErrorsFail()
/** @string Automatic generated */
fun exportAllErrorsFail(vararg objArrs: Any) = R.string.export_all_errors_fail.bind(*objArrs)
/** @string Automatic generated */
val noCpuAbi get() = noCpuAbi()
/** @string Automatic generated */
fun noCpuAbi(vararg objArrs: Any) = R.string.no_cpu_abi.bind(*objArrs)
/** @string Automatic generated */
val areYouSureRemoveRecord get() = areYouSureRemoveRecord()
/** @string Automatic generated */
fun areYouSureRemoveRecord(vararg objArrs: Any) = R.string.are_you_sure_remove_record.bind(*objArrs)
/** @string Automatic generated */
val gotIt get() = gotIt()
/** @string Automatic generated */
fun gotIt(vararg objArrs: Any) = R.string.got_it.bind(*objArrs)
/** @string Automatic generated */
val moduleVersion get() = moduleVersion()
/** @string Automatic generated */
fun moduleVersion(vararg objArrs: Any) = R.string.module_version.bind(*objArrs)
/** @string Automatic generated */
val systemVersion get() = systemVersion()
/** @string Automatic generated */
fun systemVersion(vararg objArrs: Any) = R.string.system_version.bind(*objArrs)
/** @string Automatic generated */
val areYouSureRestartSystem get() = areYouSureRestartSystem()
/** @string Automatic generated */
fun areYouSureRestartSystem(vararg objArrs: Any) = R.string.are_your_sure_restart_system.bind(*objArrs)
/** @string Automatic generated */
val fastRestart get() = fastRestart()
/** @string Automatic generated */
fun fastRestart(vararg objArrs: Any) = R.string.fast_restart.bind(*objArrs)
/** @string Automatic generated */
val accessRootFail get() = accessRootFail()
/** @string Automatic generated */
fun accessRootFail(vararg objArrs: Any) = R.string.access_root_fail.bind(*objArrs)
/** @string Automatic generated */
val moduleNotActivated get() = moduleNotActivated()
/** @string Automatic generated */
fun moduleNotActivated(vararg objArrs: Any) = R.string.module_not_activated.bind(*objArrs)
/** @string Automatic generated */
val moduleIsActivated get() = moduleIsActivated()
/** @string Automatic generated */
fun moduleIsActivated(vararg objArrs: Any) = R.string.module_is_activated.bind(*objArrs)
/** @string Automatic generated */
val moduleNotFullyActivated get() = moduleNotFullyActivated()
/** @string Automatic generated */
fun moduleNotFullyActivated(vararg objArrs: Any) = R.string.module_not_fully_activated.bind(*objArrs)
/** @string Automatic generated */
val momentAgo get() = momentAgo()
/** @string Automatic generated */
fun momentAgo(vararg objArrs: Any) = R.string.moment_ago.bind(*objArrs)
/** @string Automatic generated */
val secondAgo get() = secondAgo()
/** @string Automatic generated */
fun secondAgo(vararg objArrs: Any) = R.string.second_ago.bind(*objArrs)
/** @string Automatic generated */
val minuteAgo get() = minuteAgo()
/** @string Automatic generated */
fun minuteAgo(vararg objArrs: Any) = R.string.minute_ago.bind(*objArrs)
/** @string Automatic generated */
val hourAgo get() = hourAgo()
/** @string Automatic generated */
fun hourAgo(vararg objArrs: Any) = R.string.hour_ago.bind(*objArrs)
/** @string Automatic generated */
val dayAgo get() = dayAgo()
/** @string Automatic generated */
fun dayAgo(vararg objArrs: Any) = R.string.day_ago.bind(*objArrs)
/** @string Automatic generated */
val monthAgo get() = monthAgo()
/** @string Automatic generated */
fun monthAgo(vararg objArrs: Any) = R.string.month_ago.bind(*objArrs)
/** @string Automatic generated */
val yearAgo get() = yearAgo()
/** @string Automatic generated */
fun yearAgo(vararg objArrs: Any) = R.string.year_ago.bind(*objArrs)
/** @string Automatic generated */
val crashProcess get() = crashProcess()
/** @string Automatic generated */
fun crashProcess(vararg objArrs: Any) = R.string.crash_process.bind(*objArrs)
/** @string Automatic generated */
val shareErrorStack get() = shareErrorStack()
/** @string Automatic generated */
fun shareErrorStack(vararg objArrs: Any) = R.string.share_error_stack.bind(*objArrs)
/** @string Automatic generated */
val areYouSureUnmuteAll get() = areYouSureUnmuteAll()
/** @string Automatic generated */
fun areYouSureUnmuteAll(vararg objArrs: Any) = R.string.are_you_sure_unmute_all.bind(*objArrs)
/** @string Automatic generated */
val filterByCondition get() = filterByCondition()
/** @string Automatic generated */
fun filterByCondition(vararg objArrs: Any) = R.string.filter_by_condition.bind(*objArrs)
/** @string Automatic generated */
val clearFilters get() = clearFilters()
/** @string Automatic generated */
fun clearFilters(vararg objArrs: Any) = R.string.clear_filters.bind(*objArrs)
/** @string Automatic generated */
val resultCount get() = resultCount()
/** @string Automatic generated */
fun resultCount(vararg objArrs: Any) = R.string.result_count.bind(*objArrs)
/** @string Automatic generated */
val loading get() = loading()
/** @string Automatic generated */
fun loading(vararg objArrs: Any) = R.string.loading.bind(*objArrs)
/** @string Automatic generated */
val showErrorsDialog get() = showErrorsDialog()
/** @string Automatic generated */
fun showErrorsDialog(vararg objArrs: Any) = R.string.show_errors_dialog.bind(*objArrs)
/** @string Automatic generated */
val showErrorsToast get() = showErrorsToast()
/** @string Automatic generated */
fun showErrorsToast(vararg objArrs: Any) = R.string.show_errors_toast.bind(*objArrs)
/** @string Automatic generated */
val showNothing get() = showNothing()
/** @string Automatic generated */
fun showNothing(vararg objArrs: Any) = R.string.show_nothing.bind(*objArrs)
/** @string Automatic generated */
val appErrorsStatistics get() = appErrorsStatistics()
/** @string Automatic generated */
fun appErrorsStatistics(vararg objArrs: Any) = R.string.app_errors_statistics.bind(*objArrs)
/** @string Automatic generated */
val totalErrorsUnit get() = totalErrorsUnit()
/** @string Automatic generated */
fun totalErrorsUnit(vararg objArrs: Any) = R.string.total_errors_unit.bind(*objArrs)
/** @string Automatic generated */
val totalAppsUnit get() = totalAppsUnit()
/** @string Automatic generated */
fun totalAppsUnit(vararg objArrs: Any) = R.string.total_apps_unit.bind(*objArrs)
/** @string Automatic generated */
val generatingStatistics get() = generatingStatistics()
/** @string Automatic generated */
fun generatingStatistics(vararg objArrs: Any) = R.string.generating_statistics.bind(*objArrs)
/** @string Automatic generated */
val moduleNotFullyActivatedTip get() = moduleNotFullyActivatedTip()
/** @string Automatic generated */
fun moduleNotFullyActivatedTip(vararg objArrs: Any) = R.string.module_not_fully_activated_tip.bind(*objArrs)
/** @string Automatic generated */
val showErrorsNotify get() = showErrorsNotify()
/** @string Automatic generated */
fun showErrorsNotify(vararg objArrs: Any) = R.string.show_errors_notify.bind(*objArrs)
/** @string Automatic generated */
val appErrorsTip get() = appErrorsTip()
/** @string Automatic generated */
fun appErrorsTip(vararg objArrs: Any) = R.string.app_errors_tip.bind(*objArrs)
/** @string Automatic generated */
val batchOperations get() = batchOperations()
/** @string Automatic generated */
fun batchOperations(vararg objArrs: Any) = R.string.batch_operations.bind(*objArrs)
/** @string Automatic generated */
val areYouSureApplySiteApps get() = areYouSureApplySiteApps()
/** @string Automatic generated */
fun areYouSureApplySiteApps(vararg objArrs: Any) = R.string.are_you_sure_apply_site_apps.bind(*objArrs)
/** @string Automatic generated */
val developerNoticeTip get() = developerNoticeTip()
/** @string Automatic generated */
fun developerNoticeTip(vararg objArrs: Any) = R.string.developer_notice_tip.bind(*objArrs)
/** @string Automatic generated */
val developerNotice get() = developerNotice()
/** @string Automatic generated */
fun developerNotice(vararg objArrs: Any) = R.string.developer_notice.bind(*objArrs)
}

View File

@@ -1,120 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
@file:Suppress("DEPRECATION", "OVERRIDE_DEPRECATION")
package com.fankes.apperrorstracking.ui.activity.errors
import android.app.Activity
import android.content.Context
import android.content.Intent
import androidx.core.view.isGone
import com.fankes.apperrorstracking.R
import com.fankes.apperrorstracking.bean.AppErrorsInfoBean
import com.fankes.apperrorstracking.databinding.ActivityAppErrorsDetailBinding
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.ui.activity.base.BaseActivity
import com.fankes.apperrorstracking.utils.factory.*
import com.highcapable.yukihookapi.hook.log.loggerE
class AppErrorsDetailActivity : BaseActivity<ActivityAppErrorsDetailBinding>() {
companion object {
/** 请求保存文件回调标识 */
private const val WRITE_REQUEST_CODE = 0
/** [AppErrorsInfoBean] 传值 */
private const val EXTRA_APP_ERRORS_INFO = "app_errors_info_extra"
/**
* 启动 [AppErrorsDetailActivity]
* @param context 实例
* @param appErrorsInfo 应用异常信息
*/
fun start(context: Context, appErrorsInfo: AppErrorsInfoBean) =
context.navigate<AppErrorsDetailActivity> { putExtra(EXTRA_APP_ERRORS_INFO, appErrorsInfo) }
}
/** 预导出的异常堆栈 */
private var stackTrace = ""
override fun onCreate() {
val appErrorsInfo = runCatching { intent?.getSerializableExtra(EXTRA_APP_ERRORS_INFO) as? AppErrorsInfoBean }.getOrNull()
?: return toastAndFinish(name = "AppErrorsInfo")
binding.appInfoItem.setOnClickListener { openSelfSetting(appErrorsInfo.packageName) }
binding.titleBackIcon.setOnClickListener { onBackPressed() }
binding.printIcon.setOnClickListener {
loggerE(msg = appErrorsInfo.stackTrace)
toast(LocaleString.printToLogcatSuccess)
}
binding.copyIcon.setOnClickListener { copyToClipboard(appErrorsInfo.stackOutputShareContent) }
binding.exportIcon.setOnClickListener {
stackTrace = appErrorsInfo.stackOutputFileContent
runCatching {
startActivityForResult(Intent(Intent.ACTION_CREATE_DOCUMENT).apply {
addCategory(Intent.CATEGORY_OPENABLE)
type = "*/application"
putExtra(Intent.EXTRA_TITLE, "${appErrorsInfo.packageName}_${appErrorsInfo.timestamp}.log")
}, WRITE_REQUEST_CODE)
}.onFailure { toast(msg = "Start Android SAF failed") }
}
binding.shareIcon.setOnClickListener {
startActivity(Intent.createChooser(Intent(Intent.ACTION_SEND).apply {
type = "text/plain"
putExtra(Intent.EXTRA_TEXT, appErrorsInfo.stackOutputShareContent)
}, LocaleString.shareErrorStack))
}
binding.appIcon.setImageDrawable(appIcon(appErrorsInfo.packageName))
binding.appNameText.text = appName(appErrorsInfo.packageName)
binding.appVersionText.text = appVersion(appErrorsInfo.packageName)
binding.appAbiText.text = appCpuAbi(appErrorsInfo.packageName).ifBlank { LocaleString.noCpuAbi }
binding.jvmErrorPanel.isGone = appErrorsInfo.isNativeCrash
binding.errorTypeIcon.setImageResource(if (appErrorsInfo.isNativeCrash) R.drawable.ic_cpp else R.drawable.ic_java)
binding.errorInfoText.text = appErrorsInfo.exceptionMessage
binding.errorTypeText.text = appErrorsInfo.exceptionClassName
binding.errorFileNameText.text = appErrorsInfo.throwFileName
binding.errorThrowClassText.text = appErrorsInfo.throwClassName
binding.errorThrowMethodText.text = appErrorsInfo.throwMethodName
binding.errorLineNumberText.text = appErrorsInfo.throwLineNumber.toString()
binding.errorRecordTimeText.text = appErrorsInfo.dateTime
binding.errorStackText.text = appErrorsInfo.stackTrace
binding.appPanelScrollView.setOnScrollChangeListener { _, _, y, _, _ ->
binding.detailTitleText.text = if (y >= 30.dp(context = this)) appName(appErrorsInfo.packageName) else LocaleString.appName
}
binding.detailTitleText.setOnClickListener { binding.appPanelScrollView.smoothScrollTo(0, 0) }
}
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == WRITE_REQUEST_CODE && resultCode == Activity.RESULT_OK) runCatching {
data?.data?.let {
contentResolver?.openOutputStream(it)?.apply { write(stackTrace.toByteArray()) }?.close()
toast(LocaleString.outputStackSuccess)
} ?: toast(LocaleString.outputStackFail)
}.onFailure { toast(LocaleString.outputStackFail) }
}
override fun onBackPressed() {
intent?.removeExtra(EXTRA_APP_ERRORS_INFO)
finish()
}
}

View File

@@ -1,182 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/6/4.
*/
package com.fankes.apperrorstracking.ui.activity.main
import androidx.core.view.isVisible
import com.fankes.apperrorstracking.bean.AppFiltersBean
import com.fankes.apperrorstracking.bean.AppInfoBean
import com.fankes.apperrorstracking.databinding.ActivityConfigBinding
import com.fankes.apperrorstracking.databinding.AdapterAppInfoBinding
import com.fankes.apperrorstracking.databinding.DiaAppConfigBinding
import com.fankes.apperrorstracking.databinding.DiaAppsFilterBinding
import com.fankes.apperrorstracking.hook.factory.*
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.ui.activity.base.BaseActivity
import com.fankes.apperrorstracking.utils.factory.appIcon
import com.fankes.apperrorstracking.utils.factory.bindAdapter
import com.fankes.apperrorstracking.utils.factory.showDialog
import com.fankes.apperrorstracking.utils.tool.FrameworkTool
class ConfigureActivity : BaseActivity<ActivityConfigBinding>() {
/** 过滤条件 */
private var appFilters = AppFiltersBean()
/** 回调适配器改变 */
private var onChanged: (() -> Unit)? = null
/** 全部的 APP 信息 */
private val listData = ArrayList<AppInfoBean>()
override fun onCreate() {
binding.titleBackIcon.setOnClickListener { onBackPressed() }
binding.batchIcon.setOnClickListener {
showDialog<DiaAppConfigBinding> {
title = LocaleString.batchOperations
confirmButton {
val config0 = binding.configRadio0.isChecked
val config1 = binding.configRadio1.isChecked
val config2 = binding.configRadio2.isChecked
val config3 = binding.configRadio3.isChecked
showDialog {
title = LocaleString.notice
msg = LocaleString.areYouSureApplySiteApps(listData.size)
confirmButton {
listData.takeIf { it.isNotEmpty() }?.forEach {
putAppShowErrorsDialog(it.packageName, config0)
putAppShowErrorsNotify(it.packageName, config1)
putAppShowErrorsToast(it.packageName, config2)
putAppShowNothing(it.packageName, config3)
}
onChanged?.invoke()
}
cancelButton()
}
}
cancelButton()
}
}
binding.filterIcon.setOnClickListener {
showDialog<DiaAppsFilterBinding> {
title = LocaleString.filterByCondition
binding.containsSystemSwitch.isChecked = appFilters.isContainsSystem
binding.appFiltersEdit.apply {
requestFocus()
invalidate()
if (appFilters.name.isNotBlank()) {
setText(appFilters.name)
setSelection(appFilters.name.length)
}
}
confirmButton {
appFilters.isContainsSystem = binding.containsSystemSwitch.isChecked
appFilters.name = binding.appFiltersEdit.text.toString().trim()
refreshData()
}
cancelButton()
if (appFilters.name.isNotBlank())
neutralButton(LocaleString.clearFilters) {
appFilters.isContainsSystem = binding.containsSystemSwitch.isChecked
appFilters.name = ""
refreshData()
}
}
}
binding.listView.apply {
bindAdapter {
onBindDatas { listData }
onBindViews<AdapterAppInfoBinding> { binding, position ->
listData[position].also { bean ->
binding.appIcon.setImageDrawable(bean.icon)
binding.appNameText.text = bean.name
binding.configTypeText.text = when {
isAppShowErrorsDialog(bean.packageName) -> LocaleString.showErrorsDialog
isAppShowErrorsNotify(bean.packageName) -> LocaleString.showErrorsNotify
isAppShowErrorsToast(bean.packageName) -> LocaleString.showErrorsToast
isAppShowNothing(bean.packageName) -> LocaleString.showNothing
else -> "Unknown type"
}
}
}
}.apply { onChanged = { notifyDataSetChanged() } }
setOnItemClickListener { _, _, p, _ ->
listData[p].also { bean ->
showDialog<DiaAppConfigBinding> {
title = bean.name
binding.configRadio0.isChecked = isAppShowErrorsDialog(bean.packageName)
binding.configRadio1.isChecked = isAppShowErrorsNotify(bean.packageName)
binding.configRadio2.isChecked = isAppShowErrorsToast(bean.packageName)
binding.configRadio3.isChecked = isAppShowNothing(bean.packageName)
confirmButton {
putAppShowErrorsDialog(bean.packageName, binding.configRadio0.isChecked)
putAppShowErrorsNotify(bean.packageName, binding.configRadio1.isChecked)
putAppShowErrorsToast(bean.packageName, binding.configRadio2.isChecked)
putAppShowNothing(bean.packageName, binding.configRadio3.isChecked)
onChanged?.invoke()
}
cancelButton()
}
}
}
}
/** 模块未完全激活将显示警告 */
if (MainActivity.isModuleValied.not())
showDialog {
title = LocaleString.notice
msg = LocaleString.moduleNotFullyActivatedTip
confirmButton { FrameworkTool.restartSystem(context) }
cancelButton()
noCancelable()
}
/** 开始刷新数据 */
refreshData()
}
/** 刷新列表数据 */
private fun refreshData() {
binding.listProgressView.isVisible = true
binding.batchIcon.isVisible = false
binding.filterIcon.isVisible = false
binding.listView.isVisible = false
binding.listNoDataView.isVisible = false
binding.titleCountText.text = LocaleString.loading
FrameworkTool.fetchAppListData(context = this, appFilters) {
listData.clear()
Thread {
it.takeIf { e -> e.isNotEmpty() }?.forEach { e ->
listData.add(e)
e.icon = appIcon(e.packageName)
}
runOnUiThread {
onChanged?.invoke()
binding.listView.post { binding.listView.setSelection(0) }
binding.listProgressView.isVisible = false
binding.batchIcon.isVisible = listData.isNotEmpty()
binding.filterIcon.isVisible = true
binding.listView.isVisible = listData.isNotEmpty()
binding.listNoDataView.isVisible = listData.isEmpty()
binding.titleCountText.text = LocaleString.resultCount(listData.size)
}
}.start()
}
}
}

View File

@@ -1,152 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/14.
*/
@file:Suppress("SetTextI18n")
package com.fankes.apperrorstracking.ui.activity.main
import android.content.ComponentName
import android.content.pm.PackageManager
import android.os.Build
import androidx.core.view.isVisible
import com.fankes.apperrorstracking.BuildConfig
import com.fankes.apperrorstracking.R
import com.fankes.apperrorstracking.data.DataConst
import com.fankes.apperrorstracking.databinding.ActivityMainBinding
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.ui.activity.base.BaseActivity
import com.fankes.apperrorstracking.ui.activity.errors.AppErrorsMutedActivity
import com.fankes.apperrorstracking.ui.activity.errors.AppErrorsRecordActivity
import com.fankes.apperrorstracking.utils.factory.navigate
import com.fankes.apperrorstracking.utils.factory.openBrowser
import com.fankes.apperrorstracking.utils.factory.showDialog
import com.fankes.apperrorstracking.utils.factory.toast
import com.fankes.apperrorstracking.utils.tool.FrameworkTool
import com.highcapable.yukihookapi.YukiHookAPI
import com.highcapable.yukihookapi.hook.factory.modulePrefs
class MainActivity : BaseActivity<ActivityMainBinding>() {
companion object {
/** 模块是否有效 */
var isModuleValied = false
}
override fun onCreate() {
binding.mainTextVersion.text = LocaleString.moduleVersion(BuildConfig.VERSION_NAME)
binding.mainTextSystemVersion.text =
LocaleString.systemVersion("${Build.VERSION.RELEASE} (API ${Build.VERSION.SDK_INT}) ${Build.DISPLAY}")
binding.onlyShowErrorsInFrontSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_FRONT)
binding.onlyShowErrorsInMainProcessSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_MAIN)
binding.alwaysShowsReopenAppOptionsSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS)
binding.enableAppsConfigsTemplateSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_APP_CONFIG_TEMPLATE)
binding.hideIconInLauncherSwitch.isChecked = modulePrefs.get(DataConst.ENABLE_HIDE_ICON)
binding.mgrAppsConfigsTemplateButton.isVisible = modulePrefs.get(DataConst.ENABLE_APP_CONFIG_TEMPLATE)
binding.hideIconInLauncherSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
modulePrefs.put(DataConst.ENABLE_HIDE_ICON, b)
packageManager.setComponentEnabledSetting(
ComponentName(packageName, "${BuildConfig.APPLICATION_ID}.Home"),
if (b) PackageManager.COMPONENT_ENABLED_STATE_DISABLED else PackageManager.COMPONENT_ENABLED_STATE_ENABLED,
PackageManager.DONT_KILL_APP
)
}
binding.onlyShowErrorsInFrontSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
modulePrefs.put(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_FRONT, b)
}
binding.onlyShowErrorsInMainProcessSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
modulePrefs.put(DataConst.ENABLE_ONLY_SHOW_ERRORS_IN_MAIN, b)
}
binding.alwaysShowsReopenAppOptionsSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
modulePrefs.put(DataConst.ENABLE_ALWAYS_SHOWS_REOPEN_APP_OPTIONS, b)
}
binding.enableAppsConfigsTemplateSwitch.setOnCheckedChangeListener { btn, b ->
if (btn.isPressed.not()) return@setOnCheckedChangeListener
binding.mgrAppsConfigsTemplateButton.isVisible = b
modulePrefs.put(DataConst.ENABLE_APP_CONFIG_TEMPLATE, b)
}
/** 管理应用配置模板按钮点击事件 */
binding.mgrAppsConfigsTemplateButton.setOnClickListener { whenActivated { navigate<ConfigureActivity>() } }
/** 功能管理按钮点击事件 */
binding.viewErrorsRecordButton.setOnClickListener { whenActivated { navigate<AppErrorsRecordActivity>() } }
binding.viewMutedErrorsAppsButton.setOnClickListener { whenActivated { navigate<AppErrorsMutedActivity>() } }
/** 重启按钮点击事件 */
binding.titleRestartIcon.setOnClickListener { FrameworkTool.restartSystem(context = this) }
/** 项目地址按钮点击事件 */
binding.titleGithubIcon.setOnClickListener { openBrowser(url = "https://github.com/KitsunePie/AppErrorsTracking") }
/** 显示开发者提示 */
if (modulePrefs.get(DataConst.SHOW_DEVELOPER_NOTICE))
showDialog {
title = LocaleString.developerNotice
msg = LocaleString.developerNoticeTip
confirmButton(LocaleString.gotIt) { modulePrefs.put(DataConst.SHOW_DEVELOPER_NOTICE, value = false) }
noCancelable()
}
}
/** 刷新模块状态 */
private fun refreshModuleStatus() {
binding.mainLinStatus.setBackgroundResource(
when {
YukiHookAPI.Status.isXposedModuleActive && isModuleValied.not() -> R.drawable.bg_yellow_round
YukiHookAPI.Status.isXposedModuleActive -> R.drawable.bg_green_round
else -> R.drawable.bg_dark_round
}
)
binding.mainImgStatus.setImageResource(
when {
YukiHookAPI.Status.isXposedModuleActive -> R.mipmap.ic_success
else -> R.mipmap.ic_warn
}
)
binding.mainTextStatus.text =
when {
YukiHookAPI.Status.isXposedModuleActive && isModuleValied.not() -> LocaleString.moduleNotFullyActivated
YukiHookAPI.Status.isXposedModuleActive -> LocaleString.moduleIsActivated
else -> LocaleString.moduleNotActivated
}
binding.mainTextApiWay.isVisible = YukiHookAPI.Status.isXposedModuleActive
binding.mainTextApiWay.text = "Activated by ${YukiHookAPI.Status.executorName} API ${YukiHookAPI.Status.executorVersion}"
}
/**
* 当模块激活后才能执行相应功能
* @param callback 激活后回调
*/
private inline fun whenActivated(callback: () -> Unit) {
if (YukiHookAPI.Status.isXposedModuleActive) callback() else toast(LocaleString.moduleNotActivated)
}
override fun onResume() {
super.onResume()
/** 刷新模块状态 */
refreshModuleStatus()
/** 检查模块激活状态 */
FrameworkTool.checkingActivated(context = this) { isValied ->
isModuleValied = isValied
refreshModuleStatus()
}
}
}

View File

@@ -1,292 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
@file:Suppress("SameParameterValue")
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.annotation.SuppressLint
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.RippleDrawable
import android.graphics.drawable.RotateDrawable
import android.os.Build
import java.lang.reflect.Field
import java.lang.reflect.Method
private val gradientState = resolveGradientState()
private fun resolveGradientState(): Class<*> {
val classes = GradientDrawable::class.java.declaredClasses
for (singleClass in classes) {
if (singleClass.simpleName == "GradientState") return singleClass
}
throw RuntimeException("GradientState could not be found in thisAny GradientDrawable implementation")
}
private val rotateState = resolveRotateState()
private fun resolveRotateState(): Class<*> {
val classes = RotateDrawable::class.java.declaredClasses
for (singleClass in classes) {
if (singleClass.simpleName == "RotateState") return singleClass
}
throw RuntimeException("RotateState could not be found in thisAny RotateDrawable implementation")
}
@Throws(SecurityException::class, NoSuchFieldException::class)
private fun resolveField(source: Class<*>, fieldName: String): Field {
val field = source.getDeclaredField(fieldName)
field.isAccessible = true
return field
}
@Throws(SecurityException::class, NoSuchMethodException::class)
private fun resolveMethod(
source: Class<*>,
methodName: String,
vararg parameterTypes: Class<*>
): Method {
val method = source.getDeclaredMethod(methodName, *parameterTypes)
method.isAccessible = true
return method
}
fun setInnerRadius(drawable: GradientDrawable, value: Int) {
try {
val innerRadius = resolveField(gradientState, "mInnerRadius")
innerRadius.setInt(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setInnerRadiusRatio(drawable: GradientDrawable, value: Float) {
try {
val innerRadius = resolveField(gradientState, "mInnerRadiusRatio")
innerRadius.setFloat(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setThickness(drawable: GradientDrawable, value: Int) {
try {
val innerRadius = resolveField(gradientState, "mThickness")
innerRadius.setInt(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setThicknessRatio(drawable: GradientDrawable, value: Float) {
try {
val innerRadius = resolveField(gradientState, "mThicknessRatio")
innerRadius.setFloat(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setUseLevelForShape(drawable: GradientDrawable, value: Boolean) {
try {
val useLevelForShape = resolveField(gradientState, "mUseLevelForShape")
useLevelForShape.setBoolean(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
@SuppressLint("ObsoleteSdkInt")
fun setOrientation(drawable: GradientDrawable, value: GradientDrawable.Orientation) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
drawable.orientation = value
} else {
try {
val orientation = resolveField(gradientState, "mOrientation")
orientation.set(drawable.constantState, value)
val rectIdDirty = resolveField(GradientDrawable::class.java, "mRectIsDirty")
rectIdDirty.setBoolean(drawable, true)
drawable.invalidateSelf()
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
@SuppressLint("ObsoleteSdkInt")
fun setColors(drawable: GradientDrawable, value: IntArray) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
drawable.colors = value
} else {
try {
val colors = resolveField(gradientState, "mColors")
colors.set(drawable.constantState, value)
drawable.invalidateSelf()
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
fun setGradientRadiusType(drawable: GradientDrawable, value: Int) {
try {
val type = resolveField(gradientState, "mGradientRadiusType")
type.setInt(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setGradientRadius(drawable: GradientDrawable, value: Float) {
try {
val gradientRadius = resolveField(gradientState, "mGradientRadius")
gradientRadius.setFloat(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setStrokeColor(drawable: GradientDrawable, value: Int) {
try {
val type = resolveField(gradientState, "mStrokeColor")
type.setInt(drawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
fun setDrawable(rotateDrawable: RotateDrawable, drawable: Drawable) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rotateDrawable.drawable = drawable
} else {
try {
val drawableField = resolveField(rotateState, "mDrawable")
val stateField = resolveField(RotateDrawable::class.java, "mState")
drawableField.set(stateField.get(rotateDrawable), drawable)
drawable.callback = rotateDrawable
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
fun setPivotX(rotateDrawable: RotateDrawable, value: Float) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rotateDrawable.pivotX = value
} else {
try {
val pivotXField = resolveField(rotateState, "mPivotX")
pivotXField.setFloat(rotateDrawable.constantState, value)
val pivotXRelField = resolveField(rotateState, "mPivotXRel")
pivotXRelField.setBoolean(rotateDrawable.constantState, true)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
fun setPivotY(rotateDrawable: RotateDrawable, value: Float) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rotateDrawable.pivotY = value
} else {
try {
val pivotYField = resolveField(rotateState, "mPivotY")
pivotYField.setFloat(rotateDrawable.constantState, value)
val pivotYRelField = resolveField(rotateState, "mPivotYRel")
pivotYRelField.setBoolean(rotateDrawable.constantState, true)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
fun setFromDegrees(rotateDrawable: RotateDrawable, value: Float) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rotateDrawable.fromDegrees = value
} else {
try {
val fromDegreesField = resolveField(rotateState, "mFromDegrees")
fromDegreesField.setFloat(rotateDrawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
fun setToDegrees(rotateDrawable: RotateDrawable, value: Float) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
rotateDrawable.toDegrees = value
} else {
try {
val toDegreesField = resolveField(rotateState, "mToDegrees")
toDegreesField.setFloat(rotateDrawable.constantState, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}
fun setRadius(rippleDrawable: RippleDrawable, value: Int) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
rippleDrawable.radius = value
} else {
try {
val setRadiusMethod =
resolveMethod(RippleDrawable::class.java, "setMaxRadius", Int::class.java)
setRadiusMethod.invoke(rippleDrawable, value)
} catch (e: NoSuchFieldException) {
e.printStackTrace()
} catch (e: IllegalAccessException) {
e.printStackTrace()
}
}
}

View File

@@ -1,489 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
@file:Suppress("unused", "MemberVisibilityCanBePrivate")
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.util.StateSet
import java.util.*
import java.util.concurrent.atomic.AtomicInteger
class DrawableBuilder {
private var properties = DrawableProperties()
private var order: AtomicInteger = AtomicInteger(1)
private var transformsMap = TreeMap<Int, (Drawable) -> Drawable>()
private var baseDrawable: Drawable? = null
fun batch(properties: DrawableProperties) = apply { this.properties = properties.copy() }
fun baseDrawable(drawable: Drawable) = apply { baseDrawable = drawable }
// <shape>
fun shape(shape: Int) = apply { properties.shape = shape }
fun rectangle() = apply { shape(GradientDrawable.RECTANGLE) }
fun oval() = apply { shape(GradientDrawable.OVAL) }
fun line() = apply { shape(GradientDrawable.LINE) }
fun ring() = apply { shape(GradientDrawable.RING) }
fun innerRadius(innerRadius: Int) = apply { properties.innerRadius = innerRadius }
fun innerRadiusRatio(innerRadiusRatio: Float) =
apply { properties.innerRadiusRatio = innerRadiusRatio }
fun thickness(thickness: Int) = apply { properties.thickness = thickness }
fun thicknessRatio(thicknessRatio: Float) = apply { properties.thicknessRatio = thicknessRatio }
fun useLevelForRing(use: Boolean = true) = apply { properties.useLevelForRing = use }
// <corner>
fun cornerRadius(cornerRadius: Int) = apply { properties.cornerRadius = cornerRadius }
fun topLeftRadius(topLeftRadius: Int) = apply { properties.topLeftRadius = topLeftRadius }
fun topRightRadius(topRightRadius: Int) = apply { properties.topRightRadius = topRightRadius }
fun bottomRightRadius(bottomRightRadius: Int) =
apply { properties.bottomRightRadius = bottomRightRadius }
fun bottomLeftRadius(bottomLeftRadius: Int) =
apply { properties.bottomLeftRadius = bottomLeftRadius }
fun rounded() = apply { cornerRadius(Int.MAX_VALUE) }
fun cornerRadii(
topLeftRadius: Int,
topRightRadius: Int,
bottomRightRadius: Int,
bottomLeftRadius: Int
) = apply {
topLeftRadius(topLeftRadius); topRightRadius(topRightRadius); bottomRightRadius(
bottomRightRadius
); bottomLeftRadius(bottomLeftRadius)
}
// <gradient>
fun gradient(useGradient: Boolean = true) = apply { properties.useGradient = useGradient }
fun gradientType(type: Int) = apply { properties.type = type }
fun linearGradient() = apply { gradientType(GradientDrawable.LINEAR_GRADIENT) }
fun radialGradient() = apply { gradientType(GradientDrawable.RADIAL_GRADIENT) }
fun sweepGradient() = apply { gradientType(GradientDrawable.SWEEP_GRADIENT) }
fun angle(angle: Int) = apply { properties.angle = angle }
fun centerX(centerX: Float) = apply { properties.centerX = centerX }
fun centerY(centerY: Float) = apply { properties.centerY = centerY }
fun center(centerX: Float, centerY: Float) = apply { centerX(centerX); centerY(centerY) }
fun useCenterColor(useCenterColor: Boolean = true) =
apply { properties.useCenterColor = useCenterColor }
fun startColor(startColor: Int) = apply { properties.startColor = startColor }
fun centerColor(centerColor: Int) = apply {
properties.centerColor = centerColor
useCenterColor(true)
}
fun endColor(endColor: Int) = apply { properties.endColor = endColor }
fun gradientColors(startColor: Int, endColor: Int, centerColor: Int?) = apply {
startColor(startColor); endColor(endColor)
useCenterColor(centerColor != null)
centerColor?.let {
centerColor(it)
}
}
fun gradientRadiusType(gradientRadiusType: Int) =
apply { properties.gradientRadiusType = gradientRadiusType }
fun gradientRadius(gradientRadius: Float) = apply { properties.gradientRadius = gradientRadius }
fun gradientRadius(radius: Float, type: Int) =
apply { gradientRadius(radius); gradientRadiusType(type) }
fun gradientRadiusInPixel(radius: Float) =
apply { gradientRadius(radius); gradientRadiusType(DrawableProperties.RADIUS_TYPE_PIXELS) }
fun gradientRadiusInFraction(radius: Float) =
apply { gradientRadius(radius); gradientRadiusType(DrawableProperties.RADIUS_TYPE_FRACTION) }
fun useLevelForGradient(use: Boolean) = apply { properties.useLevelForGradient = use }
fun useLevelForGradient() = apply { useLevelForGradient(true) }
// <size>
fun width(width: Int) = apply { properties.width = width }
fun height(height: Int) = apply { properties.height = height }
fun size(width: Int, height: Int) = apply { width(width); height(height) }
fun size(size: Int) = apply { width(size).height(size) }
// <solid>
fun solidColor(solidColor: Int) = apply { properties.solidColor = solidColor }
private var solidColorPressed: Int? = null
fun solidColorPressed(color: Int?) = apply { solidColorPressed = color }
private var solidColorPressedWhenRippleUnsupported: Int? = null
fun solidColorPressedWhenRippleUnsupported(color: Int?) =
apply { solidColorPressedWhenRippleUnsupported = color }
private var solidColorDisabled: Int? = null
fun solidColorDisabled(color: Int?) = apply { solidColorDisabled = color }
private var solidColorSelected: Int? = null
fun solidColorSelected(color: Int?) = apply { solidColorSelected = color }
fun solidColorStateList(colorStateList: ColorStateList) =
apply { properties.solidColorStateList = colorStateList }
// <stroke>
fun strokeWidth(strokeWidth: Int) = apply { properties.strokeWidth = strokeWidth }
fun strokeColor(strokeColor: Int) = apply { properties.strokeColor = strokeColor }
private var strokeColorPressed: Int? = null
fun strokeColorPressed(color: Int?) = apply { strokeColorPressed = color }
private var strokeColorDisabled: Int? = null
fun strokeColorDisabled(color: Int?) = apply { strokeColorDisabled = color }
private var strokeColorSelected: Int? = null
fun strokeColorSelected(color: Int?) = apply { strokeColorSelected = color }
fun strokeColorStateList(colorStateList: ColorStateList) =
apply { properties.strokeColorStateList = colorStateList }
fun dashWidth(dashWidth: Int) = apply { properties.dashWidth = dashWidth }
fun dashGap(dashGap: Int) = apply { properties.dashGap = dashGap }
fun hairlineBordered() = apply { strokeWidth(1) }
fun shortDashed() = apply { dashWidth(12).dashGap(12) }
fun mediumDashed() = apply { dashWidth(24).dashGap(24) }
fun longDashed() = apply { dashWidth(36).dashGap(36) }
fun dashed() = apply { mediumDashed() }
// <rotate>
private var rotateOrder = 0
fun rotate(boolean: Boolean = true) = apply {
properties.useRotate = boolean
rotateOrder = if (boolean) {
order.getAndIncrement()
} else {
0
}
}
fun pivotX(pivotX: Float) = apply { properties.pivotX = pivotX }
fun pivotY(pivotY: Float) = apply { properties.pivotY = pivotY }
fun pivot(pivotX: Float, pivotY: Float) = apply { pivotX(pivotX).pivotY(pivotY) }
fun fromDegrees(degrees: Float) = apply { properties.fromDegrees = degrees }
fun toDegrees(degrees: Float) = apply { properties.toDegrees = degrees }
fun degrees(fromDegrees: Float, toDegrees: Float) =
apply { fromDegrees(fromDegrees).toDegrees(toDegrees) }
fun degrees(degrees: Float) = apply { fromDegrees(degrees).toDegrees(degrees) }
fun rotate(fromDegrees: Float, toDegrees: Float) =
apply { rotate().fromDegrees(fromDegrees).toDegrees(toDegrees) }
fun rotate(degrees: Float) = apply { rotate().degrees(degrees) }
// <scale>
private var scaleOrder = 0
fun scale(boolean: Boolean = true) = apply {
properties.useScale = boolean
scaleOrder = if (boolean) {
order.getAndIncrement()
} else {
0
}
}
fun scaleLevel(level: Int) = apply { properties.scaleLevel = level }
fun scaleGravity(gravity: Int) = apply { properties.scaleGravity = gravity }
fun scaleWidth(scale: Float) = apply { properties.scaleWidth = scale }
fun scaleHeight(scale: Float) = apply { properties.scaleHeight = scale }
fun scale(scale: Float) = apply { scale().scaleWidth(scale).scaleHeight(scale) }
fun scale(scaleWidth: Float, scaleHeight: Float) =
apply { scale().scaleWidth(scaleWidth).scaleHeight(scaleHeight) }
// flip
fun flip(boolean: Boolean = true) = apply { properties.useFlip = boolean }
fun orientation(orientation: Int) = apply { properties.orientation = orientation }
fun flipVertical() = apply { flip().orientation(FlipDrawable.ORIENTATION_VERTICAL) }
// <ripple>
fun ripple(boolean: Boolean = true) = apply { properties.useRipple = boolean }
fun rippleColor(color: Int) = apply { properties.rippleColor = color }
fun rippleColorStateList(colorStateList: ColorStateList) =
apply { properties.rippleColorStateList = colorStateList }
fun rippleRadius(radius: Int) = apply { properties.rippleRadius = radius }
fun build(): Drawable {
if (baseDrawable != null) {
return wrap(baseDrawable!!)
}
var drawable: Drawable
// fall back when ripple is unavailable on devices with API < 21
if (shouldFallbackRipple()) {
if (solidColorPressedWhenRippleUnsupported != null) {
solidColorPressed(solidColorPressedWhenRippleUnsupported)
} else {
solidColorPressed(properties.rippleColor)
}
}
if (needStateListDrawable()) {
drawable = StateListDrawableBuilder()
.pressed(buildPressedDrawable())
.disabled(buildDisabledDrawable())
.selected(buildSelectedDrawable())
.normal(buildNormalDrawable())
.build()
} else {
drawable = GradientDrawable()
setupGradientDrawable(drawable)
}
drawable = wrap(drawable)
return drawable
}
private fun getSolidColorStateList(): ColorStateList {
if (properties.solidColorStateList != null) {
return properties.solidColorStateList!!
}
val states = mutableListOf<IntArray>()
val colors = mutableListOf<Int>()
solidColorPressed?.let {
states.add(intArrayOf(android.R.attr.state_pressed))
colors.add(it)
}
solidColorDisabled?.let {
states.add(intArrayOf(-android.R.attr.state_enabled))
colors.add(it)
}
solidColorSelected?.let {
states.add(intArrayOf(android.R.attr.state_selected))
colors.add(it)
}
states.add(StateSet.WILD_CARD)
colors.add(properties.solidColor)
return ColorStateList(states.toTypedArray(), colors.toIntArray())
}
private fun getStrokeColorStateList(): ColorStateList {
if (properties.strokeColorStateList != null) {
return properties.strokeColorStateList!!
}
val states = mutableListOf<IntArray>()
val colors = mutableListOf<Int>()
strokeColorPressed?.let {
states.add(intArrayOf(android.R.attr.state_pressed))
colors.add(it)
}
strokeColorDisabled?.let {
states.add(intArrayOf(-android.R.attr.state_enabled))
colors.add(it)
}
strokeColorSelected?.let {
states.add(intArrayOf(android.R.attr.state_selected))
colors.add(it)
}
states.add(StateSet.WILD_CARD)
colors.add(properties.strokeColor)
return ColorStateList(states.toTypedArray(), colors.toIntArray())
}
private fun buildPressedDrawable(): Drawable? {
if (solidColorPressed == null && strokeColorPressed == null) return null
val pressedDrawable = GradientDrawable()
setupGradientDrawable(pressedDrawable)
solidColorPressed?.let {
pressedDrawable.setColor(it)
}
strokeColorPressed?.let {
setStrokeColor(pressedDrawable, it)
}
return pressedDrawable
}
private fun buildDisabledDrawable(): Drawable? {
if (solidColorDisabled == null && strokeColorDisabled == null) return null
val disabledDrawable = GradientDrawable()
setupGradientDrawable(disabledDrawable)
solidColorDisabled?.let {
disabledDrawable.setColor(it)
}
strokeColorDisabled?.let {
setStrokeColor(disabledDrawable, it)
}
return disabledDrawable
}
private fun buildSelectedDrawable(): Drawable? {
if (solidColorSelected == null && strokeColorSelected == null) return null
val selectedDrawable = GradientDrawable()
setupGradientDrawable(selectedDrawable)
solidColorSelected?.let {
selectedDrawable.setColor(it)
}
strokeColorSelected?.let {
setStrokeColor(selectedDrawable, it)
}
return selectedDrawable
}
private fun buildNormalDrawable(): Drawable {
val pressedDrawable = GradientDrawable()
setupGradientDrawable(pressedDrawable)
return pressedDrawable
}
private fun setupGradientDrawable(drawable: GradientDrawable) {
properties.apply {
drawable.shape = shape
if (shape == GradientDrawable.RING) {
setInnerRadius(drawable, innerRadius)
setInnerRadiusRatio(drawable, innerRadiusRatio)
setThickness(drawable, thickness)
setThicknessRatio(drawable, thicknessRatio)
setUseLevelForShape(drawable, useLevelForRing)
}
drawable.cornerRadii = getCornerRadii()
if (useGradient) {
drawable.gradientType = type
setGradientRadiusType(drawable, gradientRadiusType)
setGradientRadius(drawable, gradientRadius)
drawable.setGradientCenter(centerX, centerY)
setOrientation(drawable, getOrientation())
setColors(drawable, getColors())
drawable.useLevel = useLevelForGradient
} else {
drawable.color = getSolidColorStateList()
}
drawable.setSize(width, height)
drawable.setStroke(
strokeWidth,
getStrokeColorStateList(),
dashWidth.toFloat(),
dashGap.toFloat()
)
}
}
private fun needStateListDrawable(): Boolean {
return (hasStrokeColorStateList() || (!properties.useGradient && hasSolidColorStateList()))
}
private fun needRotateDrawable(): Boolean {
return properties.useRotate &&
!(properties.pivotX == 0.5f && properties.pivotY == 0.5f
&& properties.fromDegrees == 0f && properties.toDegrees == 0f)
}
private fun needScaleDrawable(): Boolean {
return properties.useScale
}
private fun wrap(drawable: Drawable): Drawable {
var wrappedDrawable = drawable
if (rotateOrder > 0) {
transformsMap[rotateOrder] = ::wrapRotateIfNeeded
}
if (scaleOrder > 0) {
transformsMap[scaleOrder] = ::wrapScaleIfNeeded
}
for (action in transformsMap.values) {
wrappedDrawable = action.invoke(wrappedDrawable)
}
if (properties.useFlip) {
wrappedDrawable = FlipDrawableBuilder()
.drawable(wrappedDrawable)
.orientation(properties.orientation)
.build()
}
if (isRippleSupported() && properties.useRipple) {
wrappedDrawable = RippleDrawableBuilder()
.drawable(wrappedDrawable)
.color(properties.rippleColor)
.colorStateList(properties.rippleColorStateList)
.radius(properties.rippleRadius)
.build()
}
return wrappedDrawable
}
private fun shouldFallbackRipple(): Boolean {
return properties.useRipple && !isRippleSupported()
}
private fun isRippleSupported() = true
private fun wrapRotateIfNeeded(drawable: Drawable): Drawable {
if (!needRotateDrawable()) return drawable
with(properties) {
return RotateDrawableBuilder()
.drawable(drawable)
.pivotX(pivotX)
.pivotY(pivotY)
.fromDegrees(fromDegrees)
.toDegrees(toDegrees)
.build()
}
}
private fun wrapScaleIfNeeded(drawable: Drawable): Drawable {
if (!needScaleDrawable()) return drawable
with(properties) {
return ScaleDrawableBuilder()
.drawable(drawable)
.level(scaleLevel)
.scaleGravity(scaleGravity)
.scaleWidth(scaleWidth)
.scaleHeight(scaleHeight)
.build()
}
}
private fun hasSolidColorStateList(): Boolean {
return solidColorPressed != null || solidColorDisabled != null || solidColorSelected != null
}
private fun hasStrokeColorStateList(): Boolean {
return strokeColorPressed != null || strokeColorDisabled != null || strokeColorSelected != null
}
}

View File

@@ -1,221 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
@file:Suppress("SetterBackingFieldAssignment", "unused")
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.Drawable
import android.graphics.drawable.GradientDrawable
import android.os.Parcel
import android.os.Parcelable
import android.view.Gravity
import java.io.Serializable
data class DrawableProperties(
// <shape>
@JvmField var shape: Int = GradientDrawable.RECTANGLE,
@JvmField var innerRadius: Int = -1,
@JvmField var innerRadiusRatio: Float = 9f,
@JvmField var thickness: Int = -1,
@JvmField var thicknessRatio: Float = 3f,
@JvmField var useLevelForRing: Boolean = false,
// <corner>
private var _cornerRadius: Int = 0,
@JvmField var topLeftRadius: Int = 0,
@JvmField var topRightRadius: Int = 0,
@JvmField var bottomRightRadius: Int = 0,
@JvmField var bottomLeftRadius: Int = 0,
// <gradient>
@JvmField var useGradient: Boolean = false,
@JvmField var type: Int = GradientDrawable.RADIAL_GRADIENT,
@JvmField var angle: Int = 0,
@JvmField var centerX: Float = 0.5f,
@JvmField var centerY: Float = 0.5f,
@JvmField var useCenterColor: Boolean = false,
@JvmField var startColor: Int = Constants.DEFAULT_COLOR,
@JvmField var centerColor: Int? = null,
@JvmField var endColor: Int = 0x7FFFFFFF,
@JvmField var gradientRadiusType: Int = RADIUS_TYPE_FRACTION,
@JvmField var gradientRadius: Float = 0.5f,
@JvmField var useLevelForGradient: Boolean = false,
// <size>
@JvmField var width: Int = -1,
@JvmField var height: Int = -1,
// <solid>
@JvmField var solidColor: Int = Color.TRANSPARENT,
@JvmField var solidColorStateList: ColorStateList? = null,
// <stroke>
@JvmField var strokeWidth: Int = 0,
@JvmField var strokeColor: Int = Color.DKGRAY,
@JvmField var strokeColorStateList: ColorStateList? = null,
@JvmField var dashWidth: Int = 0,
@JvmField var dashGap: Int = 0,
// <rotate>
@JvmField var useRotate: Boolean = false,
@JvmField var pivotX: Float = 0.5f,
@JvmField var pivotY: Float = 0.5f,
@JvmField var fromDegrees: Float = 0f,
@JvmField var toDegrees: Float = 0f,
// <scale>
@JvmField var useScale: Boolean = false,
@JvmField var scaleLevel: Int = 10000,
@JvmField var scaleGravity: Int = Gravity.CENTER,
@JvmField var scaleWidth: Float = 0f,
@JvmField var scaleHeight: Float = 0f,
// flip
@JvmField var useFlip: Boolean = false,
@JvmField var orientation: Int = FlipDrawable.ORIENTATION_HORIZONTAL,
// ripple
@JvmField var useRipple: Boolean = false,
@JvmField var rippleColor: Int = Constants.DEFAULT_COLOR,
@JvmField var rippleColorStateList: ColorStateList? = null,
@JvmField var rippleRadius: Int = -1
) : Serializable {
companion object {
const val RADIUS_TYPE_PIXELS = 0
const val RADIUS_TYPE_FRACTION = 1
@JvmField
val CREATOR = object : Parcelable.Creator<DrawableProperties> {
override fun createFromParcel(parcel: Parcel): DrawableProperties {
return DrawableProperties(parcel)
}
override fun newArray(size: Int): Array<DrawableProperties?> {
return arrayOfNulls(size)
}
}
}
var cornerRadius: Int = _cornerRadius
set(value) {
_cornerRadius = value
topLeftRadius = value
topRightRadius = value
bottomRightRadius = value
bottomLeftRadius = value
}
constructor(parcel: Parcel) : this(
parcel.readInt(),
parcel.readInt(),
parcel.readFloat(),
parcel.readInt(),
parcel.readFloat(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readInt(),
parcel.readInt(),
parcel.readInt(),
parcel.readInt(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readInt(),
parcel.readFloat(),
parcel.readFloat(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readValue(Int::class.java.classLoader) as? Int,
parcel.readInt(),
parcel.readInt(),
parcel.readFloat(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readInt(),
parcel.readInt(),
parcel.readParcelable(ColorStateList::class.java.classLoader),
parcel.readInt(),
parcel.readInt(),
parcel.readParcelable(ColorStateList::class.java.classLoader),
parcel.readInt(),
parcel.readInt(),
parcel.readByte() != 0.toByte(),
parcel.readFloat(),
parcel.readFloat(),
parcel.readFloat(),
parcel.readFloat(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readInt(),
parcel.readFloat(),
parcel.readFloat(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readByte() != 0.toByte(),
parcel.readInt(),
parcel.readParcelable(ColorStateList::class.java.classLoader),
parcel.readInt()
)
fun copy(): DrawableProperties {
val parcel = Parcel.obtain()
parcel.setDataPosition(0)
val properties = CREATOR.createFromParcel(parcel)
parcel.recycle()
return properties
}
fun getCornerRadii(): FloatArray {
return floatArrayOf(
topLeftRadius.toFloat(), topLeftRadius.toFloat(),
topRightRadius.toFloat(), topRightRadius.toFloat(),
bottomRightRadius.toFloat(), bottomRightRadius.toFloat(),
bottomLeftRadius.toFloat(), bottomLeftRadius.toFloat()
)
}
fun getOrientation(): GradientDrawable.Orientation {
val orientation: GradientDrawable.Orientation = when (val angle = this.angle % 360) {
0 -> GradientDrawable.Orientation.LEFT_RIGHT
45 -> GradientDrawable.Orientation.BL_TR
90 -> GradientDrawable.Orientation.BOTTOM_TOP
135 -> GradientDrawable.Orientation.BR_TL
180 -> GradientDrawable.Orientation.RIGHT_LEFT
225 -> GradientDrawable.Orientation.TR_BL
270 -> GradientDrawable.Orientation.TOP_BOTTOM
315 -> GradientDrawable.Orientation.TL_BR
else -> throw IllegalArgumentException("Unsupported angle: $angle")
}
return orientation
}
fun getColors(): IntArray {
return if (useCenterColor && centerColor != null) {
intArrayOf(startColor, centerColor!!, endColor)
} else intArrayOf(startColor, endColor)
}
fun materialization(): Drawable = DrawableBuilder().batch(this).build()
}

View File

@@ -1,78 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
@file:Suppress("DEPRECATION", "CanvasSize", "OVERRIDE_DEPRECATION")
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.graphics.Canvas
import android.graphics.ColorFilter
import android.graphics.Rect
import android.graphics.drawable.Drawable
class FlipDrawable(
private var drawable: Drawable,
private var orientation: Int = ORIENTATION_HORIZONTAL
) : Drawable() {
companion object {
const val ORIENTATION_HORIZONTAL = 0
const val ORIENTATION_VERTICAL = 1
}
override fun draw(canvas: Canvas) {
val saveCount = canvas.save()
if (orientation == ORIENTATION_VERTICAL) {
canvas.scale(1f, -1f, (canvas.width / 2).toFloat(), (canvas.height / 2).toFloat())
} else {
canvas.scale(-1f, 1f, (canvas.width / 2).toFloat(), (canvas.height / 2).toFloat())
}
drawable.bounds = Rect(0, 0, canvas.width, canvas.height)
drawable.draw(canvas)
canvas.restoreToCount(saveCount)
}
override fun onLevelChange(level: Int): Boolean {
drawable.level = level
invalidateSelf()
return true
}
override fun getIntrinsicWidth(): Int {
return drawable.intrinsicWidth
}
override fun getIntrinsicHeight(): Int {
return drawable.intrinsicHeight
}
override fun setAlpha(alpha: Int) {
drawable.alpha = alpha
}
override fun getOpacity(): Int {
return drawable.opacity
}
override fun setColorFilter(colorFilter: ColorFilter?) {
drawable.colorFilter = colorFilter
}
}

View File

@@ -1,181 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.graphics.drawable.Drawable
import android.graphics.drawable.LayerDrawable
import android.os.Build
import android.view.Gravity
import androidx.annotation.RequiresApi
class LayerDrawableBuilder {
companion object {
const val DIMEN_UNDEFINED = Int.MIN_VALUE
}
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
private var paddingMode = LayerDrawable.PADDING_MODE_NEST
private var paddingLeft = 0
private var paddingTop = 0
private var paddingRight = 0
private var paddingBottom = 0
private var paddingStart = 0
private var paddingEnd = 0
private val layers = ArrayList<Layer>()
@RequiresApi(Build.VERSION_CODES.LOLLIPOP)
fun paddingMode(mode: Int) = apply { paddingMode = mode }
fun paddingLeft(padding: Int) = apply { paddingLeft = padding }
fun paddingTop(padding: Int) = apply { paddingTop = padding }
fun paddingRight(padding: Int) = apply { paddingRight = padding }
fun paddingBottom(padding: Int) = apply { paddingBottom = padding }
@RequiresApi(Build.VERSION_CODES.M)
fun paddingStart(padding: Int) = apply { paddingStart = padding }
@RequiresApi(Build.VERSION_CODES.M)
fun paddingEnd(padding: Int) = apply { paddingEnd = padding }
fun padding(padding: Int) = apply {
paddingLeft(padding).paddingTop(padding).paddingRight(padding).paddingBottom(padding)
}
@RequiresApi(Build.VERSION_CODES.M)
fun paddingRelative(padding: Int) = apply {
paddingStart(padding).paddingTop(padding).paddingEnd(padding).paddingBottom(padding)
}
fun add(drawable: Drawable) = apply { layers.add(Layer(drawable)) }
fun width(width: Int) = apply { layers.last().width = width }
fun height(height: Int) = apply { layers.last().height = height }
fun insetLeft(inset: Int) = apply { layers.last().insetLeft = inset }
fun insetTop(inset: Int) = apply { layers.last().insetTop = inset }
fun insetRight(inset: Int) = apply { layers.last().insetRight = inset }
fun insetBottom(inset: Int) = apply { layers.last().insetBottom = inset }
@RequiresApi(Build.VERSION_CODES.M)
fun insetStart(inset: Int) = apply { layers.last().insetStart = inset }
@RequiresApi(Build.VERSION_CODES.M)
fun insetEnd(inset: Int) = apply { layers.last().insetEnd = inset }
fun inset(inset: Int) =
apply { insetLeft(inset).insetTop(inset).insetRight(inset).insetBottom(inset) }
fun inset(insetLeft: Int, insetTop: Int, insetRight: Int, insetBottom: Int) = apply {
insetLeft(insetLeft).insetTop(insetTop).insetRight(insetRight).insetBottom(insetBottom)
}
@RequiresApi(Build.VERSION_CODES.M)
fun insetRelative(inset: Int) =
apply { insetStart(inset).insetTop(inset).insetEnd(inset).insetBottom(inset) }
@RequiresApi(Build.VERSION_CODES.M)
fun insetRelative(insetStart: Int, insetTop: Int, insetEnd: Int, insetBottom: Int) = apply {
insetStart(insetStart).insetTop(insetTop).insetEnd(insetEnd).insetBottom(insetBottom)
}
@RequiresApi(Build.VERSION_CODES.M)
fun gravity(gravity: Int) = apply { layers.last().gravity = gravity }
fun modify(
index: Int, drawable: Drawable,
width: Int = DIMEN_UNDEFINED,
height: Int = DIMEN_UNDEFINED,
insetLeft: Int = DIMEN_UNDEFINED,
insetTop: Int = DIMEN_UNDEFINED,
insetRight: Int = DIMEN_UNDEFINED,
insetBottom: Int = DIMEN_UNDEFINED,
insetStart: Int = DIMEN_UNDEFINED,
insetEnd: Int = DIMEN_UNDEFINED
) =
apply {
val layer = layers[index]
layer.drawable = drawable
if (width != DIMEN_UNDEFINED) layer.width = width
if (height != DIMEN_UNDEFINED) layer.height = height
if (insetLeft != DIMEN_UNDEFINED) layer.insetLeft = insetLeft
if (insetTop != DIMEN_UNDEFINED) layer.insetTop = insetTop
if (insetRight != DIMEN_UNDEFINED) layer.insetRight = insetRight
if (insetBottom != DIMEN_UNDEFINED) layer.insetBottom = insetBottom
if (insetStart != DIMEN_UNDEFINED) layer.insetStart = insetStart
if (insetEnd != DIMEN_UNDEFINED) layer.insetEnd = insetEnd
}
fun build(): LayerDrawable {
val layerDrawable = LayerDrawable(layers.map { it -> it.drawable }.toTypedArray())
for (i in 0 until layers.size) {
val layer = layers[i]
layerDrawable.setLayerInset(
i,
layer.insetLeft,
layer.insetTop,
layer.insetRight,
layer.insetBottom
)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
if (layer.insetStart != DIMEN_UNDEFINED || layer.insetEnd != DIMEN_UNDEFINED) {
layerDrawable.setLayerInsetRelative(
i,
layer.insetStart,
layer.insetTop,
layer.insetEnd,
layer.insetBottom
)
}
}
layerDrawable.setId(i, i)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
layerDrawable.setLayerGravity(i, layer.gravity)
layerDrawable.setLayerInsetStart(i, layer.insetStart)
layerDrawable.setLayerInsetEnd(i, layer.insetEnd)
}
}
layerDrawable.paddingMode = paddingMode
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
layerDrawable.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom)
if (paddingStart != DIMEN_UNDEFINED || paddingEnd != DIMEN_UNDEFINED) {
layerDrawable.setPaddingRelative(
paddingStart,
paddingTop,
paddingEnd,
paddingBottom
)
}
}
return layerDrawable
}
internal class Layer(var drawable: Drawable) {
var gravity: Int = Gravity.NO_GRAVITY
var width: Int = -1
var height: Int = -1
var insetLeft: Int = 0
var insetTop: Int = 0
var insetRight: Int = 0
var insetBottom: Int = 0
var insetStart: Int = DIMEN_UNDEFINED
var insetEnd: Int = DIMEN_UNDEFINED
}
}

View File

@@ -1,61 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.graphics.Path
import android.graphics.drawable.ShapeDrawable
import android.graphics.drawable.shapes.PathShape
class PathShapeDrawableBuilder {
private var path: Path? = null
private var pathStandardWidth: Float = 100f
private var pathStandardHeight: Float = 100f
private var width: Int = -1
private var height: Int = -1
fun path(path: Path, pathStandardWidth: Float, pathStandardHeight: Float) = apply {
this.path = path
this.pathStandardWidth = pathStandardWidth
this.pathStandardHeight = pathStandardHeight
}
fun width(width: Int) = apply { this.width = width }
fun height(height: Int) = apply { this.height = height }
fun size(size: Int) = apply { width(size).height(size) }
fun build(custom: ((shapeDrawable: ShapeDrawable) -> Unit)? = null): ShapeDrawable {
val shapeDrawable = ShapeDrawable()
if (path == null || width <= 0 || height <= 0) {
return shapeDrawable
}
val pathShape = PathShape(path!!, pathStandardWidth, pathStandardHeight)
shapeDrawable.shape = pathShape
shapeDrawable.intrinsicWidth = width
shapeDrawable.intrinsicHeight = height
if (custom != null) {
custom(shapeDrawable)
}
return shapeDrawable
}
}

View File

@@ -1,73 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.content.res.ColorStateList
import android.graphics.Color
import android.graphics.drawable.*
import android.util.StateSet
class RippleDrawableBuilder : DrawableWrapperBuilder<RippleDrawableBuilder>() {
private var color: Int = Constants.DEFAULT_COLOR
private var colorStateList: ColorStateList? = null
private var radius: Int = -1
fun color(color: Int) = apply { this.color = color }
fun colorStateList(colorStateList: ColorStateList?) =
apply { this.colorStateList = colorStateList }
fun radius(radius: Int) = apply { this.radius = radius }
override fun build(): Drawable {
var drawable = this.drawable!!
val colorStateList = this.colorStateList ?: ColorStateList(
arrayOf(StateSet.WILD_CARD),
intArrayOf(color)
)
var mask = if (drawable is DrawableContainer) drawable.getCurrent() else drawable
if (mask is ShapeDrawable) {
val state = mask.getConstantState()
if (state != null) {
val temp = state.newDrawable().mutate() as ShapeDrawable
temp.paint.color = Color.BLACK
mask = temp
}
} else if (mask is GradientDrawable) {
val state = mask.getConstantState()
if (state != null) {
val temp = state.newDrawable().mutate() as GradientDrawable
temp.setColor(Color.BLACK)
mask = temp
}
} else {
mask = ColorDrawable(Color.BLACK)
}
val rippleDrawable = RippleDrawable(colorStateList, drawable, mask)
setRadius(rippleDrawable, radius)
rippleDrawable.invalidateSelf()
drawable = rippleDrawable
return drawable
}
}

View File

@@ -1,52 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.graphics.drawable.Drawable
import android.graphics.drawable.RotateDrawable
class RotateDrawableBuilder : DrawableWrapperBuilder<RotateDrawableBuilder>() {
private var pivotX: Float = 0.5f
private var pivotY: Float = 0.5f
private var fromDegrees: Float = 0f
private var toDegrees: Float = 360f
fun pivotX(x: Float) = apply { pivotX = x }
fun pivotY(y: Float) = apply { pivotY = y }
fun fromDegrees(degree: Float) = apply { fromDegrees = degree }
fun toDegrees(degree: Float) = apply { toDegrees = degree }
override fun build(): Drawable {
val rotateDrawable = RotateDrawable()
drawable?.let {
setDrawable(rotateDrawable, it)
apply {
setPivotX(rotateDrawable, pivotX)
setPivotY(rotateDrawable, pivotY)
setFromDegrees(rotateDrawable, fromDegrees)
setToDegrees(rotateDrawable, toDegrees)
}
}
return rotateDrawable
}
}

View File

@@ -1,45 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.graphics.drawable.Drawable
import android.graphics.drawable.ScaleDrawable
import android.view.Gravity
class ScaleDrawableBuilder : DrawableWrapperBuilder<ScaleDrawableBuilder>() {
private var level: Int = 10000
private var scaleGravity = Gravity.CENTER
private var scaleWidth: Float = 0f
private var scaleHeight: Float = 0f
fun level(level: Int) = apply { this.level = level }
fun scaleGravity(gravity: Int) = apply { this.scaleGravity = gravity }
fun scaleWidth(scale: Float) = apply { this.scaleWidth = scale }
fun scaleHeight(scale: Float) = apply { this.scaleHeight = scale }
override fun build(): Drawable {
val scaleDrawable = ScaleDrawable(drawable, scaleGravity, scaleWidth, scaleHeight)
scaleDrawable.level = level
return scaleDrawable
}
}

View File

@@ -1,60 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.graphics.drawable.Drawable
import android.graphics.drawable.StateListDrawable
import android.util.StateSet
class StateListDrawableBuilder {
private var pressed: Drawable? = null
private var disabled: Drawable? = null
private var selected: Drawable? = null
private var normal: Drawable = ColorDrawable(Color.TRANSPARENT)
fun pressed(pressed: Drawable?) = apply { this.pressed = pressed }
fun disabled(disabled: Drawable?) = apply { this.disabled = disabled }
fun selected(selected: Drawable?) = apply { this.selected = selected }
fun normal(normal: Drawable) = apply { this.normal = normal }
fun build(): StateListDrawable {
val stateListDrawable = StateListDrawable()
setupStateListDrawable(stateListDrawable)
return stateListDrawable
}
private fun setupStateListDrawable(stateListDrawable: StateListDrawable) {
pressed?.let {
stateListDrawable.addState(intArrayOf(android.R.attr.state_pressed), it)
}
disabled?.let {
stateListDrawable.addState(intArrayOf(-android.R.attr.state_enabled), it)
}
selected?.let {
stateListDrawable.addState(intArrayOf(android.R.attr.state_selected), it)
}
stateListDrawable.addState(StateSet.WILD_CARD, normal)
}
}

View File

@@ -1,229 +0,0 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/12.
*/
@file:Suppress("unused", "DEPRECATION", "OPT_IN_USAGE", "EXPERIMENTAL_API_USAGE")
package com.fankes.apperrorstracking.utils.factory
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.drawable.GradientDrawable
import android.graphics.drawable.InsetDrawable
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.ui.activity.errors.AppErrorsDisplayActivity
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.shape.MaterialShapeDrawable
import com.highcapable.yukihookapi.annotation.CauseProblemsApi
import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
/**
* 构造 [VB] 自定义 View 对话框
* @param initiate 对话框方法体
*/
@JvmName(name = "showDialog-VB")
inline fun <reified VB : ViewBinding> Context.showDialog(initiate: DialogBuilder<VB>.() -> Unit) =
DialogBuilder<VB>(context = this, VB::class.java).apply(initiate).show()
/**
* 构造对话框
* @param initiate 对话框方法体
*/
inline fun Context.showDialog(initiate: DialogBuilder<*>.() -> Unit) = DialogBuilder<ViewBinding>(context = this).apply(initiate).show()
/**
* 对话框构造器
* @param context 实例
* @param bindingClass [ViewBinding] 的 [Class] 实例 or null
*/
class DialogBuilder<VB : ViewBinding>(val context: Context, private val bindingClass: Class<*>? = null) {
private var instanceAndroidX: androidx.appcompat.app.AlertDialog.Builder? = null // 实例对象
private var instanceAndroid: android.app.AlertDialog.Builder? = null // 实例对象
private var onCancel: (() -> Unit)? = null // 对话框取消监听
private var dialogInstance: Dialog? = null // 对话框实例
private var customLayoutView: View? = null // 自定义布局
/**
* 获取 [DialogBuilder] 绑定布局对象
* @return [VB]
*/
val binding by lazy {
bindingClass?.method {
name = "inflate"
param(LayoutInflaterClass)
}?.get()?.invoke<VB>(LayoutInflater.from(context))?.apply {
customLayoutView = root
} ?: error("This dialog maybe not a custom view dialog")
}
/**
* 是否需要使用 AndroidX 风格对话框
* @return [Boolean]
*/
private val isUsingAndroidX get() = runCatching { context is AppCompatActivity }.getOrNull() ?: false
init {
if (isUsingAndroidX) runCatching {
instanceAndroidX = MaterialAlertDialogBuilder(context).also { builder ->
if (context is AppErrorsDisplayActivity)
builder.background = (builder.background as MaterialShapeDrawable).apply { setCornerSize(15.dpFloat(context)) }
}
} else runCatching {
instanceAndroid = android.app.AlertDialog.Builder(
context,
if (context.isSystemInDarkMode) android.R.style.Theme_Material_Dialog else android.R.style.Theme_Material_Light_Dialog
)
}
}
/** 设置对话框不可关闭 */
fun noCancelable() {
if (isUsingAndroidX)
runCatching { instanceAndroidX?.setCancelable(false) }
else runCatching { instanceAndroid?.setCancelable(false) }
}
/** 设置对话框标题 */
var title
get() = ""
set(value) {
if (isUsingAndroidX)
runCatching { instanceAndroidX?.setTitle(value) }
else runCatching { instanceAndroid?.setTitle(value) }
}
/** 设置对话框消息内容 */
var msg
get() = ""
set(value) {
if (isUsingAndroidX)
runCatching { instanceAndroidX?.setMessage(value) }
else runCatching { instanceAndroid?.setMessage(value) }
}
/** 设置进度条对话框消息内容 */
var progressContent
get() = ""
set(value) {
if (customLayoutView == null)
customLayoutView = LinearLayout(context).apply {
orientation = LinearLayout.HORIZONTAL
gravity = Gravity.CENTER or Gravity.START
addView(ProgressBar(context))
addView(View(context).apply { layoutParams = ViewGroup.LayoutParams(20.dp(context), 5) })
addView(TextView(context).apply {
tag = "progressContent"
text = value
})
setPadding(20.dp(context), 20.dp(context), 20.dp(context), 20.dp(context))
}
else customLayoutView?.findViewWithTag<TextView>("progressContent")?.text = value
}
/**
* 设置对话框确定按钮
* @param text 按钮文本内容
* @param callback 点击事件
*/
fun confirmButton(text: String = LocaleString.confirm, callback: () -> Unit = {}) {
if (isUsingAndroidX)
runCatching { instanceAndroidX?.setPositiveButton(text) { _, _ -> callback() } }
else runCatching { instanceAndroid?.setPositiveButton(text) { _, _ -> callback() } }
}
/**
* 设置对话框取消按钮
* @param text 按钮文本内容
* @param callback 点击事件
*/
fun cancelButton(text: String = LocaleString.cancel, callback: () -> Unit = {}) {
if (isUsingAndroidX)
runCatching { instanceAndroidX?.setNegativeButton(text) { _, _ -> callback() } }
else runCatching { instanceAndroid?.setNegativeButton(text) { _, _ -> callback() } }
}
/**
* 设置对话框第三个按钮
* @param text 按钮文本内容
* @param callback 点击事件
*/
fun neutralButton(text: String = LocaleString.more, callback: () -> Unit = {}) {
if (isUsingAndroidX)
runCatching { instanceAndroidX?.setNeutralButton(text) { _, _ -> callback() } }
else runCatching { instanceAndroid?.setNeutralButton(text) { _, _ -> callback() } }
}
/**
* 当对话框关闭时
* @param callback 回调
*/
fun onCancel(callback: () -> Unit) {
onCancel = callback
}
/** 取消对话框 */
fun cancel() = dialogInstance?.cancel()
/** 显示对话框 */
@CauseProblemsApi
fun show() {
/** 若当前自定义 View 的对话框没有调用 [binding] 将会对其手动调用一次以确保显示布局 */
if (bindingClass != null) binding
if (isUsingAndroidX) runCatching {
instanceAndroidX?.create()?.apply {
customLayoutView?.let { setView(it) }
dialogInstance = this
setOnCancelListener { onCancel?.invoke() }
}?.show()
} else runCatching {
instanceAndroid?.create()?.apply {
customLayoutView?.let { setView(it) }
window?.setBackgroundDrawable(
InsetDrawable(
GradientDrawable(
GradientDrawable.Orientation.TOP_BOTTOM,
if (context.isSystemInDarkMode) intArrayOf(0xFF2D2D2D.toInt(), 0xFF2D2D2D.toInt())
else intArrayOf(Color.WHITE, Color.WHITE)
).apply {
shape = GradientDrawable.RECTANGLE
gradientType = GradientDrawable.LINEAR_GRADIENT
cornerRadius = 15.dpFloat(this@DialogBuilder.context)
}, 30.dp(context), 0, 30.dp(context), 0
)
)
dialogInstance = this
setOnCancelListener { onCancel?.invoke() }
}?.show()
}
}
}

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="150dp"
android:height="150dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M851.5,239.1l-66.6,24.6v499.7l66.6,24.6c29.7,10.8 55.3,-17.9 55.3,-65V304.1c0,-47.1 -25.6,-76.3 -55.3,-65M362.5,374.8l-185.3,23.6c-7.2,1 -13.3,-10.2 -13.3,-24.6s5.6,-27.1 13.3,-28.7l185.3,-35.8c11.3,-2 20.5,10.8 20.5,29.2 -0.5,18.9 -9.7,34.8 -20.5,36.4M164.4,503.8c0,-14.3 5.6,-26.6 13.3,-26.6l93.7,-3.1c9.2,-0.5 16.9,12.8 16.9,29.7s-7.7,30.2 -16.9,29.7l-93.7,-3.1c-7.7,0 -13.3,-11.8 -13.3,-26.6m135.2,182.8l-122.4,-23.6c-7.2,-1.5 -13.3,-14.3 -13.3,-28.7s5.6,-25.6 13.3,-24.6l122.4,15.9c9.7,1 17.9,16.4 17.9,33.3s-8.2,29.2 -17.9,27.6M414.2,110.1L145.4,209.9c-22,8.2 -38.9,50.7 -38.9,95.7v397.3c0,45.1 16.9,87.6 38.9,95.7l268.8,99.8c42,15.9 78.8,-25.6 78.8,-93.2V203.3c0,-67.6 -36.9,-109.1 -78.8,-93.2m250.4,129L558.1,278.5v470.5l106.5,39.4c29.7,10.8 55.3,-17.9 55.3,-65V304.1c0,-47.1 -26.1,-76.3 -55.3,-65"
android:fillColor="#ffffff"/>
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="150dp"
android:height="150dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M785.8,927.4h-64.9c-9.7,0 -16.9,-9.7 -14.3,-19.5 0,-0.6 0,-0.6 0.6,-1.3 4.5,-16.9 -18.1,-26.6 -27.2,-11.7 -7.2,11 -13,20.2 -16.9,26a14.8,14.8 0,0 1,-12.3 6.5h-56.5c-9.7,0 -16.9,-9.7 -14.3,-19.5 0,-0.6 0,-0.6 0.6,-1.3 4.5,-16.9 -18.2,-26.6 -27.3,-11.7 -7.1,11 -13,20.2 -16.9,26a14.8,14.8 0,0 1,-12.3 6.5h-55.8c-9.7,0 -16.9,-9.7 -14.3,-19.5 0,-0.6 0,-0.6 0.6,-1.3 4.5,-16.9 -18.2,-26.6 -27.3,-11.7 -7.1,11 -13,20.2 -16.9,26a14.8,14.8 0,0 1,-12.3 6.5H360c-9.7,0 -16.9,-9.7 -14.3,-19.5 0,-0.6 0,-0.6 0.6,-1.3 4.5,-16.9 -18.2,-26.6 -27.3,-11.7 -7.1,11 -13,20.2 -16.9,26a14.8,14.8 0,0 1,-12.4 6.5H207.5a13.1,13.1 0,0 1,-7.1 -1.9c-43.5,-25.3 -62.9,-84.4 0.6,-138.9 42.2,-36.4 46.7,-94.8 45.4,-147.3 0,-8.4 6.5,-15.6 14.9,-15.6h526.4c7.1,0 13,4.5 14.3,11.7 14.9,64.9 20.1,116.2 32.4,205.8 8.4,65.5 -48.7,86.3 -48.7,86.3zM215.3,570.4c-20.1,0 -29.2,-14.9 -20.8,-32.5l70.8,-150.6c8.4,-18.2 31.8,-32.5 51.3,-32.5h113.6a14.7,14.7 0,0 0,14.9 -14.9V147.8c0.6,-28.6 23.4,-51.3 51.3,-51.3h42.2c27.9,0 51.3,22.7 51.3,51.3v190.8c0,8.4 6.5,14.9 14.9,14.9h109.7c20.1,0 42.8,14.9 51.3,32.4l70.7,150.6c8.5,18.2 -0.6,32.4 -20.7,32.4l-600.4,1.3z"
android:fillColor="#ffffff"/>
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="250dp"
android:height="250dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M511,0a376.4,376.4 0,0 0,-265.1 106.8,365.1 365.1,0 0,0 -108,258.6v498.7h742L880,365.5a362.4,362.4 0,0 0,-108.9 -258.6A374.9,374.9 0,0 0,511 0zM480.3,744.6L469.5,502.9L286.9,502.9l239.9,-303.1 20.5,195.2 174.1,6.1 -243.2,343.3zM0.1,966.4a55.6,55.6 0,0 1,55.6 -56.2h910.6a57.6,57.6 0,0 1,39.3 16.3,58.7 58.7,0 0,1 16.4,39.9 55.7,55.7 0,0 1,-55.7 55.6L55.6,1022.1a55.6,55.6 0,0 1,-55.5 -55.6z"
android:fillColor="#ffffff"/>
</vector>

View File

@@ -1,16 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108"
tools:ignore="VectorRaster">
<group android:scaleX="0.038671874"
android:scaleY="0.038671874"
android:translateX="34.2"
android:translateY="34.2">
<path
android:fillColor="#ffffff"
android:pathData="M1024,577.8c-1,34.9 -30.4,62.2 -65.3,62.2H848v32c0,43.7 -9.8,85.2 -27.2,122.3l120.5,120.5c25,25 25,65.5 0,90.5 -25,25 -65.5,25 -90.5,0l-109.5,-109.5C691.8,935.9 628.7,960 560,960V472c0,-13.3 -10.7,-24 -24,-24h-48c-13.3,0 -24,10.7 -24,24v488c-68.7,0 -131.8,-24.1 -181.3,-64.2l-109.5,109.5c-25,25 -65.5,25 -90.5,0 -25,-25 -25,-65.5 0,-90.5l120.5,-120.5C185.8,757.2 176,715.7 176,672v-32H65.3C30.5,640 1,612.7 0,577.8 -1,541.6 28.1,512 64,512h112v-117.5l-93.3,-93.3c-25,-25 -25,-65.5 0,-90.5 25,-25 65.5,-25 90.5,0L282.5,320h459l109.3,-109.3c25,-25 65.5,-25 90.5,0 25,25 25,65.5 0,90.5L848,394.5V512h112c35.9,0 65,29.6 64,65.8zM514,0c-123.7,0 -224,100.3 -224,224h448C738,100.3 637.7,0 514,0z" />
</group>
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="150dp"
android:height="150dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M851.2,957.9L179.2,957.9c-61.9,0 -110.9,-49.1 -110.9,-110.9L68.3,454.4c0,-32 25.6,-55.5 55.5,-55.5h55.5v224c0,32 25.6,55.5 55.5,55.5h558.9c32,0 55.5,-25.6 55.5,-55.5L849.1,398.9h55.5c32,0 55.5,25.6 55.5,55.5v390.4c2.1,64 -46.9,113.1 -108.8,113.1zM738.1,622.9h-448c-32,0 -55.5,-25.6 -55.5,-55.5v-448C234.7,89.6 260.3,64 290.1,64h448c32,0 55.5,25.6 55.5,55.5v448c0,29.9 -23.5,55.5 -55.5,55.5zM657.1,232.5L377.6,232.5c-19.2,0 -32,19.2 -32,32s12.8,25.6 32,32h279.5c19.2,0 32,-12.8 32,-32s-19.2,-32 -32,-32zM657.1,398.9L377.6,398.9c-19.2,0 -32,12.8 -32,32 0,12.8 19.2,25.6 32,25.6h279.5c19.2,0 32,-12.8 32,-25.6 0,-19.2 -19.2,-32 -32,-32z"
android:fillColor="#ffffff"/>
</vector>

View File

@@ -1,9 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="150dp"
android:height="150dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:pathData="M579.2,736.9l-218,-118.9a149.3,149.3 0,1 1,0 -212l218,-118.9a149.3,149.3 0,1 1,40.9 74.9l-218,118.9a149.9,149.9 0,0 1,0 62.2l218,118.9a149.3,149.3 0,1 1,-40.9 74.9z"
android:fillColor="#ffffff"/>
</vector>

View File

@@ -1,154 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:padding="10dp">
<TextView
android:id="@+id/process_name_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:ellipsize="end"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:singleLine="true"
android:textColor="@color/colorTextDark"
android:textSize="12sp"
android:visibility="gone" />
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
android:id="@+id/app_info_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="15dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:padding="1dp"
android:src="@drawable/ic_baseline_info"
app:tint="@color/colorTextGray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/app_info"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</com.fankes.apperrorstracking.ui.view.ItemLinearLayout>
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
android:id="@+id/close_app_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="15dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_close"
app:tint="@color/colorTextGray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/close_app"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</com.fankes.apperrorstracking.ui.view.ItemLinearLayout>
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
android:id="@+id/reopen_app_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="15dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_refresh"
app:tint="@color/colorTextGray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/reopen_app"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</com.fankes.apperrorstracking.ui.view.ItemLinearLayout>
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
android:id="@+id/error_detail_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="15dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_bug_report"
app:tint="@color/colorTextGray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/error_detail"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</com.fankes.apperrorstracking.ui.view.ItemLinearLayout>
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
android:id="@+id/muted_if_unlock_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="15dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_eject"
app:tint="@color/colorTextGray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mute_if_unlock"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</com.fankes.apperrorstracking.ui.view.ItemLinearLayout>
<com.fankes.apperrorstracking.ui.view.ItemLinearLayout
android:id="@+id/muted_if_restart_item"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingHorizontal="10dp"
android:paddingVertical="15dp">
<androidx.constraintlayout.utils.widget.ImageFilterView
android:layout_width="20dp"
android:layout_height="20dp"
android:layout_marginEnd="15dp"
android:src="@drawable/ic_baseline_eject"
app:tint="@color/colorTextGray" />
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/mute_if_restart"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</com.fankes.apperrorstracking.ui.view.ItemLinearLayout>
</LinearLayout>

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingLeft="15dp"
android:paddingTop="15dp"
android:paddingRight="15dp">
<com.google.android.material.textfield.TextInputLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.textfield.TextInputEditText
android:id="@+id/app_filters_edit"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:hint="@string/typo_app_name_pkg_name"
android:singleLine="true" />
</com.google.android.material.textfield.TextInputLayout>
<com.google.android.material.checkbox.MaterialCheckBox
android:id="@+id/contains_system_switch"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:text="@string/result_contains_system_apps"
app:buttonTint="@color/colorPrimaryAccent" />
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -1,120 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">異常調查</string>
<string name="xposed_desc">為原生 FC 對話框增加更多功能並修復中國大陸定制 ROM 刪除 FC 對話框的問題,給 Android 開發者帶來更好的體驗。 \n開發者酷安 @星夜不薈</string>
<string name="app_info">程式情報</string>
<string name="reopen_app">重新開啟</string>
<string name="error_detail">異常詳解</string>
<string name="mute_if_unlock">忽略(直到設備重新開屏)</string>
<string name="mute_if_restart">忽略(直到設備重新開機)</string>
<string name="close_app">結束程式</string>
<string name="aerr_title">%1$s 已停止運作</string>
<string name="aerr_repeated_title">%1$s 屢次停止運作</string>
<string name="mute_if_unlock_tip">忽略“%1$s”的錯誤直到設備重新開屏</string>
<string name="mute_if_restart_tip">忽略“%1$s”的錯誤直到設備重新開機</string>
<string name="back">回退</string>
<string name="copy_error_stack">複製異常堆棧</string>
<string name="export_to_file">導出到副案</string>
<string name="error_info">異常訊息</string>
<string name="error_type">異常類型</string>
<string name="error_file_name">文件名</string>
<string name="error_throw_class">拋出 Class</string>
<string name="error_throw_method">抛出 Method</string>
<string name="error_line_number">行號</string>
<string name="error_record_time">記錄時間</string>
<string name="copied">已復制</string>
<string name="copy_fail">複製失敗</string>
<string name="print_to_logcat">打印到控制台</string>
<string name="print_to_logcat_success">已打印到控制台</string>
<string name="output_stack_success">已導出異常堆棧</string>
<string name="output_stack_fail">導出異常堆棧失敗</string>
<string name="export_all">導出全部</string>
<string name="clear_all">清空全部</string>
<string name="errors_record">異常歷史記錄</string>
<string name="no_list_data">暫時沒有紀錄</string>
<string name="confirm">確認</string>
<string name="cancel">取消</string>
<string name="more">更多</string>
<string name="notice">提醒</string>
<string name="are_you_sure_clear_errors">你確認要清空全部異常紀錄嗎?</string>
<string name="all_errors_clear_success">全部異常紀錄已清空</string>
<string name="are_you_sure_export_all_errors">你確認要導出全部日誌文件嗎?打包過程可能會花費一點時間。</string>
<string name="view_detail">查看詳情</string>
<string name="export_all_errors_success">已導出全部異常紀錄</string>
<string name="export_all_errors_fail">導出全部異常紀錄失敗</string>
<string name="no_cpu_abi">無原生庫</string>
<string name="remove_record">移除紀錄</string>
<string name="are_you_sure_remove_record">你確認要移除這條紀錄嗎?</string>
<string name="got_it">我懂了</string>
<string name="restart_system">重新開機</string>
<string name="project_address">項目地址</string>
<string name="module_not_activated">模組未激活</string>
<string name="module_version">模組版本:%1$s</string>
<string name="system_version">系統版本:%1$s</string>
<string name="module_is_activated">模組已激活</string>
<string name="display_settings">顯示設置</string>
<string name="hide_app_icon_on_launcher">在桌面隱藏模組圖標</string>
<string name="hide_app_icon_on_launcher_tip">隱藏模組圖標後界面可能會被關閉,將不會再在桌面顯示,你可以在 EdXposed、LSPosed 中找到模組設置並打開。</string>
<string name="hide_app_icon_on_launcher_notice">注意:請務必在 LSPosed 中關閉“強制顯示桌面圖標”功能</string>
<string name="about_module">此模組使用 YukiHookAPI 構建。 \n了解更多 https://github.com/fankes/YukiHookAPI</string>
<string name="module_not_fully_activated">模組未完全激活,請重新開機</string>
<string name="are_your_sure_restart_system">你確定要重新開機嗎?</string>
<string name="fast_restart">急速重開</string>
<string name="access_root_fail">取得 Root 权利失败</string>
<string name="moment_ago">剛剛</string>
<string name="second_ago">秒前</string>
<string name="minute_ago">分鐘前</string>
<string name="hour_ago">小時前</string>
<string name="day_ago">天前</string>
<string name="month_ago">月前</string>
<string name="year_ago">年前</string>
<string name="crash_process">異常進程 \"%1$s\"</string>
<string name="share_error_stack">分享異常堆棧</string>
<string name="preference_settings">偏好設置</string>
<string name="function_mgr">功能管理</string>
<string name="only_show_errors_in_front">僅為前台程式展示錯誤對話框</string>
<string name="only_show_errors_in_main_process">僅為程式主進程展示錯誤對話框</string>
<string name="enable_apps_config_template">啟用程式配置模板</string>
<string name="mgr_apps_config_template">管理程式配置模板</string>
<string name="view_errors_record">查看異常歷史記錄</string>
<string name="view_muted_errors_apps">查看已忽略異常的程式</string>
<string name="only_show_errors_in_front_tip">啟用後,只有發生異常的程式處於前台(正在使用中)時才會展示錯誤對話框,發生異常的後台程式雖然不會展示錯誤對話框,但是它們都會被記錄到異常歷史記錄中。</string>
<string name="only_show_errors_in_main_process_tip">啟用後,只有程式發生的異常位於主進程(第一個 Application 實例對象)時才會展示錯誤對話框。</string>
<string name="apps_config_template_tip">你可以在這裡對每個程式發生異常時,單獨配置其在發生異常時是否展示錯誤對話框以及其它錯誤提示。</string>
<string name="view_errors_record_tip">在這裡,你可以找到從系統開機以來到現在為止的全部程式異常記錄,異常歷史記錄在重新啟動後會自動清空,你可以對記錄進行查看、導出和分享以及清空。</string>
<string name="view_muted_errors_apps_tip">在這裡,你可以找到已被你以不同形式手動忽略異常的程式,這個列表將會在重新啟動後自動清空,你可以對這些已忽略的程式進行管理以及從忽略列表中移除它們。</string>
<string name="muted_errors_apps">已忽略異常的程式</string>
<string name="unmute">取消忽略</string>
<string name="unmute_all">取消全部忽略</string>
<string name="are_you_sure_unmute_all">你確認要取消全部已忽略異常的程式嗎?</string>
<string name="apps_config_template">程式配置模板</string>
<string name="filter_by_condition">按條件過濾</string>
<string name="no_list_result">沒有結果可以展示</string>
<string name="typo_app_name_pkg_name">可輸入 APP 名稱、包名</string>
<string name="result_contains_system_apps">結果包含系統程式</string>
<string name="clear_filters">清除條件</string>
<string name="result_count">共 %1$s 個結果</string>
<string name="loading">加載中</string>
<string name="when_errors_how_to_show_tip">你可以配置當程式崩潰時系統將如何向你展示錯誤提醒副案。</string>
<string name="show_errors_dialog">顯示錯誤對話框</string>
<string name="show_errors_toast">顯示錯誤 Toast</string>
<string name="show_nothing">什麼也不顯示</string>
<string name="app_errors_statistics">程式異常統計</string>
<string name="total_errors">異常總數</string>
<string name="total_apps">程式總數</string>
<string name="most_errors_app">最多異常的程式</string>
<string name="most_errors_type">最多異常的類型</string>
<string name="total_proportion_of_errors">異常總佔比</string>
<string name="total_errors_unit">%1$s 條</string>
<string name="total_apps_unit">%1$s 個 (含系統程式)</string>
<string name="generating_statistics">統計數據生成中</string>
<string name="module_not_fully_activated_tip">模組未完全激活,可能無法加載當前設定項,建議重新開機後重試。</string>
<string name="show_errors_notify">推送錯誤通知</string>
<string name="app_errors_tip">程式發生了未處理的異常而崩潰,點擊查看詳情或反饋給程式開發者。</string>
<string name="batch_operations">批量操作</string>
<string name="are_you_sure_apply_site_apps">你確認要一次性應用設置給 %1$s 個程式嗎?</string>
<string name="errors_dialog_always_show_reopen">錯誤對話框始終顯示“重新開啟”選項</string>
<string name="errors_dialog_always_show_reopen_tip">啟用後,在程式非首次異常時也將顯示“重新開啟”選項,若當前異常非主進程或程式無法打開則依然不會顯示此選項。</string>
<string name="developer_notice">使用說明</string>
<string name="developer_notice_tip">此模組專為 Android 開發者而打造。 \n\n在可能的無法連接電腦不能進行 ADB 調試的時候,可通過此模組來快速捕獲任意已安裝程式的任意異常,以便快速定位問題。 \n\n程式發生崩潰的錯誤日誌對開發者來說是無價的財富若你不是開發者你依然可以安裝此模組以便給開發者提供更多異常信息快速解決問題。</string>
</resources>

View File

@@ -1,11 +0,0 @@
plugins {
id 'com.android.application' version '7.2.1' apply false
id 'com.android.library' version '7.2.1' apply false
id 'org.jetbrains.kotlin.android' version '1.7.0' apply false
}
ext {
appVersionName = "1.0.1"
appVersionCode = 2
enableR8 = true
}

5
build.gradle.kts Normal file
View File

@@ -0,0 +1,5 @@
plugins {
autowire(libs.plugins.android.application) apply false
autowire(libs.plugins.kotlin.android) apply false
autowire(libs.plugins.kotlin.ksp) apply false
}

View File

@@ -1,78 +0,0 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}
android {
namespace 'com.fankes.apperrorsdemo'
compileSdk 32
ndkVersion '24.0.8215888'
signingConfigs {
debug {
storeFile file('../keystore/public')
storePassword '123456'
keyAlias 'public'
keyPassword '123456'
v1SigningEnabled true
v2SigningEnabled true
}
}
defaultConfig {
minSdk 27
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
consumerProguardFiles "consumer-rules.pro"
externalNativeBuild {
cmake {
cppFlags ""
}
}
}
buildTypes {
release {
minifyEnabled false
signingConfig signingConfigs.debug
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
cmake {
path "src/main/cpp/CMakeLists.txt"
version "3.22.1"
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_11
targetCompatibility JavaVersion.VERSION_11
}
kotlinOptions {
jvmTarget = '11'
freeCompilerArgs = [
'-Xno-param-assertions',
'-Xno-call-assertions',
'-Xno-receiver-assertions'
]
}
buildFeatures {
viewBinding true
}
lintOptions {
checkReleaseBuilds false
}
}
dependencies {
implementation 'com.highcapable.yukihookapi:api:1.0.92'
implementation 'androidx.core:core-ktx:1.8.0'
implementation 'androidx.appcompat:appcompat:1.4.2'
implementation 'com.google.android.material:material:1.6.1'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

83
demo-app/build.gradle.kts Normal file
View File

@@ -0,0 +1,83 @@
plugins {
autowire(libs.plugins.android.application)
autowire(libs.plugins.kotlin.android)
}
android {
namespace = property.project.demo.app.packageName
compileSdk = property.project.android.compileSdk
ndkVersion = property.project.android.ndk.version
signingConfigs {
create("universal") {
keyAlias = property.project.demo.app.signing.keyAlias
keyPassword = property.project.demo.app.signing.keyPassword
storeFile = rootProject.file(property.project.demo.app.signing.storeFilePath)
storePassword = property.project.demo.app.signing.storePassword
enableV1Signing = true
enableV2Signing = true
}
}
defaultConfig {
applicationId = property.project.demo.app.packageName
minSdk = property.project.android.minSdk
targetSdk = property.project.android.targetSdk
versionName = property.project.demo.app.versionName
versionCode = property.project.demo.app.versionCode
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
all { signingConfig = signingConfigs.getByName("universal") }
release {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
externalNativeBuild {
cmake {
path("src/main/cpp/CMakeLists.txt")
version = property.project.android.cmake.version
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
buildFeatures {
buildConfig = true
viewBinding = true
}
lint { checkReleaseBuilds = false }
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x37")
}
androidComponents {
onVariants(selector().all()) {
it.outputs.forEach { output ->
val currentType = it.buildType
val currentSuffix = property.github.ci.commit.id?.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" } ?: ""
val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})"
if (output is com.android.build.api.variant.impl.VariantOutputImpl)
output.outputFileName.set("${property.project.name}-demo-v$currentVersion-$currentType.apk")
}
}
}
dependencies {
implementation(com.fankes.projectpromote.project.promote)
implementation(com.highcapable.yukireflection.api)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(com.google.android.material.material)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
}

View File

@@ -1,19 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<uses-permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<application
android:name=".application.DemoApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppErrorsDemo">
android:theme="@style/Theme.AppErrorsDemo"
tools:targetApi="tiramisu">
<activity
android:name=".ui.activity.MainActivity"
android:exported="true"
android:screenOrientation="behind">
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -25,7 +34,6 @@
<activity
android:name=".ui.activity.MainActivity$MultiProcessActivity"
android:exported="false"
android:process=":multi_process"
android:screenOrientation="behind" />
android:process=":multi_process" />
</application>
</manifest>

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,7 +17,7 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
* This file is created by fankes on 2022/5/10.
*/
package com.fankes.apperrorsdemo.application

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,7 +17,7 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
* This file is created by fankes on 2022/5/10.
*/
package com.fankes.apperrorsdemo.native

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,21 +17,27 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
* This file is created by fankes on 2022/5/10.
*/
@file:Suppress("SetTextI18n")
package com.fankes.apperrorsdemo.ui.activity
import android.content.Intent
import android.os.SystemClock
import com.fankes.apperrorsdemo.R
import com.fankes.apperrorsdemo.databinding.ActivityMainBinding
import com.fankes.apperrorsdemo.databinding.ActivityMultiProcessBinding
import com.fankes.apperrorsdemo.generated.DemoAppProperties
import com.fankes.apperrorsdemo.native.Channel
import com.fankes.apperrorsdemo.ui.activity.base.BaseActivity
class MainActivity : BaseActivity<ActivityMainBinding>() {
override fun onCreate() {
binding.titleBackIcon.setOnClickListener { onBackPressed() }
DemoAppProperties.GITHUB_CI_COMMIT_ID.takeIf(String::isNotBlank)?.also {
binding.titleText.text = "${getString(R.string.app_name)} ($it)"
}; binding.titleBackIcon.setOnClickListener { finish() }
binding.throwRuntimeButton.setOnClickListener { Channel.throwRuntimeException() }
binding.throwIllegalStateButton.setOnClickListener { Channel.throwIllegalStateException() }
binding.throwNullPointerButton.setOnClickListener { Channel.throwNullPointerException() }

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,10 +17,8 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
* This file is created by fankes on 2022/5/10.
*/
@file:Suppress("UNCHECKED_CAST")
package com.fankes.apperrorsdemo.ui.activity.base
import android.os.Build
@@ -31,9 +29,9 @@ import androidx.core.view.WindowCompat
import androidx.viewbinding.ViewBinding
import com.fankes.apperrorsdemo.R
import com.fankes.apperrorsdemo.utils.factory.isNotSystemInDarkMode
import com.highcapable.yukihookapi.hook.factory.method
import com.highcapable.yukihookapi.hook.type.android.LayoutInflaterClass
import java.lang.reflect.ParameterizedType
import com.highcapable.yukireflection.factory.current
import com.highcapable.yukireflection.factory.method
import com.highcapable.yukireflection.type.android.LayoutInflaterClass
abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
@@ -42,15 +40,11 @@ abstract class BaseActivity<VB : ViewBinding> : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
javaClass.genericSuperclass.also { type ->
if (type is ParameterizedType) {
binding = (type.actualTypeArguments[0] as Class<VB>).method {
name = "inflate"
param(LayoutInflaterClass)
}.get().invoke<VB>(layoutInflater) ?: error("binding failed")
setContentView(binding.root)
} else error("binding but got wrong type")
}
binding = current().generic()?.argument()?.method {
name = "inflate"
param(LayoutInflaterClass)
}?.get()?.invoke<VB>(layoutInflater) ?: error("binding failed")
setContentView(binding.root)
/** 隐藏系统的标题栏 */
supportActionBar?.hide()
/** 初始化沉浸状态栏 */

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,7 +17,7 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
* This file is created by fankes on 2022/5/10.
*/
package com.fankes.apperrorsdemo.utils.factory

View File

@@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="192dp"
android:height="150.39165dp"
android:viewportWidth="1307"
android:viewportHeight="1024">
<path
android:fillColor="#ffffff"
android:pathData="M268.7,566.5h929.6c36.3,0 72.6,-29 72.6,-72.6 0,-36.3 -29,-72.6 -72.6,-72.6H305l297.8,-297.8c29,-29 29,-72.6 0,-101.7 -29,-29 -72.6,-29 -101.7,0L72.6,450.3c-14.5,14.5 -21.8,36.3 -21.8,58.1 0,21.8 0,43.6 21.8,58.1l428.5,428.5c29,29 72.6,29 101.7,0 29,-29 29,-72.6 0,-101.7l-334.1,-326.8z" />
</vector>

View File

@@ -5,12 +5,13 @@
android:viewportWidth="108"
android:viewportHeight="108"
tools:ignore="VectorRaster">
<group android:scaleX="0.038671874"
android:scaleY="0.038671874"
android:translateX="34.2"
android:translateY="34.2">
<path
android:fillColor="#ffffff"
android:pathData="M1024,577.8c-1,34.9 -30.4,62.2 -65.3,62.2H848v32c0,43.7 -9.8,85.2 -27.2,122.3l120.5,120.5c25,25 25,65.5 0,90.5 -25,25 -65.5,25 -90.5,0l-109.5,-109.5C691.8,935.9 628.7,960 560,960V472c0,-13.3 -10.7,-24 -24,-24h-48c-13.3,0 -24,10.7 -24,24v488c-68.7,0 -131.8,-24.1 -181.3,-64.2l-109.5,109.5c-25,25 -65.5,25 -90.5,0 -25,-25 -25,-65.5 0,-90.5l120.5,-120.5C185.8,757.2 176,715.7 176,672v-32H65.3C30.5,640 1,612.7 0,577.8 -1,541.6 28.1,512 64,512h112v-117.5l-93.3,-93.3c-25,-25 -25,-65.5 0,-90.5 25,-25 65.5,-25 90.5,0L282.5,320h459l109.3,-109.3c25,-25 65.5,-25 90.5,0 25,25 25,65.5 0,90.5L848,394.5V512h112c35.9,0 65,29.6 64,65.8zM514,0c-123.7,0 -224,100.3 -224,224h448C738,100.3 637.7,0 514,0z" />
</group>
<group
android:scaleX="0.038671874"
android:scaleY="0.038671874"
android:translateX="34.2"
android:translateY="34.2">
<path
android:fillColor="#ffffff"
android:pathData="M1024,577.8c-1,34.9 -30.4,62.2 -65.3,62.2H848v32c0,43.7 -9.8,85.2 -27.2,122.3l120.5,120.5c25,25 25,65.5 0,90.5 -25,25 -65.5,25 -90.5,0l-109.5,-109.5C691.8,935.9 628.7,960 560,960V472c0,-13.3 -10.7,-24 -24,-24h-48c-13.3,0 -24,10.7 -24,24v488c-68.7,0 -131.8,-24.1 -181.3,-64.2l-109.5,109.5c-25,25 -65.5,25 -90.5,0 -25,-25 -25,-65.5 0,-90.5l120.5,-120.5C185.8,757.2 176,715.7 176,672v-32H65.3C30.5,640 1,612.7 0,577.8 -1,541.6 28.1,512 64,512h112v-117.5l-93.3,-93.3c-25,-25 -25,-65.5 0,-90.5 25,-25 65.5,-25 90.5,0L282.5,320h459l109.3,-109.3c25,-25 65.5,-25 90.5,0 25,25 25,65.5 0,90.5L848,394.5V512h112c35.9,0 65,29.6 64,65.8zM514,0c-123.7,0 -224,100.3 -224,224h448C738,100.3 637.7,0 514,0z" />
</group>
</vector>

View File

@@ -25,11 +25,12 @@
android:layout_height="20dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="20dp"
android:src="@mipmap/ic_back"
android:src="@drawable/ic_back"
android:tint="@color/colorTextGray"
android:tooltipText="@string/back" />
<TextView
android:id="@+id/title_text"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="2.5dp"
@@ -42,7 +43,7 @@
</LinearLayout>
<TextView
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginTop="5dp"
@@ -55,93 +56,108 @@
android:textColor="@color/colorTextDark"
android:textSize="13sp" />
<TextView
android:id="@+id/throw_runtime_button"
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_runtime"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
android:fadingEdgeLength="10dp"
android:fillViewport="true"
android:paddingBottom="10dp"
android:requiresFadingEdge="vertical"
android:scrollbars="none">
<TextView
android:id="@+id/throw_illegal_state_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_illegalstate"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<TextView
android:id="@+id/throw_null_pointer_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_nullpointer"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_runtime_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_runtime"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_exception_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_exception"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_illegal_state_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_illegalstate"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_native_error_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_native_error"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_null_pointer_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_nullpointer"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_multi_process_error_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_multi_process_error"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_exception_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_exception"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_native_error_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_native_error"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
<TextView
android:id="@+id/throw_multi_process_error_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:background="@drawable/bg_button_round"
android:gravity="center"
android:padding="10dp"
android:singleLine="true"
android:text="@string/throw_multi_process_error"
android:textColor="@color/colorTextGray"
android:textSize="15sp" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>
</LinearLayout>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

View File

@@ -1,12 +1,12 @@
<resources>
<string name="app_name">AppErrorsDemo</string>
<string name="back">Back</string>
<string name="function_desc">The business exception logic in common scenarios is provided here. After activating the Xposed module, you can test whether the exception can be caught here. In order to verify the effectiveness of the Xposed module, the current App does not have any logic code for manually handling exceptions.</string>
<string name="throw_runtime">throw RuntimeException</string>
<string name="throw_illegalstate">throw IllegalStateException</string>
<string name="throw_nullpointer">throw NullPointerException</string>
<string name="throw_exception">throw Exception</string>
<string name="throw_native_error">throw Native Error</string>
<string name="throw_multi_process_error">throw Multi-Process Exception</string>
<string name="function_desc">The business exception logic in common scenarios is provided here.\nAfter activating the Xposed Module, you can test whether the exception can be caught here.\nIn order to verify the effectiveness of the Xposed Module, the current App does not have any logic code for manually handling exceptions.</string>
<string name="throw_runtime">Throw RuntimeException</string>
<string name="throw_illegalstate">Throw IllegalStateException</string>
<string name="throw_nullpointer">Throw NullPointerException</string>
<string name="throw_exception">Throw Exception</string>
<string name="throw_native_error">Throw Native Error</string>
<string name="throw_multi_process_error">Throw Multi-Process Exception</string>
<string name="suicide_in_progress">Suicide in progress</string>
</resources>

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<locale-config xmlns:android="http://schemas.android.com/apk/res/android">
<locale android:name="en" />
<locale android:name="ja" />
<locale android:name="zh-Hans-CN" />
<locale android:name="zh-Hant-HK" />
<locale android:name="zh-Hant-MO" />
<locale android:name="zh-Hant-TW" />
</locale-config>

View File

@@ -1,25 +1,27 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-XX:+UseParallelGC
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
# Compiler Configuration
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
# Incremental
kotlin.incremental.useClasspathSnapshot=true
kotlin.code.style=official
kotlin.incremental.useClasspathSnapshot=true
# Project Configuration
project.name=AppErrorsTracking
project.android.compileSdk=34
project.android.minSdk=24
project.android.targetSdk=34
project.android.ndk.version="24.0.8215888"
project.android.cmake.version="3.22.1"
project.module-app.packageName=com.fankes.apperrorstracking
project.module-app.versionName="1.3"
project.module-app.versionCode=6
project.module-app.signing.keyAlias=public
project.module-app.signing.keyPassword="123456"
project.module-app.signing.storePassword="123456"
project.module-app.signing.storeFilePath=.secret/universal.p12
project.demo-app.packageName=com.fankes.apperrorsdemo
project.demo-app.versionName=${project.module-app.versionName}
project.demo-app.versionCode=${project.module-app.versionCode}
project.demo-app.signing.keyAlias=${project.module-app.signing.keyAlias}
project.demo-app.signing.keyPassword=${project.module-app.signing.keyPassword}
project.demo-app.signing.storePassword=${project.module-app.signing.storePassword}
project.demo-app.signing.storeFilePath=${project.module-app.signing.storeFilePath}

View File

@@ -0,0 +1,92 @@
preferences:
autowire-on-sync-mode: UPDATE_OPTIONAL_DEPENDENCIES
repositories-mode: FAIL_ON_PROJECT_REPOS
repositories:
gradle-plugin-portal:
scope: PLUGINS
google:
maven-central:
jit-pack:
sonatype-oss-releases:
rovo89-xposed-api:
scope: LIBRARIES
url: https://api.xposed.info/
content:
include:
group:
de.robv.android.xposed
fankes-maven-releases:
url: https://raw.githubusercontent.com/fankes/maven-repository/main/repository/releases
plugins:
com.android.application:
alias: android-application
version: 8.1.2
org.jetbrains.kotlin.android:
alias: kotlin-android
version: 1.9.10
com.highcapable.flexilocale:
alias: flexi-locale
version: 1.0.1
com.google.devtools.ksp:
alias: kotlin-ksp
version: 1.9.10-1.0.13
libraries:
com.fankes.projectpromote:
project-promote:
version: 1.0.0
repositories:
fankes-maven-releases
de.robv.android.xposed:
api:
version: 82
repositories:
rovo89-xposed-api
com.highcapable.yukihookapi:
api:
version: 1.2.0
ksp-xposed:
version-ref: <this>::api
com.highcapable.yukireflection:
api:
version: 1.0.3
com.microsoft.appcenter:
appcenter-analytics:
version: 5.0.2
appcenter-crashes:
version-ref: <this>::appcenter-analytics
com.github.topjohnwu.libsu:
core:
version: 5.2.1
com.github.duanhong169:
drawabletoolbox:
version: 1.0.7
com.google.code.gson:
gson:
version: 2.10.1
com.squareup.okhttp3:
okhttp:
version: 5.0.0-alpha.11
androidx.core:
core-ktx:
version: 1.12.0
androidx.appcompat:
appcompat:
version: 1.6.1
com.google.android.material:
material:
version: 1.10.0
androidx.constraintlayout:
constraintlayout:
version: 2.1.4
androidx.test.ext:
junit:
version: 1.1.5
androidx.test.espresso:
espresso-core:
version: 3.5.1
junit:
junit:
version: 4.13.2

View File

@@ -1,6 +1,5 @@
#Wed May 04 08:35:13 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStoreBase=GRADLE_USER_HOME

BIN
img-src/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

3
module-app/.gitignore vendored Normal file
View File

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

View File

@@ -0,0 +1,88 @@
plugins {
autowire(libs.plugins.android.application)
autowire(libs.plugins.kotlin.android)
autowire(libs.plugins.kotlin.ksp)
autowire(libs.plugins.flexi.locale)
}
android {
namespace = property.project.module.app.packageName
compileSdk = property.project.android.compileSdk
signingConfigs {
create("universal") {
keyAlias = property.project.module.app.signing.keyAlias
keyPassword = property.project.module.app.signing.keyPassword
storeFile = rootProject.file(property.project.module.app.signing.storeFilePath)
storePassword = property.project.module.app.signing.storePassword
enableV1Signing = true
enableV2Signing = true
}
}
defaultConfig {
applicationId = property.project.module.app.packageName
minSdk = property.project.android.minSdk
targetSdk = property.project.android.targetSdk
versionName = property.project.module.app.versionName
versionCode = property.project.module.app.versionCode
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
all { signingConfig = signingConfigs.getByName("universal") }
release {
isMinifyEnabled = true
isShrinkResources = true
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro")
}
}
compileOptions {
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
kotlinOptions {
jvmTarget = "17"
freeCompilerArgs = listOf(
"-Xno-param-assertions",
"-Xno-call-assertions",
"-Xno-receiver-assertions"
)
}
buildFeatures {
buildConfig = true
viewBinding = true
}
lint { checkReleaseBuilds = false }
androidResources.additionalParameters += listOf("--allow-reserved-package-id", "--package-id", "0x37")
}
androidComponents {
onVariants(selector().all()) {
it.outputs.forEach { output ->
val currentType = it.buildType
val currentSuffix = property.github.ci.commit.id?.let { suffix -> if (suffix.isNotBlank()) "-$suffix" else "" } ?: ""
val currentVersion = "${output.versionName.get()}$currentSuffix(${output.versionCode.get()})"
if (output is com.android.build.api.variant.impl.VariantOutputImpl)
output.outputFileName.set("${property.project.name}-module-v$currentVersion-$currentType.apk")
}
}
}
dependencies {
compileOnly(de.robv.android.xposed.api)
implementation(com.highcapable.yukihookapi.api)
ksp(com.highcapable.yukihookapi.ksp.xposed)
implementation(com.fankes.projectpromote.project.promote)
implementation(com.microsoft.appcenter.appcenter.analytics)
implementation(com.microsoft.appcenter.appcenter.crashes)
implementation(com.github.topjohnwu.libsu.core)
implementation(com.github.duanhong169.drawabletoolbox)
implementation(com.google.code.gson.gson)
implementation(com.squareup.okhttp3.okhttp)
implementation(androidx.core.core.ktx)
implementation(androidx.appcompat.appcompat)
implementation(com.google.android.material.material)
implementation(androidx.constraintlayout.constraintlayout)
testImplementation(junit.junit)
androidTestImplementation(androidx.test.ext.junit)
androidTestImplementation(androidx.test.espresso.espresso.core)
}

76
module-app/proguard-rules.pro vendored Normal file
View File

@@ -0,0 +1,76 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
-ignorewarnings
-optimizationpasses 10
-dontusemixedcaseclassnames
-dontoptimize
-verbose
-overloadaggressively
-allowaccessmodification
-adaptclassstrings
-adaptresourcefilenames
-adaptresourcefilecontents
-renamesourcefileattribute P
-keepattributes SourceFile,Signature,LineNumberTable
## ---------------Begin: proguard configuration for Gson ----------
# Gson uses generic type information stored in a class file when working with fields. Proguard
# removes such information by default, so configure it to keep all of it.
# Explicitly preserve all serialization members. The Serializable interface
# is only a marker interface, so it wouldn't save them.
-keepclassmembers class * implements java.io.Serializable {
static final long serialVersionUID;
private static final java.io.ObjectStreamField[] serialPersistentFields;
private void writeObject(java.io.ObjectOutputStream);
private void readObject(java.io.ObjectInputStream);
java.lang.Object writeReplace();
java.lang.Object readResolve();
}
# Gson specific classes
-dontwarn sun.misc.**
-keep class com.google.gson.stream.** { *; }
# Prevent R8 from leaving Data object members always null
-keepclassmembers,allowobfuscation class * {
@com.google.gson.annotations.SerializedName <fields>;
}
# Retain generic signatures of TypeToken and its subclasses with R8 version 3.0 and higher.
-keep,allowobfuscation,allowshrinking class com.google.gson.reflect.TypeToken
-keep,allowobfuscation,allowshrinking class * extends com.google.gson.reflect.TypeToken
## ---------------End: proguard configuration for Gson ----------
-assumenosideeffects class kotlin.jvm.internal.Intrinsics {
public static *** throwUninitializedProperty(...);
public static *** throwUninitializedPropertyAccessException(...);
}
-keep class * extends android.app.Activity
-keep class * implements androidx.viewbinding.ViewBinding {
<init>();
*** inflate(android.view.LayoutInflater);
}

View File

@@ -6,14 +6,27 @@
android:name="android.permission.QUERY_ALL_PACKAGES"
tools:ignore="QueryAllPackagesPermission" />
<uses-permission
android:name="android.permission.INTERACT_ACROSS_USERS"
tools:ignore="ProtectedPermissions" />
<uses-permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<permission
android:name="${applicationId}.DYNAMIC_RECEIVER_NOT_EXPORTED_PERMISSION"
tools:node="remove" />
<application
android:name=".application.AppErrorsApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:localeConfig="@xml/locales_config"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppErrorsTracking">
android:theme="@style/Theme.AppErrorsTracking"
tools:targetApi="tiramisu">
<meta-data
android:name="xposedmodule"
@@ -23,7 +36,10 @@
android:value="@string/xposed_desc" />
<meta-data
android:name="xposedminversion"
android:value="93" />
android:value="89" />
<meta-data
android:name="xposedsharedprefs"
android:value="true" />
<meta-data
android:name="xposedscope"
android:resource="@array/module_scope" />
@@ -59,6 +75,11 @@
android:exported="false"
android:screenOrientation="behind" />
<activity
android:name=".ui.activity.debug.LoggerActivity"
android:exported="false"
android:screenOrientation="behind" />
<activity
android:name=".ui.activity.errors.AppErrorsRecordActivity"
android:exported="true"
@@ -83,7 +104,6 @@
android:name=".ui.activity.errors.AppErrorsDetailActivity"
android:exported="true"
android:launchMode="singleTask"
android:screenOrientation="behind"
android:taskAffinity=":detail" />
<service

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,21 +17,28 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/10.
* This file is created by fankes on 2022/5/10.
*/
package com.fankes.apperrorstracking.application
import androidx.appcompat.app.AppCompatDelegate
import com.fankes.apperrorstracking.locale.LocaleString
import com.fankes.apperrorstracking.data.ConfigData
import com.fankes.apperrorstracking.generated.locale.ModuleAppLocale
import com.fankes.apperrorstracking.locale.locale
import com.fankes.apperrorstracking.utils.tool.AppAnalyticsTool
import com.highcapable.yukihookapi.hook.xposed.application.ModuleApplication
class AppErrorsApplication : ModuleApplication() {
override fun onCreate() {
super.onCreate()
/** 绑定 I18n */
locale = ModuleAppLocale.attach(this)
/** 跟随系统夜间模式 */
AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM)
/** 绑定 I18n */
LocaleString.bind(instance = this)
/** 装载存储控制类 */
ConfigData.init(this)
/** 装载 App Center */
AppAnalyticsTool.init(this)
}
}

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,7 +17,7 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/6/1.
* This file is created by fankes on 2022/6/1.
*/
package com.fankes.apperrorstracking.bean
@@ -25,6 +25,8 @@ import java.io.Serializable
/**
* 应用异常信息显示 bean
* @param pid APP 进程 ID
* @param userId APP 用户 ID
* @param packageName APP 包名
* @param processName APP 进程名
* @param appName APP 名称
@@ -34,6 +36,8 @@ import java.io.Serializable
* @param isShowReopenButton 是否显示重新打开按钮
*/
data class AppErrorsDisplayBean(
var pid: Int,
var userId: Int,
var packageName: String,
var processName: String,
var appName: String,

View File

@@ -0,0 +1,262 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is created by fankes on 2022/5/10.
*/
package com.fankes.apperrorstracking.bean
import android.app.ApplicationErrorReport
import android.content.Context
import android.os.Build
import com.fankes.apperrorstracking.const.ModuleVersion
import com.fankes.apperrorstracking.locale.locale
import com.fankes.apperrorstracking.utils.factory.appCpuAbiOf
import com.fankes.apperrorstracking.utils.factory.appMinSdkOf
import com.fankes.apperrorstracking.utils.factory.appTargetSdkOf
import com.fankes.apperrorstracking.utils.factory.appVersionCodeOf
import com.fankes.apperrorstracking.utils.factory.appVersionNameOf
import com.fankes.apperrorstracking.utils.factory.difference
import com.fankes.apperrorstracking.utils.factory.toUtcTime
import com.google.gson.annotations.SerializedName
import java.io.Serializable
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
/**
* 应用异常信息 bean
* @param pid 进程 ID
* @param userId 用户 ID
* @param cpuAbi CPU 架构类型
* @param packageName 包名
* @param versionName 版本名称
* @param versionCode 版本号
* @param targetSdk 目标 SDK 版本
* @param minSdk 最低 SDK 版本
* @param isNativeCrash 是否为原生层异常
* @param exceptionClassName 异常类名
* @param exceptionMessage 异常信息
* @param throwClassName 抛出异常的类名
* @param throwFileName 抛出异常的文件名
* @param throwMethodName 抛出异常的方法名
* @param throwLineNumber 抛出异常的行号
* @param stackTrace 异常堆栈
* @param timestamp 记录时间戳
*/
data class AppErrorsInfoBean(
@SerializedName("pid")
var pid: Int = -1,
@SerializedName("userId")
var userId: Int = -1,
@SerializedName("cpuAbi")
var cpuAbi: String = "",
@SerializedName("packageName")
var packageName: String = "",
@SerializedName("versionName")
var versionName: String = "",
@SerializedName("versionCode")
var versionCode: Long = -1L,
@SerializedName("targetSdk")
var targetSdk: Int = -1,
@SerializedName("minSdk")
var minSdk: Int = -1,
@SerializedName("isNativeCrash")
var isNativeCrash: Boolean = false,
@SerializedName("exceptionClassName")
var exceptionClassName: String = "",
@SerializedName("exceptionMessage")
var exceptionMessage: String = "",
@SerializedName("throwFileName")
var throwFileName: String = "",
@SerializedName("throwClassName")
var throwClassName: String = "",
@SerializedName("throwMethodName")
var throwMethodName: String = "",
@SerializedName("throwLineNumber")
var throwLineNumber: Int = -1,
@SerializedName("stackTrace")
var stackTrace: String = "",
@SerializedName("timestamp")
var timestamp: Long = -1L
) : Serializable {
companion object {
/**
* 从 [ApplicationErrorReport.CrashInfo] 克隆
* @param context 当前实例
* @param pid APP 进程 ID
* @param userId APP 用户 ID
* @param packageName APP 包名
* @param crashInfo [ApplicationErrorReport.CrashInfo]
* @return [AppErrorsInfoBean]
*/
fun clone(context: Context, pid: Int, userId: Int, packageName: String?, crashInfo: ApplicationErrorReport.CrashInfo?) =
(crashInfo?.exceptionClassName?.lowercase() == "native crash").let { isNativeCrash ->
AppErrorsInfoBean(
pid = pid,
userId = userId,
cpuAbi = packageName?.let { context.appCpuAbiOf(it) } ?: "",
packageName = packageName ?: "unknown",
versionName = packageName?.let { context.appVersionNameOf(it).ifBlank { "unknown" } } ?: "",
versionCode = packageName?.let { context.appVersionCodeOf(it) } ?: -1L,
targetSdk = packageName?.let { context.appTargetSdkOf(it) } ?: -1,
minSdk = packageName?.let { context.appMinSdkOf(it) } ?: -1,
isNativeCrash = isNativeCrash,
exceptionClassName = crashInfo?.exceptionClassName ?: "unknown",
exceptionMessage = if (isNativeCrash) crashInfo?.stackTrace.let {
if (it?.contains("Abort message: '") == true)
runCatching { it.split("Abort message: '")[1].split("'")[0] }.getOrNull()
?: crashInfo?.exceptionMessage ?: "unknown"
else crashInfo?.exceptionMessage ?: "unknown"
} else crashInfo?.exceptionMessage ?: "unknown",
throwFileName = crashInfo?.throwFileName ?: "unknown",
throwClassName = crashInfo?.throwClassName ?: "unknown",
throwMethodName = crashInfo?.throwMethodName ?: "unknown",
throwLineNumber = crashInfo?.throwLineNumber ?: -1,
stackTrace = crashInfo?.stackTrace?.trim() ?: "unknown",
timestamp = System.currentTimeMillis()
)
}
}
/**
* 获取当前内容是否为空
* @return [Boolean]
*/
val isEmpty get() = pid == -1 && userId == -1 && timestamp == -1L
/**
* 获取生成的 Json 文件名
* @return [String]
*/
val jsonFileName get() = "${packageName}_${pid}_$timestamp.json"
/**
* 获取 APP 版本信息与版本号
* @return [String]
*/
val versionBrand get() = if (versionName.isBlank()) "unknown" else "$versionName($versionCode)"
/**
* 获取异常本地化 UTC 时间
* @return [String]
*/
val utcTime get() = timestamp.toUtcTime()
/**
* 获取异常本地化经过时间
* @return [String]
*/
val crossTime
get() = timestamp.difference(
now = locale.momentAgo,
second = locale.secondAgo,
minute = locale.minuteAgo,
hour = locale.hourAgo,
day = locale.dayAgo,
month = locale.monthAgo,
year = locale.yearAgo
)
/**
* 获取异常本地化时间
* @return [String]
*/
val dateTime get() = SimpleDateFormat.getDateTimeInstance().format(Date(timestamp)) ?: utcTime
/**
* 获取异常堆栈分享模板
* @param sDeviceBrand
* @param sDeviceModel
* @param sDisplay
* @param sPackageName
* @return [String]
*/
fun stackOutputShareContent(
sDeviceBrand: Boolean = true,
sDeviceModel: Boolean = true,
sDisplay: Boolean = true,
sPackageName: Boolean = true
) = """
Generated by AppErrorsTracking $ModuleVersion
Project URL: https://github.com/KitsunePie/AppErrorsTracking
===============
""".trimIndent() + "\n${environmentInfo(sDeviceBrand, sDeviceModel, sDisplay, sPackageName)}"
/**
* 获取异常堆栈文件模板
* @param sDeviceBrand
* @param sDeviceModel
* @param sDisplay
* @param sPackageName
* @return [String]
*/
fun stackOutputFileContent(
sDeviceBrand: Boolean = true,
sDeviceModel: Boolean = true,
sDisplay: Boolean = true,
sPackageName: Boolean = true
) = """
================================================================
Generated by AppErrorsTracking $ModuleVersion
Project URL: https://github.com/KitsunePie/AppErrorsTracking
================================================================
""".trimIndent() + "\n${environmentInfo(sDeviceBrand, sDeviceModel, sDisplay, sPackageName)}"
/**
* 获取运行环境信息
* @param sDeviceBrand
* @param sDeviceModel
* @param sDisplay
* @param sPackageName
* @return [String]
*/
private fun environmentInfo(
sDeviceBrand: Boolean,
sDeviceModel: Boolean,
sDisplay: Boolean,
sPackageName: Boolean
) = """
[Device Brand]: ${Build.BRAND.by(sDeviceBrand)}
[Device Model]: ${Build.MODEL.by(sDeviceModel)}
[Display]: ${Build.DISPLAY.by(sDisplay)}
[Android Version]: ${Build.VERSION.RELEASE}
[Android API Level]: ${Build.VERSION.SDK_INT}
[System Locale]: ${Locale.getDefault()}
[Process ID]: $pid
[User ID]: $userId
[CPU ABI]: ${cpuAbi.ifBlank { "none" }}
[Package Name]: ${packageName.by(sPackageName)}
[Version Name]: ${versionName.ifBlank { "unknown" }}
[Version Code]: ${versionCode.takeIf { it != -1L } ?: "unknown"}
[Target SDK]: ${targetSdk.takeIf { it != -1 } ?: "unknown"}
[Min SDK]: ${minSdk.takeIf { it != -1 } ?: "unknown"}
[Error Type]: ${if (isNativeCrash) "Native" else "JVM"}
[Crash Time]: $utcTime
[Stack Trace]:
""".trimIndent() + "\n$stackTrace"
/**
* 判断字符串是否需要显示
* @param isDisplay 是否需要显示
* @return [String]
*/
private fun String.by(isDisplay: Boolean) = if (isDisplay) this else "***"
}

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,15 +17,19 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/6/4.
* This file is created by fankes on 2022/6/4.
*/
package com.fankes.apperrorstracking.bean
import com.fankes.apperrorstracking.bean.enum.AppFiltersType
import java.io.Serializable
/**
* 应用过滤条件 bean
* @param name 名称或包名
* @param isContainsSystem 是否包含系统应用
* @param type 过滤条件类型
*/
data class AppFiltersBean(var name: String = "", var isContainsSystem: Boolean = false) : Serializable
data class AppFiltersBean(
var name: String = "",
var type: AppFiltersType = AppFiltersType.USER
) : Serializable

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,7 +17,7 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/6/8.
* This file is created by fankes on 2022/6/8.
*/
package com.fankes.apperrorstracking.bean
@@ -30,4 +30,8 @@ import java.io.Serializable
* @param name APP 名称
* @param packageName APP 包名
*/
data class AppInfoBean(var icon: Drawable? = null, var name: String, var packageName: String) : Serializable
data class AppInfoBean(
var icon: Drawable? = null,
var name: String,
var packageName: String
) : Serializable

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,7 +17,7 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/6/3.
* This file is created by fankes on 2022/6/3.
*/
package com.fankes.apperrorstracking.bean
@@ -28,7 +28,10 @@ import java.io.Serializable
* @param type 类型
* @param packageName 包名
*/
data class MutedErrorsAppBean(var type: MuteType, var packageName: String) : Serializable {
data class MutedErrorsAppBean(
var type: MuteType,
var packageName: String
) : Serializable {
/**
* 已忽略的异常类型

View File

@@ -1,6 +1,6 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2019-2022 Fankes Studio(qzmmcn@163.com)
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
@@ -17,19 +17,20 @@
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is Created by fankes on 2022/5/7.
* This file is created by fankes on 2023/1/22.
*/
package com.fankes.apperrorstracking.utils.drawable.drawabletoolbox
package com.fankes.apperrorstracking.bean.enum
import android.graphics.drawable.Drawable
/**
* 应用过滤条件类型定义类
*/
enum class AppFiltersType {
/** 用户 */
USER,
class FlipDrawableBuilder : DrawableWrapperBuilder<FlipDrawableBuilder>() {
/** 系统 */
SYSTEM,
private var orientation: Int = FlipDrawable.ORIENTATION_HORIZONTAL
fun orientation(orientation: Int) = apply { this.orientation = orientation }
override fun build(): Drawable {
return FlipDrawable(drawable!!, orientation)
}
/** 全部 */
ALL
}

View File

@@ -0,0 +1,59 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is created by fankes on 2023/9/19.
*/
@file:Suppress("MemberVisibilityCanBePrivate")
package com.fankes.apperrorstracking.const
import com.fankes.apperrorstracking.generated.ModuleAppProperties
import com.fankes.apperrorstracking.wrapper.BuildConfigWrapper
/**
* 包名常量定义类
*/
object PackageName {
/** 系统框架 */
const val SYSTEM_FRAMEWORK = "android"
}
/**
* 模块版本常量定义类
*/
object ModuleVersion {
/** 当前 GitHub 提交的 ID (CI 自动构建) */
const val GITHUB_COMMIT_ID = ModuleAppProperties.GITHUB_CI_COMMIT_ID
/** 版本名称 */
const val NAME = BuildConfigWrapper.VERSION_NAME
/** 版本号 */
const val CODE = BuildConfigWrapper.VERSION_CODE
/** 是否为 CI 自动构建版本 */
val isCiMode = GITHUB_COMMIT_ID.isNotBlank()
/** 当前版本名称后缀 */
val suffix = GITHUB_COMMIT_ID.let { if (it.isNotBlank()) "-$it" else "" }
override fun toString() = "$NAME$suffix($CODE)"
}

View File

@@ -0,0 +1,139 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is created by fankes on 2023/1/20.
*/
package com.fankes.apperrorstracking.data
import com.fankes.apperrorstracking.data.enum.AppErrorsConfigType
import com.highcapable.yukihookapi.hook.xposed.prefs.data.PrefsData
/**
* 应用配置模版存储控制类
*/
object AppErrorsConfigData {
/** 显示错误对话框键值名称 */
private const val SHOW_ERRORS_DIALOG_APPS = "_show_errors_dialog_apps"
/** 推送错误通知键值名称 */
private const val SHOW_ERRORS_NOTIFY_APPS = "_show_errors_notify_apps"
/** 显示错误 Toast 键值名称 */
private const val SHOW_ERRORS_TOAST_APPS = "_show_errors_toast_apps"
/** 什么也不显示键值名称 */
private const val SHOW_ERRORS_NOTHING_APPS = "_show_errors_nothing_apps"
/** 全局错误显示类型 */
private val GLOBAL_SHOW_ERRORS_TYPE = PrefsData("_global_show_errors_type", AppErrorsConfigType.DIALOG.ordinal)
/** 显示错误对话框的 APP 包名数组 */
private var showDialogApps = HashSet<String>()
/** 推送错误通知的 APP 包名数组 */
private var showNotifyApps = HashSet<String>()
/** 显示错误 Toast 的 APP 包名数组 */
private var showToastApps = HashSet<String>()
/** 什么也不显示的 APP 包名数组 */
private var showNothingApps = HashSet<String>()
/** 刷新存储控制类 */
fun refresh() {
showDialogApps = ConfigData.getStringSet(SHOW_ERRORS_DIALOG_APPS).toHashSet()
showNotifyApps = ConfigData.getStringSet(SHOW_ERRORS_NOTIFY_APPS).toHashSet()
showToastApps = ConfigData.getStringSet(SHOW_ERRORS_TOAST_APPS).toHashSet()
showNothingApps = ConfigData.getStringSet(SHOW_ERRORS_NOTHING_APPS).toHashSet()
}
/**
* 获取当前 APP 显示错误的类型是否为 [type]
* @param type 当前类型
* @param packageName 当前 APP 包名 - 不填为全局配置
* @return [Boolean]
*/
fun isAppShowingType(type: AppErrorsConfigType, packageName: String = "") =
if (packageName.isNotBlank()) when (type) {
AppErrorsConfigType.GLOBAL ->
showDialogApps.contains(packageName).not() &&
showNotifyApps.contains(packageName).not() &&
showToastApps.contains(packageName).not() &&
showNothingApps.contains(packageName).not()
AppErrorsConfigType.DIALOG -> showDialogApps.contains(packageName)
AppErrorsConfigType.NOTIFY -> showNotifyApps.contains(packageName)
AppErrorsConfigType.TOAST -> showToastApps.contains(packageName)
AppErrorsConfigType.NOTHING -> showNothingApps.contains(packageName)
} else ConfigData.getInt(GLOBAL_SHOW_ERRORS_TYPE) == type.ordinal
/**
* 写入当前 APP 显示错误的类型
* @param type 当前类型
* @param packageName 当前 APP 包名 - 不填为全局配置
* @throws IllegalStateException 如果 [packageName] 为空 [type] 为 [AppErrorsConfigType.GLOBAL]
*/
fun putAppShowingType(type: AppErrorsConfigType, packageName: String = "") {
if (packageName.isBlank() && type == AppErrorsConfigType.GLOBAL)
error("You can't still specify the \"follow global config\" type when saving the global config")
fun saveAllData() {
ConfigData.putStringSet(SHOW_ERRORS_DIALOG_APPS, showDialogApps)
ConfigData.putStringSet(SHOW_ERRORS_NOTIFY_APPS, showNotifyApps)
ConfigData.putStringSet(SHOW_ERRORS_TOAST_APPS, showToastApps)
ConfigData.putStringSet(SHOW_ERRORS_NOTHING_APPS, showNothingApps)
}
if (packageName.isNotBlank()) when (type) {
AppErrorsConfigType.GLOBAL -> {
showDialogApps.remove(packageName)
showNotifyApps.remove(packageName)
showToastApps.remove(packageName)
showNothingApps.remove(packageName)
saveAllData()
}
AppErrorsConfigType.DIALOG -> {
showDialogApps.add(packageName)
showNotifyApps.remove(packageName)
showToastApps.remove(packageName)
showNothingApps.remove(packageName)
saveAllData()
}
AppErrorsConfigType.NOTIFY -> {
showDialogApps.remove(packageName)
showNotifyApps.add(packageName)
showToastApps.remove(packageName)
showNothingApps.remove(packageName)
saveAllData()
}
AppErrorsConfigType.TOAST -> {
showDialogApps.remove(packageName)
showNotifyApps.remove(packageName)
showToastApps.add(packageName)
showNothingApps.remove(packageName)
saveAllData()
}
AppErrorsConfigType.NOTHING -> {
showDialogApps.remove(packageName)
showNotifyApps.remove(packageName)
showToastApps.remove(packageName)
showNothingApps.add(packageName)
saveAllData()
}
} else ConfigData.putInt(GLOBAL_SHOW_ERRORS_TYPE, type.ordinal)
}
}

View File

@@ -0,0 +1,138 @@
/*
* AppErrorsTracking - Added more features to app's crash dialog, fixed custom rom deleted dialog, the best experience to Android developer.
* Copyright (C) 2017-2023 Fankes Studio(qzmmcn@163.com)
* https://github.com/KitsunePie/AppErrorsTracking
*
* This software is non-free but opensource software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* as published by the Free Software Foundation; either
* version 3 of the License, or any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* and eula along with this software. If not, see
* <https://www.gnu.org/licenses/>
*
* This file is created by fankes on 2023/1/17.
*/
@file:Suppress("StaticFieldLeak")
package com.fankes.apperrorstracking.data
import android.content.Context
import android.provider.Settings
import com.fankes.apperrorstracking.bean.AppErrorsInfoBean
import com.fankes.apperrorstracking.utils.factory.appCpuAbiOf
import com.fankes.apperrorstracking.utils.factory.appVersionCodeOf
import com.fankes.apperrorstracking.utils.factory.appVersionNameOf
import com.fankes.apperrorstracking.utils.factory.toEntityOrNull
import com.fankes.apperrorstracking.utils.factory.toJsonOrNull
import com.highcapable.yukihookapi.hook.log.YLog
import java.io.File
import java.util.concurrent.CopyOnWriteArrayList
/**
* [AppErrorsInfoBean] 存储控制类
*/
object AppErrorsRecordData {
/** 异常记录数据文件目录路径 */
private const val FOLDER_PATH = "/data/misc/app_errors_records/"
/** 当前实例 */
private var context: Context? = null
/**
* 获取当前异常记录数据目录
* @return [File]
*/
private val errorsInfoDataFolder by lazy { File(FOLDER_PATH) }
/**
* 获取当前全部异常记录数据文件
* @return [List]<[File]>
*/
private val errorsInfoDataFiles get() = errorsInfoDataFolder.listFiles()?.sortedByDescending { it.lastModified() } ?: emptyList()
/** 已记录的全部 APP 异常信息数组 */
var allData = CopyOnWriteArrayList<AppErrorsInfoBean>()
/**
* 初始化存储控制类
* @param context 实例
*/
fun init(context: Context) {
this.context = context
initializeDataDirectory()
allData = readAllDataFromFiles()
}
/** 初始化异常记录数据目录 */
private fun initializeDataDirectory() {
runCatching {
errorsInfoDataFolder.also { if (it.exists().not() || it.isFile) it.apply { delete(); mkdirs() } }
}.onFailure {
YLog.error("Can't create directory \"$FOLDER_PATH\", there will be problems with the app errors records function", it)
}
}
/**
* 获取旧版异常记录数据并自动转换到新版
* @return [ArrayList]<[AppErrorsInfoBean]> or null
*/
private fun copyOldDataFromResolverString() = context?.let {
val keyName = "app_errors_data"
runCatching {
Settings.Secure.getString(it.contentResolver, keyName)
?.toEntityOrNull<CopyOnWriteArrayList<AppErrorsInfoBean>>()
?.onEach { e ->
e.cpuAbi = it.appCpuAbiOf(e.packageName)
e.versionName = it.appVersionNameOf(e.packageName).ifBlank { "unknown" }
e.versionCode = it.appVersionCodeOf(e.packageName)
e.toJsonOrNull()?.also { json -> File(errorsInfoDataFolder.absolutePath, e.jsonFileName).writeText(json) }
}.let { result ->
if (result != null) {
Settings.Secure.putString(it.contentResolver, keyName, "")
result
} else null
}
}.getOrNull()
}
/**
* 从文件获取全部异常记录数据
* @return [ArrayList]<[AppErrorsInfoBean]>
*/
private fun readAllDataFromFiles() = copyOldDataFromResolverString() ?: CopyOnWriteArrayList<AppErrorsInfoBean>().apply {
errorsInfoDataFiles.takeIf { it.isNotEmpty() }?.forEach { it.readText().toEntityOrNull<AppErrorsInfoBean>()?.let { e -> add(e) } }
}
/**
* 添加新的异常记录数据
* @param bean [AppErrorsInfoBean] 实例
*/
fun add(bean: AppErrorsInfoBean) {
allData.add(0, bean)
bean.toJsonOrNull()?.runCatching { File(errorsInfoDataFolder.absolutePath, bean.jsonFileName).writeText(this) }
}
/**
* 移除指定的异常记录数据
* @param bean [AppErrorsInfoBean] 实例
*/
fun remove(bean: AppErrorsInfoBean) {
allData.remove(bean)
runCatching { File(errorsInfoDataFolder.absolutePath, bean.jsonFileName).delete() }
}
/** 清除全部异常记录数据 */
fun clearAll() {
allData.clear()
runCatching { errorsInfoDataFolder.deleteRecursively() }
initializeDataDirectory()
}
}

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