Early promote to FG service for active calls#1628
Early promote to FG service for active calls#1628aleksandar-apostolov merged 1 commit intodevelopfrom
Conversation
PR checklist ✅All required conditions are satisfied:
🎉 Great job! This PR is ready for review. |
WalkthroughThe CallService notification logic was simplified by removing a conditional check that previously gated foreground service startup based on active call state. The service now unconditionally attempts to start foreground notifications when a setup notification is available, eliminating the prior state-dependent branching logic. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt (1)
653-666: Function name no longer reflects its behavior.The function
promoteToFgServiceIfNoActiveCallnow unconditionally promotes to foreground (when notification is available), but the name still implies it only does so when there's no active call. This could mislead future maintainers.Consider renaming to better reflect the new behavior, e.g.,
promoteToFgServiceEarlyorensureForegroundStarted.Suggested rename
- private fun promoteToFgServiceIfNoActiveCall( + private fun promoteToFgServiceEarly( videoClient: StreamVideoClient, notificationId: Int, trigger: String, ) { videoClient.getSettingUpCallNotification()?.let { notification -> startForegroundWithServiceType( notificationId, notification, trigger, permissionManager.getServiceType(baseContext, trigger), ) } }Also update the call site at line 219:
promoteToFgServiceEarly(params.streamVideo, notificationId, params.trigger)🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt` around lines 653 - 666, Rename the misleading function promoteToFgServiceIfNoActiveCall to a name that reflects unconditional promotion (for example promoteToFgServiceEarly or ensureForegroundStarted) and update its single call site where it's invoked as promoteToFgServiceEarly(params.streamVideo, notificationId, params.trigger); ensure the implementation (which uses videoClient.getSettingUpCallNotification(), startForegroundWithServiceType(...), permissionManager.getServiceType(baseContext, trigger)) remains unchanged but the new name is used consistently across the file and any references are updated.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt`:
- Around line 653-666: Rename the misleading function
promoteToFgServiceIfNoActiveCall to a name that reflects unconditional promotion
(for example promoteToFgServiceEarly or ensureForegroundStarted) and update its
single call site where it's invoked as
promoteToFgServiceEarly(params.streamVideo, notificationId, params.trigger);
ensure the implementation (which uses
videoClient.getSettingUpCallNotification(), startForegroundWithServiceType(...),
permissionManager.getServiceType(baseContext, trigger)) remains unchanged but
the new name is used consistently across the file and any references are
updated.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 075e38c5-9f85-48ec-81a0-96e306153aec
📒 Files selected for processing (1)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt
SDK Size Comparison 📏
|
|
|
🚀 Available in v1.20.1 |



Goal
Resolve
ForegroundServiceDidNotStartInTimeExceptionfor ongoing callsImplementation
Early promote to FG service for active calls
🎨 UI Changes
None
Testing
Simple call
Summary by CodeRabbit