Commit Graph
7703 Commits
Author SHA1 Message Date
topjohnwu b910c7d915 Update .gitignore 2026-08-26 05:42:55 +00:00
Bela Schaum 3c411abc34 Fix slice copy range for 'want' in dtb.rs 2026-08-25 21:09:16 +00:00
topjohnwu 15062974a3 magiskboot: allow free zImage piggy payload size
Support dynamic zImage piggy payload sizes during repacking by updating
the zImage decompressor stub headers, symbol tables, and GOT entries.

Previously, magiskboot padded repacked zImage files to preserve the
exact original file size. For non-gzip compressed zImages (such as XZ),
repacking with a different payload size broke stub symbol resolution
and resulted in ununpackable or unbootable images.

Key changes:
- Encapsulate zImage parsing and patching in a dedicated struct ZImage
  in Rust with CXX FFI, new_head, and new_tail methods.
- Locate piggy_end using table references or GOT table entries bounded
  by LC0.
- Relocate LC0 table entries, LC1 table, and GOT table entries with
  4-byte padding/alignment when payload size changes.
- Relocate R_ARM_GOTPC PC-relative literal pools in decompressor .text.
- Append uncompressed size for non-gzip algorithms per size_append.
- Remove zopfli compression support across magiskboot as dynamic zImage
  piggy sizing supersedes the need for exact size matching.

Fix #9880

Assisted-by: Gemini 3.7 Flash
2026-08-25 19:09:29 +00:00
topjohnwu de60431a0d magiskboot: port find_dtb_offset to Rust
Port find_dtb_offset from C++ to Rust in dtb.rs, using the fdt crate
for header parsing and root node validation.

Key changes:
- Upgrade fdt crate to 0.2.0-alpha2 and adapt dtb.rs to updated APIs.
- Implement find_dtb_offset using Fdt::new_unaligned_fallible.
- Define MIN_NON_EMPTY_DTB_SIZE (0x48) per Linux kernel ARM zImage
  specification to ignore empty or false positive DTB headers.
- Expose find_dtb_offset to C++ via CXX bridge and clean up legacy
  structs and declarations.

Assisted-by: Gemini 3.7 Flash
2026-08-25 19:09:29 +00:00
topjohnwu c02705d969 magiskboot: migrate check_fmt to Rust
Migrate check_fmt and guess_lzma to Rust in format.rs.

Assisted-by: Gemini 3.6 Flash
2026-08-25 19:09:29 +00:00
Michael Jauregui a19666d884 magiskboot: Lower the compression presets for XZ & LZMA
magiskboot: Lower the compression presets for XZ & LZMA

The compression routine always uses the maximum compression preset for all formats.
This is problematic with XZ and LZMA because they use far more memory than the other formats, while just providing a very marginal advantage in the resulting file size.
The compression preset was changed from 9 to 6, which is often the default value and provides more than enough compression.
Tested on Samsung Galaxy Fame (512MB RAM, perfect for this).
2026-08-23 21:46:25 +00:00
topjohnwu 7600d3664f app: default to Monet theme and filter pre-Android S
Default to Monet (dynamic color) theme options on supported API
versions (Android S+) while hiding Monet options on unsupported
versions (< Android S).

Introduce ColorMode enum to encapsulate theme modes and UI index
mapping logic cleanly.

Assisted-by: Gemini 3.6 Flash
2026-08-23 15:42:12 +00:00
topjohnwu 8297807b8b apk-ng: refine M3 theme color schemes
Update light and dark color schemes in apk-ng to strictly align with
Material 3 Expressive color guidelines. Explicitly define surface
container tokens for improved contrast and card visibility, and
enhance primary and tertiary accents.

Assisted-by: Gemini 3.6 Flash
2026-08-23 15:42:12 +00:00
topjohnwu cc76a4e748 Update AGENTS.md 2026-08-22 23:23:55 -07:00
topjohnwu 99a6e2749f app: modernize architecture and state in apk-ng
Refactor apk-ng to adhere to modern Android and Jetpack Compose best
practices:
- Migrate VMFactory to the type-safe AndroidX viewModelFactory DSL.
- Use collectAsStateWithLifecycle across all screen composables to
  pause flow collection when backgrounded.
- Convert PolicyItem, ModuleItem, DenyAppState, and DenyProcessState
  to pure immutable data classes, removing Compose MutableState from
  ViewModels.
- Extract shell operations from UI model classes into ViewModels.
- Bridge Info.isConnected LiveData to coroutine Flow using callbackFlow
  and collect in viewModelScope without modifying :core.
- Consolidate magisk and manager version state into
  HomeViewModel.UiState.
- Add contentType to LazyColumn items for optimal list recycling.
- Restore proper localized string resolution in MainActivityDialogs.

Assisted-by: Gemini 3.7 Flash
2026-08-20 21:36:49 +00:00
topjohnwu 3aaf18038a app: improve Compose idiomaticity in apk-ng
Refactor apk-ng UI components and screens to follow idiomatic Jetpack
Compose patterns:
- Hoist state across dialogs and bottom sheets, replacing MutableState
  parameter passing with standard boolean flags and event callbacks.
- Add modifier parameter to all UI composables and apply proper modifier
  chaining.
- Decouple screen composables from MainActivity host casting by
  providing explicit authentication and permission callbacks.
- Scope SuperuserViewModel to MainActivity and share across MainScreen
  and SuperuserDetailScreen.
- Unify loose mutable states in SuRequestViewModel into an immutable
  UiState StateFlow.
- Fix dynamic loop remember allocations in MainActivity dialogs.
- Provide stable item keys for LazyColumn in MagiskLogTab.

Assisted-by: Gemini 3.7 Flash
2026-08-20 21:36:49 +00:00
topjohnwu c578a9632b app: reload tabs when selected in apk-ng
Because HorizontalPager pre-renders all tab composables, LaunchedEffect
with a Unit key was only executing once on initial creation. As a result,
changes to configuration (e.g. update channel) calling resetUpdate()
did not trigger a reload when returning to the Home tab, causing the
install/reinstall dialog to display an empty changelog.

Trigger startLoading() whenever a tab becomes active (isCurrentPage).

Assisted-by: Gemini 3.7 Flash
2026-08-20 21:36:49 +00:00
topjohnwu 5262ecdf82 Fix default channel shown in UI 2026-08-20 21:36:49 +00:00
lsx 0675a18a3a init: check charger mode before force_normal_boot
b55f597c ("Skip loading magisk in charger mode") aborts when
androidboot.mode=charger, but the check sits after the force_normal_boot
branch. Devices that set androidboot.force_normal_boot=1 during off-mode
charging (e.g. some Motorola models) take force_normal_boot -> first_stage()
and never reach the charger check, so Magisk still loads in charger mode and
bumps the never-reset bootloop counter until safe mode trips.

Move the charger check ahead of skip_initramfs/force_normal_boot so charger
boots abort regardless, matching AOSP treating charger mode first.

Fixes #9967.
2026-08-18 18:38:55 +00:00
Alessandro Sangiorgi a5bca88317 app: reset install method when file picker or download dialog is cancelled 2026-08-18 10:57:09 -07:00
topjohnwu 999bda3bc4 app: adopt Material 3 Expressive UI in apk-ng
Update apk-ng components and screens to adhere to Material 3 Expressive
design guidelines:
- Define expressive Shapes and Typography scales in MagiskTheme.
- Add active pill indicators with spring animations to floating nav bar.
- Update card surfaces to 20dp-24dp rounded containers with tonal depth.
- Modernize action buttons and search bar to expressive pill shapes.
- Enhance dialogs and su request screens with rounded surfaces.

Assisted-by: Gemini 3.7 Flash
2026-08-18 17:56:10 +00:00
topjohnwu 6177c7c52b app: improve Material 3 colors in apk-ng
Improve Material 3 color system compliance and legibility across apk-ng:
- Add custom Magisk-branded light and dark fallback color schemes.
- Fix button color token pairings and remove custom alpha blending.
- Fix surface/background tokens in dialogs and markdown views.
- Harmonize badges and warnings with semantic M3 color roles.
- Remove redundant TopAppBar icon tint overrides.

Assisted-by: Gemini 3.7 Flash
2026-08-18 17:56:10 +00:00
topjohnwu fa6867b6a7 Remove unused resources 2026-08-18 17:56:10 +00:00
topjohnwu 47a112edd0 Update gradle dependencies 2026-08-18 17:56:10 +00:00
topjohnwu 599a572d41 app: add scrollbar to screens in apk-ng
Add interactive, draggable scrollbars to all scrollable screens and
components in apk-ng so users can fast-scroll through long content.

Assisted-by: Gemini 3.7 Flash
2026-08-18 17:56:10 +00:00
topjohnwu 8cc4d3a5c1 docs: update AGENTS.md in subdirectories
Update subproject AGENTS.md guidelines to always include the top-level
AGENTS.md.

Assisted-by: Gemini 3.7 Flash
2026-08-18 17:56:10 +00:00
topjohnwu d04ab3fbff app: resize LogLevelBadge using Material 3 Badge
Replace custom padded Box in LogLevelBadge with Material 3's Badge
component to make log level indicators more compact and consistent
with the rest of the application's badge styling.

Assisted-by: Gemini 3.7 Flash
2026-08-18 17:56:10 +00:00
topjohnwu f6af844a00 Update live_setup.sh
[skip ci]
2026-08-18 17:56:10 +00:00
topjohnwu 3bdffe695d Generate shorty in comments and reorder jni_hooks 2026-08-12 23:49:37 +00:00
topjohnwu 43954973dd Update avd.sh
- Fix API level parsing
- Fix -l argument
2026-08-12 22:44:35 +00:00
Wang Han 65aa82516f Update jni hook signatures for A17 QPR2 2026-08-11 20:14:03 -07:00
topjohnwu 290200b990 Handle empty matrix.type correctly
[skip ci]
2026-08-11 01:20:15 +00:00
topjohnwu a65e492e3d Update build-logic
- Prevent gradle from crashing when flags.prop does not exist
- Fix ndk version

[skip ci]
2026-08-11 01:09:03 +00:00
topjohnwu ede844bdaa Reduce the amount of tests to run
[skip ci]
2026-08-05 11:24:59 -07:00
Bela Schaum 72dfc7b9a8 Update condition to check for newline and comma 2026-08-05 11:17:01 -07:00
kousuandClaude Sonnet 4.6 d9a9b02c27 Update AVB hash header image_size to match unpacked original_image_size.
Fixes https://github.com/topjohnwu/Magisk/issues/8389

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-08-05 10:32:24 -07:00
ZGX089 9bd037ae5d fix(localization): Arabic translation 2026-08-04 21:08:40 -07:00
ZGX089 f31c724e2b feat: improve/sync Arabic translation
sync with latest string changes, alongside some adjustments for previous/old strings.
2026-08-04 21:08:40 -07:00
Edytor-Studio Core 92d88d91e4 Update Ukraine(app/core/src/main/res/values-uk/strings.xml) 2026-08-04 20:29:07 -07:00
Edytor-Studio Core afda36295a Update Ukraine(app/stub-res/src/main/res/values-uk/strings.xml) 2026-08-04 20:29:07 -07:00
Neebe3289 38e83986dd Update Indonesian translations
Update and added new translation as subsequent to commit 81413b0f10, e70e8088ad

Change-Id: I16ad054110d42a3a282d34621d24b965c3dbfaed
2026-08-04 12:12:56 -07:00
I3elphegor a0394bb638 Update Czech translations in strings.xml for improved clarity and consistency 2026-08-04 12:12:23 -07:00
Alessandro Sangiorgi 1f4659357f Update Italian translations (strings.xml) 2026-08-04 12:11:39 -07:00
Alessandro Sangiorgi 8bf342652f Update Italian translations for Magisk core strings.xml 2026-08-04 12:11:39 -07:00
Wang Han 2c98b6ccf2 Update resetprop to support --compact 2026-08-04 12:07:38 -07:00
topjohnwu 0b0ee5611e Update libcxx 2026-08-03 19:22:52 -07:00
topjohnwu fd0cb66b6b Cargo fmt 2026-07-31 22:57:41 -07:00
topjohnwu a581038608 Update cargo dependencies 2026-07-31 22:57:41 -07:00
topjohnwu bffc9108bc Address new clippy warnings 2026-07-31 22:57:41 -07:00
topjohnwu b32ff20b79 Update ONDK to r30.1 2026-07-31 22:57:41 -07:00
topjohnwu d04635478a Fix clippy warnings across native codebase
Address clippy warnings including collapsible match statements in
bootstages, daemon, su daemon, and db modules, as well as iterator
loops in files.rs.

Assisted-by: Gemini 3.6 Flash
2026-07-31 22:57:41 -07:00
topjohnwu 05099cce89 sepolicy: use pure token-based xperm parsing
Update extract_token to only split hyphens when preceding a valid
hex xperm. Revert parse_xperm and parse_xperms to pure token-based
AST parsing without inspecting ID strings.

Assisted-by: Gemini 3.6 Flash
2026-07-31 22:57:41 -07:00
topjohnwu 9d4befe06d sepolicy: add unit tests for statement parsing
Add unit tests covering all PolicyStatement variants, brace set
expansion, xperm ranges/complements, spacing corner cases, and error
cases.

Assisted-by: Gemini 3.6 Flash
2026-07-31 22:57:41 -07:00
topjohnwu 896b78cdd5 sepolicy: parse statements into PolicyStatement enum
Parse tokens into intermediate PolicyStatement enums with meaningful
field names before executing them on SePolicy.

Assisted-by: Gemini 3.6 Flash
2026-07-31 22:57:41 -07:00
topjohnwu dfd9fe00d3 docs: update native AGENTS.md guidelines
Document native build pipeline, FFI mechanics, and Rust code
conventions in native/AGENTS.md.

Assisted-by: Gemini 3.6 Flash
2026-07-31 22:57:41 -07:00