Skip to content

Fixed incoming call notification not waking the device on locked screen#1639

Merged
aleksandar-apostolov merged 4 commits intodevelopfrom
bugfix/rahullohra/incoming-call-lock-screen-notification
Apr 1, 2026
Merged

Fixed incoming call notification not waking the device on locked screen#1639
aleksandar-apostolov merged 4 commits intodevelopfrom
bugfix/rahullohra/incoming-call-lock-screen-notification

Conversation

@rahul-lohra
Copy link
Copy Markdown
Contributor

@rahul-lohra rahul-lohra commented Apr 1, 2026

Goal

Fix locked screen incoming-call wake up notification behaviour

Implementation

When we launch a temporary notification for an incoming call, it should include all the properties of the standard incoming call notification.

🎨 UI Changes

None

Testing

  1. Open demo-app
  2. Login with any user
  3. Lock the screen
  4. Get an incoming call
  5. The incoming call should wake up the device

Summary by CodeRabbit

  • New Features

    • Enhanced call setup notifications with improved context awareness, now providing customized notification handling based on call type and trigger for better user experience during call initialization.
  • Deprecations

    • Legacy call setup notification method deprecated in favor of enhanced variant with improved customization capabilities.

@rahul-lohra rahul-lohra self-assigned this Apr 1, 2026
@rahul-lohra rahul-lohra added the pr:bug Fixes a bug label Apr 1, 2026
@rahul-lohra rahul-lohra requested a review from a team as a code owner April 1, 2026 11:49
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

PR checklist ✅

All required conditions are satisfied:

  • Title length is OK (or ignored by label).
  • At least one pr: label exists.
  • Sections ### Goal, ### Implementation, and ### Testing are filled.

🎉 Great job! This PR is ready for review.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 1, 2026

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.02 MB 12.02 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.68 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.28 MB 6.28 MB 0.00 MB 🟢

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 1, 2026

Walkthrough

A parameterized notification API is introduced, allowing notification handlers to differentiate setup notifications based on trigger type and call ID. The zero-argument getSettingUpCallNotification() method is deprecated across interfaces and implementations, replaced by getSettingUpCallNotification(trigger: String, callId: StreamCallId). The call service is updated to pass these parameters when retrieving foreground notifications.

Changes

Cohort / File(s) Summary
Public Interface Contract
stream-video-android-core/api/stream-video-android-core.api, src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamNotificationHandler.kt
Added new StreamSettingUpCallNotificationProvider interface with parameterized getSettingUpCallNotification(String, StreamCallId) method. Updated StreamNotificationProvider to extend both StreamNotificationProviderWithPayload and StreamSettingUpCallNotificationProvider. Deprecated zero-argument variant with replaceWith directive.
Notification Handler Implementations
src/main/kotlin/io/getstream/video/android/core/notifications/DefaultNotificationHandler.kt, src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamDefaultNotificationHandler.kt, src/main/kotlin/io/getstream/video/android/core/notifications/internal/NoOpNotificationHandler.kt
Added overloaded getSettingUpCallNotification(trigger: String, callId: StreamCallId) implementations to all handlers. StreamDefaultNotificationHandler introduces trigger-based routing with special handling for TRIGGER_INCOMING_CALL to build fullscreen notifications. Deprecated parameterless variants across all handlers.
Service Integration
src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt
Updated promoteToFgServiceIfNoActiveCall() to accept callId: StreamCallId parameter and pass both trigger and callId to notification retrieval, enabling context-aware notification generation for foreground service startup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A new trigger awakens the notification dream,
Parameters flow through each handler's stream,
Old APIs fade with a deprecated sigh,
While CallService and notifications together fly! 📲✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description covers Goal and Implementation sections and provides clear testing steps, but lacks several required sections including UI Changes details, Changelog update confirmation, unit test coverage, and the contributor/reviewer checklists.
Title check ✅ Passed The PR title describes fixing incoming call notifications on locked screens, which aligns with the code changes that add parameterized notification methods for handling incoming call triggers.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/rahullohra/incoming-call-lock-screen-notification

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamNotificationHandler.kt (1)

186-188: Add KDoc for the new public StreamSettingUpCallNotificationProvider contract.

This is a public API surface and should document trigger expectations and valid values to prevent mismatched implementations.

As per coding guidelines: "Use KDoc (/** ... */) for public APIs and complex subsystems; link to Stream docs when relevant".

🤖 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/handlers/StreamNotificationHandler.kt`
around lines 186 - 188, Add KDoc to the public interface
StreamSettingUpCallNotificationProvider and its method
getSettingUpCallNotification: use /** ... */ above the interface and above
getSettingUpCallNotification to describe the purpose of the contract, the
expected semantics of the trigger parameter (enumerate or list valid trigger
string values and whether they are case-sensitive), the meaning of callId
(StreamCallId), the returned Notification behavior (when null is allowed), and
link to the relevant Stream docs for notification triggers; ensure the KDoc
covers visibility as a public API and any threading/usage notes so implementers
won’t misinterpret trigger expectations.
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamDefaultNotificationHandler.kt (1)

556-559: Extract duplicated incoming-notification builder logic to reduce drift risk.

This branch duplicates core incoming notification construction logic already present in the file. Reusing a shared internal builder will reduce behavioral divergence in future changes.

Also applies to: 580-606

🤖 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/handlers/StreamDefaultNotificationHandler.kt`
around lines 556 - 559, The duplicated incoming notification construction logic
should be extracted into a shared internal builder function and both callers
should delegate to it to avoid drift; create a private helper (e.g.,
buildIncomingCallNotification or getIncomingCallNotificationInternal) that
encapsulates the common steps (notification channel, pending intent, actions,
content/title, extras, and notification builder configuration) and replace the
duplicated blocks at the current comment region and lines ~580-606 to call that
helper, ensuring the helper accepts necessary parameters (callId, callerName,
isVideo, context/notificationManager, and any callbacks) so both existing
functions reuse the same implementation.
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/DefaultNotificationHandler.kt (1)

287-290: Consider honoring trigger for incoming setup notifications here as well.

This overload currently ignores trigger/callId and always falls back to the generic setup notification. For apps still using DefaultNotificationHandler, incoming lock-screen wake behavior may not match the new trigger-aware path.

♻️ Suggested direction
 override fun getSettingUpCallNotification(
     trigger: String,
     callId: StreamCallId,
-): Notification? = getSettingUpCallNotification()
+): Notification? {
+    return when (trigger) {
+        io.getstream.video.android.core.notifications.internal.service.CallService.TRIGGER_INCOMING_CALL ->
+            getRingingCallNotification(
+                ringingState = RingingState.Incoming(),
+                callId = callId,
+                callDisplayName = null,
+                shouldHaveContentIntent = true,
+                payload = emptyMap(),
+            ) ?: getSettingUpCallNotification()
+        else -> getSettingUpCallNotification()
+    }
+}
🤖 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/DefaultNotificationHandler.kt`
around lines 287 - 290, The override of getSettingUpCallNotification(trigger:
String, callId: StreamCallId) currently ignores trigger and callId and always
returns the generic getSettingUpCallNotification(); update it to honor trigger
and callId by routing to the trigger-aware creation path (e.g., when trigger
indicates an incoming/lock-screen wake, call the existing incoming-call
notification builder such as the incoming call notification method used
elsewhere in DefaultNotificationHandler, passing callId and trigger), and only
fall back to getSettingUpCallNotification() when no trigger-specific behavior
applies; ensure you reference and reuse the same helper/creator methods inside
DefaultNotificationHandler so trigger-aware behavior matches the new path.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamDefaultNotificationHandler.kt`:
- Around line 574-595: The notification builder uses fullScreenPendingIntent
(from intentResolver.searchIncomingCallPendingIntent) without null-checking;
since searchIncomingCallPendingIntent can return null, update
StreamDefaultNotificationHandler where fullScreenPendingIntent is obtained to
guard against null and avoid calling setFullScreenIntent/setContentIntent with a
null PendingIntent: explicitly check fullScreenPendingIntent != null before
calling setFullScreenIntent(fullScreenPendingIntent, true) and
setContentIntent(fullScreenPendingIntent), and if null, fall back to a safe
behavior such as omitting full-screen/content intents or creating a conservative
content intent (e.g., a generic tap intent) before calling
ensureChannelAndBuildNotification so ensureChannelAndBuildNotification and the
notification build path never receive a null PendingIntent.

In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamNotificationHandler.kt`:
- Around line 355-359: The `@Deprecated` annotation on the no-arg
getSettingUpCallNotification() should not include a ReplaceWith suggesting
StreamSettingUpCallNotificationProvider.getSettingUpCallNotification(trigger,callId)
because the replacement requires parameters not available at call sites; update
the `@Deprecated` on getSettingUpCallNotification to be message-only (remove the
replaceWith argument) so it points callers to
StreamSettingUpCallNotificationProvider.getSettingUpCallNotification without
providing a broken quick-fix.
- Line 235: StreamNotificationProvider now inherits
StreamSettingUpCallNotificationProvider which declares
getSettingUpCallNotification(trigger: String, callId: StreamCallId) and breaks
existing implementations that only override the deprecated no-arg
getSettingUpCallNotification(); add a default implementation of the two-arg
method inside the StreamNotificationProvider interface that delegates to the
zero-arg deprecated getSettingUpCallNotification() so existing custom providers
continue to compile (refer to StreamNotificationProvider,
StreamSettingUpCallNotificationProvider, getSettingUpCallNotification(trigger:
String, callId: StreamCallId), and the deprecated
getSettingUpCallNotification()).

---

Nitpick comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/DefaultNotificationHandler.kt`:
- Around line 287-290: The override of getSettingUpCallNotification(trigger:
String, callId: StreamCallId) currently ignores trigger and callId and always
returns the generic getSettingUpCallNotification(); update it to honor trigger
and callId by routing to the trigger-aware creation path (e.g., when trigger
indicates an incoming/lock-screen wake, call the existing incoming-call
notification builder such as the incoming call notification method used
elsewhere in DefaultNotificationHandler, passing callId and trigger), and only
fall back to getSettingUpCallNotification() when no trigger-specific behavior
applies; ensure you reference and reuse the same helper/creator methods inside
DefaultNotificationHandler so trigger-aware behavior matches the new path.

In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamDefaultNotificationHandler.kt`:
- Around line 556-559: The duplicated incoming notification construction logic
should be extracted into a shared internal builder function and both callers
should delegate to it to avoid drift; create a private helper (e.g.,
buildIncomingCallNotification or getIncomingCallNotificationInternal) that
encapsulates the common steps (notification channel, pending intent, actions,
content/title, extras, and notification builder configuration) and replace the
duplicated blocks at the current comment region and lines ~580-606 to call that
helper, ensuring the helper accepts necessary parameters (callId, callerName,
isVideo, context/notificationManager, and any callbacks) so both existing
functions reuse the same implementation.

In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamNotificationHandler.kt`:
- Around line 186-188: Add KDoc to the public interface
StreamSettingUpCallNotificationProvider and its method
getSettingUpCallNotification: use /** ... */ above the interface and above
getSettingUpCallNotification to describe the purpose of the contract, the
expected semantics of the trigger parameter (enumerate or list valid trigger
string values and whether they are case-sensitive), the meaning of callId
(StreamCallId), the returned Notification behavior (when null is allowed), and
link to the relevant Stream docs for notification triggers; ensure the KDoc
covers visibility as a public API and any threading/usage notes so implementers
won’t misinterpret trigger expectations.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 56590115-144a-4a64-9aa3-81fbe6b1dcee

📥 Commits

Reviewing files that changed from the base of the PR and between 2ca0f86 and f70627f.

📒 Files selected for processing (6)
  • stream-video-android-core/api/stream-video-android-core.api
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/DefaultNotificationHandler.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamDefaultNotificationHandler.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/handlers/StreamNotificationHandler.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/NoOpNotificationHandler.kt
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/CallService.kt

@rahul-lohra rahul-lohra changed the title Fix locked screen incoming-call wake up notification behaviour [AND-1139] Fix locked screen incoming-call wake up notification behaviour Apr 1, 2026
@rahul-lohra rahul-lohra changed the title [AND-1139] Fix locked screen incoming-call wake up notification behaviour Fix locked screen incoming-call wake up notification behaviour Apr 1, 2026
@aleksandar-apostolov aleksandar-apostolov changed the title Fix locked screen incoming-call wake up notification behaviour Fixed incoming call notification not waking the device on locked screen Apr 1, 2026
@aleksandar-apostolov aleksandar-apostolov changed the title Fixed incoming call notification not waking the device on locked screen Fixed incoming call notification not waking the device on locked screen Apr 1, 2026
@aleksandar-apostolov aleksandar-apostolov merged commit a3384ec into develop Apr 1, 2026
12 of 13 checks passed
@aleksandar-apostolov aleksandar-apostolov deleted the bugfix/rahullohra/incoming-call-lock-screen-notification branch April 1, 2026 12:36
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 1, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
0.0% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@stream-public-bot stream-public-bot added the released Included in a release label Apr 1, 2026
@stream-public-bot
Copy link
Copy Markdown
Collaborator

🚀 Available in v1.21.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr:bug Fixes a bug released Included in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants