From 9878ff38e9ef2a18e81dcdaaed24e65d88abf934 Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Wed, 18 Sep 2024 18:40:20 +0700 Subject: [PATCH] android camera service type --- .../android/src/main/java/chat/simplex/app/CallService.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/apps/multiplatform/android/src/main/java/chat/simplex/app/CallService.kt b/apps/multiplatform/android/src/main/java/chat/simplex/app/CallService.kt index 3b334bf70b..dacf7d04c9 100644 --- a/apps/multiplatform/android/src/main/java/chat/simplex/app/CallService.kt +++ b/apps/multiplatform/android/src/main/java/chat/simplex/app/CallService.kt @@ -105,11 +105,9 @@ class CallService: Service() { 0 } } else if (Build.VERSION.SDK_INT >= 30) { - if (call.supportsVideo()) { - ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA - } else { - ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE - } + // since audio call can be transformed to video call, it's important to include camera type too in order to have camera working in the following situation: + // user turned the camera on, disabled picture-in-picture, went to background and entered the app again: without camera type the video will be frozen forever + ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA } else if (Build.VERSION.SDK_INT >= 29) { ServiceInfo.FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK } else {