-
Notifications
You must be signed in to change notification settings - Fork 58
[Telecom-3] support notification-owned incoming ringing #1809
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
Open
rahul-lohra
wants to merge
7
commits into
refactor/rahullohra/incoming-call-orchestration
from
feature/rahullohra/notification-owned-incoming-ringing
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
2ba6f7d
fix(core): register app with Telecom once
rahul-lohra 489f7f7
refactor(core): extract incoming call coordinator
rahul-lohra 4d7ac60
feat(core): support notification-owned incoming ringing
rahul-lohra 9a7c136
fix(core): keep legacy ringtone ownership in legacy flow
rahul-lohra 3de9034
store incoming ringtone owner in callState
rahul-lohra abce3c1
store incoming ringtone owner in callState
rahul-lohra c39583c
fix unit-tests
rahul-lohra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
22 changes: 22 additions & 0 deletions
22
...deo-android-core/src/main/kotlin/io/getstream/video/android/core/IncomingRingtoneOwner.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Copyright (c) 2014-2026 Stream.io Inc. All rights reserved. | ||
| * | ||
| * Licensed under the Stream License; | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://github.com/GetStream/stream-video-android/blob/main/LICENSE | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.getstream.video.android.core | ||
|
|
||
| internal sealed interface IncomingRingtoneOwner { | ||
| data object Notification : IncomingRingtoneOwner | ||
| data object Legacy : IncomingRingtoneOwner | ||
| } |
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
57 changes: 57 additions & 0 deletions
57
.../kotlin/io/getstream/video/android/core/notifications/IncomingCallNotificationPreparer.kt
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| /* | ||
| * Copyright (c) 2014-2026 Stream.io Inc. All rights reserved. | ||
| * | ||
| * Licensed under the Stream License; | ||
| * you may not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * https://github.com/GetStream/stream-video-android/blob/main/LICENSE | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
|
|
||
| package io.getstream.video.android.core.notifications | ||
|
|
||
| import android.app.Notification | ||
| import androidx.core.app.NotificationCompat | ||
| import io.getstream.video.android.core.IncomingRingtoneOwner | ||
| import io.getstream.video.android.core.RingingState | ||
| import io.getstream.video.android.core.StreamVideoClient | ||
| import io.getstream.video.android.core.notifications.handlers.incomingCallNotificationFlags | ||
|
|
||
| internal class IncomingCallNotificationPreparer( | ||
| private val streamVideo: StreamVideoClient, | ||
| ) { | ||
|
|
||
| private val context = streamVideo.context | ||
|
|
||
| fun prepare( | ||
| nonRingingNotification: Notification, | ||
| owner: IncomingRingtoneOwner, | ||
| ringingState: RingingState.Incoming, | ||
| ): Notification = when (owner) { | ||
| IncomingRingtoneOwner.Notification -> prepareRingingNotification( | ||
| nonRingingNotification, | ||
| ringingState, | ||
| ) | ||
| IncomingRingtoneOwner.Legacy -> nonRingingNotification | ||
| } | ||
|
|
||
| private fun prepareRingingNotification( | ||
| nonRingingNotification: Notification, | ||
| ringingState: RingingState.Incoming, | ||
| ): Notification { | ||
| val channelId = NotificationCompat.getChannelId(nonRingingNotification) | ||
| ?: return nonRingingNotification | ||
| return NotificationCompat.Builder(context, nonRingingNotification) | ||
| .setChannelId(channelId) | ||
| .build() | ||
| .apply { | ||
| flags = incomingCallNotificationFlags(flags, ringingState) | ||
| } | ||
| } | ||
| } |
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift
🔎 Supported by static analysis
🤖 get_repo_knowledge executed:
get_repo_knowledge GetStream/stream-video-android /tmp/coderabbit-repo-knowledge/getstream-stream-video-android-2f9d1734/learnings /tmp/coderabbit-repo-knowledge/getstream-stream-video-android-2f9d1734/conventionsLength of output: 16392
🏁 Script executed:
Repository: GetStream/stream-video-android
Length of output: 50386
🏁 Script executed:
Repository: GetStream/stream-video-android
Length of output: 50386
🌐 Web query:
Android NotificationManager createNotificationChannel existing channel sound vibration cannot change official documentation💡 Result:
According to official Android developer documentation, you cannot programmatically change the sound or vibration settings of a NotificationChannel once it has been submitted to the NotificationManager [1][2][3]. These settings are effectively write-once; they are only modifiable before the channel is first created and submitted [2][3]. After creation, the user has final control over these behaviors through the system settings [1][4]. While you can programmatically update certain other properties of an existing channel—such as its name, description, or group—auditory and vibration behaviors remain locked to prevent apps from overriding user preferences [5][4]. If you need to provide users with different notification sound or vibration options, the recommended approaches include: 1. Directing Users to System Settings: Provide a way to open the system notification settings for your channel so the user can modify the sound and vibration themselves [1][4]. You can use an Intent with the action ACTION_CHANNEL_NOTIFICATION_SETTINGS to link directly to this UI [4]. 2. Creating Multiple Channels: If specific notification types require different sounds or vibration patterns, create separate NotificationChannels for each configuration upfront [6]. 3. Manual Implementation (Workaround): Some developers implement custom notification behavior by setting the channel's sound/vibration to null or silent and handling the sound/vibration manually when the notification is posted (e.g., using a MediaPlayer or VibrationManager), though this approach bypasses standard channel settings [7]. While some applications achieve apparent "updates" by deleting and recreating channels with the same ID, this is generally discouraged and unreliable, as Android may prevent changes to channels that have been deleted by the user or the app [6][8]. If you choose to delete and recreate a channel, you must use a new, unique channel ID for the new configuration [6].
Citations:
🏁 Script executed:
Repository: GetStream/stream-video-android
Length of output: 5797
Use a new channel ID for Android 17 ringing notifications.
createRingingChannelandcreateboth registernotificationChannels.incomingCallChannel.id. On upgraded installations, that channel may already exist without the ringing sound or vibration settings. Android does not apply those settings after channel creation, so Android 17 notifications can retain the old behavior. Use a versioned ringing-channel ID instead of recreating the existing ID.🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this is done on PR - 5 #1804
Android 17 will use new incoming calls channel ID and Prendroid 17 will keep use the existing one
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 9176
@rahul-lohra, verified. PR#1804selects a new incoming-call channel ID on Android 17 and later. It retains the existing channel ID before Android 17.This resolves the upgrade-path concern in the stacked follow-up. The review finding remains open for this PR because PR
#1804is still open.✏️ Learnings added
You are interacting with an AI system.