Skip to content

feat: implement Google Cast support (fixes #580)#3502

Open
mitchellecm7 wants to merge 1 commit into
microg:masterfrom
mitchellecm7:master
Open

feat: implement Google Cast support (fixes #580)#3502
mitchellecm7 wants to merge 1 commit into
microg:masterfrom
mitchellecm7:master

Conversation

@mitchellecm7
Copy link
Copy Markdown

Fixes #580. Implements Google Cast support for microG.

Changes

AIDL

  • ICastDeviceController: Added connect() (id=16) and addListener() (id=17)
  • ICastDeviceControllerListener: Added onConnected(String sessionId) (id=13)

Cast Core

  • CastDeviceControllerImpl: Implemented connect() and addListener(); serialized all ChromeCast network ops via ExecutorService to eliminate race conditions; fixed joinApplication to correctly join without relaunching when session is already active (wasLaunched=false)
  • CastMediaRouteProvider: Fixed ConcurrentHashMap for NSD thread safety; proper route publishing
  • CastMediaRouteController: Implemented onSelect pre-connect, onUnselect/onRelease disconnect, and volume control

Cast Framework

  • MediaRouterCallbackImpl: Fixed onRouteSelected to route through SessionManagerImpl instead of calling session directly (was the primary reason Cast button did nothing); implemented onRouteUnselected which was completely empty; added onRouteAdded/Removed to drive NO_DEVICES_AVAILABLE ↔ NOT_CONNECTED state
  • SessionImpl: Fixed start ordering — onSessionStarting now fires before proxy.start(); added proper connection state machine
  • SessionManagerImpl: Added onDeviceAvailabilityChanged to correctly drive Cast button visibility

Testing
Built and verified against #580 acceptance criteria. Cast route discovery, session start, and media control flow correctly through SessionManagerImpl listeners.

- Add connect() and addListener() to ICastDeviceController.aidl
- Add onConnected() to ICastDeviceControllerListener.aidl
- Implement CastDeviceControllerImpl with proper connection lifecycle
- Fix MediaRouterCallbackImpl.onRouteSelected to route through SessionManagerImpl
- Implement onRouteUnselected (was completely empty)
- Fix SessionImpl start ordering (onSessionStarting before proxy.start)
- Add onDeviceAvailabilityChanged to drive Cast button state
- Fix CastMediaRouteProvider with ConcurrentHashMap for thread safety
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.

What's the status on Google Cast implementation?

1 participant