Commit Graph

66 Commits

Author SHA1 Message Date
NkBe 74bbeb9bda
patch-loader: 優化配置和資源處理
Add a shared Gson instance and harden config/module/asset loading to avoid NPEs and crashes. Guard legacy module iteration, use apply() for SharedPreferences, throw when config asset is missing, reuse GSON for parsing, and null-check resource streams before copying. Also set provider dex file writable only if created and remove some unused imports. These changes improve resilience when manager/asset data is unavailable and clean up file handling.
2026-02-10 17:46:38 +08:00
NkBe 59dc353e0e
修正本地模式模式並解決 x86_64 的 bypass_svc 構建問題
manager / patch-loader:
- 將 ConfigProvider 添加至管理器以調用已啟用模組列表,繞過安卓沙盒限制。
- 將 NeoLocalApplicationService 改寫為查詢 ConfigProvider,而非 SharedPreferences。
- 動態解析 APK 路徑透過 PackageManager 並改善錯誤記錄。

bypass_svc:
- 修復 x86_64 編譯錯誤。
- 為 x86_64 提供 stub 實現。
- 將 g_is_hook_active 移至全域範圍以避免未定義符號。
- 保護 ARM64 特定的 syscall/seccomp 邏輯。
2026-02-10 16:39:53 +08:00
NkBe 271eb7bd82
feat(sigbypass): SVC Bypass (ARM64) and OpenAt I/O Redirection
導入 ARM64 專用的 SVC/Seccomp 內核級簽名繞過 (Level 3),並全面強化檔案 I/O 重定向機制。
移除非 ARM64 架構的支持
2025-12-22 21:57:33 +08:00
NkBe 5a90ed436e
fix: 正確設定共享偏好設定鍵並提升加載穩定性
- 修正了 SharedPreferences 鍵配置錯誤,確保模組緩存能正確加載。
- 優化 檔案注入器: 減少 ZipFile 重複 I/O,提升啟動效率。
- 優化 profile 禁用: 採用冪等性檢查和 Truncate 替代 Delete/Create 流程,增強對系統監控的穩定性,避免用戶配置意外清除。
- 代碼精簡: 改進了變數命名和程式碼結構。

fix: 正確設定共享偏好設定鍵並提升加載穩定性

- 修正了 SharedPreferences 鍵配置錯誤,確保模組緩存能正確加載。
- 優化 檔案注入器: 減少 ZipFile 重複 I/O,提升啟動效率。
- 優化 profile 禁用: 採用冪等性檢查和 Truncate 替代 Delete/Create 流程,增強對系統監控的穩定性,避免用戶配置意外清除。
- 改進 manager 構建檔案確保所有庫檔案不被壓縮。
- 代碼精簡: 改進了變數命名和程式碼結構。
2025-12-07 22:52:51 +08:00
NkBe 5aa809dc5a
Refactor:Replace all instances of `lspatch` with `npatch`
嘗試规避關鍵詞檢測
2025-12-02 23:42:23 +08:00
NkBe f03ad9a386
fix: improve asset handling and error checks 2025-11-21 19:33:34 +08:00
NkBe b076eed005
fix: 优化 manager 连接与禁用 profile 文件
修正 manager 连接失败时的回退逻辑,避免 service 为 null,统一本地服务处理。新增 disableProfile 方法,自动清理和禁用 profile 文件,防止 profile 干扰运行。
2025-11-20 20:58:37 +08:00
NkBe 83817fba3c
feat: restore IntegrApplicationService and refactor RemoteService
LSPApplication 現在會根據情況選擇使用 IntegrApplicationService 或 NeoLocalApplicationService(是否 useManager 和安裝包内是否有集成模組安裝包)。
重構 RemoteApplicationService,簡化連接流程,移除死亡監聽(NeoLocal用不到了)。
2025-11-19 21:03:41 +08:00
NkBe 5642d2e62f
Improve compatibility with boot.oat in recent A15
See JingMatrix/LSPosed#414 for details

Also update few dependencies.

