Commit Graph

299 Commits

Author SHA1 Message Date
JingMatrix 3540f14481
Gracefully handle ENOTSUP in ConfigFileManager.chattr0 (#523)
The `chattr0` method, which attempts to clear special file attributes (like 'i' for immutable) using `ioctl`, can fail with an `ErrnoException` and the error code `ENOTSUP` (Operation not supported) on certain filesystems or Android environments (e.g., noted on a Android 11 device).

When `ioctl` fails with `ENOTSUP`, it means the underlying filesystem does not support the operation of setting/clearing these attributes. In this case, we can safely assume the file/directory is not immutable via this mechanism and treat the operation as a successful non-action.

This commit updates `chattr0` to catch `ErrnoException` specifically and return `true` if the error is `OsConstants.ENOTSUP`, preventing unexpected failures in config file management.
2026-01-31 15:51:03 +01:00
JingMatrix 047ad98c65
Fix dex2oat crash on Android 10 due to architecture mismatch (#521)
Previously, the daemon determined the architecture of the target `dex2oat` binary based on its own process architecture (`Process.is64Bit()`).
On Android 10, `/apex/com.android.runtime/bin/dex2oat` is frequently a 32-bit binary, even on 64-bit devices.

This caused the daemon to incorrectly treat the target as 64-bit and mount the 64-bit wrapper (`bin/dex2oat64`). Consequently, the wrapper attempted to execute the 32-bit binary using `linker64`, resulting in a crash: `error: "/apex/.../dex2oat" is 32-bit instead of 64-bit`

This commit changes the logic to inspect the ELF header of the target binary. We now explicitly check `e_ident[EI_CLASS]` to determine if the file is 32-bit or 64-bit and assign it to the correct mounting slot. This ensures the 32-bit wrapper is mounted over 32-bit targets, preventing the linker mismatch.
2026-01-28 18:07:00 +01:00
JingMatrix 1436f692fb
Refactor dex2oat wrapper to solve long-standing issues (#515)
Manual library path injection via LD_LIBRARY_PATH has become unreliable due to symbol mismatches in core libraries (e.g., `libc++`) between the system and APEX partitions. Recent updates to `liblog` and `libbase` (in Android 16) have resulted in missing symbols like `__hash_memory` or `fmt` when the ART APEX binaries are forced to load system-partition shims.

This commit switches the wrapper to execute the runtime APEX linker directly (e.g., `/apex/com.android.runtime/bin/linker64`). By passing the dex2oat binary to the linker via `/proc/self/fd/`, the linker can properly initialize internal namespaces and resolve dependencies from the correct APEX and bootstrap locations.

Moreover, for the OatHeader hook, a bug introduced in 6703b45350 is now fixed, where the target functions of PLT hooks are overwritten by the our helper functions.

Details of the refactored project are explained in README.
2026-01-25 10:13:57 +01:00
JingMatrix 211bd5f115
Centralize dependencies and migrate to submodules (#512)
Centralize dependencies and migrate to submodules

Move `apache` and `axml` modules to a unified `external` directory and migrate libxposed API and service interfaces from Maven dependencies to Git submodules.

Included changes:
- Updated .gitmodules with new paths.
- Simplified core.yml CI workflow.
- Updated Gradle project references to use the new directory structure.
- Added documentation for external components.
2026-01-22 15:13:06 +01:00
JingMatrix b6fb2f7855
[translation] Update translation from Crowdin (#503)
* New translations strings.xml (Japanese)

* New translations strings.xml (Japanese)

* New translations strings.xml (Swedish)
2026-01-15 21:50:16 +01:00
JingMatrix 0e457e3247 Start LSPosed daemon in `service.sh`
This reverts partially commit c622d0f1f9.

In my test device (Pixel 6, Android 16 qpr2, KernelSU), calling twice LSPosed daemon results a detection based on `mount_id` values. In `com.reveny.nativecheck` 7.6.1, it is named as `Detected Magic Mount`.
Of course, this naming is incorrect and misleading. We refer to https://github.com/JingMatrix/NeoZygisk/pull/39 for details of this detection point.
2025-12-04 23:59:55 +01:00
JingMatrix 487e835559 Properly set SELinux context after reboot
After reboot, the SELinux context labels for files located in `/data/adb` are reset to `u:object_r:adb_data_file:s0`.

To fully address the issue in ed1f61d2, we should always compare the SELinux context and reset it when necessary.
2025-11-08 20:17:05 +01:00
JingMatrix b270bd55df
[translation] Update translation from Crowdin (#343) 2025-11-08 17:24:32 +01:00
JingMatrix ed1f61d26e Fix SELinux context for Xposed API 100
Files in `/data/adb/lspd/modules/` should be accessible via xposed API `openRemoteFile`.
Close #381 and #466 as fixed.
2025-11-08 16:54:34 +01:00
JingMatrix 31e19069e4
Invoke dexopt via command line (#445)
Starting with Android 14 (API level 34), the Android Runtime (ART) Service handles on-device Ahead-Of-Time (AOT) compilation, also known as `dexopt`.
As a result, in Android 16 beta qpr2, the method `performDexOptMode` is removed.

See https://source.android.com/docs/core/runtime/configure/package-manager for details.
2025-11-08 15:58:32 +01:00
JingMatrix c622d0f1f9 Start service daemon in post-fs-data.sh (#429)
For trace cleaning modules to work properly, such as the DenyList feature of NeoZygisk, it is better to execute modules mount (`dex2oat` for the case of LSPosed) at post-fs-data.sh.

Moreover, the `logd` daemon of LSPosed should start as early as possible.

This reverts commit 92cbed418e (pull-request #57).

The original pull-request claimed a `PlayIntegrityFix` break, but was not reproducible on other devices.
2025-11-08 11:59:16 +01:00
JingMatrix e7018a3b87 Collect logs for TEESimulator
Simplify the process of debugging https://github.com/JingMatrix/TEESimulator
2025-11-08 11:59:16 +01:00
JingMatrix 2666bdad2d
Correct database migration and initialization logic (#236)
Reworks the `initDB` function to resolve critical failures.

- Prevents a "no such table: configs" crash on fresh installs by
  deferring the compilation of CREATE TABLE statements until their
  dependencies are met.
- Fixes a "duplicate column" error by correcting the initial schema
  and letting migration logic add new columns.
- Replaces the fragile fall-through switch and nested transactions with a
  robust, sequential upgrade process inside a single atomic transaction.
2025-09-14 17:21:14 +02:00
Furkan Karcıoğlu 2293acbe27
Fix support for Android 16 QPR Beta 3 (#326)
The function signature of `getUsers` in class `android.os.IUserManager` is changed to `getUsers(Z)Ljava/util/List;` in Android 16 QPR Beta 3.

The corresponding calls to this function are updated to fix this incompatibility, which was initially observed on Android Canary.
2025-07-18 04:42:14 +02:00
JingMatrix 165ad94bf9 Adjust logs for dex2oat
1. Log dex2oat for debugging purpose
2. Avoid log formatting warning of type `dev_t` since it could be `%lu`
   or `%u`
3. Reformat changed files
2025-03-07 07:13:35 +01:00
JingMatrix bfa38b0d53 Fix liboat_hook.so inaccessible in some device (#190)
User has reported `dex2oat` failure with SELinux log:

```
W dex2oat64: type=1400 audit(0.0:922): avc: denied { read } for path="/data/adb/modules/zygisk_lsposed/bin/liboat_hook64.so" dev="dm-58" ino=91204 scontext=u:r:dex2oat:s0 tcontext=u:object_r:adb_data_file:s0 tclass=file permissive=0
```

Hence, we now set the SELinux context of `liboat_hook.so` in Dex2OatService.

Moreover, by the pull-request #194, we have to move `putenv` out of the if block by testing.
Indeed, if we call `putenv` inside the if block, then it is no longer valid out of the block.
2025-02-23 09:30:36 +01:00
JingMatrix c0478f593e
Hook dex2oat functions to remove LSPosed traces (#152)
We use the env LD_PRELOAD to hook the execution of `dex2oat`, which can be directly set to be a file descriptor.
2025-01-08 07:19:18 +01:00
JingMatrix 2bc0f0c716 Refine SELinux rules for Xposed files (#149)
1. The SELinux context label `magisk_file` is widely used by Zygisk implementation modules. It is improper for LSPosed to abuse this label for its own files. We replace it by `xposed_file`.
2. A new rule added according to the SELinux logs, which is needed to write to the mangaer's SharedPreference.
3. `xposed_data` is a new SELinux context label for XSharedPreference files, it is not meant to provide MAC restricted access but to conform with Android's rule: https://developer.android.com/about/versions/pie/android-9.0-changes-28#per-app-selinux.
4. We add attribute `mlstrustedobject` to ignore the `Multi-Level and Multi-Category Security` enforced on Android.
2025-01-06 16:31:17 +01:00
JingMatrix fba56a9927 Adjust debugging settings
1. Set log buffer size for system
2. Increase buffer size to 128 Kb
3. Record also logs for APatch, KernelSU and SELinux
4. Add installation tasks for APatch
2025-01-03 14:06:28 +01:00
JingMatrix 583aa30393 Avoid start multiple log watchdog threads
It is observed that `enableWatchDog` might be called after the manager
activity is resumed without user's interaction, due to some unknown
mechanism of preference refreshing.
2024-12-10 11:56:42 +01:00
JingMatrix e7a5835d8f
Clear compilation warnings (#121)
* Fix warnings of CMake

To completely remove CMake version warnings, one may need to change the CMakeLists.txt file in the NDK installation.

* Add compiler flag -Wpedantic

Show compilation errors for the core subject, while ignore some of them
2024-12-09 22:15:18 +01:00
JingMatrix 8dff17c1f9 Fix log watchdog logic
Log watchdog is meant to revert changes to the system prop
`persist.log.tag`, which sets global log level, see docs at
https://cs.android.com/android/platform/superproject/main/+/main:system/logging/logd/README.property

Current commit fixes the following:
1. avoid recast size value `-1` to unsigned integer type size_t;
2. allow the `Enable log watchdog` to removed added system prop and
   restart the watchdog forcely.
2024-12-09 09:55:06 +01:00
JingMatrix fd3f76324e [translation] Update translation from Crowdin (#112,#116)
* New translations strings.xml (French, Romanian, Chinese)

* Fix Crowdin CDATA escape problem

The gradle parsing error happens because the character `'` of
`system_prop_incorrect` still needs to be escaped even it has already
been enclosed in CDATA.
2024-12-09 09:53:39 +01:00
JingMatrix 98565cf9b8 Fix logs generated by LSPosed manager
1. Update Dobby to set log TAG properly
2. Fix log preference settings for debug version
2024-12-07 13:00:08 +01:00
JingMatrix 1339fc7d3c Add more options in the Select menu
Allow users to select all/none and automatically include new applications.
Close #93 as completed.

Co-authored-by: mywalk <66966897+mywalkb@users.noreply.github.com>
2024-12-04 21:35:05 +01:00
JingMatrix 466b3a4aee
Strip logs if verbose log is disabled (#101)
When the `Disable verbose log` option is toggled, more logs are stripped to avoid detections based on log entries.
2024-11-25 22:28:34 +01:00
JingMatrix 85b8fa17fb Set provider of FakeContext as a workaround
The ContentProvider of FakeContext is tricky, being null or not, it can
always break notification construction in some devices.
Close #79 as fixed.
2024-11-24 22:24:48 +01:00
JingMatrix 0a2f26fef9 Fix parcel recycling when no response from bridge
In case that there is no response from bridge, a second try of sending
binder will cause the (unowned) parcels to be recycled twice.
2024-11-24 00:42:15 +01:00
JingMatrix 1b98e55cfc Bypass flags checks for Notification constrctors
Close #98 #96 as fixed.
In the decomplied smali files, the method `load_overrides_systemui`
of the class `FeatureFlagsImpl` is called only if its field
`systemui_is_cached` is false.
2024-11-22 20:30:09 +01:00
JingMatrix a8fd853657
[translation] Update translation from Crowdin (#87)
* New translations strings.xml (Japanese)

* New translations strings.xml (Japanese)

* New translations strings.xml (Japanese)

* New translations strings.xml (French)

* New translations strings.xml (Japanese)

* New translations strings.xml (Turkish)

* New translations strings.xml (Japanese)
2024-11-04 19:03:46 +01:00
JingMatrix 8fb6afb84e Rename Apache class names to avoid conflicts
We add a gradle task to rename class names in the Apache library
2024-10-31 14:43:43 +01:00
JingMatrix f1f0b42c70
[translation] Update translation from Crowdin (#81)
* New translations strings.xml (Arabic)

* New translations strings.xml (Russian)

* New translations strings.xml (Portuguese, Brazilian)
2024-10-29 14:48:12 +01:00
JingMatrix ff04a68822
Fix CallBooleanMethodV hook of exec_transact (#71)
* Revert "use shared memory"

This reverts commit 44570c5ed0.

* Revert "fix manager not detected"

This reverts commit 9125b4b2f1.

Close #69 as fixed.
2024-10-17 18:46:01 +02:00
Captain Throwback 92cbed418e Start service daemon in late_start mode (#57)
1. Starting daemon during post-fs-data can cause Play Integrity detection
   for devices without the PlayIntegrityFix module.
2. Starting LSPosed service daemon in post-fs-data mode is redundant on
   many devices
2024-10-08 03:05:03 +02:00
JingMatrix d5533e3048
[translation] Update translation from Crowdin (#42)
* New translations strings.xml (French)

* New translations strings.xml (Spanish)

* New translations strings.xml (Chinese Simplified)
2024-09-24 10:36:45 +02:00
JingMatrix 4d8e01176f Remove Riru support
The repository RikkaApps/Riru is archived since Jan 8, 2024, which
recommends Zygisk as its alternative.
2024-09-23 11:10:25 +02:00
JingMatrix 6b2ce6c614 Add commons-lang as a subproject
Avoid using a local version of this apache module
2024-09-22 14:25:45 +02:00
JingMatrix b317b48e9a Allow to de-activate log watchlog (#20)
Requested by #14, a switch is added to the release version.
Patch of msvamp rejected in original repository
mywalk added ui interface

Co-authored-by: mywalk <66966897+mywalkb@users.noreply.github.com>
2024-09-22 14:25:40 +02:00
JingMatrix 42cf1c2fd5 [skip ci] Replace submodule Dobby by LSPlt
It remains to implement HookFunction and UnhookFunction with LSPlt
2024-08-31 05:36:57 +02:00
5ec1cff 41eb1c63ad new parasitic manager 2024-08-31 02:43:25 +02:00
5ec1cff 9125b4b2f1 fix manager not detected 2024-08-31 02:43:25 +02:00
5ec1cff 44570c5ed0 use shared memory 2024-08-31 02:43:24 +02:00
JingMatrix 17625a04d5 Fix CMake syntax error
Update cmake version
2024-07-24 01:23:05 +02:00
5ec1cff 948fda8e0c
set DdmHandleAppName to package name for daemon (#2905) 2023-12-30 11:44:59 +08:00
5ec1cff 2f58f0785d
fix FakeContext getContentResolver NPE (#2904) 2023-12-30 03:31:54 +00:00
LoveSy ab0ee265b1
Fix oneui notification (#2902) 2023-12-30 00:35:21 +08:00
5ec1cff edecd5c253
fix daemon could not post notification after soft reboot (#2899) 2023-12-28 09:34:13 +00:00
rawer886 6f1268e7af
Fix dex2oat on 64bit only Android 10 (#2820) 2023-10-19 03:50:06 +00:00
XposedBot 82d138cc6c
[translation] Update translation from Crowdin (#2807) 2023-10-11 11:41:20 +00:00
LoveSy c5e1a544bf
Update ApplicationInfo if it was system_server cached (#2805) 2023-10-11 11:10:18 +08:00