fix: silent install via root now triggers Magisk prompt#673
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR integrates libsu (via JitPack and the version catalog), configures a default libsu Shell, replaces su-binary probing with Changeslibsu integration and root service refactoring
🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryRewrites
Confidence Score: 5/5Safe to merge pending community confirmation on a rooted device; no logic defects in the changed code paths The rewrite correctly delegates shell lifecycle to libsu, the double-checked locking pattern is sound, shell arguments are properly quoted, and the try/finally cleanup is correctly scoped RootServiceManager.kt — the only substantive change; all other files are build configuration Important Files Changed
Sequence DiagramsequenceDiagram
participant App
participant RootServiceManager
participant libsu as libsu (Shell)
participant Magisk as Magisk / KernelSU daemon
App->>RootServiceManager: initialize()
RootServiceManager->>libsu: "Shell.setDefaultBuilder(timeout=10s)"
RootServiceManager->>libsu: Shell.isAppGrantedRoot()
libsu-->>RootServiceManager: null / false / true
RootServiceManager-->>App: "status = NOT_AVAILABLE / PERMISSION_NEEDED / READY"
App->>RootServiceManager: requestPermission()
RootServiceManager->>libsu: Shell.getShell() [blocks on IO thread]
libsu->>Magisk: su socket handshake
Magisk-->>App: Show grant dialog (UI thread)
App-->>Magisk: User taps Allow
Magisk-->>libsu: Root shell granted
libsu-->>RootServiceManager: "Shell (status=ROOT_SHELL)"
RootServiceManager->>libsu: Shell.isAppGrantedRoot()
libsu-->>RootServiceManager: true
RootServiceManager-->>App: "status = READY"
App->>RootServiceManager: installPackage(apkFile, installer)
RootServiceManager->>libsu: "Shell.cmd(cp src tmp && chmod 644 tmp).exec()"
libsu-->>RootServiceManager: copyRes
RootServiceManager->>libsu: Shell.cmd(pm install -i pkg -r tmp).exec()
libsu-->>RootServiceManager: result (stdout / exit code)
RootServiceManager->>libsu: Shell.cmd(rm -f tmp).submit()
RootServiceManager-->>App: STATUS_SUCCESS / STATUS_FAILURE
Reviews (2): Last reviewed commit: "fix(root): wrap install in outer try/fin..." | Re-trigger Greptile |
Closes #651.
The previous root installer spawned
suviaRuntime.execdirectly against a hardcoded list of su binary paths. On modern Magisk (≥27) + Android 14/15 this never triggers the superuser daemon prompt — the binary is hidden from non-granted callers, so the probe immediately returns "no su" and the Root tile shows "No root" with no permission dialog.Rewrote
RootServiceManageron top of libsu 6.0.0 (the canonical lib from the Magisk author, used by LSPosed/Shizuku/etc.). It handles binary discovery, the daemon socket, MagiskHide quirks, and works out of the box with KernelSU + APatch.Behaviour changes:
Shell.isAppGrantedRoot()(null → NOT_AVAILABLE, false → PERMISSION_NEEDED, true → READY).Shell.getShell()forces main shell creation, which surfaces the Magisk/KernelSU/APatch grant dialog properly.installPackage: stages APK to/data/local/tmp(avoids SELinux path-access issues),pm install -r -i <installer> <tmp>, cleans up.uninstallPackage:pm uninstall <pkg>via libsu shell.RootStatusenum unchanged; all callsites (SilentInstallerDispatcher,AndroidInstallerStatusProvider,AutoUpdateWorker, Tweaks UI) untouched.Added JitPack repo scoped to
com.github.topjohnwuonly (no wide-net resolution).Tested by compile-verifying
:composeApp:assembleDebug. I do not have a rooted device to manually verify; flagging for community confirmation.Summary by CodeRabbit
Bug Fixes
Improvements