Co-Authored-By: JingMatrix <jingmatrix@gmail.com>
2025-11-19 21:03:41 +08:00
NkBe 0883ea5577
refactor: improve module loading and remote service
優化本地模組加載流程,修復模組路徑丟失時自動恢復,並加強日誌提示。重構 RemoteApplicationService,實現 Binder 死亡監聽與資源釋放,提升遠端服務連接穩定性與錯誤處理能力。
2025-10-29 23:16:38 +08:00
NkBe c30f588b50
fix: extend service bind timeout and improve getPrefsPath 2025-10-29 23:16:38 +08:00
NkBe 307660038e
refactor: rename lspatch meta key to npatch 2025-10-29 21:38:58 +08:00
NkBe d843faa515
fix: Forgot to add the inject DP option and Remove redundant intent-filter
.
2025-10-29 21:38:58 +08:00
NkBe a2b9e529ca
feat: support inject MT Manager DocumentsProvider
Co-Authored-By: Hicores <me@hicore.cc>
2025-10-29 21:38:57 +08:00
NkBe 5d21b9c599
feat: Optimized kill signature verification feature
Added a public method, `replaceApplication`. This method uses Xposed to intercept `android.app.ApplicationPackageManager`'s `getApplicationInfo` and `getApplicationInfoAsUser`. It allows for dynamic changes to the application's `sourceDir` and `publicSourceDir` to redirect the location where the system loads APKs.
2025-10-08 15:47:17 +08:00
NkBe(HSSkyBoy) d644c22ade
feat: support patching with new package name
feat: log APK patch paths in submitPatch

fix: improve temp APK file handling

feat: add newPackageName option

refactor: optimize patch install dialogs

