Cleanup old mechanism to use server to connect to androidMobile agent - #2863
Open
jebrans wants to merge 5 commits into
Open
Cleanup old mechanism to use server to connect to androidMobile agent#2863jebrans wants to merge 5 commits into
jebrans wants to merge 5 commits into
Conversation
Register an inline Android device schema from the mobile sample, route executeAction callbacks to alarm and timer intents, return action results, and cover the registration and parsing contract with focused tests. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The mobile-2 sample had two parallel mechanisms for receiving device commands: the fire-and-forget `takeAction` calls pushed by the server-side `androidMobile` agent over the `clientio:` channel, and the client-registered `androidDevice` agent that receives `executeAction` invokes and returns a result. The former is strictly worse - it duplicated the alarm and timer handlers but discarded the outcome, so the agent never learned whether the intent actually launched. Delete the `takeAction` path and make `registerClientAgent` the sole onboarding and command mechanism. `searchNearby` existed only on the legacy path, so it moves into the client-agent schema first; it now reports success or failure back like the other two actions instead of being fired blind. `clientio:` is retained - it remains the only transport for display and user-interaction traffic. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Remove the legacy
takeActiondevice-command path from themobile-2Android sample, making
registerClientAgentthe sole mechanism foronboarding the app and dispatching device actions.
The sample previously carried two parallel command paths. The
client-hosted
androidDeviceagent receives typedexecuteActioncallbacks and returns a result to TypeAgent. The older path handled
fire-and-forget
takeActioncalls pushed by the server-sideandroidMobileagent over theclientio:channel; it duplicated thealarm and timer handlers but discarded the outcome, so TypeAgent never
learned whether the intent actually launched.
searchNearbyexisted only on the legacy path, so it moves into theclient-agent schema first. It now reports success or failure back like
the other two actions instead of being fired blind.
The
clientio:channel is retained — it remains the only transport fordisplay and user-interaction traffic (
appendDisplay,setDisplay,setDisplayInfo,notify,requestChoice,requestInteraction).Only the
takeActionbranch is removed.Example
Before
Two paths reached the same Android intents, and only one could report a
result:
searchNearbywas reachable only through the first path, so a failureto launch the maps app was invisible to TypeAgent.
After
One path, and every action reports its outcome:
searchNearbycan now be tested deterministically like the otheractions:
A failed launch now surfaces as an action error rather than silence:
Notes
Verified with
testDebugUnitTest,assembleDebugandlintDebug—79 tests, 0 failures, lint clean. Two tests were added covering
searchNearbyparsing and its invalid-parameter path.