mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-04 07:25:25 +01:00
Restrict telecom usage to API 37.
This commit is contained in:
@@ -317,23 +317,23 @@ class ActiveCallManager(
|
||||
@get:RequiresApi(30)
|
||||
override val serviceType: Int
|
||||
get() {
|
||||
val telecom = Build.VERSION.SDK_INT >= 34 && AndroidTelecomUtil.hasActiveController()
|
||||
val telecom = Build.VERSION.SDK_INT >= 36 && AndroidTelecomUtil.hasActiveController()
|
||||
|
||||
return if (telecom) {
|
||||
var type = if (telecom) {
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_PHONE_CALL
|
||||
} else {
|
||||
var type = ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
|
||||
|
||||
if (Permissions.hasAll(this, Manifest.permission.RECORD_AUDIO)) {
|
||||
type = type or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE
|
||||
}
|
||||
|
||||
if (Permissions.hasAll(this, Manifest.permission.CAMERA)) {
|
||||
type = type or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
|
||||
}
|
||||
|
||||
type
|
||||
ServiceInfo.FOREGROUND_SERVICE_TYPE_DATA_SYNC
|
||||
}
|
||||
|
||||
if (Permissions.hasAll(this, Manifest.permission.RECORD_AUDIO)) {
|
||||
type = type or ServiceInfo.FOREGROUND_SERVICE_TYPE_MICROPHONE
|
||||
}
|
||||
|
||||
if (Permissions.hasAll(this, Manifest.permission.CAMERA)) {
|
||||
type = type or ServiceInfo.FOREGROUND_SERVICE_TYPE_CAMERA
|
||||
}
|
||||
|
||||
return type
|
||||
}
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
|
||||
@@ -34,7 +34,7 @@ object AndroidTelecomUtil {
|
||||
@JvmStatic
|
||||
val telecomSupported: Boolean
|
||||
get() {
|
||||
if (Build.VERSION.SDK_INT >= 34 && !systemRejected && isTelecomAllowedForDevice()) {
|
||||
if (Build.VERSION.SDK_INT >= 36 && !systemRejected && isTelecomAllowedForDevice()) {
|
||||
if (!registered) {
|
||||
registerPhoneAccount()
|
||||
}
|
||||
@@ -48,11 +48,12 @@ object AndroidTelecomUtil {
|
||||
|
||||
@JvmStatic
|
||||
fun registerPhoneAccount() {
|
||||
if (Build.VERSION.SDK_INT >= 34 && !systemRejected) {
|
||||
if (Build.VERSION.SDK_INT >= 36 && !systemRejected) {
|
||||
Log.i(TAG, "Registering with CallsManager")
|
||||
try {
|
||||
callsManager.registerAppWithTelecom(
|
||||
CallsManager.CAPABILITY_BASELINE or CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING
|
||||
capabilities = CallsManager.CAPABILITY_BASELINE or CallsManager.CAPABILITY_SUPPORTS_VIDEO_CALLING,
|
||||
backwardsCompatSdkLevel = 37
|
||||
)
|
||||
Log.i(TAG, "CallsManager registration successful")
|
||||
registered = true
|
||||
|
||||
Reference in New Issue
Block a user