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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
- Expose MagiskD::get_app_id via CXX bridge and reuse it in denylist
instead of duplicating user collection and package UID lookup in C++.
- Remove redundant manager package name returns, Status enum, and the
ManagerInfo wrapper struct now that the package name is fixed.
Assisted-by: Gemini 4 Argon
Normalize system and shared-UID (< 10000) processes to their app ID
when evaluating su policies and uid_granted_root so policies stored by
PolicyDao.normalizeUid match across non-zero users on HSUM devices.
- Normalize eval_uid in build_su_info and uid in uid_granted_root when
app_id < AID_APP_START.
- Ensure SECURE_DIR exists before writing settings in boot_complete(),
seed SuMultiuserMode on HSUM, and check isHeadlessSystemUser in
Info.showSuperUser.
- Normalize UID comparisons in PackageManager.getPackageInfo(uid, pid).
- Simplify ManagerInfo to track a single TrackedFile instead of a
per-user BTreeMap.
- Skip negative parse_int results in deny collect_users.
Assisted-by: Gemini 4 Argon
Consolidate ProviderInstaller and APKInstall into :core under matching
packages (com.topjohnwu.magisk and com.topjohnwu.magisk.utils).
- Move ProviderInstaller.java and APKInstall.java to :core
- Delete app/shared/ module and its build configuration
- Merge permissions and application attributes into :core manifest
- Remove :shared project dependency from :core build.gradle.kts
- Update app/settings.gradle.kts to only include :apk, :core, :test
- Update magisk-app skill documentation to remove obsolete references
Assisted-by: Gemini 4 Argon
Remove the :stub Android application module, its build-logic task
integration, build.py stub building commands, and leftover stub hooks
in :core.
- Delete app/stub/ and its 60 tracked files (activity, networking,
and localized string resources)
- Remove :stub from app/settings.gradle.kts
- Remove stubTask and stub.apk syncing in Setup.kt
- Remove build_stub, stub subparser, and stub APK copying in build.py
- Simplify RootUtils by removing unused stub parameter and constructor
- Remove unused -keep rule for App constructor in proguard-rules.pro
- Update README.MD to remove stub string references
Assisted-by: Gemini 4 Argon
Move permissions, requestLegacyExternalStorage, and the debug
usesCleartextTraffic manifest from :shared into :core so the stub APK
only retains permissions required for downloading and installing the
full Magisk APK.
Assisted-by: Gemini 4 Argon
Remove support for custom/repackaged manager package names
(su_manager / repackaged_pkg) and secondary certificate verification
(repackaged_cert) from the native daemon and database.
- Remove SuManager from DbEntryKey in CXX bridge and db.rs.
- Remove unused get_db_string and rm_db_string methods from MagiskD.
- Delete check_dyn and check_stub in package.rs.
- Remove repackaged_* fields from ManagerInfo and derive Default.
- Simplify find_apk_path, get_package_uid, and get_manager to target
APP_PACKAGE_NAME and verify against TRUSTED_CERT.
- Bump SQLite DB_VERSION to 13, drop strings table on migration, and
remove create_strings from new database initialization.
- Remove obsolete hidden/stub app sections from FAQ documentation.
Assisted-by: Gemini 4 Argon
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
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
- Use --user current for pm install, adb install, and appops set across
install_script, adb_pm_install, and test/setup scripts.
- Skip headless user 0 in get_users() on HSUM devices.
- Use --user current in app_notify for non-app UIDs instead of calling
content call against all users.
- Clear path buffer on each iteration in setup_magisk_env.
- Use --user current for am instrument in app migration tests.
Assisted-by: Gemini 4 Argon
- Extract the signing certificate from keyStore via keytool in
dump_flags_native() and emit TRUSTED_CERT in flags.rs (or an empty
slice when keyStore is not configured).
- Replace dynamic certificate extraction from stub.apk in
preserve_stub_apk() with the static TRUSTED_CERT constant.
- Move get_package_uid() out of MagiskD into a standalone function.
Assisted-by: Gemini 4 Argon
- 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
The AVB 1.0 BootSignature format comes from AOSP's BootSignature.java,
which signs and verifies with Java's SHA256withECDSA family. Those
produce and expect ASN.1 DER encoded (r, s) signatures.
magiskboot wrote and parsed the fixed width r || s form instead. An
image signed by AOSP with an EC key was therefore not recognized by
`magiskboot verify` (nor flagged AVB1_SIGNED by unpack), and an image
signed by `magiskboot sign-avb1` with an EC key was rejected by AOSP's
verifier with "Invalid encoding for signature".
Encode and decode ECDSA signatures as DER. RSA is unchanged.
Assisted-by: Claude Opus 5.5
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
Wrap the underlying raw source stream in ProgressInputStream before
decompression and compare against rawSize (entry.compressedSize for
DEFLATED zip entries) so that progress percentages and transfer speeds
reflect actual I/O instead of skewed decompressed output on sparse
images.
Also remove the redundant InflaterInputStream.close() override in
ZipChannel since Android's libcore unconditionally ends the Inflater
on close().
Assisted-by: Gemini 4 Argon
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
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
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
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
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
With reactive su prompting removed, root requests from UIDs without
an existing policy in the database are rejected immediately. Previously,
RootSettings defaulted log and notify to true, causing the daemon to
notify the manager app whenever an unconfigured UID attempted to run
su.
Derive Default for RootSettings so that policy defaults to Deny with
log and notify initialized to false, preventing unwanted notifications
to the app when no database policy exists. Also simplify SuInfo::allow
and SuInfo::deny to leverage Default.
Assisted-by: Gemini 3.8 Flash
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
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
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
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
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
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