fix: don't mark app installed when Shizuku falls back to system installer#488
fix: don't mark app installed when Shizuku falls back to system installer#488rainxchzed wants to merge 2 commits into
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 (3)
WalkthroughThe PR refactors install outcome handling across three layers. The orchestrator service now branches on the installer's returned ChangesInstall Outcome Propagation & Conditional Handling
Sequence DiagramsequenceDiagram
actor User
participant DetailsVM as DetailsViewModel
participant Orchestrator as DefaultDownloadOrchestrator
participant Installer as Installer
participant AppDB as InstalledAppsRepository
User->>DetailsVM: Observes completion
DetailsVM->>Orchestrator: Polls orchestrator entry
activate Orchestrator
Orchestrator->>Installer: installer.install(filePath, ext)
Installer-->>Orchestrator: InstallOutcome.COMPLETED
Orchestrator->>AppDB: setPendingInstallFilePath(null)
AppDB-->>Orchestrator: ✓
Orchestrator-->>DetailsVM: OrchestratedDownload{installOutcome=COMPLETED}
deactivate Orchestrator
DetailsVM->>DetailsVM: resolvedOutcome=COMPLETED<br/>isCompleted=true
DetailsVM->>AppDB: Persist installed app
AppDB-->>DetailsVM: ✓
DetailsVM->>Orchestrator: dismiss(packageKey)
par Alternative Path: Delegated Install
Orchestrator->>Installer: installer.install(...)
Installer-->>Orchestrator: InstallOutcome.DELEGATED_TO_SYSTEM
Orchestrator-->>DetailsVM: OrchestratedDownload{installOutcome=DELEGATED_TO_SYSTEM}
DetailsVM->>DetailsVM: resolvedOutcome=DELEGATED<br/>isCompleted=false
DetailsVM->>AppDB: Persist with delegated outcome
Note over DetailsVM: Skip dismiss() — keep entry visible
end
Estimated Code Review Effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
Summary
When the user has Shizuku/Sui selected as their installer but the binder isn't actually ready (binder died, Sui not running, permission revoked, etc.),
ShizukuInstallerWrappersilently falls back to the standard Android installer and reportsInstallOutcome.DELEGATED_TO_SYSTEM. The orchestrator'srunInstallwas discarding that return value and unconditionally moving the entry toDownloadStage.Completed, andDetailsViewModel'sCompletedhandler hard-codedinstallOutcome = COMPLETEDwhen persisting the DB row. Result: the app would be marked as installed the moment the system install prompt appeared — even if the user immediately tapped Cancel.Fix
OrchestratedDownloadnow carries the actualinstallOutcomeproduced by the orchestrator's own install attempt.nullfor entries that never went throughrunInstall(foreground-driven install paths capture the outcome themselves).DefaultDownloadOrchestrator.runInstallnow branches on the outcome:COMPLETED→ clear pending file path, clear notifier, transition toCompleted(current behavior).DELEGATED_TO_SYSTEM→ keep the parked file path and notifier intact, transition toCompletedcarrying the delegated outcome so consumers know it's not a confirmed install.DetailsViewModel.OrchestratorStage.Completedreads the entry's outcome and forwards it tosaveInstalledAppToDatabase(which already mapsoutcome != COMPLETED→isPendingInstall = true). It also avoids firingrecordInstallSucceededtelemetry, the "Installed" log line, and the orchestrator dismiss for delegated-only outcomes — those are reserved for confirmed installs.After the fix, a Shizuku-fallback install that the user cancels at the system prompt leaves the row with
isPendingInstall = trueand a parked file.PackageEventReceiverflips it tofalseonly whenPACKAGE_ADDEDactually fires; if the user never accepts, the 24h stale-pending sweep inSyncInstalledAppsUseCasecleans it up.Test plan
PACKAGE_ADDEDfires, the row flips to installed (verified by Apps section showing it under "Up to date").Summary by CodeRabbit
New Features
Bug Fixes