Finally managed to make call notifications visible on Android Auto!

This commit is contained in:
Sylvain Berfini 2024-08-07 10:00:10 +02:00
parent 8e588bf800
commit a676c51401
4 changed files with 60 additions and 0 deletions

View file

@ -194,6 +194,15 @@
android:value="Needed to keep app alive to be able to receive messages and calls from third party SIP servers for which push notifications aren't available." />
</service>
<service
android:name=".telecom.TelecomAndroidAutoService"
android:exported="true">
<intent-filter>
<action android:name="androidx.car.app.CarAppService"/>
<category android:name="androidx.car.app.category.CALLING"/>
</intent-filter>
</service>
<!-- Receivers -->
<receiver android:name=".core.CorePushReceiver"

View file

@ -0,0 +1,37 @@
/*
* Copyright (c) 2010-2024 Belledonne Communications SARL.
*
* This file is part of linphone-android
* (see https://www.linphone.org).
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.linphone.telecom
import android.content.pm.ApplicationInfo
import androidx.car.app.CarAppService
import androidx.car.app.validation.HostValidator
import org.linphone.R
class TelecomAndroidAutoService : CarAppService() {
override fun createHostValidator(): HostValidator {
return if ((applicationInfo.flags and ApplicationInfo.FLAG_DEBUGGABLE) != 0) {
HostValidator.ALLOW_ALL_HOSTS_VALIDATOR
} else {
HostValidator.Builder(applicationContext)
.addAllowedHosts(R.array.hosts_allowlist_sample_copy)
.build()
}
}
}

View file

@ -853,4 +853,17 @@
<string name="content_description_ldap_delete">Delete this LDAP configuration</string>
<string name="content_description_ldap_save">Save LDAP configuration</string>
<string name="content_description_play_call_recording">Plays the call recording</string>
<!-- Copy of private hosts_allowlist_sample in androidx.car.app:app:1.7.0-beta01, as they recommend it.
I removed android automotive hosts to only keep Android Auto ones for now -->
<string-array name="hosts_allowlist_sample_copy" translatable="false">
<item>fdb00c43dbde8b51cb312aa81d3b5fa17713adb94b28f598d77f8eb89daceedf,
com.google.android.projection.gearhead</item>
<item>70811a3eacfd2e83e18da9bfede52df16ce91f2e69a44d21f18ab66991130771,
com.google.android.projection.gearhead</item>
<item>1975b2f17177bc89a5dff31f9e64a6cae281a53dc1d1d59b1d147fe1c82afa00,
com.google.android.projection.gearhead</item>
</string-array>
</resources>

View file

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<automotiveApp>
<uses name="notification" />
<uses name="template"/>
</automotiveApp>