Skip to content

Commit 417c6be

Browse files
authored
Revert "Update core-telecom dependency and add CALL_BACK intent filter (#405)" (#406)
This reverts commit 2d64c04.
1 parent 2d64c04 commit 417c6be

8 files changed

Lines changed: 18 additions & 76 deletions

File tree

gradle/libs.versions.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
# limitations under the License.
1515
#
1616
[versions]
17-
agp = "8.13.2"
17+
agp = "8.9.1"
1818
fragmentCompose = "1.8.6"
1919
kotlin = "2.1.10"
2020
coreKtx = "1.17.0"
@@ -66,7 +66,6 @@ playServicesMlkitBarcodeScanning = "18.3.1"
6666
protobuf = "0.9.4"
6767
firebaseCrashlyticsBuildtools = "3.0.5"
6868
uwb = "1.0.0-alpha10"
69-
telecom = "1.1.0-alpha04"
7069

7170

7271
[libraries]
@@ -100,7 +99,6 @@ coil-compose = { module = "io.coil-kt:coil-compose", version.ref = "coil" }
10099
coil-video = { module = "io.coil-kt:coil-video", version.ref = "coil" }
101100
kotlin-coroutines-play = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-play-services", version.ref = "coroutines" }
102101
play-services-location = { module = "com.google.android.gms:play-services-location", version.ref = "play-services-location" }
103-
androidx-core-telecom = { module = "androidx.core:core-telecom", version.ref = "telecom" }
104102

105103
# Core dependencies
106104
android-gradlePlugin = { module = "com.android.tools.build:gradle", version.ref = "agp" }

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.13-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

samples/connectivity/telecom/build.gradle.kts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,11 @@ plugins {
2525

2626
android {
2727
namespace = "com.example.platform.connectivity.telecom"
28-
compileSdk {
29-
version = release(version = 36) {
30-
minorApiLevel = 1
31-
}
32-
}
28+
compileSdk = 36
3329

3430
defaultConfig {
3531
minSdk = 23
32+
targetSdk = 35
3633

3734
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
3835
}
@@ -42,6 +39,7 @@ android {
4239
}
4340

4441
dependencies {
42+
implementation("androidx.core:core-telecom:1.0.1")
4543
implementation(project(mapOf("path" to ":samples:connectivity:audio")))
4644

4745
implementation(libs.androidx.activity.compose)
@@ -52,9 +50,6 @@ dependencies {
5250
implementation(libs.androidx.material3)
5351
implementation(project(":shared"))
5452

55-
// Sample specific dependencies
56-
implementation(libs.androidx.core.telecom)
57-
5853
implementation(libs.accompanist.permissions)
5954

6055
androidTestImplementation(libs.androidx.test.core)

samples/connectivity/telecom/src/main/java/com/example/platform/connectivity/telecom/TelecomCallSample.kt

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,21 +25,16 @@ import android.widget.Toast
2525
import androidx.annotation.RequiresApi
2626
import androidx.compose.foundation.layout.Arrangement
2727
import androidx.compose.foundation.layout.Column
28-
import androidx.compose.foundation.layout.Row
2928
import androidx.compose.foundation.layout.fillMaxSize
3029
import androidx.compose.foundation.layout.padding
3130
import androidx.compose.material3.Button
32-
import androidx.compose.material3.Checkbox
3331
import androidx.compose.material3.MaterialTheme
3432
import androidx.compose.material3.Text
3533
import androidx.compose.runtime.Composable
3634
import androidx.compose.runtime.LaunchedEffect
3735
import androidx.compose.runtime.collectAsState
3836
import androidx.compose.runtime.getValue
39-
import androidx.compose.runtime.mutableStateOf
4037
import androidx.compose.runtime.remember
41-
import androidx.compose.runtime.saveable.rememberSaveable
42-
import androidx.compose.runtime.setValue
4338
import androidx.compose.ui.Alignment
4439
import androidx.compose.ui.Modifier
4540
import androidx.compose.ui.platform.LocalContext
@@ -49,7 +44,6 @@ import com.example.platform.connectivity.telecom.call.TelecomCallService
4944
import com.example.platform.connectivity.telecom.model.TelecomCall
5045
import com.example.platform.connectivity.telecom.model.TelecomCallRepository
5146
import com.example.platform.shared.PermissionBox
52-
import androidx.core.net.toUri
5347

5448
@RequiresApi(Build.VERSION_CODES.O)
5549
@Composable
@@ -110,30 +104,14 @@ private fun TelecomCallOptions() {
110104
"No active call"
111105
}
112106
Text(text = title, style = MaterialTheme.typography.titleLarge)
113-
114-
var excludeCallLogging by rememberSaveable {
115-
mutableStateOf(false)
116-
}
117-
Row(
118-
verticalAlignment = Alignment.CenterVertically
119-
) {
120-
Checkbox(
121-
checked = excludeCallLogging,
122-
onCheckedChange = { isChecked ->
123-
excludeCallLogging = isChecked
124-
}
125-
)
126-
Text("Exclude from call logs")
127-
}
128107
Button(
129108
enabled = !hasOngoingCall,
130109
onClick = {
131110
Toast.makeText(context, "Incoming call in 2 seconds", Toast.LENGTH_SHORT).show()
132111
context.launchCall(
133112
action = TelecomCallService.ACTION_INCOMING_CALL,
134113
name = "Alice",
135-
uri = "tel:12345".toUri(),
136-
excludeCallLogging = excludeCallLogging
114+
uri = Uri.parse("tel:12345"),
137115
)
138116
},
139117
) {
@@ -145,8 +123,7 @@ private fun TelecomCallOptions() {
145123
context.launchCall(
146124
action = TelecomCallService.ACTION_OUTGOING_CALL,
147125
name = "Bob",
148-
uri = "tel:54321".toUri(),
149-
excludeCallLogging = excludeCallLogging
126+
uri = Uri.parse("tel:54321"),
150127
)
151128
},
152129
) {
@@ -156,13 +133,12 @@ private fun TelecomCallOptions() {
156133
}
157134

158135
@RequiresApi(Build.VERSION_CODES.O)
159-
internal fun Context.launchCall(action: String, name: String, uri: Uri, excludeCallLogging: Boolean) {
136+
private fun Context.launchCall(action: String, name: String, uri: Uri) {
160137
startService(
161138
Intent(this, TelecomCallService::class.java).apply {
162139
this.action = action
163140
putExtra(TelecomCallService.EXTRA_NAME, name)
164141
putExtra(TelecomCallService.EXTRA_URI, uri)
165-
putExtra(TelecomCallService.EXTRA_EXCLUDE_CALL_LOGGING, excludeCallLogging)
166142
},
167143
)
168144
}

samples/connectivity/telecom/src/main/java/com/example/platform/connectivity/telecom/call/TelecomCallActivity.kt

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import android.app.KeyguardManager
2020
import android.content.Intent
2121
import android.os.Build
2222
import android.os.Bundle
23-
import android.telecom.TelecomManager
2423
import android.util.Log
2524
import android.view.WindowManager
2625
import androidx.activity.ComponentActivity
@@ -32,8 +31,6 @@ import androidx.compose.material3.MaterialTheme
3231
import androidx.compose.material3.Surface
3332
import androidx.compose.ui.Modifier
3433
import androidx.core.content.getSystemService
35-
import androidx.core.net.toUri
36-
import com.example.platform.connectivity.telecom.launchCall
3734
import com.example.platform.connectivity.telecom.model.TelecomCallRepository
3835

3936

@@ -53,8 +50,6 @@ class TelecomCallActivity : ComponentActivity() {
5350
// Set the right flags for a call type activity.
5451
setupCallActivity()
5552

56-
handleCallBack()
57-
5853
setContent {
5954
MaterialTheme {
6055
Surface(
@@ -83,12 +78,6 @@ class TelecomCallActivity : ComponentActivity() {
8378
)
8479
}
8580

86-
override fun onNewIntent(intent: Intent) {
87-
super.onNewIntent(intent)
88-
setIntent(intent)
89-
handleCallBack()
90-
}
91-
9281
/**
9382
* Enable the calling activity to be shown in the lockscreen and dismiss the keyguard to enable
9483
* users to answer without unblocking.
@@ -105,17 +94,8 @@ class TelecomCallActivity : ComponentActivity() {
10594
}
10695

10796
val keyguardManager = getSystemService<KeyguardManager>()
108-
keyguardManager?.requestDismissKeyguard(this, null)
109-
}
110-
111-
private fun handleCallBack() {
112-
if (intent.action == TelecomManager.ACTION_CALL_BACK) {
113-
launchCall(
114-
action = TelecomCallService.ACTION_OUTGOING_CALL,
115-
name = "Bob",
116-
uri = "tel:54321".toUri(),
117-
excludeCallLogging = false
118-
)
97+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && keyguardManager != null) {
98+
keyguardManager.requestDismissKeyguard(this, null)
11999
}
120100
}
121101
}

samples/connectivity/telecom/src/main/java/com/example/platform/connectivity/telecom/call/TelecomCallService.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class TelecomCallService : Service() {
5959
companion object {
6060
internal const val EXTRA_NAME: String = "extra_name"
6161
internal const val EXTRA_URI: String = "extra_uri"
62-
internal const val EXTRA_EXCLUDE_CALL_LOGGING = "extra_exclude_call_logging"
6362
internal const val ACTION_INCOMING_CALL = "incoming_call"
6463
internal const val ACTION_OUTGOING_CALL = "outgoing_call"
6564
internal const val ACTION_UPDATE_CALL = "update_call"
@@ -125,7 +124,6 @@ class TelecomCallService : Service() {
125124
@Suppress("DEPRECATION")
126125
intent.getParcelableExtra(EXTRA_URI)!!
127126
}
128-
val excludeCallLogging = intent.getBooleanExtra(EXTRA_EXCLUDE_CALL_LOGGING, false)
129127

130128
scope.launch {
131129
if (incoming) {
@@ -135,7 +133,7 @@ class TelecomCallService : Service() {
135133

136134
launch {
137135
// Register the call with the Telecom stack
138-
telecomRepository.registerCall(name, uri, excludeCallLogging, incoming)
136+
telecomRepository.registerCall(name, uri, incoming)
139137
}
140138

141139
if (!incoming) {

samples/connectivity/telecom/src/main/java/com/example/platform/connectivity/telecom/model/TelecomCallRepository.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ import androidx.annotation.RequiresApi
2525
import androidx.core.telecom.CallAttributesCompat
2626
import androidx.core.telecom.CallControlResult
2727
import androidx.core.telecom.CallControlScope
28+
import androidx.core.telecom.CallException
2829
import androidx.core.telecom.CallsManager
30+
import kotlinx.coroutines.CoroutineScope
31+
import kotlinx.coroutines.Dispatchers
32+
import kotlinx.coroutines.SupervisorJob
2933
import kotlinx.coroutines.channels.Channel
3034
import kotlinx.coroutines.flow.Flow
3135
import kotlinx.coroutines.flow.MutableStateFlow
@@ -83,13 +87,8 @@ class TelecomCallRepository(private val callsManager: CallsManager) {
8387
* Register a new call with the provided attributes.
8488
* Use the [currentCall] StateFlow to receive status updates and process call related actions.
8589
*/
86-
suspend fun registerCall(
87-
displayName: String,
88-
address: Uri,
89-
excludeCallLogging: Boolean,
90-
isIncoming: Boolean
91-
) {
92-
// For simplicity, we don't support multiple calls
90+
suspend fun registerCall(displayName: String, address: Uri, isIncoming: Boolean) {
91+
// For simplicity we don't support multiple calls
9392
check(_currentCall.value !is TelecomCall.Registered) {
9493
"There cannot be more than one call at the same time."
9594
}
@@ -98,7 +97,6 @@ class TelecomCallRepository(private val callsManager: CallsManager) {
9897
val attributes = CallAttributesCompat(
9998
displayName = displayName,
10099
address = address,
101-
isLogExcluded = excludeCallLogging,
102100
direction = if (isIncoming) {
103101
CallAttributesCompat.DIRECTION_INCOMING
104102
} else {
@@ -223,7 +221,7 @@ class TelecomCallRepository(private val callsManager: CallsManager) {
223221
}
224222

225223
is TelecomCallAction.ToggleMute -> {
226-
// We cannot programmatically mute the telecom stack. Instead, we just update
224+
// We cannot programmatically mute the telecom stack. Instead we just update
227225
// the state of the call and this will start/stop audio capturing.
228226
updateCurrentCall {
229227
copy(isMuted = !isMuted)

settings.gradle.kts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ pluginManagement {
2727
gradlePluginPortal()
2828
}
2929
}
30-
plugins {
31-
id("org.gradle.toolchains.foojay-resolver-convention") version "0.10.0"
32-
}
3330
dependencyResolutionManagement {
3431
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
3532
repositories {

0 commit comments

Comments
 (0)