Commit Graph
100 Commits
Author SHA1 Message Date
topjohnwu da50b5586f Sign ChromeOS boot images with magiskboot
Port the `futility vbutil_kernel --pack` code path used to sign
ChromeOS boot images into magiskboot as a new `sign-chromeos` action.
The kernel keyblock and data key are embedded into the executable, and
all signing parameters previously passed in sign_chromeos are
hardcoded. The output is bit-for-bit identical to the reference tool.

Rename the existing `sign` action to `sign-avb1` to disambiguate.

Remove the prebuilt futility binary and stop shipping the chromeos
assets folder; scripts now call magiskboot directly.

Assisted-by: Claude Opus 5.5
2026-10-06 22:59:48 +00:00
topjohnwu 3e9b09f5d5 app: add WholeFilePatcher and ImageExtractor
Define WholeFilePatcher and ImageExtractor interfaces for whole-file
patching and single-image extraction pipelines.

Have TarProcessor implement WholeFilePatcher, and OtaPayloadExtractor
and ZipExtractor implement ImageExtractor. In MagiskInstallImpl,
streamline terminology by renaming srcBoot to targetImage, useRootDir
to useRootFs, and processArchive to processWholeFile.

Assisted-by: Gemini 3.8 Flash
2026-10-06 15:53:42 -07:00
topjohnwu 980f426668 app: share one input pipeline for files and URLs
processFile handled two different jobs in one function, sharing
variables and try/catch blocks: patching a tar archive into a new tar,
and extracting a boot image into a patched .img. It also opened the
input twice, as a stream for detection and as a channel for the
extractors. processUrl separately repeated a zip-only copy of the
image path.

Open the input once as a DataChannel: DataChannel.File for a URI and
DataChannel.Http for a URL. Everything after that is one pipeline:
processInput reads the header with a positional read and dispatches to
processArchive (tar in, tar out) or extractAndProcessImage (payload,
zip or raw image in, image out). As a result, URLs now accept every
format that files do.

Additionally:
- Rename DataChannel.sliceStream to stream, and add a zero-arg
  stream() that covers the entire channel.
- Make TarProcessor.consume take a DataChannel and close it, matching
  the extractors.
- Close the input ParcelFileDescriptor instead of leaking it.
- Report output file creation failures on the URL path instead of
  crashing.

Assisted-by: Claude Opus 5.5
2026-10-06 15:53:42 -07:00
topjohnwu 09d55f2afd app: extract tar processing into TarProcessor
Tar firmware handling (e.g. Samsung AP tars) was entangled with
MagiskInstallImpl: BootItem and processTar lived in the installer, and
processFile set up the TarArchiveOutputStream, used a nullable
BootItem as the tar flag, and reassigned its file to new-boot.img.

Move all tar logic into a standalone TarProcessor next to
OtaPayloadExtractor and ZipExtractor. Since the output tar has to stay
open while the installer patches the image, it uses a two-phase API:
consume() extracts the boot images, copies all other entries to the
output tar, and returns the image to patch; finish() writes the
patched image and finalizes the archive. The caller still owns and
closes both raw streams, and MagiskInstallImpl no longer references
any tar types.

Additionally:
- Pass through vbmeta.img smaller than 256 bytes unpatched instead of
  looping forever, as the loop continued without advancing the entry.
- Close the output stream when patching fails instead of leaking it,
  ignoring close errors so that they cannot crash the app.

Assisted-by: Claude Opus 5.5
2026-10-06 15:53:42 -07:00
topjohnwu 5ebd48ab87 app: refactor DataChannel and extractors
Refactor DataSourceChannel into an abstract DataChannel with nested
DataChannel.File and DataChannel.Http implementations, separating
local file and remote HTTP stream backends.

Additionally:
- Rename Payload to OtaPayloadExtractor and ExtractImage to
  ZipExtractor to better reflect their responsibilities.
- Standardize both extractors with a uniform constructor and a
  consume(channel: DataChannel) method that handles channel lifecycle.
- Make OtaPayloadExtractor stateless by passing channel, manifest,
  and data offsets directly through method arguments.

Assisted-by: Gemini 3.8 Flash
2026-10-06 15:53:42 -07:00
topjohnwu 3b37599db9 Cleanup resources 2026-10-06 05:53:18 +00:00
topjohnwu 441ac32623 Handle the situation when connect_daemon returns -1
Fix #10117, close #10141
2026-10-06 03:45:05 +00:00
topjohnwu 8f0cc199e7 core: resolve user 0 assumptions for HSUM
On Headless System User Mode (HSUM) devices, user 0 is headless while
human users operate under secondary user IDs. Eliminate residual
assumptions in core native components where user 0 was presumed to be
the sole or active manager user:

- In setup_magisk_env, scan all existing users via get_users() to check
  if the app-local binary install directory exists.
- In ensure_manager, check all users before falling back to stub install
  so an already-installed manager on a secondary user is recognized.
- Pass --user all to pm install, pm uninstall, and appops set in package
  management scripts to handle manager lifecycle device-wide.

Assisted-by: Gemini 3.8 Flash
2026-10-05 18:20:32 -07:00
topjohnwu e097945851 su: unify su usage callback to notify action
Consolidate su notification and logging IPC calls into a single notify
action on the native side, passing all logging parameters along with an
explicit "log" boolean key.

On the application side, retain the existing "log" action entry point
for backwards compatibility with older daemons, and update the "notify"
handler to dispatch to either logging or notification based on the
boolean values.

Assisted-by: Gemini 3.8 Flash
2026-10-05 18:20:32 -07:00
topjohnwu 813f9cb9d4 Support Headless System User Mode (HSUM)
On Headless System User Mode (HSUM) devices (e.g. Android Automotive
OS and shared tablets), user 0 is strictly a non-interactive background
system user while human users operate as secondary users (user 10+).

- Check ro.fw.mu.headless_system_user in daemon_entry and store it on
  MagiskD.
- Enforce MultiuserMode::User on HSUM devices and seed the setting in
  magisk.db during post-fs-data, avoiding duplicate override logic.
- For non-app UIDs (< AID_APP_START), scan all discovered users from
  /data/user_de to resolve the manager package/UID and broadcast su
  usage notifications across all users.
- Include system UIDs (< 10000) in PolicyDao.fetchAll() so ADB shell
  (UID 2000) policies can be loaded on secondary users.
- Hide the Multiuser Mode setting in the app on HSUM devices.

Assisted-by: Gemini 3.8 Flash
2026-10-05 18:20:32 -07:00
topjohnwu f093f847bb app: remove interactive su request components
Following the removal of reactive interactive su prompting in magiskd,
remove the corresponding request activity and obsolete settings from
the app.

- Remove SuRequestActivity, SuRequestScreen, SuRequestViewModel, and
  SuRequestHandler.
- Remove tapjack protection, auto response, and request timeout
  settings and resources.
- Update Stub.kt manifest generator to drop the unexported activity
  placeholder.
- Simplify DynLoad activity mapping now that both stub and app declare
  a single activity.
- Bump magisk.stubVersion to 41.

Assisted-by: Gemini 3.8 Flash
2026-10-05 01:38:20 -07:00
topjohnwu a1cf051ac7 su: remove legacy am start fallback
Historically, magiskd fell back to `am start` when notifying the app
if `content call` failed. With interactive su prompts removed and
SuRequestActivity slated for removal, this fallback is obsolete.

Rely exclusively on ContentProvider calls for su logging and notify
events, log content call errors directly, and remove Extra::add_intent.

Assisted-by: Gemini 3.8 Flash
2026-10-05 01:38:20 -07:00
topjohnwu 9d79f868f0 test: update su test to explicitly grant access
With interactive su prompting removed, update MagiskAppTest to
explicitly grant su access to the ADB shell UID in the policy database
rather than relying on SuRequestActivity launch and auto-allow config.

Assisted-by: Gemini 3.8 Flash
2026-10-05 01:38:20 -07:00
topjohnwu 9a101215f1 su: remove interactive su request prompt
With the ability to explicitly grant superuser access in the app,
reactive su prompting and waiting for user response via an interactive
dialog is no longer needed.

- Remove app_request and the associated FIFO / poll waiting logic.
- Change the default SuPolicy and RootSettings from Query to Deny.
- Make SuInfo immutable by removing the internal Mutex<AccessInfo>,
  flattening settings into SuInfo, and refreshing with an updated
  clone on cache hits.
- Remove SuAppContext and convert notification and logging logic into
  private MagiskD methods.

Assisted-by: Gemini 3.8 Flash
2026-10-05 01:38:20 -07:00
topjohnwu ccad207125 app: allow explicitly granting superuser access
Add a floating action button on the superuser page that opens a new
app list allowing users to proactively grant superuser privileges to
applications before they request root.

The grant screen adopts the same style and controls as the denylist
screen, including search, sorting, and system/OS filtering, while
always keeping the Shell application accessible. Common card and list
item UI components are shared with the superuser policy list.

Assisted-by: Gemini 3.8 Flash
2026-10-05 01:38:20 -07:00
topjohnwu 5381a1e9b8 Remove legacy apk codebase
Remove the legacy view-based APK module (:apk-legacy), along with its
subcommands, configurations, release packaging steps, and associated
unused dependencies.

Assisted-by: Gemini 3.8 Flash
2026-10-04 03:30:08 -07:00
topjohnwu 70bf88c383 magiskboot: detect format for XZ BCJ filter
Detect the architecture and file format from input bytes to apply the
proper BCJ pre-filter when compressing with XZ:

- ELF binaries: map e_machine to x86, ARM-Thumb, ARM64, or RISC-V.
- Linux kernels: detect ARM64 raw Image, RISC-V Image, and ARM32 raw
  vmlinux.bin via condition-code density.
- Non-code data: omit BCJ filters to avoid degradation.

Introduce get_encoder_bcj_detection and eliminate the redundant
compress_bytes_kernel and compress_len_kernel helpers.

Assisted-by: Gemini 3.8 Flash
2026-10-04 04:07:03 +00:00
topjohnwu f7a9b39be2 sepolicy: switch to open_memstream
Replace BSD funopen with POSIX open_memstream when dumping the policy
image into memory. Also update the crt0 submodule which implements
open_memstream and fixes duplicate mmap64 definitions on 32-bit targets.

Assisted-by: Gemini 3.8 Flash
2026-10-03 18:27:40 -07:00
topjohnwu a70a7e67b0 Fix host build compatibility with GCC
Fix compilation errors when building host binaries (such as magiskboot)
using GCC on Linux:
- Define _GNU_SOURCE in base and boot build.rs for glibc extensions.
- Add missing <cstdarg>, <cstring>, and <memory> standard headers.
- Provide a fallback definition for __printflike on glibc.
- Implement portable strscpy without relying on BSD strlcpy.
- Add unwrap_ref in bootimg.hpp to allow binding references to packed
  struct members under GCC.
- Remove cxx_impl_annotations in codegen.rs to prevent always_inline
  from being emitted on header declarations without function bodies.

Assisted-by: Gemini 3.8 Flash
2026-10-03 06:35:05 +00:00
topjohnwu 66bcdaf4e0 magiskboot: support building on host
Allow magiskboot to be built directly on host platforms (macOS and
Linux) using Cargo:
- Add a binary target to boot module with a no_main entry point that
  directly reuses the C main CLI implementation.
- Compile native C and C++ sources (base, boot, cxx, and lz4) via cc in
  base and boot build.rs when target_os is not Android.
- Platform gate Linux-specific functionality (SELinux xattrs, mount,
  namespaces) in base on Linux and Android, and provide macOS fallback
  for xsendfile.
- Move MountInfo and mount parsing from files to mount module.
- Scope Android-specific LTO rustflags in config.toml to Android
  targets.
- Ensure build.py compiles Rust modules as static libraries (--lib).

Assisted-by: Gemini 3.8 Flash
2026-10-02 17:17:48 -07:00
topjohnwu 33d09a2aff Expose xpipe2 as symbol 2026-10-02 17:17:48 -07:00
topjohnwu 32ee775026 Cleanup base.cpp 2026-10-02 17:17:48 -07:00
topjohnwu 8348d6e39c base: eliminate /proc/self/fd path resolution
Remove reliance on /proc/self/fd symlink resolution across base and core
components:
- Add top-level pre_order_walk and post_order_walk that track entry
  paths via an internal buffer, and unify Directory walk methods to
  support path-tracking and pathless traversals without extra overhead.
- Add DirEntry::get_stat using fstatat(AT_SYMLINK_NOFOLLOW) directly on
  directory file descriptors.
- Update Directory::copy_into and link_into to operate directly on file
  descriptors with fd_get_attr/fd_set_attr, passing paths only for
  symlink attribute updates.
- Refactor find_apk_path and restore_tmpcon to use pre_order_walk, and
  update get_app_no_list to use DirEntry::get_stat.
- Remove DirEntry::resolve_path, Directory::path_at,
  Directory::resolve_path, and fd_path.
- Replace remaining consumers of xrealpath and canonical_path (in su
  and magiskinit) with standard realpath or partition matching, allowing
  removal of Utf8CStr::realpath and its C FFI exports.

Assisted-by: Gemini 3.8 Flash
2026-10-02 17:17:48 -07:00
topjohnwu 0e228db61f Reduce more Linux specific code in base 2026-10-02 17:17:48 -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 93708e5e73 Use nix Errno 2026-10-02 17:17:48 -07:00
topjohnwu 32998d6991 app: fix D-pad focus and navigation issues
Fix multiple D-pad focus traversal and containment defects reported on
Android TV and non-touch devices:

- Pager focus bleed: Set beyondViewportPageCount = 0 on HorizontalPager
  in MainScreen and LogScreen. Constrain horizontal and upward focus
  exits on pager page containers using focusProperties and focusGroup so
  DPAD_RIGHT on module cards or switches does not oscillate into
  adjacent offscreen tabs.
- LogScreen focus leak: Wrap log tabs in focus boundaries to prevent
  DPAD_UP at the top of the logs from escaping into the Home tab.
- Module install accessibility: Wire bidirectional D-pad focus between
  ShortNavigationBar (Modules tab), the root FloatingActionButton, and
  the module card list using FocusRequesters. Remove redundant install
  buttons from TopAppBar and EmptyState.

Fixes #10113

Assisted-by: Gemini 3.8 Flash
2026-09-21 18:33:34 -07:00
topjohnwu aed0261c3d Refactor adb patching and emulator setup
Add support for patching boot images directly via adb
with the build.py script.
2026-09-21 01:40:07 -07:00
topjohnwu 89d3100ffc Update cargo dependencies 2026-09-20 02:21:59 -07:00
topjohnwu da320823ac magiskboot: enable BCJ filter for XZ compression
Enable the architecture-specific BCJ pre-filter when creating XzWriter
for supported ABIs. For ARM32 kernel compression, use the standard ARM
filter rather than Thumb-2.

Assisted-by: Gemini 3.8 Flash
2026-09-20 02:21:59 -07:00
topjohnwu 9e8ff0d1bd Update xz-embedded to upstream submodule
Add https://github.com/tukaani-project/xz-embedded as a submodule
pinned to tag v2024-12-30, replacing previously vendored sources.
Keep customized userspace configuration in external/xz_config with
architecture-specific BCJ filters and CRC64 support.

Assisted-by: Gemini 3.8 Flash
2026-09-20 02:21:59 -07:00
topjohnwu ad81daf874 Update gradle dependencies 2026-09-20 02:21:59 -07:00
topjohnwu 6d391dd5b1 magiskboot: handle decompression errors in unpack
Previously, decompress_bytes dropped the LoggedResult from decoding,
returning void. In bootimg.cpp, unpack and split_image_dtb never checked
whether decompression succeeded, leaving empty 0-byte output files and
returning RETURN_OK (0).

Return a boolean status from decompress_bytes and check it during unpack
and split_image_dtb. On decompression failure, remove any incomplete
output files and return RETURN_ERROR (1).

Assisted-by: Gemini 3.8 Flash
2026-09-18 16:50:34 -07:00
topjohnwu 887a97822b magiskboot: search compressed formats in zImage
When locating the compressed piggy payload in a zImage, check only
formats where fmt.is_compressed() to avoid false positives on container
or header formats (such as DTB or Android boot magic).

Additionally, prioritize 4-byte aligned offsets since ARM kernel linker
scripts align .piggydata to 4 bytes, falling back to an unaligned scan
only if no candidate is found.

Assisted-by: Gemini 3.8 Flash
2026-09-18 16:50:34 -07:00
topjohnwu 8376f7b27c magiskboot: validate XZ header CRC in check_fmt
XZ decompressor stubs in 32-bit ARM Linux zImage (lib/decompress_unxz.c)
include the HEADER_MAGIC string literal "\3757zXZ" in .rodata, which
appears before the compressed payload. check_fmt previously matched
only the first 5 bytes, falsely identifying the .rodata string literal
as an XZ payload.

Validate the 12-byte XZ stream header by verifying the 6-byte magic,
stream flags, and IEEE 802.3 CRC32 of the stream flags. In addition,
harden GZIP, BZIP2, and LZOP checks with stricter header validation
to prevent false positives when scanning raw binaries.

Assisted-by: Gemini 3.8 Flash
2026-09-18 16:50:34 -07:00
topjohnwu 3c0838f44e app: fix scrollbar touch interception
Only consume pointer events when the scrollbar is visible and touch hits
the thumb, preventing edge touches from teleporting the scroll position
when the scrollbar is invisible.

In addition, compute drag fraction relative to the initial grab offset
within the thumb to prevent jump-on-grab.

Assisted-by: Gemini 3.8 Flash
2026-09-18 01:05:11 -07:00
topjohnwu 66211d4021 app: fix dialog scrolling and scrollbar layout
Resolve scrolling, touch interception, and scrollbar layout defects
in markdown dialogs across the apk module:

- Dialog: Implement LinkClickMovementMethod to handle link taps without
  intercepting drag gestures, allowing Compose to retain momentum and
  fling physics.
- Dialog: Rebuild MagiskDialog with Dialog and Surface to allow
  scrollable content to extend to the card boundaries, positioning the
  scrollbar at the outer edge while keeping text padding intact to
  prevent overlap. Support neutralButton and scrollable parameters.
- HomeScreen & ModuleScreen: Use scrollable MagiskDialog for install
  and module changelog dialogs.

Assisted-by: Gemini 3.8 Flash
2026-09-17 22:21:22 -07:00
topjohnwu 37063225d4 build: show progress when downloading ONDK
Wrap the HTTP response stream in setup_ndk with a ProgressStream reader
to display a dynamic terminal progress bar showing percentage and
transferred megabytes during download and decompression.

Updates are throttled to at most 10 Hz and suppressed in non-interactive
environments.

Assisted-by: Gemini 3.8 Flash
2026-09-05 08:17:11 +00:00
topjohnwu 173153fcc7 build: improve build.py and env.py scripts
Modernize build scripts and improve reliability across environments:
- Update required Java toolchain to JDK 25 across scripts and CI
- Propagate subprocess exit codes and report filesystem errors
- Fix argument parsing edge cases and dynamic linker path handling
- Anchor working directory and improve terminal output formatting

Assisted-by: Gemini 3.8 Flash
2026-09-05 08:17:11 +00:00
topjohnwu 96221b69fa Release Magisk v31.0
[skip ci]
2026-09-04 09:46:09 -07:00
topjohnwu bc1128c4f2 Update release date 2026-09-04 09:45:37 -07:00
topjohnwu 584ba3227e Update cargo dependencies 2026-09-04 09:44:49 -07:00
topjohnwu da382dc771 Update AGP 2026-09-04 09:44:49 -07:00
topjohnwu cc08282b6d app: always use TerminalScreen in FlashScreen
Unify FlashScreen to render TerminalScreen unconditionally for all
installation and flashing actions instead of branching on FLASH_ZIP
with a LazyColumn fallback:

- FlashScreen: Remove LazyColumn, scrollbar, and the unused action
  parameter, displaying TerminalScreen inside the scaffold body.
- FlashViewModel: Forward MagiskInstaller output directly to the
  terminal emulator via appendLineOnMain and remove consoleItems.
  Await emulatorReady before starting flashing operations.
- FlashViewModel: Preserve transcriptText saving for FLASH_ZIP while
  saving logItems (stdout and stderr) for MagiskInstaller actions.
- MainActivity: Drop action parameter from FlashScreen invocation.

Assisted-by: Gemini 3.8 Flash
2026-09-04 09:44:49 -07:00
topjohnwu b36c60abc1 app: prevent SuRequest dismiss on touch outside
Setting setFinishOnTouchOutside(false) at the Activity window level was
insufficient because SuRequestScreen hosts MagiskDialog (AlertDialog),
which defaults to dismissOnClickOutside = true. Tapping outside the
dialog triggered onDismissRequest and finished the activity.

Add dismissOnClickOutside and dismissOnBackPress parameters to
MagiskDialog (defaulting to true), and set dismissOnClickOutside = false
for SuRequestScreen to prevent accidental dismissal while keeping back
button dismissal intact.

Assisted-by: Gemini 3.8 Flash
2026-09-03 22:08:33 -07:00
topjohnwu 26dd8c1352 app: fix scrollbar drag and list synchronization
- Invert offsetRatio accurately in LazyListState adapter using
  maxOffset so scroll fraction maps 1:1 to list items and avoids jumping
  upon drag release.
- Allow dragging anywhere along the track and consume pointer events on
  PointerEventPass.Initial to prevent underlying views from stealing
  touch input.
- Use MutatePriority.PreventUserInput to avoid drag cancellation from
  inner scroll modifiers.
- Immediately snap alpha animation to 1.0 upon touch down for instant
  visual feedback.

Assisted-by: Gemini 3.8 Flash
2026-09-03 21:36:21 -07:00
topjohnwu 4334c078c1 app: fix UI element shadow clipping
Resolve shadow and elevation clipping issues across the apk module:

- DenyListScreen: Remove redundant Modifier.clip from DenyAppCard so
  elevation drop shadows can render outside the card.
- DenyListScreen & HomeScreen: Add an 8dp horizontal offset to dropdown
  menus to prevent popup drop shadows clipping at the screen edge.
- SuperuserScreen, LogScreen, DenyListScreen, ModuleScreen: Move
  horizontal padding from Modifier.padding to LazyColumn contentPadding
  so item shadows have breathing room within the scroll container.
- ModuleScreen & MainScreen: Hoist floating action button to root
  Scaffold to prevent FAB being sliced during HorizontalPager swipe
  transitions.
- Dialog: Apply full systemBars insets and uniform 24dp padding to
  MagiskDialog to prevent dialog shadow clipping against screen edges.

Assisted-by: Gemini 3.8 Flash
2026-09-03 17:51:10 -07:00
topjohnwu fed84885e3 app: fix touch effect and hitbox mismatches
Resolve touch target and ripple effect area discrepancies across the
apk module:

- ModuleScreen: Use Card(onClick) to ensure ripple indications are
  clipped to the card's 20.dp rounded corners.
- SettingsComponents: Make trailing Switch passive and apply
  Modifier.toggleable on ListItem to eliminate nested ripples and
  conflicting hitboxes.
- DenyListScreen: Use Modifier.toggleable on ProcessRow with a passive
  Checkbox to prevent 48dp touch targets overflowing the 32dp row.
- HomeScreen: Increase developer link button spacing to 8.dp to prevent
  overlapping 48x48dp touch targets.
- Scrollbar: Only consume pointer events when the scrollbar is visible
  and touch hits the thumb, allowing underlying controls to receive
  touches unimpeded.

Assisted-by: Gemini 3.8 Flash
2026-09-03 16:17:29 -07:00
topjohnwu aafda835f4 app: polish home screen actions and reboot menu
- Standardize card shapes to 20.dp across all home screen cards
- Add M3 leading icons, 16.dp shape, and divider to reboot dropdown menu
- Convert support donation buttons to Material 3 FilledTonalButton
- Group App card hide/restore button and reinstall button with proper
  accessibility content description
- Update section headers to labelLarge SemiBold matching Settings

Assisted-by: Gemini 3.8 Flash
2026-09-03 15:44:44 -07:00
topjohnwu 7064cdf305 app: modernize settings layout and choice dialogs
- Replace popup DropdownMenu in SettingsDropdown with standard
  Material 3 single-choice RadioButton dialog.
- Standardize screen horizontal margins to 16dp and increase spacing
  between preference sections.
- Insert outlineVariant HorizontalDividers between items inside
  each section card.
- Apply RoundedCornerShape(12.dp) to OutlinedTextFields in Settings
  text dialogs.

Assisted-by: Gemini 3.8 Flash
2026-09-03 15:44:44 -07:00
topjohnwu 87a3ca3024 app: modernize logs screen cards and typography scale
Refactor SuLogCard to use Material 3 ListItem with an internal
HorizontalDivider for detail rows. Modernize MagiskLogCard to use
Card(onClick) and standardize horizontal margins to 16.dp across both
log tabs.

Replace hardcoded sp font sizes with MaterialTheme.typography tokens
(labelSmall and bodySmall) using monospace font families to ensure
consistent font scaling.

Assisted-by: Gemini 3.8 Flash
2026-09-03 15:44:44 -07:00
topjohnwu 5127a6d782 app: modernize superuser policy items with M3 ListItem
Refactor PolicyCard to use Material 3 ListItem within a Card container,
removing the artificial VerticalDivider and bespoke click bounds.

In SuperuserDetailScreen:
- Standardize Card corner radiuses to 20.dp
- Add subtle HorizontalDivider between switch items
- Modernize RevokeButton to use filledTonalButtonColors with standard
  ButtonDefaults.shape and ButtonWithIconContentPadding

Assisted-by: Gemini 3.8 Flash
2026-09-03 15:44:44 -07:00
topjohnwu c8c214a0ed app: normalize TopAppBar insets across screens
Compose Material 3 TopAppBar already applies standard insets internally
for navigation and action icons. Remove redundant manual start/end
paddings across detail and main screens to ensure icons align flush with
the standard 16dp content margin.

Assisted-by: Gemini 3.8 Flash
2026-09-03 15:44:44 -07:00
topjohnwu 482cde7aa4 app: use ShortNavigationBar and fix insets
- Replace Material 3 NavigationBar with ShortNavigationBar and
  ShortNavigationBarItem for a more compact bottom bar.
- Set contentWindowInsets to zero on the root Scaffold so status bar
  insets are passed down to child screens' TopAppBars.
- Consume innerPadding on HorizontalPager to prevent nested Scaffolds
  from duplicating bottom system navigation insets.

Assisted-by: Gemini 3.8 Flash
2026-09-03 01:43:17 -07:00
topjohnwu c2f8da60f6 app: fix touch handling in SuRequest dialog
- Remove android:windowIsFloating so SuRequestActivity is a full-screen
  translucent activity rather than a floating window that dismisses on
  touches outside during asynchronous initialization.
- Set setFinishOnTouchOutside(false) to prevent unwanted dismissals.
- Decouple the 1-second grant button delay from the countdown timer so
  interacting with the timeout slider immediately does not leave the
  grant button permanently disabled.
- Ensure an immediate DENY response is sent if the activity or
  view model is destroyed before responding.

Assisted-by: Gemini 3.8 Flash
2026-09-03 00:22:42 -07:00
topjohnwu c603be1005 Fix wording in SuRequest dialog 2026-09-02 23:14:56 -07:00
topjohnwu b9ee06bc57 app: dynamically generate themes from seed color
Replace the static, hardcoded light and dark ColorScheme tables with a
helper that dynamically generates Material 3 color schemes using
SchemeTonalSpot from Google Material Color Utilities.

