Skip to content

Conversation

@tareko
Copy link
Contributor

@tareko tareko commented Dec 20, 2025

This PR is in response to Issue #1688 . In summary, if PIP is not available, the call ends and this should not happen. I used ChatGPT Codex, Claude, and localAI via Qwen3-coder to generate the code in this PR. Within my personal programming abilities, I still believe the code is elegant. I've used the test app for several calls with no issues on a P6P with latest android.

This PR implements two key functions:

  1. It allows the call to remain active even if PIP is not enabled and it is in the background
  2. It creates a persistent notification that:
    a. Allows users to return to the call
    b. Allows users to end an active call directly from the persistent notification without needing to return to the CallActivity

Features

  • Add CallForegroundService with persistent notification
  • Support calls in background without requiring picture-in-picture mode
  • Add "Return to call" and "End call" action buttons to CallForegroundService notification with corresponding PendingIntent
  • Handle proper foreground service types for microphone/camera permissions
  • Add notification permission and fallback messaging.
  • Add EndCallReceiver to handle end call broadcasts from notification action
  • Use existing ic_baseline_close_24 drawable for end call action icon
  • Register broadcast receiver in CallActivity to handle end call requests from notification using ReceiverFlag.NotExported for Android 14+ compatibility
  • Add proper cleanup flow: notification action → EndCallReceiver → CallActivity → proper hangup sequence
  • Track intentional call leaving to prevent unwanted service restarts
  • Release proximity sensor lock properly during notification-triggered hangup
  • Add diagnostic logging throughout the end call flow for debugging

The implementation follows Android best practices:

  • Uses NotExported receiver flag for internal app-only broadcasts
  • Properly unregisters receivers in onDestroy to prevent leaks
  • Uses immutable PendingIntents for security
  • Maintains proper state management during call termination

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

…round, with notification controls for managing the call

- Add CallForegroundService with persistent notification
- Support calls in background without requiring picture-in-picture mode
- Add "Return to call" and "End call" action buttons to CallForegroundService notification with corresponding PendingIntent
- Handle proper foreground service types for microphone/camera permissions
- Add notification permission and fallback messaging.
- Add EndCallReceiver to handle end call broadcasts from notification action
- Use existing ic_baseline_close_24 drawable for end call action icon
- Register broadcast receiver in CallActivity to handle end call requests from notification using ReceiverFlag.NotExported for Android 14+ compatibility
- Add proper cleanup flow: notification action → EndCallReceiver → CallActivity → proper hangup sequence
- Track intentional call leaving to prevent unwanted service restarts
- Release proximity sensor lock properly during notification-triggered hangup
- Add diagnostic logging throughout the end call flow for debugging

The implementation follows Android best practices:
- Uses NotExported receiver flag for internal app-only broadcasts
- Properly unregisters receivers in onDestroy to prevent leaks
- Uses immutable PendingIntents for security
- Maintains proper state management during call termination

Signed-off-by: Tarek Loubani <tarek@tarek.org>
@tareko tareko force-pushed the fix-background-death-2 branch from 74d1035 to ce14a04 Compare December 20, 2025 13:19
@AndyScherzinger AndyScherzinger added the 3. to review Waiting for reviews label Dec 21, 2025
…tyle

Signed-off-by: Tarek Loubani <tarek@tarek.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants