Remove unused code from Call Class - #1762
Conversation
PR checklist ❌The following issues were detected:
What we check
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
💤 Files with no reviewable changes (1)
WalkthroughThe change removes obsolete internal members and helpers from ChangesCall internals cleanup
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
SDK Size Comparison 📏
|
|
9c374ea
into
refactor/call-class-decomposition
* refactor(core): decompose Call into focused internal components Break the ~2,260-line Call class into 11 internal collaborators under call/components (CallApiClient, CallStatsReporter, CallRenderer, CallEventManager, CallMediaManager, CallSessionManager, CallIceConnectionMonitor, CallConnectivityMonitor, CallJoinCoordinator, CallReconnector, CallLifecycleManager). Call remains a thin, binary-compatible public facade that delegates to them; public API is unchanged (apiCheck passes). Update white-box reflection tests to target the new component owners after internals moved out of Call. Co-authored-by: Cursor <cursoragent@cursor.com> * fix(core): remove duplicated join preflight from Call facade Call.join() ran join analytics, permission checks, and the guest-token wait before delegating to CallJoinCoordinator.join(), which performed the exact same preflight — so every join() executed it twice. Make the facade a pure delegation so the preflight runs only once in the coordinator. Co-authored-by: Cursor <cursoragent@cursor.com> * test(core): add unit tests for Call decomposition components Add JVM unit tests for the extracted Call collaborators (CallApiClient, CallEventManager, CallSessionManager, CallRenderer, CallMediaManager) to raise coverage on the refactor's new code toward the SonarCloud gate. Co-authored-by: Cursor <cursoragent@cursor.com> * test(core): add unit tests for join/reconnect/connectivity/ice components Broaden new-code coverage for the extracted Call components: exercise the CallJoinCoordinator retry loop and join-and-ring flow (via the RtcSession test factory), the CallConnectivityMonitor reconnect/leave listener, the reachable CallReconnector state-machine branches, the CallIceConnectionMonitor restart paths, plus additional CallMediaManager (monitorHeadset, not-selected devices) and CallApiClient (ring request, ringing create) cases. Co-authored-by: Cursor <cursoragent@cursor.com> * test(core): cover reconnector rejoin/migrate and renderer audio paths Add a unitTestRtcSessionFactory seam to CallReconnector's rejoin/migrate so the session-swap, monitor and finalize paths are unit-testable, and add tests for them (success + retry-until-exhausted). Also cover CallRenderer's incoming-audio track walking for all/selected participants. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(core): decouple Call collaborators from the Call facade Give the Call decomposition components explicit dependencies so they no longer reach into the Call facade: - CallApiClient, CallConnectivityMonitor, CallEventManager, CallIceConnectionMonitor, CallRenderer, CallStatsReporter, CallSessionManager and CallMediaManager now take the granular collaborators they need (type/id/scope/state/session/clientImpl/eglBase) instead of a Call. - Isolate the unavoidable identity hand-offs behind small seams/providers: RingingCallRegistrar for CallApiClient's ring/accept client-state writes, and a lazy () -> Call provider for CallMediaManager's MediaManagerImpl (a public type that requires a Call). - Behaviour is unchanged; component unit tests now construct each collaborator directly without a Call mock. The three orchestrators (CallReconnector, CallJoinCoordinator, CallLifecycleManager) still hold Call and are left for a follow-up. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(core): finish decoupling Call collaborators and repair the suite Removes the last Call references from the extracted components so no class under call/components holds the facade any more. CallLifecycleManager now takes its collaborators directly (lazy providers, since it is constructed before CallState and the monitors exist), which made Call.stopConnectionMonitors/stopStatsReporting/cancelSfuObservers/ shutDownJobsGracefully dead; they are removed. CallMediaManager gains disableLocalCapture() so the lifecycle no longer reaches through to the device handles. The three callback interfaces into Call (CallHost, CallTeardownHost, RingingCallRegistrar) were named after who implements them rather than what they do, and six of their eight methods did the same thing: register or deregister this call in the client's ringing/active registries. Two were byte-identical. They collapse into one ClientCallRegistry; the genuine outliers (hasRequiredPermissions, shutDownJobs) become plain lambdas. Two production fixes surfaced while repairing the tests: - CallMediaManager evaluated eglBase().eglBaseContext to build an argument for MediaManagerFactory.create, forcing a real EGL context before the factory ran. Call owns both the context and the factory, so the parameter is dropped and the factory resolves it itself. - The reconnect loop reads connectivity straight off the connection module (it must not go through CallConnectivityMonitor, which would close a dependency cycle), but injectMockNetwork was repointed at the monitor. The loop therefore polled the real provider and stalled without consuming an attempt. Injecting at the module fixes three reconnect tests that had been failing since the decomposition commit. JoinRecoverableFailureTest is rebuilt on the coordinator harness: it relied on spying Call and reflectively repointing CallJoinCoordinator.call, a field that no longer exists. Core suite: 978 tests, 0 failures. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(core): read session state from its owner instead of the Call facade CallSessionManager owns the session identity and reconnect bookkeeping, but Call still re-exposed it through internal accessors that mostly existed for a single caller. Remove them: location and nonFastReconnectAttempts were only reachable from tests, connectStartTime/reconnectStartTime had dead setters, and unifiedSessionId was read by RtcSession alone. RtcSession now takes CallSessionManager directly and reads session identity and reconnect timings from it. The elapsed-time arithmetic moves onto the manager as connectionTimeSeconds()/reconnectionTimeSeconds(), next to the timestamps it derives from. The two test-only reads move into CallTestSeams.kt so they stay out of the production API. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor(core): break the reconnector/join-coordinator dependency cycle CallReconnector and CallJoinCoordinator each depended on the other, so one had to be injected as a lazy provider. Move the shared joinRequest into CallApiClient, which already owns the coordinator REST calls, and relocate the failed-SFU set to CallSessionManager so the request no longer has to ask the reconnector for it. Both orchestrators now depend on the api client and neither depends on the other. Also drops the provider lambdas around state, analytics, stats and media by declaring those components before their consumers. FailedSfuIdsTest no longer needs reflection into private reconnector members; the behaviour is covered directly in CallSessionManagerTest. Co-authored-by: Cursor <cursoragent@cursor.com> * chore: remove unused code (#1762) --------- Co-authored-by: Cursor <cursoragent@cursor.com> Co-authored-by: Rahul Kumar Lohra <tgunix@gmail.com>



Goal
Remove unused internal code
Implementation
Remove unused internal code
🎨 UI Changes
None
Testing
None
Summary by CodeRabbit
Documentation
Refactor