Skip to content

Null-check the stop intent before stopService in cleanup - #1794

Merged
andremion merged 3 commits into
developfrom
andrerego/and-1466-port-the-stop-intent-null-check-to-develop
Aug 31, 2026
Merged

Null-check the stop intent before stopService in cleanup#1794
andremion merged 3 commits into
developfrom
andrerego/and-1466-port-the-stop-intent-null-check-to-develop

Conversation

@andremion

@andremion andremion commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Goal

Port the stop-intent null check from #1792 to develop. ServiceIntentBuilder.buildStopIntent(...) returns null when the call service is not running, and cleanup() passed that null into context.stopService(...), throwing a NullPointerException on every logout without a running call service. The exception is swallowed by safeCall, so it only shows up as noise in the logs, but the stopService call itself never worked in that state.

The develop-v2 side of this defect is fixed in #1792, together with the logout main-thread freeze (that half is develop-v2-only code). Since nothing merges develop-v2 back into develop, this half needs its own PR here, as raised in the #1792 review.

Part of AND-1466.

Implementation

serviceIntent.let { context.stopService(serviceIntent) } becomes buildStopIntent(...)?.let { serviceIntent -> context.stopService(serviceIntent) }. The block is byte-identical to the one in #1792, so the next develop into develop-v2 merge resolves it without a conflict.

🎨 UI Changes

Not applicable.

Testing

  • StreamVideoClientTest (which includes the existing cleanup test) and spotless pass on this branch.
  • The regression tests exercising the cleanup paths live in Fix the logout main-thread freeze in StreamVideoClient cleanup #1792 (StreamVideoClientCleanupTest) and reach develop-v2 with that PR; they are not portable here because they cover the develop-v2-only disconnect bridge.

Summary by CodeRabbit

  • Bug Fixes
    • Improved call service cleanup by avoiding unnecessary stop requests when the service is not running.
    • Prevented potential cleanup issues when no service stop intent is available.

@andremion
andremion requested a review from a team as a code owner August 31, 2026 12:40
@andremion andremion added the pr:bug Fixes a bug label Aug 31, 2026
@github-actions

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.

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 82b92b85-a314-48ed-9e14-ef8487661bc8

📥 Commits

Reviewing files that changed from the base of the PR and between b530e34 and bebb7fc.

📒 Files selected for processing (1)
  • stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

cleanup() now handles a nullable stop intent. It calls context.stopService only when ServiceIntentBuilder().buildStopIntent(...) returns a non-null intent.

Changes

Service cleanup

Layer / File(s) Summary
Conditional call-service stop
stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/StreamVideoClient.kt
cleanup() now calls context.stopService only when the stop intent is non-null.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to bebb7

Cleanup now skips stopping the call service when no stop intent exists while preserving normal service shutdown behavior. No actionable merge-blocking risk remains after normal checks and review.

Suggested reviewers: rahul-lohra, aleksandar-apostolov

Poem

A rabbit checks the service light
If an intent appears, it stops just right
No needless call is made
Cleanup keeps its tidy shade
Soft paws hop through the night

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
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.
Description check ✅ Passed The description includes the required Goal, Implementation, UI Changes, and Testing sections. It clearly explains the defect, the fix, and the testing status. The contributor checklist, reviewer check…
Title check ✅ Passed The title clearly and concisely describes the main change: adding a null check for the stop intent before calling stopService in cleanup.
Full details: Description check

Explanation

The description includes the required Goal, Implementation, UI Changes, and Testing sections. It clearly explains the defect, the fix, and the testing status. The contributor checklist, reviewer checklist, and GIF are not included, but these omissions are non-critical for this small code-only change.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch andrerego/and-1466-port-the-stop-intent-null-check-to-develop

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.

@github-actions

Copy link
Copy Markdown
Contributor

SDK Size Comparison 📏

SDK Before After Difference Status
stream-video-android-core 12.29 MB 12.29 MB 0.00 MB 🟢
stream-video-android-ui-xml 5.70 MB 5.70 MB 0.00 MB 🟢
stream-video-android-ui-compose 6.23 MB 6.23 MB 0.00 MB 🟢

@andremion

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@rahul-lohra rahul-lohra 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.

lgtm

@sonarqubecloud

Copy link
Copy Markdown

@andremion
andremion enabled auto-merge (squash) August 31, 2026 14:35
@andremion
andremion merged commit 622f5ed into develop Aug 31, 2026
21 of 22 checks passed
@andremion
andremion deleted the andrerego/and-1466-port-the-stop-intent-null-check-to-develop branch August 31, 2026 14:49
@stream-public-bot stream-public-bot added the released Included in a release label Sep 1, 2026
@stream-public-bot

Copy link
Copy Markdown
Collaborator

🚀 Available in v1.32.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