Repository navigation
fix(android): report a package that is not installed when terminating it - #498
mobile-kevin wants to merge 1 commit into
Conversation
am force-stop exits 0 for any package name, so terminating an app that is not installed reported success. Check pm path first and fail with '<package> not installed', the message the iOS device and simulator give. Terminating an installed app that is not running still succeeds.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review. 📝 WalkthroughWalkthrough
ChangesAndroid app termination
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to Terminating an Android package that is not installed now reports an error instead of silently succeeding. Installed apps that are not running still terminate without error. No merge-blocking risk is identified. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Problem
mobilecli apps terminate <package>on Android reports success for a package that is not installed, becauseam force-stopexits 0 for any name:The iOS device and the simulator (#493) already fail with
<package> not installed.Fix
AndroidDevice.TerminateAppcheckspm path <package>first and returns<package> not installedwhen it prints nothing. An installed app that is not running is still force-stopped without error, so callers that stop an app before relaunching it are unaffected.pm pathoutput is read by a small pure function,pmPathReportsInstalled, so an adb or device failure (non-empty output that is notpackage:…) is returned as an error instead of being read as "not installed".Cost: one extra
adb shell pm pathper terminate (~50 ms on an emulator).Testing
main:should report that a package which is not installed cannot be terminatedfailed withapps terminate com.mobilenext.notinstalled unexpectedly succeeded; it passes with the fix.should terminate an installed app that is not running without an errorpasses before and after.pmPathReportsInstalled: installed, split APK, not installed, adb failure.go test ./...passes;golangci-lintreports the same 84 findings asmain, none new.Found while QA-testing mobile-mcp (BUG-34).
Summary by CodeRabbit