-
Notifications
You must be signed in to change notification settings - Fork 56
Improve CallService lifecycle, notification handling, and ringing-to-active transition #1588
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
aleksandar-apostolov
merged 57 commits into
develop
from
bugfix/rahullohra/refactor-call-service
Jan 26, 2026
Merged
Improve CallService lifecycle, notification handling, and ringing-to-active transition #1588
aleksandar-apostolov
merged 57 commits into
develop
from
bugfix/rahullohra/refactor-call-service
Jan 26, 2026
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Adds more detailed logging to the `CallEventObserver` to provide better insight into the handling of incoming call events.
When a `CallRejectedEvent` is received, the `createdBy` field on the call state is now updated with the user who created the call.
Introduces `LocalCallAcceptedEvent` and `LocalCallRejectedEvent` to represent call state changes originating from the local device. These new local events are now used in `CallEventObserver` instead of the generic `CallAcceptedEvent` and `CallRejectedEvent`, providing a clearer distinction for handling call lifecycle states like accepting a call. Additionally, `CallState` now fires these local events, improving the accuracy of event-driven logic.
# Conflicts: # stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/Call.kt # stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt
Adds a reason when leaving a call from the `CallLifecycleManager`. This provides more context for why the call was ended, distinguishing between different scenarios such as the task being removed for an ongoing or incoming call.
Contributor
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
Contributor
SDK Size Comparison 📏
|
Renames several components within the `CallService` infrastructure to improve clarity by prefixing them with "CallService". This includes managers and observers. The events `LocalCallAcceptedEvent` and `LocalCallRejectedEvent` are renamed to `LocalCallAcceptedPostEvent` and `LocalCallRejectedPostEvent` respectively to better reflect their purpose. Additionally, this change introduces a comprehensive suite of unit tests for the `CallService` and its related components, covering: - Lifecycle and notification management - Event, ringing state, and notification update observers - Foreground service permission handling - Debouncer and Throttler utilities
Renames `LocalCallAcceptedEvent` and `LocalCallRejectedEvent` to `LocalCallAcceptedPostEvent` and `LocalCallRejectedPostEvent` respectively, to better reflect that they are events sent *after* the action has occurred.
Adds `notificationId` as a parameter to the `updateNotification` function. This allows for updating the notification with a specific ID. The previous `updateNotification` function without the ID has been deprecated.
Adds an overloaded version of the `updateNotification` method that doesn't require a notification ID, simplifying its usage.
The `transitionToAcceptCall` function in `ClientState` is now marked as `internal`, restricting its usage to within the same module. This change also updates the public API definition.
Removes an unnecessary `stopService` call that was being made immediately after `startService` in `ServiceLauncher`.
Adds a TODO comment to `DefaultNotificationDispatcher.kt` to ensure a new fix is verified before merging.
Adds a TODO comment to `DefaultNotificationDispatcher.kt` to ensure a new fix is verified before merging.
Adds the `RobolectricTestRunner` to `ServiceStateTest` to address test failures that occurred when running all tests together. The `unregisterToggleCameraBroadcastReceiver` test has been moved to the end of the file as it was failing for unknown reasons, and a `println` has been added for debugging.
When a call is initiated, it now transitions through the `RingingState.Outgoing` state. This change ensures that a foreground service with an outgoing call notification is started, providing immediate feedback to the user that a call is being placed. A delay is introduced before starting the foreground service for outgoing calls to allow the system to properly transition the call state.
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/events/LocalEvent.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt
Outdated
Show resolved
Hide resolved
...ream/video/android/core/notifications/internal/service/observers/CallServiceEventObserver.kt
Outdated
Show resolved
Hide resolved
...kotlin/io/getstream/video/android/core/notifications/internal/service/models/ServiceState.kt
Outdated
Show resolved
Hide resolved
...oid-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/Debouncer.kt
Show resolved
Hide resolved
...video/android/core/notifications/internal/service/managers/CallServiceNotificationManager.kt
Show resolved
Hide resolved
...am/video/android/core/notifications/internal/service/managers/CallServiceLifecycleManager.kt
Show resolved
Hide resolved
...deo/android/core/notifications/internal/service/observers/CallServiceRingingStateObserver.kt
Outdated
Show resolved
Hide resolved
...rc/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt
Show resolved
Hide resolved
Contributor
|
Its a good refactor which extracts some concerns from the |
Contributor
|
Shouldn't this go towards |
Contributor
Author
Yes I will correct it |
|
aleksandar-apostolov
approved these changes
Jan 26, 2026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.


Goal
Implementation
Core Changes
Core classes
-Since we will use same service to transition from ringing to active so we need to store a reference of original notification Id
- Process
LocalCallMissedEventhere so that it will work for calls which are not activeService classes refactoring
Util Classes
Testing
Fix FG Service Notification dismiss from Notification Tray
Service lifecycle
Summary by CodeRabbit
New Features
Bug Fixes
✏️ Tip: You can customize this high-level summary in your review settings.