Skip to content

Add webview communication with the frontend#2965

Draft
TimoPtr wants to merge 2 commits intomasterfrom
android/webview_architecture
Draft

Add webview communication with the frontend#2965
TimoPtr wants to merge 2 commits intomasterfrom
android/webview_architecture

Conversation

@TimoPtr
Copy link
Member

@TimoPtr TimoPtr commented Feb 17, 2026

Proposed change

Add a small mermaid diagram explaining how the communication with the frontend is working in the Android app.

image

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features for which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Remove stale or deprecated documentation

Checklist

  • I have read and followed the documentation guidelines.
  • I have verified that my changes render correctly in the documentation.

Additional information

Summary by CodeRabbit

  • Documentation
    • Added a WebView communication architecture section to Android docs, including an architecture overview, an interaction diagram illustrating message flow, and a "Component responsibilities" subsection detailing the public-facing components and their roles.

@TimoPtr TimoPtr requested a review from a team as a code owner February 17, 2026 09:15
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

No actionable comments were generated in the recent review. 🎉


📝 Walkthrough

Walkthrough

A new documentation section titled "WebView communication architecture" is added to the Android architecture guide, detailing the communication flow between Home Assistant Frontend JS and internal Android components, including architecture overview and component responsibilities. This is a documentation-only addition with no code or behavior changes.

Changes

Cohort / File(s) Summary
Android architecture documentation
docs/android/architecture.md
Added new "WebView communication architecture" section with component interaction overview, Mermaid diagram describing data flow between FrontendJsBridge, FrontendMessageHandler, FrontendExternalBusRepository, and ServerSessionManager, and detailed component responsibilities subsection.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: adding documentation about WebView communication with the frontend in the Android app context.
Description check ✅ Passed The description follows the template with all required sections completed: Proposed change is filled (with diagram image), Type of change is checked, both checklist items are marked complete, and relevant PR link is provided.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch android/webview_architecture

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/android/architecture.md (1)

119-119: Consider clarifying the arrow label for consistency.

The label "FrontendJsHandler" appears to reference an interface or type, while other labels in the diagram use method names or actions (e.g., "getExternalAuth()", "onMessageReceived()"). Consider making this label more descriptive to match the pattern, such as "implements FrontendJsHandler" or "via FrontendJsHandler".

📝 Suggested clarification
-    JsBridge -->|"FrontendJsHandler"| MsgHandler
+    JsBridge -->|"via FrontendJsHandler"| MsgHandler

or

-    JsBridge -->|"FrontendJsHandler"| MsgHandler
+    JsBridge -->|"implements FrontendJsHandler"| MsgHandler
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/android/architecture.md` at line 119, The diagram arrow label
"FrontendJsHandler" is ambiguous compared to other action/method labels; update
the label between JsBridge and MsgHandler to a descriptive phrase like
"implements FrontendJsHandler" or "via FrontendJsHandler" so it matches the
pattern of method/action labels (reference: JsBridge, FrontendJsHandler,
MsgHandler).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/android/architecture.md`:
- Line 92: The two broken links in the sentence referencing external
authentication and external bus need updating: replace the paths
`/docs/api/native-app-integration/frontend/external-authentication` and
`/docs/api/native-app-integration/frontend/external-bus` with the correct
`/docs/frontend/external-authentication` and `/docs/frontend/external-bus`
respectively so the WebView paragraph links point to the actual documentation
pages.

---

Nitpick comments:
In `@docs/android/architecture.md`:
- Line 119: The diagram arrow label "FrontendJsHandler" is ambiguous compared to
other action/method labels; update the label between JsBridge and MsgHandler to
a descriptive phrase like "implements FrontendJsHandler" or "via
FrontendJsHandler" so it matches the pattern of method/action labels (reference:
JsBridge, FrontendJsHandler, MsgHandler).

@TimoPtr
Copy link
Member Author

TimoPtr commented Feb 17, 2026

@jpelgrom do we wait for it to be use before merging this?

@jpelgrom
Copy link
Member

Mermaid styling seems to need some tweaks for dark mode...

do we wait for it to be use before merging this?

Yes I'd wait until this is actually how the main WebView works, we might tweak it while developing.

@silamon silamon marked this pull request as draft March 2, 2026 17:46
@silamon
Copy link
Contributor

silamon commented Mar 2, 2026

From what I understand, this isn't ready for merge yet, hence setting as draft.

@TimoPtr
Copy link
Member Author

TimoPtr commented Mar 3, 2026

From what I understand, this isn't ready for merge yet, hence setting as draft.

Exactly. I'll handle the merge, once the migration is going to be over. We are merging small bits at the time in debug only in the app. I'm going to probably keep this PR for a while and might update it along the way. The progress can be tracked in home-assistant/android#6424

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants