Commit Graph
7902 Commits
Author SHA1 Message Date
topjohnwu 0972f67d97 Release Magisk v31.1
[skip ci]
2026-10-25 01:56:27 +00:00
topjohnwu 8c78d913cb docs: add v31.1 changelog
Add release notes for Magisk v31.1 to docs/changes.md.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-25 01:35:50 +00:00
topjohnwu 4a07c71693 docs: link OTA guide and add Googlebook OTA notes
- Link ota.md under the Users section in docs/README.md.
- Note in docs/ota.md that restoring the boot image is also unnecessary
  for Googlebooks.
- Add a System Updates subsection under Googlebooks in docs/install.md
  linking to ota.md.

Assisted-by: Gemini 4 Argon
2026-10-25 01:22:53 +00:00
topjohnwu e33c720fcf docs: add Googlebooks installation guide
- Add a new Googlebooks section in docs/install.md covering bootloader
  unlocking, recovery image patching, USB drive creation, and booting
  into recovery mode without wiping data.
- Convert step lists in Patching Images, Samsung Devices, and Custom
  Recovery sections to numbered lists.

Assisted-by: Gemini 4 Argon
2026-10-25 01:22:53 +00:00
topjohnwu 3d378ae6b1 docs: update OTA upgrade guide and screenshots
- Remove non-A/B OTA instructions and specify A/B-only support.
- Note that the workflow is tested on Pixel devices and that boot image
  restoration is unnecessary on Pixels.
- Update the OTA installation workflow and screenshots.

Assisted-by: Gemini 4 Argon
2026-10-24 23:22:26 +00:00
topjohnwu 61137ff502 docs: update documentation for v31.0
Update user and developer documentation to reflect current v31.0
architecture, CLI flags, build workflows, and UI flows:

- install.md & device_info.png: update Home screen screenshot to the
  Material 3 UI, document "Patch firmware / image" options (storage,
  remote HTTPS URL, Pixel factory image auto-download), add
  vendor_boot support, update patched image filenames, and drop
  references to the removed stub app.
- build.md: update JDK requirement to JDK 25, replace binary with
  native and gen subcommands, and document scripts/env.py, clippy,
  cargo, and sccache/ccache.
- details.md: update $INTERNALDIR layout, 2SI SwitchRoot and SEPolicy
  patching strategies (Legacy now covers Android 7.x only),
  boot-complete stage, resetprop ro.* behavior, and SELinux policy
  rules.
- tools.md: add --print-rules and xperm syntax to magiskpolicy, and
  document -c and -M in su.
- guides.md: document action.sh, reference REMOVE in customize.sh,
  and clarify post-fs-data script timeout and overlay.d rules.
- boot.md: add Android 13+ GKI 2.0 (init_boot / vendor_boot) context
  and update AOSP documentation links.
- faq.md: document automatic Safe Mode bootloop recovery, Reboot menu
  Safe Mode toggle, and emulator patching commands.

Assisted-by: Gemini 4 Argon
Assisted-by: Claude Opus 5.5
2026-10-24 20:09:24 +00:00
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 9f512a6a05 app: recreate activity on locale change
Without the system's per-app language settings (before Android 13),
changing the language in the app relaunched the foreground activity by
starting it again and finishing it. MainActivity is singleTask, so the
start was delivered to the same instance, which was then finished, and
the app closed instead of showing the new language.

Recreate the activity instead, and remove relaunch(), which has no
other users.

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 a51dc10f88 native: Simplify and deduplicate package lookup
- 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
2026-10-22 14:06:48 -07:00
topjohnwu e8e8c3e3f1 Fix HSUM su policy lookup and manager tracking
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
2026-10-22 14:06:48 -07:00
topjohnwu e31ef291d4 app: merge :shared into :core and remove :shared
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
2026-10-22 14:06:48 -07:00
topjohnwu d22fea2906 app: remove :stub module and build integration
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
2026-10-22 14:06:48 -07:00
topjohnwu c86a8776ce Remove stub embedding from native and scripts
Remove stub.apk and stub.xz extraction, compression,
ramdisk embedding, and daemon auto-installation from native
components (magiskinit, magiskd, scripting), installation
scripts, MagiskInstaller, and build.py.

Assisted-by: Gemini 4 Argon
2026-10-22 14:06:48 -07:00
topjohnwu 447a8f9965 app: Move core-only manifest entries from shared
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
2026-10-22 14:06:48 -07:00
topjohnwu 5f2faee618 native: Remove custom package and cert validation
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
2026-10-22 14:06:48 -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 1240c2e35c app: Remove app repackaging and signing
Remove app hiding repackaging, key generation, AXML patching, and
in-app APK signing components along with BouncyCastle (bcpkix).

- Delete AppMigration, Keygen, AXML, and signing package classes.
- Remove bcpkix dependency and build-logic packaging exclude.
- Remove suManager, keyStoreRaw, StringDao, and strings DB table.
- Simplify DownloadProcessor app update and SplashScreen init.
- Remove AppMigrationTest, setupAppHide/Restore, and test scripts
  references to repackaged test packages.
- Remove unused hide_app_title string across all locales.

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 ea16c8141e Fix package management and user targeting on HSUM
- 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
2026-10-22 14:06:48 -07:00
topjohnwu c275a4ea30 Embed trusted certificate in flags.rs
- 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
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 af8c2566b0 Update documentation to use samloader-rs 2026-10-16 14:00:19 +00:00
leoca 87e72a582e Use DER encoding for AVB1 ECDSA signatures
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
2026-10-15 00:38:20 +02: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