152 Commits
Author SHA1 Message Date
topjohnwu d50f99e64c app: fix accessibility labels
- The back buttons of the DenyList, flash and action screens, and the
  DenyList's clear search button, had no label, so TalkBack read them
  as unlabeled buttons. Label them like the other screens do.
- A module's enable switch is its own accessibility node without the
  module name. Name it after the module.
- The safe mode item in the reboot menu showed its state only with a
  check mark. Expose it as a toggleable state.
- Navigation items and the module action and update buttons labeled
  their icons with the same text as their visible label, so it was
  read twice. Make those icons decorative.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 9ee6815a54 app: keep patch method across process death
The patch dialog restores its state after process death, including a
pending file pick, but the selected install method only lived in
InstallViewModel. If the app was killed while the file picker was open,
the new ViewModel had no method, so picking the image closed the dialog
and silently did nothing.

On Pixel and Googlebook devices, the dialog also keyed its source
choice on the downloadable firmware image. That is only found after
the firmware search, which runs again after process death, so a file
chosen before was reset to the downloadable image.

Set the patch method when an image is selected, and save the user's
source choice without keying it on the firmware image.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 8acbd6305e app: keep Home dialog state across recreation
Two Home dialogs didn't restore their data with their visibility:

- The "abnormal state" dialog kept its visibility in saved state but
  its exit code in plain remember. After a rotation the code was 0, so
  for code 2, which needs a full reinstall, it offered the quick fix
  (fix environment and reboot) instead.
- The app install dialog read the update from Info.update, which is
  reset on every connectivity change, including each time the app
  comes to the foreground, and after process death. It then showed
  empty notes and downloaded an empty link.

Save the exit code, and keep the update shown by the Home screen in the
ViewModel and in the dialog's saved state, passing it to the download.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 5f184cb45e app: request notification permission for updates
Turning on "Check for updates" didn't request the notification
permission, so on Android 13+ the update notifications could never be
shown. Instead, every creation of MainActivity, including rotations,
requested the permission when the setting was on, and turned the
setting off if it was denied, while the settings switch still showed it
as on.

Request the permission when the setting is turned on, and only enable
it when granted. Only request it on startup when the activity is first
created, and refresh the switch from the setting when the settings tab
resumes.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 6fa7eed138 app: handle errors when saving logs
Saving the install, action or Magisk log didn't handle any error: if
creating or writing the file failed (e.g. storage full, or the media
store rejecting the file), the exception reached the default handler
and the app exited. On Android 10 and older, a module name containing
a slash also made the action log name point to a missing directory.

Save logs through a shared helper that replaces slashes in the name
and shows an error toast when saving fails.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 9fe92a0fc8 app: remove legacy isolated denylist entries
Isolated processes are matched by name prefix, and the DenyList now
adds a single "isolated|<process>:" entry per app. Older versions of
the app added one entry per isolated service instead, e.g.
"isolated|com.foo:com.foo.Service". The screen shows the isolated row
as checked if any entry starts with the prefix, but unchecking it only
removed the exact prefix entry, so the old entries stayed and the row
was checked again on the next visit.

When removing an isolated row, remove every isolated entry starting
with its prefix.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 8ad2b4a364 app: serialize superuser grant writes
Each tap on the grant screen started its own database write on the IO
dispatcher, with nothing ordering them. A grant takes two queries
(fetch, then replace) while a revoke takes one, so a quick grant and
revoke could run as fetch, delete, replace and leave the app granted
while it was shown as not granted. The new state was also computed from
the item the UI captured, so two taps before a recomposition both
granted.

Write in tap order under a Mutex, like SuperuserViewModel does, and
toggle the current state of the app.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 6699202d35 app: keep lists while refreshing
The superuser, log and module lists are refreshed whenever their tab is
shown, when returning to the main screen, after configuration changes,
and on other events (the module list on every activity start, the logs
on every superuser request). Each refresh set the loading flag, which
replaced the list with a spinner, so the list lost its scroll position
and expanded cards collapsed. Module update buttons also disappeared
until update info was fetched again. The DenyList even scanned every
installed app again on rotation.

