Commit Graph

526 Commits

Author SHA1 Message Date
NkBe db64adde94
Use reflection for DexFile and XResources
Avoid direct references to dalvik.system.DexFile and android.content.res.XResources by using reflection and guarded calls. LSPApplication now constructs and injects the provider dex via reflective DexFile/DexPathList$Element creation inside a try/catch to handle deprecation/compat issues on newer Android versions and log failures. LSPLoader replaces the direct XResources.setPackageNameForResDir call with a reflective invocation (with warning logs) to prevent class resolution failures under strict boot classloader namespace delegation. Also added logging and minor import/constant adjustments to improve robustness and diagnostics.

Co-Authored-By: MrZhongzq <108169409+mrzhongzq@users.noreply.github.com>
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
2026-03-06 22:10:05 +08:00
NkBe 43ca1640ab
Fix .so file 16KB alignment in patched APKs:
- Change .so alignment from 4096 to 16384 bytes to comply with
     Android 15+ 16KB page alignment requirements.

Co-Authored-By: MrZhongzq <108169409+mrzhongzq@users.noreply.github.com>
Co-Authored-By: Claude <81847+claude@users.noreply.github.com>
2026-03-06 22:06:32 +08:00
NkBe cf6993baa0
Fix ConfigProvider crash: Make ConfigManager database initialization
lazy to prevent UninitializedPropertyAccessException when ContentProvider
   is queried before Application.onCreate() runs.
2026-03-06 21:31:19 +08:00
NkBe cf50194b29
chore: update core submodule URL to HSSkyBoy repository 2026-03-06 21:31:19 +08:00
NkBe 3c8964bc83
Enable resource shrinking; bump CMake min version 2026-02-23 18:02:04 +08:00
NkBe df7bf3eb58
修復模組加載備援機制
新增本地快取讀取:當系統無法透過 Content Provider 獲取管理器模組清單時,會自動切換至 loadModulesFromCache 模式,從本地的 SharedPreferences 讀取先前儲存的模組資訊。

支援路徑加載:快取機制支援直接透過檔案路徑(APK Path)加載模組,即使該 App 已被卸載或路徑變更,只要檔案存在即可嘗試加載。
2026-02-11 23:26:41 +08:00
NkBe 7e5e2d6bfd
feat: 新增外部 APK 覆蓋支援
將原始 APK 的處理邏輯 (計算 CRC、解壓、路徑分配) 抽離至獨立類別。
系統啟動時會優先檢查外部路徑  ` /sdcard/Android/data/[包名]/cache/npatch/origin/origin.apk `
若偵測到外部檔案,將自動使用該檔案覆蓋內部快取,方便用戶在不重新打包的情況下更換 原始 APK 。
自動將快取後的 APK 設為「唯讀」狀態,並強化了資源缺失時的報錯機制。

Co-Authored-By: hw1020 <43195286+hw1020@users.noreply.github.com>
2026-02-11 23:08:08 +08:00
NkBe 7844b99b3a
Fix: Choose service according to embedded module
Improve startup resilience by selecting the application service according to availability: catch Throwable from manager lookup and clear service on failure, then if service is null check hasEmbeddedModules(context) to prefer IntegrApplicationService when embedded modules exist, otherwise use NeoLocalApplicationService. Also refine logging levels/messages (info on success, warn on failure) to provide clearer diagnostics.
2026-02-11 21:36:13 +08:00
NkBe f2713a342b
Use NestedZip linking with copy fallback
Make APK packaging more robust by conditionally embedding the original APK (based on sigbypassLevel) and opening the source as either a NestedZip or a read-only ZFile. Attempt to add file links via NestedZip.addFileLink for entries, and fall back to copying the entry stream on failure or when source is read-only. Clean up related logic (remove the earlier separate embedding block), improve error messages, and minor reordering (minSdkVersion declaration) to streamline patch processing.
2026-02-10 21:45:38 +08:00
NkBe 834fefe421
Update core submodule and simplify CI checkout 2026-02-10 20:18:07 +08:00
NkBe 7cf0f3a229
refactor: optimize APK processing and cleanup redundant code
Refactored NPatch.java to use NestedZip, optimized dex file counting, and removed unused permission replacement methods. Improved logging and error reporting during the patch process.
2026-02-10 20:02:32 +08:00
NkBe c1480fa121
improve NPatch zip handling
將 android:largeHeap="true" 添加至管理員 manifest 中,防止系統限制 RAM。啟用 ZFileOptions.setNoTimestamps,並將來源 APK 嵌入為唯讀壓縮檔。
2026-02-10 19:26:23 +08:00
NkBe 97a23caa9e
修復 arsc 的正確壓縮和對齊
在 ZFileOptions 中為 .arsc 檔案添加 4 字節對齊規則,並在新增條目時將 resources.arsc 處理為原生程式庫。確保 resources.arsc 的正確對齊。
2026-02-10 18:37:34 +08:00
NkBe 11fc7aa9a2
Release 0.7.4 2026-02-10 17:46:50 +08:00
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 3aa1e26343
Restrict ARCHES to 64-bit ABIs
Remove 32-bit ABIs from NPatch's ARCHES set: only 'arm64-v8a' and 'x86_64' remain.
2026-02-10 14:32:24 +08:00
NkBe f4eacbf2d3
Update core and dependencies
Update to LSPosed v1.11.0
解決了 Android 10 和 OnePlus 裝置上的特定問題,重構 Dex2Oat 以消除缺失符號錯誤並提升可靠性....
https://github.com/JingMatrix/LSPosed/releases/tag/v1.11.0
2026-02-10 14:32:24 +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 01071283c6
Remove: Uncomment LogsScreen 2025-12-11 23:18:17 +08:00
NkBe f14f65d078
refactor(ui): 統一介面風格並優化佈局
- Home:重新整理資訊卡,將 StringBuilder 替換為 Composables;修正填充和 HtmlText 參數錯誤。
- Manager:為 TabRow 添加動畫指示器並統一頁面間距。
- Settings:為 KeyStore 對話框添加垂直滾動功能,以防止在小螢幕上出現裁剪。
- Repo:改善「即將推出」的 UI,增添圖標。
2025-12-11 22:42:26 +08:00
NkBe f215471400
fix(patch): 优化Manifest权限与authority映射
重构了权限和authority的映射逻辑,统一使用targetPackage变量,支持com.google.android前缀不变。

