Skip to content

Make the Android Video SDK compatible with Android 17.#1752

Open
rahul-lohra wants to merge 4 commits into
developfrom
feature/rahullohra/background-media-android-17-compatible
Open

Make the Android Video SDK compatible with Android 17.#1752
rahul-lohra wants to merge 4 commits into
developfrom
feature/rahullohra/background-media-android-17-compatible

Conversation

@rahul-lohra

@rahul-lohra rahul-lohra commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Goal

Closes AND-1324

Make the Android Video SDK compatible with Android 17.

Android 17 introduces new restrictions on background media playback Link . Previously, the SDK relied on the SHORT_SERVICE foreground service type to play the incoming call ringtone while the app was in the background. This approach is no longer suitable on Android 17.

Solution:
For incoming calls on Android 17, replace SHORT_SERVICE with ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL.

Implementation

Replace SHORT_SERVICE with ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL for the incoming call foreground service on Android 17.

🎨 UI Changes

None

Testing

  1. Launch Android 17 Emulator
  2. Increase all the sound of that emulator to verify audio of incoming call
  3. Receive an incoming call on that emulator and verify incoming ringing call is playing

Summary by CodeRabbit

  • Bug Fixes

    • Improved handling of incoming calls on newer Android versions.
    • Incoming ringing now uses the phone-call foreground service type on Android 17 and later, while retaining short-service behavior on earlier versions.
  • Tests

    • Added coverage to verify incoming-call service behavior across Android versions.

@rahul-lohra rahul-lohra self-assigned this Jul 23, 2026
@rahul-lohra rahul-lohra added the pr:improvement Enhances an existing feature or code label Jul 23, 2026
@github-actions

github-actions Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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, or the PR is bot-authored.
  • An issue is linked (Linear ticket or GitHub issue), or the PR is bot-authored.

🎉 Great job! This PR is ready for review.

@rahul-lohra rahul-lohra changed the title Make the Android Video SDK compatible with Android 17. [AND-1324] Make the Android Video SDK compatible with Android 17. Jul 23, 2026
@rahul-lohra rahul-lohra changed the title [AND-1324] Make the Android Video SDK compatible with Android 17. Make the Android Video SDK compatible with Android 17. Jul 23, 2026
@rahul-lohra rahul-lohra changed the title Make the Android Video SDK compatible with Android 17. [AND-1324] Make the Android Video SDK compatible with Android 17. Jul 23, 2026
@rahul-lohra rahul-lohra changed the title [AND-1324] Make the Android Video SDK compatible with Android 17. Make the Android Video SDK compatible with Android 17. Jul 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.27 MB 12.27 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.68 MB 5.70 MB 0.02 MB 🟢
stream-video-android-ui-compose 6.20 MB 6.20 MB 0.00 MB 🟢

@sonarqubecloud

Copy link
Copy Markdown

@rahul-lohra
rahul-lohra marked this pull request as ready for review July 23, 2026 08:05
@rahul-lohra
rahul-lohra requested a review from a team as a code owner July 23, 2026 08:05
@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Incoming-call foreground service selection now uses a dedicated SDK-aware path. Android 17+ uses the phone-call service type when supported, while earlier versions retain the existing fallback. Tests cover both runtime SDK branches.

Changes

Incoming call foreground service type

Layer / File(s) Summary
SDK-aware incoming-call routing and validation
stream-video-android-core/src/main/.../ForegroundServicePermissionManager.kt, stream-video-android-core/src/test/.../ForegroundServicePermissionManagerTest.kt
Incoming calls now select FOREGROUND_SERVICE_TYPE_PHONE_CALL on supported Android 17+ runtimes and retain the short-service fallback below Android 17; tests verify both behaviors.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested labels: pr:bug

Poem

A rabbit hops where call bells ring,
Picks the service type for spring.
Short below seventeen,
Phone-call above is seen—
Tests thump their paws: “All green!”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: Android 17 compatibility for the Android Video SDK.
Description check ✅ Passed It includes the required Goal, Implementation, UI Changes, and Testing sections; the remaining template items are non-critical.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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 feature/rahullohra/background-media-android-17-compatible

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/permissions/ForegroundServicePermissionManager.kt`:
- Around line 103-106: Replace the hardcoded 37 in the API-level check within
ForegroundServicePermissionManager with a named ANDROID_17_API_LEVEL constant,
and remove the TODO comment. Use the constant in the Build.VERSION.SDK_INT
comparison while preserving the existing foreground service type condition;
track the future compileSdk upgrade separately.
🪄 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 Plus

Run ID: 74a1c0bf-57c9-4fc2-b260-e8e63754ed25

📥 Commits

Reviewing files that changed from the base of the PR and between 8fbaea4 and 0b0bf1d.

📒 Files selected for processing (2)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/permissions/ForegroundServicePermissionManager.kt
  • stream-video-android-core/src/test/kotlin/io/getstream/video/android/core/notifications/internal/service/permissions/ForegroundServicePermissionManagerTest.kt

Comment on lines +103 to +106
// TODO: replace the hardcoded 37 with Build.VERSION_CODES.<ANDROID_17> once compileSdk /
// targetSdk are raised to 37; the constant does not exist at the current compileSdk.
if (requiredForegroundTypes.contains(ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL) &&
Build.VERSION.SDK_INT >= 37

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Replace the TODO-backed API-level literal.

SonarCloud reports this TODO as unresolved. Extract 37 into a named ANDROID_17_API_LEVEL constant and track the compileSdk upgrade separately, rather than retaining a warning in production code.

🧰 Tools
🪛 GitHub Check: SonarCloud Code Analysis

[warning] 103-103: Complete the task associated to this TODO comment.

See more on https://sonarcloud.io/project/issues?id=GetStream_stream-video-android&issues=AZ-NzQi5cRmzc0-YXoah&open=AZ-NzQi5cRmzc0-YXoah&pullRequest=1752

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/notifications/internal/service/permissions/ForegroundServicePermissionManager.kt`
around lines 103 - 106, Replace the hardcoded 37 in the API-level check within
ForegroundServicePermissionManager with a named ANDROID_17_API_LEVEL constant,
and remove the TODO comment. Use the constant in the Build.VERSION.SDK_INT
comparison while preserving the existing foreground service type condition;
track the future compileSdk upgrade separately.

Source: Linters/SAST tools

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

Labels

pr:improvement Enhances an existing feature or code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant