Repository navigation
feat(chat): integrate Calls with Android Telecom - #6821
thecyberd3m0n wants to merge 17 commits into
Conversation
Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to
|
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Linked Issues check | [#6551] The PR adds Core-Telecom registration, incoming and outgoing call handling, disconnect callbacks, and foreground-service support. However, CallNotificationActivity.onCreate registers an inco… |
Register incoming calls when the app receives the incoming-call event, before it launches CallNotificationActivity. Register outgoing calls when dialing starts, then update Telecom state as setup progresses. Add tests for both call-flow i… |
|
| Docstring Coverage | Docstring coverage is 5.13% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 39 functions across 8 files. | Write docstrings for the functions missing them to satisfy the coverage threshold. |
✅ Passed checks (3 passed)
-
Check name Status Explanation Title check ✅ Passed The title clearly and concisely identifies the main change: integrating calls with Android Telecom. Description check ✅ Passed The description explains the issue, reported user-visible result, Android Auto TODO, and AI use. It includes the screenshots and TODO sections, but omits the checklist section and its test, capability… Out of Scope Changes check ✅ Passed The Telecom dependency, permissions, manager, call-flow callbacks, foreground-service changes, and tests support [ #6551]. TheCallActivitytask-selection changes support returning to the app during …
Full details: Linked Issues check
-
Explanation
[
#6551] The PR adds Core-Telecom registration, incoming and outgoing call handling, disconnect callbacks, and foreground-service support. However,CallNotificationActivity.onCreateregisters an incoming call only after the existing notification activity starts. This does not provide Telecom handling independent of the custom notification and full-screen-intent path requested in [#6551].CallActivity.handleCallStateJoinedregisters an outgoing call only after the call joins, not when dialing starts. The new tests coverTelecomManager; they do not cover these call-flow integration points.Resolution
Register incoming calls when the app receives the incoming-call event, before it launches
CallNotificationActivity. Register outgoing calls when dialing starts, then update Telecom state as setup progresses. Add tests for both call-flow integrations.
- Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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 @coderabbitai help to get the list of available commands.
There was a problem hiding this comment.
Actionable comments posted: 7
🧹 Nitpick comments (1)
app/src/main/java/com/nextcloud/talk/dagger/modules/ManagerModule.kt (1)
39-41: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueRemove the redundant
@Providesbinding or the@Injectconstructor.
TelecomManagerhas an@Injectconstructor and a@Singletonannotation. The@Providesmethod on Lines 39-41 duplicates this binding. Dagger can resolve the class directly, but it reports a duplicate binding only for explicit@Bindsor@Providespairs. Keep one source of truth to avoid confusion.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0d1211a3-74dc-44ad-ba17-5de474975924
📒 Files selected for processing (8)
app/build.gradle.ktsapp/src/main/AndroidManifest.xmlapp/src/main/java/com/nextcloud/talk/activities/CallActivity.ktapp/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.ktapp/src/main/java/com/nextcloud/talk/call/TelecomManager.ktapp/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.ktapp/src/main/java/com/nextcloud/talk/dagger/modules/ManagerModule.ktapp/src/main/java/com/nextcloud/talk/services/CallForegroundService.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟠 Major · Send leaveCall when Telecom rejects a valid incoming call. · CallNotificationActivity.kt:94-98
app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt:94-98
🎯 Functional Correctness | 🟠 Major | ⚡ Quick winSend
leaveCallwhen Telecom rejects a valid incoming call.
onRejectCallcurrently calls onlyhangup(), which finishes the activity without callingNcApi.leaveCall. A valid incoming Talk call can remain active. Guard the nullable token instead of usingroomToken!!.handleExtras()maps a missing key to"", so the assertion does not crash for that case, but it would build an invalid URL.Suggested fix
+import io.reactivex.schedulers.Schedulers + ... onRejectCall = { runOnUiThread { + val token = roomToken + if (!token.isNullOrEmpty()) { + val apiVersion = ApiUtils.getCallApiVersion( + userBeingCalled, + intArrayOf(ApiUtils.API_V4, 1) + ) + val credentials = ApiUtils.getCredentials( + userBeingCalled.username, + userBeingCalled.token + ) + ncApi!!.leaveCall( + credentials, + ApiUtils.getUrlForCall(apiVersion, userBeingCalled.baseUrl, token), + null + ).subscribeOn(Schedulers.io()).subscribe( + { }, + { e -> Log.w(TAG, "Something went wrong when rejecting the call", e) } + ) + } hangup() } }
🧹 Nitpick comments (1)
app/src/test/java/com/nextcloud/talk/call/TelecomManagerTest.kt (1)
82-118: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winMake the add-call exception tests observe the launched coroutine.
The incoming and outgoing tests stub
registerPhoneAccount, but those methods callCallsManager.addCall, which delegates to the platformTelecomManager.addCalloverload. They also launch onTelecomManager’s independentCoroutineScope(Dispatchers.Main). The tests therefore do not reliably detect removal of the add-call catch blocks. Inject the test’sTestScope, make the four-argumentaddCallstub throw, and advance the test scheduler. This is a test-coverage gap, not evidence of a current production failure.
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
0b14f5a9-9d54-4d21-ae9f-0d2423ec7125
📒 Files selected for processing (2)
app/src/main/java/com/nextcloud/talk/activities/CallActivity.ktapp/src/test/java/com/nextcloud/talk/call/TelecomManagerTest.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
f67d1f90-1548-4aa7-9615-4ca7a391c469
📒 Files selected for processing (4)
app/src/main/java/com/nextcloud/talk/activities/CallActivity.ktapp/src/main/java/com/nextcloud/talk/call/TelecomManager.ktapp/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.ktapp/src/test/java/com/nextcloud/talk/call/TelecomManagerTest.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
…gistration token for telecom Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
- Configuration used: Organization UI
- Review profile: CHILL
- Plan: Advanced
- Run ID:
13653a15-c309-4932-9b3c-caaae5226be5
📒 Files selected for processing (1)
app/src/main/java/com/nextcloud/talk/call/TelecomManager.kt
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.
Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
facf646 to
c9936b0
Compare
545114e to
21f4c32
Compare
|
Thank you for contributing @thecyberd3m0n 👍 |
There was a problem hiding this comment.
🟡 Changes recommended
Call registration, lifecycle cleanup, disconnect handoff, and advertised hold support have unresolved functional defects.
7 open findings
Disconnect Telecom registration on calling timeout · New Register Telecom calls on reliable lifecycle transitions · New Transfer disconnect handling to the active call lifecycle · New Remove unsupported Telecom hold capabilities · New Register incoming calls independently of notification activity display · New Disconnect incoming registration on cancellation or hangup · New Set voice-only mode for audio incoming calls · New
What changed in this PR
Integrates Talk calls with Android Telecom to support native call controls on compatible devices, including Wear OS.
Changes:
- Adds a Telecom manager for call registration and control.
- Connects call activities and foreground-service permissions to Telecom.
- Adds manager tests and an Android-version navigation fallback.
| File | Description |
|---|---|
| app/src/test/java/com/nextcloud/talk/call/TelecomManagerTest.kt | Adds Telecom manager tests. |
| app/src/main/java/com/nextcloud/talk/services/CallForegroundService.kt | Adds phone-call foreground-service type. |
| app/src/main/java/com/nextcloud/talk/dagger/modules/ManagerModule.kt | Provides the singleton Telecom manager. |
| app/src/main/java/com/nextcloud/talk/callnotification/CallNotificationActivity.kt | Registers incoming calls and answer/reject callbacks. |
| app/src/main/java/com/nextcloud/talk/call/TelecomManager.kt | Implements Telecom registration and call controls. |
| app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.kt | Registers the app with Telecom at startup. |
| app/src/main/java/com/nextcloud/talk/activities/CallActivity.kt | Connects call lifecycle to Telecom and adjusts navigation fallback. |
| app/src/main/AndroidManifest.xml | Declares Telecom permissions and service type. |
| app/build.gradle.kts | Adds Core-Telecom dependency. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| } | ||
| ) | ||
| } else { | ||
| telecomManager.setCallActive(roomToken) |
| address = Uri.parse("talk:$roomToken"), | ||
| direction = CallAttributesCompat.DIRECTION_INCOMING, | ||
| callType = getCallType(isVideo), | ||
| callCapabilities = CallAttributesCompat.SUPPORTS_SET_INACTIVE |
| telecomManager.addIncomingCall( | ||
| displayName = displayName ?: "Nextcloud Talk Call", | ||
| roomToken = roomToken!!, | ||
| isVideo = isInCallWithVideo(callFlag), |
|
Hi @thecyberd3m0n thanks for the PR. As i dont have a WearOS for testing i hope some of my colleagues have one. If they don't we will test with the Android Studio Emulator. Could you have a look at the comments from Copilot here in github and also these findings from Claude?: |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
|
During my work on this PR, I realized that tying OS-level telecom events to an |
Signed-off-by: Dmitrij Rysanow <thecyberd3m0n@gmail.com>
|
@mahibi I've resolved issues mentioned by Copilot, and deeply tested the issue with 2 phones and watch. All synchronization issues were resolved, and call state is in sync with Telecom/external devices. If you want - I can record a short video on how it works now |

Resolves #6551. Telecom feature will work only on devices that support it
🖼️ Screenshots
🚧 TODO
🤖 AI