修改部分參考 #37,主要用於修復 #25

Co-Authored-By: areteruhiro <108941410+areteruhiro@users.noreply.github.com>
2025-12-11 22:36:05 +08:00
NkBe 2245f35f61
Release 0.7.3 2025-12-08 22:19:57 +08:00
NkBe efeb758845
fix(injectDex): Fixed the crash issue of the injection loader on some Android.
https://github.com/JingMatrix/LSPatch/pull/68
2025-12-08 22:19:44 +08:00
NkBe 5c8509e4f5
feat: 支持手動重載列表
- 當卸載後重新整理程式清單
- 可手動下拉刷新應用列表與模組列表
2025-12-07 23:47:43 +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 799bc1d022
feat: manager新增签名校验防篡改
HSSkyBoy
2025-12-07 21:31:27 +08:00
NkBe f4b2513182
feat: 更严格的权限检查
Android 11 及以上: 檢查 Environment.isExternalStorageManager(),如果沒有權限,則跳轉到「所有檔案存取權」設定頁面 。

Android 10 及以下: 檢查並請求 WRITE_EXTERNAL_STORAGE 和 READ_EXTERNAL_STORAGE 權限 。
2025-12-06 14:58:39 +08:00
NkBe 2d86d32ff2
manager: 优化构建配置 2025-12-05 22:28:44 +08:00
NkBe 544eccfeef
Move org.lsposed.npatch.util to nkbe.util 2025-12-04 23:06:27 +08:00
NkBe 611d77f263
rename provider2mtprovider 2025-12-03 22:32:53 +08:00
NkBe af548bb25d
feat: 增加已修補列表自動刷新 & 優化安裝完成後的跳轉邏輯
1. AppManageViewModel:
- 實現已修補應用列表的自動刷新機制(每 90 秒輪詢一次)。
- 引入 `silent` 參數區分自動刷新與手動刷新,避免自動刷新時 UI 出現加載轉圈,提升體驗。

2. NewPatchPage:
- 重構安裝成功的判定邏輯:不再僅依賴 PackageInstaller 的回調。
- 新增 `BroadcastReceiver` 監聽系統 `PACKAGE_ADDED` 和 `PACKAGE_REPLACED` 廣播。
- 確保系統真正註冊完新包後再執行導航返回 (navigateUp),解決安裝後立即返回導致列表尚未更新或狀態不同步的問題。
2025-12-03 00:33:21 +08:00
NkBe 5aa809dc5a
Refactor:Replace all instances of `lspatch` with `npatch`
嘗試规避關鍵詞檢測
2025-12-02 23:42:23 +08:00
NkBe fd8dc4d3c9
build(deps): bump the actions group across 1 directory with 2 updates (#31) 2025-12-02 21:40:46 +08:00
Chara White e576531cbc
readme: Fix Telegram link missing schema (#26) 2025-11-21 22:08:10 +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 4d7f56c21c
Release 0.7.2 2025-11-19 23:31:04 +08:00
NkBe c136335aaf
feat: support Shizuku API to fetch app list
ShizukuApi 增添 getInstalledApplications 方法,包名管理器增添 fetchAppList 方法,優先使用 Shizuku API 獲取應用列表,失敗則回退至標準 PackageManager。
2025-11-19 22:59:02 +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 9588a87814
refactor: improve APK signature block parsing 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 a89856c4b4
actions: use ubuntu runs
我記錯了,是 Windows 才兩倍份額,而且還沒 Ubuntu 快(
2025-11-19 20:53:41 +08:00
NkBe 0fa8ef2b89
enjoy: 專門為MiUI桌面卸載添加了提示,提升使用者體驗 2025-10-29 23:54:55 +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 094be621af
actions: runs on windows
使用 Windows 執行 Workfolws 能比 Linux 節省1倍的 Actions 份額
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