Repository navigation
DevFlow: correct Android ADB port forwarding guidance - #3630
jfversluis wants to merge 1 commit into
Conversation
Agent-to-broker uses adb reverse on the broker port; CLI-to-agent uses adb forward on the agent port. Document automatic forwarding in maui devflow wait/list, device selection with --device and ANDROID_SERIAL, and that maui devflow diagnose reports forwarding state without repairing it. Fixes #3352 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
PoliCheck Scan ReportThe following report lists PoliCheck issues in PR files. Before you merge the PR, you must fix all severity-1 and severity-2 issues. The AI Review Details column lists suggestions for either removing or replacing the terms. If you find a false positive result, mention it in a PR comment and include this text: #policheck-false-positive. This feedback helps reduce false positives in future scans. ✅ No issues foundMore information about PoliCheckInformation: PoliCheck | Severity Guidance | Term |
|
Learn Build status updates of commit dcee770: ✅ Validation status: passed
For more details, please refer to the build report. |
There was a problem hiding this comment.
🟡 Changes recommended
The Android setup guide gives inaccurate forwarding-recovery advice: cdp status cannot restore missing mappings, and list cannot recover the broker reverse mapping after an emulator restart before agent registration.
2 open issues
What changed in this PR
This documentation update corrects Android DevFlow connectivity guidance, distinguishing the broker’s reverse mapping from the agent’s forward mapping.
Changes:
- Corrects ADB forwarding directions across setup, architecture, and platform-support documentation.
- Documents automatic forwarding, device selection, and manual recovery.
- Clarifies that
maui devflow diagnosereports forwarding status without repairing mappings.
| File | Description |
|---|---|
docs/developer-tools/devflow/setup-android.md |
Expands forwarding setup, device selection, diagnostics, and troubleshooting. |
docs/developer-tools/devflow/index.md |
Corrects the Android platform-support connectivity note. |
docs/developer-tools/devflow/broker.md |
Corrects connectivity directions, commands, and recovery guidance. |
Review effort: Balanced
| 1. Deploy and run your app. When the agent registers, `maui devflow wait` adds the agent forward mapping. | ||
| 1. Run `maui devflow list` to confirm that the agent appears. This command also adds any missing mappings for registered Android agents. | ||
|
|
||
| Other DevFlow commands that connect to an Android agent also add any missing mappings before they connect. |
|
|
||
| > [!NOTE] | ||
| > Run these commands each time the emulator restarts. For physical devices connected via USB, the same `adb reverse` commands apply. | ||
| > ADB removes the mappings when the emulator restarts or the device disconnects. Run `maui devflow list` or `maui devflow wait` again to restore them. The same mappings apply to physical devices connected through USB. |

Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
dcee7702214e16f6fa9fbbb8e1257707e63c01ae8f53402(AndroidDevFlowPortForwarder.cs,AgentManagementOperations.cs,DevFlowCommands.cs).↑ Shipped CLI
0.1.0-preview.14help shows--deviceonmaui devflow diagnose; PR merge commit is contained inv0.1.0-preview.10.↑ markdownlint clean; technical and reader-persona reviews by two models, findings addressed.
↓ No end-to-end runtime run: a hung local emulator blocked DevFlow device enumeration, and repairing commands were not run on shared emulators.
↓ Docs build (xref/moniker warnings) not run locally; relies on PR build.
Fixes #3352
Summary
Documents the Android DevFlow port-forwarding changes from dotnet/maui-labs#273 and corrects wrong guidance that said
adb reversefor both connections.adb reverse tcp:19223 tcp:19223; the host CLI reaches the in-app agent withadb forward tcp:{port} tcp:{port}.maui devflow waitadds the broker reverse mapping before waiting and the agent forward after registration;maui devflow listand commands that connect to an Android agent add missing mappings.--device <serial>onwait,list, anddiagnose;ANDROID_SERIALas fallback (and the only selector for auto-resolved agent commands, which pass no device). Multiple devices produce an error with candidate serials instead of guessing.maui devflow diagnose: documents theAndroid forwardingsection /androidJSON property and clarifies that it reports only and doesn't repair (DiagnoseAsynccallsEnsureForwardingForPortsAsync(..., repair: false, ...)). The issue text claimed diagnose repairs; the source and upstreamdocs/DevFlow/broker.mdsay otherwise.Files
docs/developer-tools/devflow/setup-android.md: rewrote the ADB port forwarding section (automatic, multiple devices, status check, manual), updated troubleshooting, broadened intro.docs/developer-tools/devflow/broker.md: corrected the platform connectivity table, command block, and troubleshooting row.docs/developer-tools/devflow/index.md: corrected the Android platform-support note.Not included
maui devflowCLI reference page exists in this repo, so the issue's suggested option-table row wasn't added.Verification sources
v0.1.0-preview.10)src/Cli/Microsoft.Maui.Cli/DevFlow/Android/AndroidDevFlowPortForwarder.cssrc/Cli/Microsoft.Maui.Cli/DevFlow/Operations/AgentManagementOperations.cssrc/DevFlow/Microsoft.Maui.DevFlow.Agent.Abstractions/BrokerRegistration.cs(agent retries broker connection in the background)Internal previews
Build report