Skip to content

Refactor away libsu again - #19

Merged
Mygod merged 11 commits into
masterfrom
byelibsu
Jun 3, 2026
Merged

Refactor away libsu again#19
Mygod merged 11 commits into
masterfrom
byelibsu

Conversation

@Mygod

@Mygod Mygod commented Jun 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

@Mygod Mygod added the enhancement New feature or request label Jun 3, 2026
@Mygod
Mygod marked this pull request as ready for review June 3, 2026 18:37
@Mygod
Mygod requested a review from Copilot June 3, 2026 18:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the previous libsu-based RootService integration and replaces it with an owned root-process startup and Binder handoff flow, eliminating the JitPack/libsu dependency and updating the library, demo app, and tests accordingly.

Changes:

  • Drop libsu + JitPack usage and implement an owned root app_process startup path with provider-based Binder handoff.
  • Introduce new internal startup/runtime components (bootstrap/main/launcher/ownership/handoff) and a new public NoShellException.
  • Update tests and demo code to validate the new startup, IPC, and failure/cancellation behaviors.

Reviewed changes

Copilot reviewed 33 out of 33 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
settings.gradle.kts Removes JitPack repository entry (no longer needed after libsu removal).
README.md Updates feature/comparison docs and documents hidden API assumptions for the new design.
lib/src/test/java/be/mygod/librootkotlinx/RootSessionTest.kt Adds coverage for propagating owned-shell startup failures from acquire().
lib/src/test/java/be/mygod/librootkotlinx/RootServerTest.kt Adds tests for new lifecycle logging and startup event behavior.
lib/src/test/java/be/mygod/librootkotlinx/impl/RootServiceHandoffTest.kt New tests for token-based Binder handoff and provider failure behavior.
lib/src/test/java/be/mygod/librootkotlinx/impl/RootProcessHandleTest.kt Updates startup/cancellation tests to match new startup sequencing and error messages.
lib/src/test/java/be/mygod/librootkotlinx/impl/RootCommandServiceTest.kt Adds test ensuring fatal callback failures stop the root process.
lib/src/test/java/be/mygod/librootkotlinx/impl/libsu/RootProcessLauncherTest.kt Deletes obsolete tests for the removed libsu rewrite path.
lib/src/main/java/be/mygod/librootkotlinx/RootSession.kt Changes lifecycle hook to handleRootLifecycle, adds niceName, and documents new lifecycle timing; annotates acquire/use with @Throws(NoShellException).
lib/src/main/java/be/mygod/librootkotlinx/RootServer.kt Refactors lifecycle/event handling, improves failure logging, and adjusts close/cleanup semantics.
lib/src/main/java/be/mygod/librootkotlinx/NoShellException.kt New public exception for “no root shell” startup failures.
lib/src/main/java/be/mygod/librootkotlinx/io/ProcessPipes.kt New process helper APIs (startPipes, awaitExit, Process.pid) and ProcessPipes wrapper.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootServiceHandoffProvider.kt New internal ContentProvider endpoint for root-to-app Binder handoff.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootServiceHandoffClient.kt New root-side client for external provider acquisition + IContentProvider.call compatibility.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootServiceHandoff.kt New token registry and delivery mechanism for one-shot Binder handoff.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootServiceConnection.kt Replaces libsu binding with owned root-process startup + handoff registration/cleanup.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessPipes.kt Adjusts pipe path handling and removes libsu/ShellUtils dependency.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessOwnership.kt Refactors ownership socket API (explicit socket name param) and switches logging to project logger.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessMain.kt New root-side runtime that creates the service binder and delivers it via handoff.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessLauncher.kt New owned startup command builder/executor for root app_process (no libsu rewrite).
lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessHandle.kt New startup sequencing (ownership + stdio + connection) and lifecycle handling orchestration.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessBootstrap.kt New bootstrap entrypoint to create package context/classloader before invoking RootProcessMain.
lib/src/main/java/be/mygod/librootkotlinx/impl/RootCommandService.kt Converts from RootService to an owned binder with explicit “stop root process” callback.
lib/src/main/java/be/mygod/librootkotlinx/impl/libsu/RootProcessMain.kt Deletes obsolete libsu-mirroring root-side entrypoint.
lib/src/main/java/be/mygod/librootkotlinx/impl/libsu/RootProcessLauncher.kt Deletes obsolete libsu startup command rewrite implementation.
lib/src/main/java/be/mygod/librootkotlinx/impl/libsu/PendingRootServiceBind.kt Deletes obsolete libsu reflection shim for pending bind cleanup.
lib/src/main/java/be/mygod/librootkotlinx/impl/AppProcess.kt New helper for app_process command construction, quoting, and (API<26) relocation script.
lib/src/main/AndroidManifest.xml Adds non-exported direct-boot-aware provider for handoff.
lib/consumer-rules.pro Updates keep rules for bootstrap/main reflection entry points.
lib/build.gradle.kts Removes libsu dependency from library module.
lib/api/current.txt Updates tracked public API for NoShellException, RootSession signature changes, and new process helpers.
app/src/main/java/be/mygod/librootkotlinx/demo/MainActivity.kt Updates demo to use new nonblocking Process IO and adds Binder passing demo.
app/src/androidTest/java/be/mygod/librootkotlinx/demo/RootStartupCancellationTest.kt Expands assertions for new demo output and updates no-root detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/src/main/java/be/mygod/librootkotlinx/impl/RootProcessHandle.kt
Comment on lines +163 to +164
currentCoroutineContext().ensureActive()
if (rootServiceConnected.isCancelled) throw CancellationException("Root startup cancelled")
@Mygod
Mygod merged commit 1d70a83 into master Jun 3, 2026
4 of 6 checks passed
@Mygod
Mygod deleted the byelibsu branch June 3, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants