Commit Graph
58 Commits
Author SHA1 Message Date
topjohnwu b43a08fdde Bump minSdk to 24 and drop API 23 workarounds
- Bump minSdk to 24 in Setup.kt, APP_PLATFORM to android-24 in
  Application.mk, and update CI AVD matrices and scripts.
- Unify SePatchStrategy::Legacy with SePatchStrategy::SelinuxFs in
  magiskinit to use MOCK_ENFORCE FIFO blocking and remove MOCK_REQPROT.
- Make APP_DATA_DIR a compile-time "/data/user_de" constant and remove
  pre-API 24 /data/user and /data/adb fallbacks.
- Remove Android 6.0 Samsung forkAndSpecialize JNI hook signature.
- Remove pre-API 24 device-protected storage wrappers, Api23Impl in
  LocaleSetting, AndroidManifest.xml stub resource workaround, and
  ServiceCompat/ProcessCompat/InlinedApi workarounds in the app.

Assisted-by: Gemini 4 Argon
2026-10-22 14:06:48 -07:00
fhgffy 806ecdf8e8 Handle NULL database strings safely
SQLite returns a null pointer for SQL NULL. Passing it to rust::Str
crashes the daemon when a query result contains a NULL column.

Return an empty Rust string for NULL while leaving the raw C++ getter
unchanged, so callers that distinguish NULL can keep doing so.

Fixes: #10131
Assisted-by: GPT-6
2026-10-05 22:06:05 -07:00
topjohnwu b76d674a60 Move daemon utilities from base to core
Move utilities that are exclusively used by the daemon (core module)
from base to core:
- fork_dont_care, fork_no_orphan, new_daemon_thread, init_argv0,
  set_nice_name, and switch_mnt_ns into utils.cpp
- exec_command* functions and exec_t into scripting.cpp as static
  functions, as scripting is their sole consumer

Also remove the unused exec_command_sync overload.

Assisted-by: Gemini 3.8 Flash
2026-10-02 17:17:48 -07:00
topjohnwu 8b7d1ffcdd Migrate magisk_main to Rust 2025-09-18 03:22:44 -07:00
topjohnwu cf483ad4d2 Migrate connect_daemon to Rust 2025-09-15 14:25:18 -07:00
topjohnwu 4aed644e08 Directly accept RequestCode for connect_daemon 2025-09-15 14:25:18 -07:00
topjohnwu 8b49eda85a Migrate daemon_entry to Rust 2025-09-15 14:25:18 -07:00
topjohnwu 7057d4c7f1 Migrate setup_magisk_env to Rust 2025-09-15 14:25:18 -07:00
topjohnwu 7cccf83b37 Remove unused poll_ctrl implementation 2025-09-14 01:59:04 -07:00
topjohnwu bd657c354c Reduce FFI across C++/Rust 2025-09-02 22:06:08 -07:00
topjohnwu 653730d75e Make cxx binding generate less code 2025-08-29 01:44:06 -07:00
topjohnwu c4e2985677 Migrate resetprop to Rust 2025-08-27 22:48:48 -07:00
topjohnwu 42d9f87bc9 Cleanup resetprop code 2025-08-27 22:48:48 -07:00
topjohnwu 2e4fa6864c Make Utf8CStr a first class citizen in C++ codebase
Utf8CStr is in many cases a better string view class than
std::string_view, because it provides "view" access to a string buffer
that is guaranteed to be null terminated. It also has the additional
benefit of being UTF-8 verified and can seemlessly cross FFI boundaries.

We would want to start use more Utf8CStr in our existing C++ codebase.
2025-08-27 22:48:48 -07:00
topjohnwu 8d10ab89f2 Set zygisk properties in Rust 2025-08-20 11:23:18 -07:00
topjohnwu cd0eca20b0 Migrate connect.cpp to Rust 2025-08-08 21:06:41 -07:00
topjohnwu 589a270b8d Migrate disable/remove modules to Rust 2025-08-05 11:24:55 -07:00
topjohnwu 55c3ee3a6f Move Zygisk code out of module.cpp 2025-07-07 13:43:11 -07:00
topjohnwu 1460317ebd Cleanup C++ headers 2025-06-16 02:25:38 -07:00
topjohnwu 73840f8721 Migrate selinux.cpp to selinux.rs 2025-04-28 17:22:14 -07:00
topjohnwu 88628fdf3c Make sure IPC is arch agnostic 2025-02-02 22:08:41 +08:00
topjohnwu 0469817781 Cleanup code and bindings 2025-02-02 22:08:41 +08:00
topjohnwu a786801141 Implement su_daemon in Rust 2025-02-02 22:08:41 +08:00
topjohnwu ab86732c89 Implement simple serialization over IPC 2025-02-02 22:08:41 +08:00
topjohnwu 59622d1688 Use static methods in cxx-rs 2025-02-02 02:46:33 +08:00
topjohnwu b25aa8295a Move bootstage into Rust 2025-01-31 02:52:27 +08:00
topjohnwu 15a605765c Fully implement daemon side of Zygisk in Rust 2025-01-31 02:52:27 +08:00
topjohnwu b575c95710 Implement fd I/O on Rust side 2025-01-31 02:52:27 +08:00
topjohnwu a48a9c858a Migrate zygisk handler to Rust 2025-01-31 02:52:27 +08:00
topjohnwu 0d8d6290a3 Move module list into MagiskD 2025-01-31 02:52:27 +08:00
topjohnwu 82d1d19267 Migrate uid_granted_root to Rust 2025-01-11 00:11:48 +08:00
topjohnwu 4d4195c02d Migrate prune_su_access to Rust 2025-01-11 00:11:48 +08:00
topjohnwu 5637a258fc Migrate package detection to Rust 2025-01-11 00:11:48 +08:00
topjohnwu 7edd8be169 Minor changes 2025-01-04 02:24:08 -08:00
topjohnwu 24650eefe4 Bind SQLite to Rust 2025-01-04 02:24:08 -08:00
topjohnwu 8e1a44e7eb Use argument binding for query 2025-01-04 02:24:08 -08:00
topjohnwu 2722875190 Use better C++ SQL APIs 2025-01-04 02:24:08 -08:00
topjohnwu 3ca6d06f69 Cleanup database code 2025-01-04 02:24:08 -08:00
topjohnwu 10e47248de Use finer grain sqlite3 APIs 2025-01-04 02:24:08 -08:00
topjohnwu 09c7ac754b Simplify MagiskD Rust/C++ FFI 2024-12-03 15:51:17 -08:00
topjohnwu 2bdc047c4d Call sqlite3_free only on sqlite3 malloc-ed objects 2024-08-14 13:23:59 -07:00
vvb2060 2963d4ca9e Rewrite get_manager 2024-07-12 13:45:48 -07:00
vvb2060 6aab856de7 Enhanced denylist app id tracking 2024-07-12 13:45:48 -07:00
topjohnwu 6c27ba6b88 Rename db entry name 2024-05-15 12:42:55 +08:00
vvb2060 02e189a029 core: add safe mode config to db 2024-05-15 12:42:55 +08:00
vvb2060andtopjohnwu 60e8415369 Make denylist work when zygisk is disabled
Co-authored-by: topjohnwu <topjohnwu@gmail.com>
2024-04-08 23:00:50 -07:00
topjohnwu 2cb0af1ff3 Move revert_unmount into Rust 2024-03-30 02:51:39 -07:00
topjohnwu a1b6568226 Implement preinit related features in Rust 2024-03-28 14:11:03 -07:00
topjohnwu 308c9999fa Properly detect package changes 2024-01-28 00:42:43 -08:00
topjohnwu f2c4288d2d Run pthread_atfork only once
Close #7704
2024-01-25 00:17:05 -08:00