Skip to content

Fix crash when starting screen sharing during a call.#9154

Open
bmarty wants to merge 3 commits into
developfrom
feature/bma/fixScreenSharingCrash
Open

Fix crash when starting screen sharing during a call.#9154
bmarty wants to merge 3 commits into
developfrom
feature/bma/fixScreenSharingCrash

Conversation

@bmarty

@bmarty bmarty commented Jun 24, 2026

Copy link
Copy Markdown
Member

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

Fix crash when user wants to share the screen during a call

Motivation and context

Closes #9153

Screenshots / GIFs

Tests

  • If you can share the device during a video call, the issue is fixed

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Jun 24, 2026
val notificationId = clock.epochMillis().toInt()
val notification = notificationUtils.buildScreenSharingNotification()
startForegroundCompat(notificationId, notification)
startForegroundCompat(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why not using ServiceCompat.startForeground?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Oh yes, and this is fixing some other potential issues: 13fdb03

this,
callId.hashCode(),
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL

this,
callId.hashCode(),
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL

this,
callId.hashCode(),
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL

this,
callId.hashCode(),
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL

this,
callId.hashCode(),
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_PHONE_CALL

this,
NotificationUtils.NOTIFICATION_ID_FOREGROUND_SERVICE,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_DATA_SYNC
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_DATA_SYNC

this,
notificationId,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 30 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MICROPHONE
  • ⚠️ Field requires API level 30 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MICROPHONE

this,
notificationId,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION

this,
FOREGROUND_SERVICE_NOTIFICATION_ID,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_LOCATION,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_LOCATION
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_LOCATION

this,
notificationId,
notification,
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_DATA_SYNC
  • ⚠️ Field requires API level 29 (current min is 21): android.content.pm.ServiceInfo#FOREGROUND_SERVICE_TYPE_DATA_SYNC

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

Labels

Z-NextRelease For issues and PRs which should be included in the NextRelease.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Screen sharing make the application crash on API 35+

4 participants