Only show the loading state until the first load finishes, keep update
info of unchanged modules across refreshes, and scan apps for the
DenyList only once per screen.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu d582d8145d app: run module actions in BusyBox ash
Every script running in the context of Magisk is supposed to run in
BusyBox ash with standalone mode. Since module actions and installs run
in a PTY, they ran in /system/bin/sh instead: busybox script starts
$SHELL, which su sets to /system/bin/sh, and ASH_STANDALONE was never
set. Module installers recover by re-executing themselves in BusyBox,
but action.sh has no such fallback.

Run the PTY command in BusyBox ash with ASH_STANDALONE=1, which has to
be set before ash starts. Also run the action from the module's
directory name, quoted, rather than from the id in module.prop, which
can differ from it.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 7dca458185 app: release the installer lock when cancelled
MagiskInstaller.exec() only cleared its static session flag after the
operation returned normally. When the calling coroutine was cancelled,
withContext() threw once the blocking operation finished and the flag
stayed set, so every later install, patch, uninstall, restore or
environment fix failed immediately until the app process died.

Restore images and Fix environment ran in a composition scope through
rememberLoadingDialog(), so this happened just by rotating while their
loading dialog was showing, which also lost the result toast and the
reboot after fixing the environment. Leaving a running flash screen
triggered it too.

Release the flag in a finally block, and run both operations in
HomeViewModel, which survives configuration changes. Remove
rememberLoadingDialog(), which has no other users.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 18112c7366 app: don't crash on broken module metadata
Modules are third-party, but some of their metadata could crash the
app:

- A malformed updateJson URL (e.g. ftp://) made Retrofit throw
  IllegalArgumentException, which LocalModule.fetch() didn't catch, so
  the app exited every time the module list loaded, even offline. A
  malformed changelog URL did the same when opening the update dialog.
- Two module directories with the same id in module.prop crashed the
  module list, which used the id as the item key.

Catch every non-cancellation exception when fetching update info and
changelogs, and identify modules by their directory name, which is
unique.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 4384cf49fa app: don't pass file names through the shell
The module zip's display name and path were pasted into the root shell
command that runs the installer, inside single quotes. The display name
comes from the content provider, which belongs to another app for
external install requests. A name with an apostrophe broke the install,
and a crafted name could run arbitrary commands as root.

Print the header line directly to the terminal instead of with echo,
without control characters, and quote the paths with a new
shellQuoted() helper, which also replaces the manual escaping in
runSuCommand.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu a2f1a7a8fc app: report real exit codes of terminal commands
Module installs and actions run in a PTY through busybox script, which
always exits with 0. The exit code of the command itself was lost, so
a failed module install or action was shown as done, with a reboot
button.

Run the command in a subshell and have it write its exit code to a
temporary file, then read it after the process exits.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 1db3c0be3e app: switch tabs on new intents
MainActivity is singleTask, so an intent sent while the app is running
is delivered to onNewIntent(). The requested tab was only read from the
launch intent, so e.g. the "App settings" button in the system settings
brought the app to the front without opening the Settings tab.

Also read the requested tab from new intents and switch to it. If
another screen is open, it stays open and the tab is shown when going
back, so no running flash or action screen is interrupted.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 1d662cb09d app: don't rerun flash and action jobs on restore
The back stack survives process death, but a flash or action screen's
ViewModel doesn't. When such a screen was restored, its new ViewModel
had no job yet, so the job started again without the user asking: a
Magisk install, a module zip, an uninstall, or a module's action
script, which may not be safe to repeat.

Record in the ViewModel's SavedStateHandle that the job was started.
If a restored screen finds the flag in a new ViewModel, its job and
output are gone, so leave the screen instead of running the job again.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu cbd8f32d90 app: buffer navigation events until collected
ViewModels requested navigation through a SharedFlow without replay, so
a request was silently dropped when no screen was collecting it. This
happens when an activity result arrives right after the activity was
recreated: the launcher delivers it before the screen's collector has
started. E.g. after a configuration change while picking an image to
patch, the patch dialog closed but the patching screen never opened.

Use a buffered Channel instead, so requests wait for the collector.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu cbb813c41e app: drop navigation clicks during transitions
Clicks that open a screen were handled even while a screen transition
was running, so a quick second tap could push another screen on top of
the one being opened, e.g. an app's details and then the grant screen.

Wrap these clicks in dropUnlessResumed, as the Navigation 3 recipes do.
NavDisplay caps each scene's lifecycle at STARTED until its transition
settles, so taps during the animation are dropped.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu ffc852cda3 app: ignore duplicate pushes of the top route
Navigator.push() accepted any route, so a double tap (e.g. on an app in
the Superuser list) or the same flash request confirmed twice pushed
the same route twice. Navigation 3 gives equal routes the same content
key, so both copies shared one ViewModel and saved state: a second
identical flash request just showed the first one's result, and two
back presses were needed to leave.

Ignore a push of the route that is already on top. Making routes unique
instead would let a double tap start two installs at once.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 747f5196ad app: never pop the root navigation entry
A screen's back button stays clickable while the screen slides out, so
tapping it twice quickly called Navigator.pop() twice. The second call
removed Route.Main, and NavDisplay crashed the app because its back
stack must not be empty.

Make pop() a no-op on the root entry. Leaving the app from the root is
handled by the system, not by popping the last entry.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 008a7bff80 app: keep FAB clear of side system bars
In navigation bar mode, NavigationSuiteScaffold places the primary
action at the end edge of the window with a fixed 16dp margin and
ignores window insets. In landscape with 3-button navigation, the FAB
on the Modules and Superuser tabs overlapped the side navigation bar.

Pad the primary action slot with the end side of the safe drawing
insets in bar mode, so the FAB stays clear of side system bars and
display cutouts. Portrait and navigation rail layouts are unchanged.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 1f86825151 app: redraw terminal after resizing
The terminal emulator lives in the ViewModel and survives Activity
recreation, but a recreated TerminalScreen draws its first frame
before LaunchedEffect resizes the emulator to the new viewport.
Nothing invalidated the drawing after the resize, so after rotating,
the screen kept showing rows laid out for the old geometry instead of
the end of the output, and the scrollbars used stale values.

Refresh the snapshot state and redraw after every resize, through the
same path used for new output, and keep a scrolled-up position within
the transcript.

Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 276f72733e app: use standard horizontal slide transitions
Configure NavDisplay with standard horizontal slide transitions for
forward, pop, and predictive back navigation, following the layout
direction, and wrap the root content in a Surface to prevent window
background bleed.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu b575a63970 app: optimize Compose performance and code quality
Eliminate recomposition bottlenecks in TerminalScreen by invalidating
strictly inside the draw phase via drawBehind, decoupling the
TerminalEmulator lifecycle to ViewModels, and replacing Handler with
Coroutines Dispatchers.Main.immediate in TerminalProcess. Commands still
start only after the terminal has been sized to its viewport.

Stabilize Compose data models (PolicyItem, AppProcessInfo, ProcessInfo,
SuGrantAppInfo, SuGrantAppState) as @Immutable data classes with
read-only val properties, decoupling Android Drawable dependencies into
an on-demand async AppIcon component.

Drop the remain field from SuPolicy as timed grants no longer exist, and
always write until=0. This lets SuperuserViewModel rebuild policies from
the immutable PolicyItem without persisting an expired row. Apply policy
edits to the UI state first and persist them in order, so quick
consecutive toggles cannot overwrite each other and reloads or deletes
cannot interleave with them. Remove the MagiskDB.Literal helper, which
no longer has any users.

Implement dynamic adaptive bottom padding in SuperuserScreen and
ModuleScreen according to FAB positioning (isFabAtBottom),
deduplicate sort and filter controls into AppSortFilterActions,
modernize storage permission handling using ActivityResultContracts,
and replace BaseViewModel.showSnackbar with showToast. Keep the delayed
reboot after fixing the environment from being cancelled when leaving
HomeScreen.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu bb533df6e0 app: implement UDF for settings and decouple auth
Refactor SettingsScreen and SettingsViewModel to adhere to modern
Unidirectional Data Flow (UDF) patterns. Hoist all preference
settings, environment visibility flags, and modal dialog states into an
immutable SettingsUiState collected via collectAsStateWithLifecycle.
Decompose SettingsScreen into a pure stateless SettingsContent
composable with configuration-resilient, validated dialogs.

Keep localized strings out of SettingsUiState and resolve them during
composition, so they follow per-app locale changes even though the
ViewModel outlives the recreated Activity. Refresh device security and
environment flags whenever the screen resumes.

Eliminate Activity memory leaks caused by passing ActivityExtension
lambdas into retained ViewModels. Introduce rememberBiometricAuth
scoped to Composable lifecycles using rememberLauncherForActivityResult
with RequestAuthentication contract. Remove authenticate callback
properties from SettingsViewModel, SuperuserViewModel, and
SuperuserGrantViewModel, and invoke biometric authentication at
call-time in the UI layer.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 1ae3cd9288 app: modernize navigation and predictive back
Refactor Navigator to wrap NavBackStack<NavKey> with Parcelable
listSaver and multi-key support, and remove dead @Serializable
annotations and imports from Routes.kt.

Implement hierarchical tab back navigation in MainScreen to animate
scroll to Tab.HOME before bubbling to root exit, only while Route.Main
is the current destination. Scope child pager pages in MainScreen and
LogScreen with
rememberNavigationEventDispatcherOwner(enabled = isCurrentPage) to
prevent inactive offscreen tabs from intercepting navigation events.

Add NavigationBackHandler and exit confirmation dialogs to FlashScreen
and ActionScreen during active execution, and guard TopAppBar back
navigation buttons while operations are in progress.

Add NavigationBackHandler and TopAppBar back interception to
DenyListScreen and SuperuserGrantScreen to collapse active search
queries before exiting the screen.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu daa07e6d51 app: modernize edge-to-edge and system insets
Enable edge-to-edge window fitting in MainActivity before
super.onCreate() and disable navigation bar contrast enforcement on
API 29+. Declare adjustResize soft input mode in AndroidManifest.xml
and remove deprecated runtime setSoftInputMode.

Derive system bar appearance from the app's color mode instead of the
system night mode by passing a custom detectDarkMode to
enableEdgeToEdge. Re-apply it from MagiskTheme whenever the resolved
theme changes, replacing the unkeyed SideEffect that only updated the
icon colors and left the API < 29 and API 35+ scrims mismatched.

Support full IME and system bar insets in MagiskDialog and
InstallDialog using safeDrawing insets and decorFitsSystemWindows, and
make the custom update channel and download path dialogs in
SettingsScreen scrollable so their text fields stay reachable above
the keyboard.

Pass Scaffold innerPadding to contentPadding or post-scroll padding in
HomeScreen, SettingsScreen, ModuleScreen, SuperuserScreen, and
LogScreen so scrollable content draws behind transparent system bars
edge-to-edge without clipping. Keep the start/end insets as regular
padding so content stays clear of side navigation bars in landscape.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 7e4eeb4f8d app: harden security and clean up build & R8 rules
Harden external intent handling in MainActivity: only accept module
installation, and drop any other action, including uninstallation.
Require explicit user confirmation before flashing, unless the intent
carries the per-process token attached to our own one-shot module
download intents, which the user already chose to install. Hide
overlay windows while the confirmation is shown. Look up the file name
from the external provider with a timeout, and sanitize it and the
provider authority shown in the confirmation. Avoid external intent
indirection in HomeScreen when triggering uninstallation.

Restore callback-based confirm dialogs together with their content
after configuration changes. Dialogs awaited by a coroutine are not
restored, as nothing would receive their result.

Register dynamic USB receivers in InstallDialog as not exported via
registerRuntimeReceiver (RECEIVER_NOT_EXPORTED, enforced on API 33+).

Enable android:enableOnBackInvokedCallback in core manifest to support
predictive back gestures. Fix MagiskDialog modifier parameter ordering
to adhere to Compose lint rules.

Remove the obsolete release manifest and redundant R8 configuration in
core and apk modules: the Parcelable CREATOR and Continuation keep
rules and -allowaccessmodification are covered by
proguard-android-optimize.txt and library consumer rules, and
-shrinkunusedprotofields has no effect with Wire.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 13:01:45 -07:00
topjohnwu 7d9b0dfb3e app: Remove dynamic code loading and simplify stub
Remove dynamic APK class and resource loading across :app, :shared,
and :stub. Consolidate stub resources into :stub and remove stub
obfuscation and encryption.

- Merge :stub-res into :stub and delete the :stub-res module.
- Delete DynLoad, DelegateComponentFactory, ClassLoaders,
  StubApplication, StubRootService, and dummy component classes.
- Delete StubApk, DynamicClassLoader, and CompoundEnumeration from
  :shared.
- Remove lsparanoid, stub component randomization, resource
  encryption, and Stub.kt from build-logic.
- Remove stubVersion and STUB_VERSION tracking.
- Simplify DownloadActivity to use direct resources and APKInstall.
- Remove isRunningAsStub and stub-specific hooks across :core.

Assisted-by: Gemini 4 Argon
2026-10-22 14:06:48 -07:00
topjohnwu 5847745840 app: Remove app hiding UI
Remove the ability to hide or restore the Magisk app from the
application UI in preparation for completely removing the app hiding
and stub repackaging feature.

- Remove hide and restore dialogs, ViewModel actions, and the
  hide/restore toggle IconButton from HomeScreen.
- Remove the stub home screen shortcut item from SettingsScreen and
  associated action in SettingsViewModel.
- Remove shortcut prompt and invalid non-root stub restore dialogs
  from MainActivity.
- Remove addHomeIcon() from Shortcuts and ASKED_HOME preference from
  Config.
- Remove 13 unused localized string resources across all 52 locale
  strings.xml files.

Assisted-by: Gemini 4 Argon
2026-10-22 14:06:48 -07:00
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
topjohnwu 2762a0ebf2 app: track both read and write progress
Add ProgressOutputStream and wrap both the raw input stream and output
stream in runWholeFilePatcher so read and write progress and speeds are
tracked independently.

Render read and write progress on two in-place lines in the terminal to
fit narrow screens, and support multi-line in-place updates in
appendLineOnMain using ANSI cursor movement and erase-in-display.

Assisted-by: Gemini 4 Argon
2026-10-15 00:33:42 +02:00
topjohnwu 2168e71f14 app: describe supported formats in patch dialog
Remove the outdated patch_file_msg string resource across all locales
and add a top-level patch_image_msg description in PatchComposableDialog
explaining all supported input formats and their expected outputs.

Render the formatted description with bold spans, hanging-indent bullet
rows, a divider, and improved spacing for the radio group and URL input
field.

Assisted-by: Gemini 4 Argon
2026-10-14 23:44:30 +02:00
topjohnwu 25df423252 app: unify image patching and support USB output
Merge "Select and patch a file" and "Download and patch a file" into a
single "Patch firmware / image" flow that lets users choose between an
app-provided firmware suggestion, a local file, or an HTTPS URL.

On Googlebooks, allow streaming the patched recovery GPT image directly
to a connected USB flash drive via Android's USB Host Bulk-Only
Transport and SCSI block commands in UsbBlockDevice, avoiding writing
the multi-gigabyte image to internal storage or needing another PC.

Assisted-by: Gemini 4 Argon
2026-10-14 23:44:30 +02:00
topjohnwu 1629d44714 app: hide Superuser log tab without root access
Omit PrimaryTabRow and SuLogTab in LogScreen when Info.env.isActive is
false, rendering MagiskLogTab directly below TopAppBar and skipping
SuLog database queries in LogViewModel.

Assisted-by: Gemini 4 Argon
2026-10-14 01:12:03 +02:00
topjohnwu 9a47544da0 app: fix truncated text in SuLogCard header
Replace the 3-column ListItem in SuLogCard with a Row and Column
layout that places the action badge alongside the app name and gives
the UID/PID and timestamp lines the full header width without single-
line truncation.

Assisted-by: Gemini 4 Argon
2026-10-13 23:06:06 +02:00
topjohnwu e8915d9db1 su: remove obsolete access and reauth settings
With reactive su request prompts removed and superuser permissions
granted explicitly ahead of time in the app, the legacy 4-way superuser
access mode (Disabled, Apps only, ADB only, Apps & ADB) and pre-O
reauthentication after upgrade settings are no longer applicable.

ADB shell (com.android.shell) is now an explicit policy entry managed
directly in the Superuser tab, making global access filters redundant
and prone to conflicting state. Furthermore, revoking policy on package
upgrade without reactive prompting silently breaks root for upgraded
apps.

- Remove RootAccess enum and root_access checks from magiskd.
- Remove su access mode and reauthenticate settings from Manager app.
- Drop ACTION_PACKAGE_REPLACED from Receiver and manifests.
- Purge obsolete string resources across all translations.

Assisted-by: Gemini 3.8 Flash
2026-10-09 09:37:15 -07:00
topjohnwu 79bf48d768 app: show in-place progress during image patching
Wrap PatchFileClassifier.openStream() in ProgressInputStream via
openProgressStream() in MagiskInstallImpl to emit real-time transfer
progress and EMA-smoothed speed during Tar and RecoveryGpt processing.
Also update OtaPayloadExtractor to emit operation download progress
in-place.

Render console lines starting with '\r' in-place in TerminalEmulator
using ANSI erase-in-line ("\r\u001b[2K") and exclude them from saved
logItems in FlashViewModel.

Also fix single-byte read recursion and track skipped bytes in
ProgressInputStream.

Assisted-by: Gemini 3.8 Flash
2026-10-09 06:22:04 +00:00
topjohnwu b268b361f0 More HSUM fixes 2026-10-09 03:51:34 +00:00
topjohnwu d033e43151 app: jump on long scrollbar drags
Dragging the scrollbar thumb of a lazy list or grid scrolled by the
dragged distance, and a large scrollBy composes and measures every
item in between. On the Magisk log, fast thumb drags froze the UI
for up to several seconds per frame.

When the target is more than a viewport away, jump to the matching
item index with scrollToItem() instead; shorter moves still scroll
by pixels so slow drags stay smooth.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu b9d7d6f2d1 app: keep dpad focus in content on rail
With a navigation rail there is nothing below the page, yet pressing
DPAD_DOWN on the last focusable item let the 2D focus search leave
the page and land on a rail item to the side. Cancel downward exits
from the page in rail mode; moving to the rail is still possible
with DPAD_LEFT. The bottom bar keeps its existing focus handling.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu a271b9559e app: use bar when navigation rail does not fit
The navigation suite switches to a rail once the window is at least
480dp tall, but the collapsed rail with the FAB header needs about
476dp of its own height for all five destinations plus the 44dp
bottom space. In short freeform windows on desktop the last rail
item was clipped by the window edge.

The rail cannot scroll and its spacing is fixed, so fall back to the
short navigation bar when the height left for the rail after system
bars is below 520dp, the same switch the library already makes for
windows under 480dp.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 5f1135036d app: align search fields with app grids
On wide windows the DenyList and Grant search fields were centered
within their 720dp cap, while the app grid below them starts at the
left edge. With few results the cards sat far left under an indented
search field.

Keep the 720dp cap, which is the M3 search bar maximum, but align the
field to the start so it lines up with the grid and the top app bar
title. Compact windows are unchanged since the field fills the width.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 96e6d90d0f app: refine FAB slot in navigation rail
M3 specifies that a FAB nested in a navigation rail rests at
elevation level 0. Use the library's zero elevation for the FAB in
the rail header; the FAB floating above the bottom bar keeps its
default elevation.

The rail header reserves a 56dp slot so the rail items do not jump
when the FAB shows or hides. Without root, neither the Modules nor
the Superuser tab exists and the FAB never shows, so skip the slot
and let the rail items start at the top.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 2140801eb4 app: use non-deprecated window size class API
WindowWidthSizeClass is deprecated in window-core 1.5. Check the
width breakpoints with WindowSizeClass.isWidthAtLeastBreakpoint()
instead. The adaptive library only buckets widths at 600 and 840dp,
so the expanded and compact checks behave exactly as before.

The API is only available since window-core 1.4, while adaptive
1.1.0 puts 1.3.0 on the compile classpath. Depend on window-core
1.5.0 explicitly, the version already resolved at runtime, so the
packaged dependencies do not change.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 42b203679a app: size install dialog for wide windows
The install dialog always covered the whole window. Full screen
dialogs are meant for compact windows only; on a desktop window it
turned a short list of options into a huge empty page. Keep it full
screen on compact windows, and show it as a regular sized dialog with
rounded corners and the dialog surface color everywhere else.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 52314125e0 app: use two columns on wide screens
Home and Settings are columns of cards, which became very wide and
sparse on large windows. Add a small AdaptiveColumns helper that
splits the content into two equal columns on expanded width windows,
capped in width and centered, and falls back to the existing single
column otherwise. Settings wraps each title and card pair so they
stay together, and moves the App section to the second column when
the root-only sections are hidden.

The Superuser detail page only has a few rows, so cap its width and
center it instead of splitting it.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 6ad8aea21e app: use grids for app lists
The DenyList and Grant Superuser screens listed every app as a card
spanning the whole window, and the search field stretched across it
too. Show the apps in adaptive grids instead (staggered for DenyList,
whose cards expand to show processes), and cap the search field at
the Material search bar maximum width. Phones still get one column.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu c60156ebd3 app: show tab lists as adaptive grids
On wide windows the Superuser, Modules and Superuser log lists were a
single column of cards stretched across the whole window. Turn them
into lazy grids with adaptive columns: one column on phones, more as
the window gets wider. Modules use a staggered grid since its cards
expand, with a larger minimum width for the action buttons row. The
spacer items move into content padding so phones look the same.

The Magisk log is read from top to bottom, so it stays a single
column, but its cards and the log tab row are capped to a readable
width and centered.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu 07ae8380ea app: use adaptive navigation suite
The bottom navigation bar was used at every window size, which wastes
vertical space and looks out of place on wide windows such as desktop
and unfolded foldables.

Switch MainScreen to NavigationSuiteScaffold, which shows the same
bottom bar on compact windows and a navigation rail on medium and
wider windows. With a rail, the FAB moves into the rail header; its
slot is kept even when the FAB is hidden so the rail items don't jump
when switching tabs. The pager no longer swipes between tabs in rail
mode, and the custom FAB/bottom bar focus wiring only applies to the
bar layout, leaving default 2D focus search for the rail.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00
topjohnwu d4b6bebcf9 app: support any scrollable in scrollbar
The scrollbar only had adapters for ScrollState and LazyListState, so
lazy grids could not use it. Replace the LazyListState adapter, which
estimated sizes from the visible items, with one generic adapter built
on ScrollableState.scrollIndicatorState. Lazy lists, grids and
staggered grids all provide it, so existing lists keep working and
grids can be adopted without extra code.

Assisted-by: Claude Opus 5.5
2026-10-08 10:35:49 -07:00