Skip to content

Overlay and BLE remote features#15

Open
baileyboy0304 wants to merge 12 commits intomsp1974:devfrom
baileyboy0304:overlay
Open

Overlay and BLE remote features#15
baileyboy0304 wants to merge 12 commits intomsp1974:devfrom
baileyboy0304:overlay

Conversation

@baileyboy0304
Copy link
Copy Markdown

In this code I have added android flavors - FireTv and universal.

univeral - the standard VACA code.
FireTV - this enables overlay code so that the VACA app can overlay on top of anything that is on the android screen - either the desktop or another app. This allows VA dashboards to be shown on a fireTV stick, over the top of TV pictures etc.

I needed to disable the microphone input (otherwise fireOS always shows a microphone icon on the screen). This has touched a few of the VACA files.

I needed to rename MainActivity to BaseMainActivity, to allow minimal changes to the VACA code, and for me to make the overlay changes I needed.

Let me now what you think!

baileyboy0304 and others added 10 commits February 28, 2026 17:11
Move root.visibility = View.VISIBLE before the first
safelyAttachOrUpdate() call in shrinkToBubble() so the overlay
window is added to the WindowManager as VISIBLE from the start.

On the FireTV Cube (AFTGAZL / SDK 28), adding the root as GONE
and then flipping to VISIBLE afterwards was not picked up by the
compositor without an explicit updateViewLayout(), leaving the
bubble clock invisible until a dashboard overlay or picker
triggered a full WM pass.

https://claude.ai/code/session_01DuqQ5oXJhwe63UtFLaxDxL
The bootstrap ticker re-injects injectSpaNavigationHook() every
500ms via evaluateJavascript().  When the hook was already
installed (__vaNavHooked == true), the re-injection path updated
__vaLastHref to the current URL but never called onPathChange().

On the FireTV Cube, the WebView is reparented into the overlay
root FrameLayout before the root is attached to the WindowManager.
In this detached state, in-page JS timers (setTimeout/setInterval)
are throttled, so the pushState interceptor's debouncedNotify()
callback and the 500ms polling setInterval never fire.  The
re-injection was the only mechanism that could still detect the
change (evaluateJavascript runs from the main Handler), but it
silently absorbed it.

Now the re-injection path compares location.href against
__vaLastHref and calls onPathChange() when they differ, acting
as a reliable fallback for devices that throttle detached-view
JS timers.

https://claude.ai/code/session_01DuqQ5oXJhwe63UtFLaxDxL
The JS navigation hook relies on in-page setTimeout/setInterval
timers which may not fire when the WebView is in a detached view
tree (not yet attached to WindowManager).  Add a native-level
fallback: the bootstrap ticker now also calls
evaluateJavascript("location.href") with a callback — the
callback fires on the main thread regardless of in-page timer
state, so it reliably detects URL changes.

Also add diagnostic logging at every step:
- install() sequence + webView.url at entry
- bootstrap ticker native-poll URL changes
- NavBridge.onPathChange (promoted from debug to info)
- handlePossibleInAppNavigation entry + profile + phase
- shrinkToBubble entry + rootToken + dimensions after attach

https://claude.ai/code/session_01DuqQ5oXJhwe63UtFLaxDxL
Replace Unicode left/right double quotation marks (U+201C/U+201D)
with ASCII double quotes (U+0022) throughout OverlayController.kt
and OverlayHost.kt. These were inadvertently introduced by the
edit tool and caused syntax errors on the Windows build.

https://claude.ai/code/session_01DuqQ5oXJhwe63UtFLaxDxL
…/clock

On the FireTV Cube, after moveTaskToBack the WebView loads HA and
stays on /lovelace/default_view. Home Assistant never pushes a
navigation to /view-assist/clock, so shrinkToBubble() was never
called and the overlay root was never attached to the WindowManager.

Add a fallback in the bootstrap ticker: after 20 ticks (~10s) if
no clock navigation has been seen, proactively call
shrinkToBubble() to show the bubble clock and attach the overlay
to the WindowManager.

https://claude.ai/code/session_01DuqQ5oXJhwe63UtFLaxDxL
On the FireTV Cube, the overlay root is never attached to the
WindowManager at boot because shrinkToBubble() is only called
when a /view-assist/clock navigation is detected -- but that
navigation never arrives because the WebView is in a detached
view tree (root not added to WM yet), preventing HA's Lovelace
frontend from processing SPA navigation commands.

Fix the chicken-and-egg problem by calling shrinkToBubble() at
the end of install(). This immediately attaches the root to the
WindowManager, puts the WebView in an attached view hierarchy
so HA can process navigation, and makes the bubble clock visible
from boot.

https://claude.ai/code/session_01DuqQ5oXJhwe63UtFLaxDxL
@msp1974
Copy link
Copy Markdown
Owner

msp1974 commented Mar 14, 2026

Hey @baileyboy0304 . Not yet had chance to look at this as been workign through some additional stuff for the 0.10.0 release. That is due out today so will start to work through this with you after. Thx

claude and others added 2 commits March 23, 2026 14:31
Add a timestamp+URL guard at the top of handlePossibleInAppNavigation()
so that when js-nav-hook and native-poll both detect the same URL change,
only the first one processes it. The second is skipped within a 5-second
window, eliminating the double chrome-hiding that caused the visible
flicker.

https://claude.ai/code/session_01RiL3PzQbpeUGnWKCQGPL5q
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