Update wait_for_boot to monitor the background emulator process and
fail immediately if it crashes, avoiding indefinite blocking on
adb wait-for-device. Implement timeout handling directly in the
polling loop without relying on subshell timeout wrappers.
In run_main, capture emulator stdout/stderr to a temporary log and
dump its contents on failure for easier debugging. Temporarily disable
tracing within wait_for_boot during polling to keep test logs clean
while preserving the caller's shell tracing state.
Assisted-by: Gemini 3.7 Flash
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
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
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).
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
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
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
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
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
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.
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
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
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
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
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
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