feat: support rename packagename
Co-Authored-By: javaeryang <27242250+javaeryang@users.noreply.github.com>
2025-10-08 15:47:16 +08:00
NkBe(HSSkyBoy) d1993bb739
feat: Introduced <unistd.h> and optimized logs and error messages 2025-10-06 23:27:30 +08:00
NkBe(HSSkyBoy) 7613e7de10
feat: add output log to media
底層實現了日誌檔案寫入。為管理器新增了 outputLog 選項,可以將日誌輸出到 Android/media 目錄。
2025-10-06 23:27:30 +08:00
NkBe dbacad9876
fix: improve service fallback and module loading 2025-10-01 17:56:01 +08:00
NkBe 9804125d1f
feat: Streamline application mode descriptions 2025-09-30 23:24:03 +08:00
NkBe ed202bbb10
refactor: use PatchConfig and optimize module loading
[feat: Local mode runs without background manager](https://github.com/7723mod/NPatch/pulls/2)
2025-09-30 23:24:02 +08:00
NkBe 5bbef84a43
feat: Add null checks for JNI method arguments
Adds a null pointer check for the origApkPath and cacheApkPath arguments in the enableOpenatHook native method.

Previously, passing nullptr to this method would lead to a potential crash. The added checks ensure the function handles invalid input gracefully by logging an error and returning early, thus preventing a potential crash.
2025-09-30 23:24:02 +08:00
NkBe c2fdd4941d
refactor: improve hook and dex loading logic
重構了 patch_loader.cpp 並修改了bypass_sig.cpp,優化了 openat hook 的實現方式,簡化了 HookOpenat 和 enableOpenatHook 的流程。PatchLoader 的 LoadDex、InitArtHooker、InitHooks、SetupEntryClass、Load 方法也進行了結構優化,提升了代碼可讀性和健壯性,減少了重複代碼,並加強了錯誤處理。
參考自 802d3fbe28 爲什麽這樣改我也有點忘了,commit用Copilot寫的
2025-09-07 22:17:31 +08:00
NkBe 4e63d61cd3
fix: can't connect to manager
順便優化了一下排版
2025-09-07 22:16:41 +08:00
NkBe c0aecf9e33
change name and url
Co-Authored-By: Kaelyn Wisoky <206877283+lshwjgpt25@users.noreply.github.com>
2025-09-05 23:48:04 +08:00
NkBe 624a786bad
fix: liblspatch.so not found by modifying include path
让不同的构建有独立的输出目录,防止文件冲突
2025-08-18 13:40:32 +08:00
NkBe 493d367bfc
fix: 缺失的大括号 2025-08-17 22:40:26 +08:00
NkBe 336ad9ecf8
Fix: 兼容特殊加固
問題出自
7b98d98389
只是嘗試性修復
2025-08-17 22:20:04 +08:00
JingMatrix 5180d7315d Update dependencies
Update compose-destinations is non-trivial.
To use version 2.0+ in the future, we need to follow its migration guide:
https://composedestinations.rafaelcosta.xyz/migrating-to-v2/
2025-08-03 09:42:16 +02:00
JingMatrix 95ed02d4bb Update JingMatrix/LSPosed
Users of Android 16 beta 3 has reported LSPlant failure, for which we should thus update LSPosed.
See issue https://github.com/JingMatrix/LSPlant/issues/2.

Files are reformatted.
2025-03-15 09:22:18 +01:00
JingMatrix bab8bd2d4c Update JingMatrix/LSPosed 2024-12-01 09:48:30 +01:00
JingMatrix 332d99784e Fix log formatting of __openat hook 2024-09-16 19:22:30 +02:00
JingMatrix 557d56091d Update JingMatrix/LSPosed
To avoid a crash in the fisrt launch (#7), we cannot use PLT
.inline_hooker to DisableBackgroundVerification.

Remove ccache to avoid difference between CI builds and local builds.
2024-09-16 19:22:26 +02:00
JingMatrix cddf811b9c Update dependencies
1. Use JDK 21
2. Update ksp for compatibility (compulsory)
3. R8 claims that org.lsposed.lspatch.util.ModuleLoader is needed

We use rules in share/lspatch-rules.pro to ensure that LSPatch works
properly after R8 engine
2024-05-18 22:57:32 +02:00
JingMatrix 3dacebc6bf Remove symbol cache
See commit 42190f1fb8
2023-12-28 14:00:22 +01:00
JingMatrix c3ee8bec23 Check ProfileFile existence first
Avoid java.nio.file.NoSuchFileException when readAttributes.
2023-12-28 13:29:27 +01:00
JingMatrix 87a765d65c Remove dependency on Gson
Patch-loader might use Gson provided by the apk classLoader
2023-12-28 13:29:27 +01:00
Js0n 3674a967ef
Remove keep alive foreground service because bound service won't need it (#262)
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-11-23 20:32:24 +08:00
LoveSy 7d69dbcb66 Fix crash and sync 2023-06-29 10:08:50 +08:00
Howard Wu 941726d559
Core upgrade (#213)
Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-06-29 02:17:00 +08:00
JingMatrix 5d927f1dd2
Fix file permissions for Android 14 (#201)
Dex file should not be writable, otherwise it causes
java.lang.SecurityException.

Here is the related [soucre
code](https://cs.android.com/android/platform/superproject/+/master:art/runtime/native/dalvik_system_DexFile.cc;l=381)
of Android 14.

---------

Co-authored-by: LoveSy <shana@zju.edu.cn>
2023-06-08 00:11:47 +08:00
Howard Wu 0964a8eece
Update core to 1.8.6 (#168)
With
- update AGP to 7.4.0
- update Android Build Tools to 33.0.1
2023-01-28 11:54:06 +08:00
Nullptr 2ace2660b4
Fix modules missing after update loader for integrated mode 2022-11-13 22:43:39 +08:00
Nullptr c191397dc0
Add foreground keep alive option 2022-11-09 13:09:50 +08:00
Nullptr 54cf7eed35
Use service instead of content provider to send binder 2022-11-08 02:54:31 +08:00
Nullptr 9c951bdbb6
Better signature bypass 2022-11-05 22:58:45 +08:00
Nullptr 5876d4a0a0
Update dependencies & Fix UI previewing 2022-11-05 12:00:25 +08:00
Nullptr f8888b81e8
Support bootstrapping loader dynamically for local mode (#118) 2022-10-21 15:24:16 +08:00
Nullptr edea4552a2
Support fake signatures for other lspatched apps 2022-10-20 18:36:41 +08:00
Bob Pan 030e1e54bc
replace PackageInfo.CREATOR to hook creation of PackageInfo in all Parcel api (#117)
* replace PackageInfo.CREATOR to hook creation of PackageInfo in all Parcel api

* also clear Parcel.sPairedCreators
2022-10-14 21:31:58 +08:00