The default light and dark themes are now generated from the Magisk
launcher icon accent color (#00AF9C) as seed.

Assisted-by: Gemini 3.8 Flash
2026-09-02 22:52:33 -07:00
topjohnwu 38cfe2f80e app: sync system bar icon colors with theme
Because the base post-splash theme is a dark theme, the window
defaults to light (white) status bar icons. When the app is in light
theme, the icons blend into the light background and become invisible.

Synchronize WindowInsetsControllerCompat's appearance flags with the
active theme so dark icons are used in light theme and light icons in
dark theme.

Assisted-by: Gemini 3.8 Flash
2026-09-02 22:23:17 -07:00
topjohnwu 42272ccac7 scripts: improve release.sh build and upload flow
- Generate an ephemeral build config inheriting only signing properties
  so local developer settings in config.prop remain untouched
- Remove gsed requirement by making in-place edits POSIX-compliant
- Add ver_to_code and code_to_ver conversion functions
- Add pre-upload validation and safe git staging
- Add command usage handling

Assisted-by: Gemini 3.8 Flash
2026-09-02 21:03:19 -07:00
topjohnwu 4b0a2d5046 scripts: verify APK signatures in release.sh
Add signature verification to release.sh using apksigner from the
latest Android SDK build-tools to ensure all built APKs match the
expected certificate fingerprint.

Assisted-by: Gemini 3.8 Flash
2026-09-02 19:57:45 -07:00
topjohnwu 29af8001b6 Update v31.0 changes 2026-09-02 11:46:50 -07:00
topjohnwu df50d1fbff Remove PreviewActivity in release builds 2026-09-02 02:16:37 -07:00
topjohnwu 3c8b9a0e61 app: prevent jarring item jumps in denylist UI
- Track initiallyChecked state in DenyAppState
- Use initiallyChecked in sort comparator to keep list position stable
- Keep initially checked items visible in filter when unselected

Assisted-by: Gemini 3.7 Flash
2026-09-02 02:08:23 -07:00
topjohnwu c98966c802 app: unify LogScreen header scroll background
- Wrap TopAppBar and PrimaryTabRow in topBar Column with animated container
- Set TopAppBar and PrimaryTabRow containers to transparent to share surface

Assisted-by: Gemini 3.7 Flash
2026-09-02 02:08:23 -07:00
topjohnwu b7ec312380 app: improve Material 3 component conformance
- Replace custom dividers with VerticalDivider / HorizontalDivider
- Use standard Material 3 search styling for DenyList
- Remove redundant button / FAB shape overrides and card clip modifiers
- Convert custom warning and notice boxes to Material 3 Card
- Align PrimaryTabRow to full width in LogScreen

Assisted-by: Gemini 3.7 Flash
2026-09-02 02:08:23 -07:00
topjohnwu bc3efc03bd app: migrate to Material 3 NavigationBar
Replace the custom floating navigation bar with official Material 3
NavigationBar and NavigationBarItem components, and remove unnecessary
bottom padding workarounds across all screens.

Assisted-by: Gemini 3.7 Flash
2026-09-02 02:08:23 -07:00
topjohnwu 3612faf766 app: configure link color for MarkdownText
Explicitly set linkTextColor on the underlying TextView so Markdown
links adhere to the active Compose theme.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu 81342a572f app: improve scrollbar drag handling and inertia
Override active fling inertia on touch down using
MutatePriority.UserInput and handle scroll events sequentially via a
conflated channel.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu cbfd2a736f app: use full-screen dialog for install screen
Replace the install bottom sheet with a full-screen Dialog to provide
more vertical space for release notes and installation methods.

- Remove the legacy multi-step wizard logic from InstallViewModel.
- Use styled Cards with SettingsSwitch for install options and
  SettingsArrow for installation methods.
- Remove max height constraint on MarkdownText to allow release notes
  to expand naturally with full-screen scrolling.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu eb1ae600e2 app: use MagiskDialog in SuRequestScreen
Refactor SuRequestScreen to use the shared MagiskDialog component,
matching standard dialog styling across the app.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu b80d2b74e9 app: adjust MagiskDialog width and margins
Disable platform default width on dialogs and apply standard horizontal
padding and max-width constraints for better readability.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu c6fddfbe25 app: consolidate dialogs into MagiskDialog
Add a shared MagiskDialog component to unify styling, typography,
shape, and button layouts across all dialogs in the app module.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu ec3b0b8c5f Never import android.R 2026-09-01 23:04:00 -07:00
topjohnwu d3d5698001 app: use pager for tabs in logs screen
Add a HorizontalPager in LogScreen to support swiping horizontally
between the Superuser and Magisk log tabs instead of paging the outer
main navigation tabs.

Assisted-by: Gemini 3.7 Flash
2026-09-01 23:04:00 -07:00
topjohnwu 8c4341e928 Prepare for v31.0 release 2026-08-31 23:46:36 -07:00
topjohnwu 7847ab6de8 app: fix navigation when flashing modules
When launching a flash intent using FLAG_ACTIVITY_CLEAR_TOP, Android
recreates MainActivity if singleTop or singleTask is not set, causing
the app to briefly display the home screen before showing the flash
screen.

Set MainActivity to singleTask, add FLAG_ACTIVITY_SINGLE_TOP to flash
intents, and default cold-start flash zip intents to the modules tab.

Assisted-by: Gemini 3.7 Flash
2026-08-31 23:46:10 -07:00
topjohnwu 3e6e4326b1 app-legacy: add webview zygote to denylist
Port WebView Zygote denylist support to the legacy app module.

Assisted-by: Gemini 3.7 Flash
2026-08-31 19:29:38 -07:00
topjohnwu a5c8861629 Promote next-gen app to production, and demote existing app to legacy 2026-08-31 15:55:14 -07:00
topjohnwu 74df51fd1b app-ng: improve uninstalled state on home screen
When Magisk is not installed:
- Display "Not Installed" in error color instead of "N/A"
- Use a prominent filled primary button for the Install action
- Dim the Magisk icon tint to outline color

Assisted-by: Gemini 3.7 Flash
2026-08-31 10:54:59 -07:00
topjohnwu e9fd6b58ab app-ng: align app card icon and title with magisk
Adjust the App card icon size to 48dp and the following spacer to 16dp
to match the Magisk card and align their titles horizontally.

Assisted-by: Gemini 3.7 Flash
2026-08-31 01:49:57 -07:00
topjohnwu 64be5dcc2e app-ng: move uninstall button to top app bar
Remove the oversized uninstall button from the home screen content and
place an uninstall action icon in the top app bar next to the reboot
button.

Assisted-by: Gemini 3.7 Flash
2026-08-31 01:49:57 -07:00
topjohnwu 99039b7e6c app-ng: improve su request dialog layout
Widen the su request dialog card to fit screen width on phones while
capping at 560dp on larger screens. Move the package name to its own
row below the app icon and title to avoid clipping and allow it to
wrap onto multiple lines when necessary. Make the dialog content
vertically scrollable to ensure all actions are visible in landscape.

Assisted-by: Gemini 3.7 Flash
2026-08-31 01:49:57 -07:00
topjohnwu faa5f85b15 Fix legacy app launch 2026-08-29 23:34:16 -07:00
topjohnwu a6ea7cefea Update links, icons, and developer 2026-08-29 23:34:16 -07:00
topjohnwu f38e0c8bc6 su: Enable logging and notify by default
When a UID makes a root request for the first time, no row exists in
the policies table. Previously, RootSettings derived Default, which
initialized log and notify to false. As a result, connect_app() skipped
calling app_log() or app_notify() immediately after user approval on
the initial su request.

Explicitly implement Default for RootSettings with log and notify set
to true by default.

Assisted-by: Gemini 3.7 Flash
2026-08-30 00:03:52 +00:00
topjohnwu b8b140fafa app-ng: center align empty state placeholder text
Set textAlign = TextAlign.Center on the empty state placeholder text in
SuperuserScreen and ModuleScreen so multi-line messages are centered
horizontally instead of left-aligned.

Assisted-by: Gemini 3.7 Flash
2026-08-30 00:03:52 +00:00
topjohnwu a2affbb415 app-ng: support horizontal scrolling in terminal
Increase the terminal buffer columns to prevent text lines from wrapping
at the screen boundary, and enable bidirectional scrolling in
TerminalScreen.

Track the maximum used column across terminal lines dynamically to
constrain horizontal scrolling to actual content, and add a horizontal
scrollbar component matching the vertical scrollbar.

Assisted-by: Gemini 3.7 Flash
2026-08-30 00:03:52 +00:00
topjohnwu cbe497e196 app-ng: improve Magisk log parsing and UI
Magisk daemon internal logs skip the TAG field, outputting directly
after the priority level. Update MagiskLogParser to treat logcat tags
as part of the message and strip leading delimiters for internal logs.

Also adjust the Magisk log card UI layout to format PID/TID clearly and
remove the duplicate key generation in LazyColumn that caused crashes.

Assisted-by: Gemini 3.7 Flash
2026-08-27 17:19:55 +00:00
topjohnwu 227e3cee0a Update lsposed for testing 2026-08-27 17:19:55 +00:00
topjohnwu ce404d1951 Update gradle dependencies 2026-08-27 17:19:55 +00:00
topjohnwu 5480fc41c3 app: inject prebuilt bootctl into jniLibs
Download updated multi-arch prebuilt bootctl binaries built from
Android 14 (android-14.0.0_r1) and package them into jniLibs alongside
busybox instead of bundling a single binary in assets.

The new bootctl binaries support AIDL Boot HAL implementations on
Android 14+ (API 31+), fixing OTA slot switching issues on newer
devices like Pixels.

Update post-OTA install logic in the app and shell scripts to use the
native bootctl executable from MAGISKBIN.

Fixes #8824
2026-08-27 03:29:31 +00:00
topjohnwu 2fc7a6d284 avd.sh: improve boot waiting and error handling
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
2026-08-26 05:42:55 +00:00
topjohnwu e7e5469100 Update avd.sh to accept ABI
Also update to use Android CLI
2026-08-26 05:42:55 +00:00
topjohnwu 4623f546e3 Convert subproject AGENTS.md into skills 2026-08-26 05:42:55 +00:00
topjohnwu b910c7d915 Update .gitignore 2026-08-26 05:42:55 +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
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