Add telecom remote config and enable for internal.

This commit is contained in:
Cody Henthorne
2026-08-12 12:59:29 -04:00
parent 3a58f0375d
commit 4e84182822
10 changed files with 39 additions and 35 deletions
@@ -716,10 +716,10 @@ class InternalSettingsFragment : DSLSettingsFragment(R.string.preferences__inter
)
switchPref(
title = DSLSettingsText.from("Disable Telecom integration"),
isChecked = state.callingDisableTelecom,
title = DSLSettingsText.from("Use Telecom integration"),
isChecked = state.callingUseTelecom,
onClick = {
viewModel.setInternalCallingDisableTelecom(!state.callingDisableTelecom)
viewModel.setInternalCallingUseTelecom(!state.callingUseTelecom)
}
)
@@ -12,7 +12,7 @@ data class InternalSettingsState(
val allowCensorshipSetting: Boolean,
val callingServer: String,
val callingDataMode: CallManager.DataMode,
val callingDisableTelecom: Boolean,
val callingUseTelecom: Boolean,
val callingSetAudioConfig: Boolean,
val callingUseOboeAdm: Boolean,
val callingUseSoftwareAec: Boolean,
@@ -107,8 +107,8 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
refresh()
}
fun setInternalCallingDisableTelecom(enabled: Boolean) {
preferenceDataStore.putBoolean(InternalValues.CALLING_DISABLE_TELECOM, enabled)
fun setInternalCallingUseTelecom(enabled: Boolean) {
preferenceDataStore.putBoolean(InternalValues.CALLING_USE_TELECOM, enabled)
refresh()
}
@@ -246,7 +246,7 @@ class InternalSettingsViewModel(private val repository: InternalSettingsReposito
allowCensorshipSetting = SignalStore.internal.allowChangingCensorshipSetting,
callingServer = SignalStore.internal.groupCallingServer,
callingDataMode = SignalStore.internal.callingDataMode,
callingDisableTelecom = SignalStore.internal.callingDisableTelecom,
callingUseTelecom = SignalStore.internal.callingUseTelecom,
callingSetAudioConfig = SignalStore.internal.callingSetAudioConfig,
callingUseOboeAdm = SignalStore.internal.callingUseOboeAdm,
callingUseSoftwareAec = SignalStore.internal.callingUseSoftwareAec,
@@ -18,7 +18,7 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
const val DELAY_RESENDS: String = "internal.delay_resends"
const val CALLING_SERVER: String = "internal.calling_server"
const val CALLING_DATA_MODE: String = "internal.calling_bandwidth_mode"
const val CALLING_DISABLE_TELECOM: String = "internal.calling_disable_telecom"
const val CALLING_USE_TELECOM: String = "internal.calling_use_telecom"
const val CALLING_SET_AUDIO_CONFIG: String = "internal.calling_set_audio_config"
const val CALLING_USE_OBOE_ADM: String = "internal.calling_use_oboe_adm"
const val CALLING_USE_SOFTWARE_AEC: String = "internal.calling_use_software_aec"
@@ -152,9 +152,9 @@ class InternalValues internal constructor(store: KeyValueStore) : SignalStoreVal
}
/**
* Whether or not Telecom integration is manually disabled.
* Whether or not Telecom integration is enabled.
*/
var callingDisableTelecom by booleanValue(CALLING_DISABLE_TELECOM, true).falseForExternalUsers()
var callingUseTelecom by booleanValue(CALLING_USE_TELECOM, true).falseForExternalUsers()
/**
* Whether or not to override the audio settings from the remote configuration.
@@ -24,6 +24,7 @@ import org.thoughtcrime.securesms.webrtc.audio.SignalAudioManager
object AndroidTelecomUtil {
private val TAG = Log.tag(AndroidTelecomUtil::class.java)
private const val MIN_SDK_VERSION = 37
private val context = AppDependencies.application
private var systemRejected = false
private var registered = false
@@ -34,7 +35,7 @@ object AndroidTelecomUtil {
@JvmStatic
val telecomSupported: Boolean
get() {
if (Build.VERSION.SDK_INT >= 36 && !systemRejected && isTelecomAllowedForDevice()) {
if (Build.VERSION.SDK_INT >= MIN_SDK_VERSION && !systemRejected && isTelecomAllowedForDevice()) {
if (!registered) {
registerPhoneAccount()
}
@@ -48,12 +49,11 @@ object AndroidTelecomUtil {
@JvmStatic
fun registerPhoneAccount() {
if (Build.VERSION.SDK_INT >= 36 && !systemRejected) {
if (Build.VERSION.SDK_INT >= MIN_SDK_VERSION && !systemRejected) {
Log.i(TAG, "Registering with CallsManager")
try {
callsManager.registerAppWithTelecom(
capabilities = CallsManager.CAPABILITY_BASELINE or CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING,
backwardsCompatSdkLevel = 37
capabilities = CallsManager.CAPABILITY_BASELINE or CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING
)
Log.i(TAG, "CallsManager registration successful")
registered = true
@@ -210,8 +210,9 @@ object AndroidTelecomUtil {
private fun isTelecomAllowedForDevice(): Boolean {
if (RemoteConfig.internalUser) {
return !SignalStore.internal.callingDisableTelecom
return SignalStore.internal.callingUseTelecom
}
return RingRtcDynamicConfiguration.isTelecomAllowedForDevice()
}
}
@@ -1,7 +1,6 @@
package org.thoughtcrime.securesms.service.webrtc
import android.os.Build
import org.signal.core.util.asListContains
import org.signal.core.util.isNotNullOrBlank
import org.signal.ringrtc.AudioConfig
import org.signal.ringrtc.VideoConfig
@@ -17,8 +16,7 @@ object RingRtcDynamicConfiguration {
private var lastFetchTime: Long = 0
fun isTelecomAllowedForDevice(): Boolean {
return RemoteConfig.telecomManufacturerAllowList.lowercase().asListContains(Build.MANUFACTURER.lowercase()) &&
!RemoteConfig.telecomModelBlocklist.lowercase().asListContains(Build.MODEL.lowercase())
return RemoteConfig.useJetPackTelecom
}
@JvmStatic
@@ -838,20 +838,6 @@ object RemoteConfig {
hotSwappable = true
)
/** A comma-separated list of manufacturers that *should* use Telecom for calling. */
val telecomManufacturerAllowList: String by remoteString(
key = "android.calling.telecomAllowList",
defaultValue = "",
hotSwappable = true
)
/** A comma-separated list of manufacturers that *should* use Telecom for calling. */
val telecomModelBlocklist: String by remoteString(
key = "android.calling.telecomModelBlockList",
defaultValue = "",
hotSwappable = true
)
/** A comma-separated list of manufacturers that should *not* use CameraX mixed mode. */
val cameraXMixedModelBlocklist: String by remoteString(
key = "android.cameraXMixedModelBlockList.3",
@@ -1436,5 +1422,14 @@ object RemoteConfig {
hotSwappable = true
)
/** Whether to enable Jetpack telecom integration for 1:1 calls */
@JvmStatic
@get:JvmName("useJetPackTelecom")
val useJetPackTelecom: Boolean by remoteBoolean(
key = "android.calling.useJetPackTelecom",
defaultValue = false,
hotSwappable = false
)
// endregion
}
@@ -20,6 +20,7 @@ import org.thoughtcrime.securesms.keyvalue.SignalStore;
import org.thoughtcrime.securesms.notifications.NotificationChannels;
import org.thoughtcrime.securesms.recipients.Recipient;
import org.thoughtcrime.securesms.service.webrtc.ActiveCallManager;
import org.thoughtcrime.securesms.service.webrtc.AndroidTelecomUtil;
import org.thoughtcrime.securesms.util.ConversationUtil;
import org.signal.core.util.DeviceProperties;
@@ -161,8 +162,9 @@ public class CallNotificationBuilder {
}
}
/** Telecom requires one notification id for the lifetime of a call, so the dedicated ringing id is only used when we manage the call ourselves. */
public static int getNotificationId(int type) {
if (deviceVersionSupportsIncomingCallStyle() && type == TYPE_INCOMING_RINGING) {
if (deviceVersionSupportsIncomingCallStyle() && type == TYPE_INCOMING_RINGING && !AndroidTelecomUtil.hasActiveController()) {
return WEBRTC_NOTIFICATION_RINGING;
} else {
return WEBRTC_NOTIFICATION;
@@ -222,7 +224,7 @@ public class CallNotificationBuilder {
}
private static @NonNull String getNotificationChannel(int type) {
if (type == TYPE_INCOMING_RINGING) {
if (type == TYPE_INCOMING_RINGING || AndroidTelecomUtil.hasActiveController()) {
return NotificationChannels.getInstance().CALLS;
} else {
return NotificationChannels.getInstance().CALL_STATUS;
+1 -1
View File
@@ -24,7 +24,7 @@ androidx-lifecycle-navigation3 = "2.10.0"
androidx-media3 = "1.9.1"
androidx-navigation = "2.9.8"
androidx-navigation3-core = "1.1.4"
androidx-core-telecom = "1.1.0-alpha04"
androidx-core-telecom = "1.1.0-alpha06"
androidx-window = "1.3.0"
glide = "5.0.9"
libsignal-client = "0.100.0"
+8
View File
@@ -1650,6 +1650,14 @@ https://docs.gradle.org/current/userguide/dependency_verification.html
<sha256 value="6a26b5d210c21ea47d4687a154f8c1c7455bbc4faa5b696b5b4016d1a982d778" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.core" name="core-telecom" version="1.1.0-alpha06">
<artifact name="core-telecom-1.1.0-alpha06.aar">
<sha256 value="eb1db1185b0ad0c634374fdf076c6c0c8546aaa89f502a28c520ba74adcfc147" origin="Generated by Gradle"/>
</artifact>
<artifact name="core-telecom-1.1.0-alpha06.module">
<sha256 value="fe8ec84c531994ee2833007237668a1a89a06ebfc58fc4a3e83175a867c07145" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="androidx.core" name="core-viewtree" version="1.0.0">
<artifact name="core-viewtree-1.0.0.aar">
<sha256 value="dc1b678d58ebcf2bfa1587be68ff826694ce3d221251b9ef30d4d4b36297e6de" origin="Generated by Gradle"/>