Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
run: |
mkdir -p "$HOME/.gradle"
{
echo "org.gradle.jvmargs=-Xmx5g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
echo "org.gradle.jvmargs=-Xmx3g -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 -XX:+UseParallelGC -XX:MaxMetaspaceSize=1g"
echo "org.gradle.configureondemand=true"
echo "kapt.incremental.apt=true"
} > "$HOME/.gradle/gradle.properties"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@
<service
android:name=".services.CallForegroundService"
android:exported="false"
android:foregroundServiceType="phoneCall|microphone|camera" />
android:foregroundServiceType="microphone|camera" />

<provider
android:name="androidx.core.content.FileProvider"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,6 @@ class CallActivity : CallBaseActivity() {
setContentView(binding!!.root)
hideNavigationIfNoPipAvailable()
processExtras(intent.extras!!)
CallForegroundService.start(applicationContext, conversationName, intent.extras)

conversationUser = currentUserProvider.currentUser.blockingGet()

credentials = ApiUtils.getCredentials(conversationUser!!.username, conversationUser!!.token)
Expand Down Expand Up @@ -1039,6 +1037,7 @@ class CallActivity : CallBaseActivity() {
checkRecordingConsentAndInitiateCall()

if (permissionUtil!!.isMicrophonePermissionGranted()) {
CallForegroundService.start(applicationContext, conversationName, intent.extras)
if (!microphoneOn) {
onMicrophoneClick()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,15 @@ class CallForegroundService : Service() {

override fun onBind(intent: Intent?): IBinder? = null

@Suppress("ForegroundServiceType")
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
val conversationName = intent?.getStringExtra(EXTRA_CONVERSATION_NAME)
val callExtras = intent?.getBundleExtra(EXTRA_CALL_INTENT_EXTRAS)
val notification = buildNotification(conversationName, callExtras)

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
startForeground(
NOTIFICATION_ID,
notification,
resolveForegroundServiceType(callExtras)
)
val foregroundServiceType = resolveForegroundServiceType(callExtras)
startForeground(NOTIFICATION_ID, notification, foregroundServiceType)
} else {
startForeground(NOTIFICATION_ID, notification)
}
Expand Down Expand Up @@ -90,21 +88,20 @@ class CallForegroundService : Service() {
}

private fun resolveForegroundServiceType(callExtras: Bundle?): Int {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
return 0
}

var serviceType = ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE
val isVoiceOnlyCall = callExtras?.getBoolean(KEY_CALL_VOICE_ONLY, false) ?: false
val canPublishVideo = callExtras?.getBoolean(
KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
false
) ?: false

if (!isVoiceOnlyCall && canPublishVideo) {
serviceType = serviceType or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
var serviceType = 0
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
serviceType = serviceType or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE

val isVoiceOnlyCall = callExtras?.getBoolean(KEY_CALL_VOICE_ONLY, false) ?: false
val canPublishVideo = callExtras?.getBoolean(
KEY_PARTICIPANT_PERMISSION_CAN_PUBLISH_VIDEO,
false
) ?: false

if (!isVoiceOnlyCall && canPublishVideo) {
serviceType = serviceType or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
}
}

return serviceType
}

Expand Down
Loading